Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Applications
Tor Browser
Commits
679f44da
Verified
Commit
679f44da
authored
Jul 3, 2023
by
cypherpunks1
Committed by
Pier Angelo Vendrame
Jan 15, 2024
Browse files
Options
Downloads
Patches
Plain Diff
Bug 40175: Add origin attributes to about:reader top-level requests
parent
6bc20ba1
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!889
Bug 42366: Tor Browser 115.7.0esr alpha rebase
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
toolkit/components/reader/AboutReader.sys.mjs
+1
-0
1 addition, 0 deletions
toolkit/components/reader/AboutReader.sys.mjs
toolkit/components/reader/ReaderMode.sys.mjs
+13
-4
13 additions, 4 deletions
toolkit/components/reader/ReaderMode.sys.mjs
with
14 additions
and
4 deletions
toolkit/components/reader/AboutReader.sys.mjs
+
1
−
0
View file @
679f44da
...
...
@@ -788,6 +788,7 @@ AboutReader.prototype = {
try
{
article
=
await
ReaderMode
.
downloadAndParseDocument
(
url
,
{
...
this
.
_doc
.
nodePrincipal
?.
originAttributes
},
docContentType
);
}
catch
(
e
)
{
...
...
This diff is collapsed.
Click to expand it.
toolkit/components/reader/ReaderMode.sys.mjs
+
13
−
4
View file @
679f44da
...
...
@@ -231,11 +231,12 @@ export var ReaderMode = {
* Downloads and parses a document from a URL.
*
* @param url URL to download and parse.
* @param attrs OriginAttributes to use for the request.
* @return {Promise}
* @resolves JS object representing the article, or null if no article is found.
*/
async
downloadAndParseDocument
(
url
,
docContentType
=
"
document
"
)
{
let
result
=
await
this
.
_downloadDocument
(
url
,
docContentType
);
async
downloadAndParseDocument
(
url
,
attrs
=
{},
docContentType
=
"
document
"
)
{
let
result
=
await
this
.
_downloadDocument
(
url
,
attrs
,
docContentType
);
if
(
!
result
?.
doc
)
{
return
null
;
}
...
...
@@ -258,9 +259,11 @@ export var ReaderMode = {
return
article
;
},
_downloadDocument
(
url
,
docContentType
=
"
document
"
)
{
_downloadDocument
(
url
,
attrs
=
{},
docContentType
=
"
document
"
)
{
let
uri
;
try
{
if
(
!
lazy
.
Readerable
.
shouldCheckUri
(
Services
.
io
.
newURI
(
url
)))
{
uri
=
Services
.
io
.
newURI
(
url
);
if
(
!
lazy
.
Readerable
.
shouldCheckUri
(
uri
))
{
return
null
;
}
}
catch
(
ex
)
{
...
...
@@ -272,9 +275,15 @@ export var ReaderMode = {
let
histogram
=
Services
.
telemetry
.
getHistogramById
(
"
READER_MODE_DOWNLOAD_RESULT
"
);
try
{
attrs
.
firstPartyDomain
=
Services
.
eTLD
.
getSchemelessSite
(
uri
);
}
catch
(
e
)
{
console
.
error
(
"
Failed to get first party domain for about:reader
"
,
e
);
}
return
new
Promise
((
resolve
,
reject
)
=>
{
let
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
"
GET
"
,
url
,
true
);
xhr
.
setOriginAttributes
(
attrs
);
xhr
.
onerror
=
evt
=>
reject
(
evt
.
error
);
xhr
.
responseType
=
docContentType
===
"
text/plain
"
?
"
text
"
:
"
document
"
;
xhr
.
onload
=
evt
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment