Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
Tor Browser
Commits
c330bb32
Commit
c330bb32
authored
Nov 04, 2020
by
Alex Catarineu
Committed by
Matthew Finkel
Nov 13, 2020
Browse files
Bug 40171: Make WebRequest and GeckoWebExecutor First-Party aware
parent
548e31db
Changes
2
Hide whitespace changes
Inline
Side-by-side
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/WebRequest.java
View file @
c330bb32
...
...
@@ -49,6 +49,11 @@ public class WebRequest extends WebMessage {
*/
public
final
@Nullable
String
referrer
;
/**
* The value of the origin of this request.
*/
public
final
@Nullable
String
origin
;
@Retention
(
RetentionPolicy
.
SOURCE
)
@IntDef
({
CACHE_MODE_DEFAULT
,
CACHE_MODE_NO_STORE
,
CACHE_MODE_RELOAD
,
CACHE_MODE_NO_CACHE
,
...
...
@@ -110,6 +115,7 @@ public class WebRequest extends WebMessage {
method
=
builder
.
mMethod
;
cacheMode
=
builder
.
mCacheMode
;
referrer
=
builder
.
mReferrer
;
origin
=
builder
.
mOrigin
;
if
(
builder
.
mBody
!=
null
)
{
body
=
builder
.
mBody
.
asReadOnlyBuffer
();
...
...
@@ -126,6 +132,7 @@ public class WebRequest extends WebMessage {
/* package */
String
mMethod
=
"GET"
;
/* package */
int
mCacheMode
=
CACHE_MODE_DEFAULT
;
/* package */
String
mReferrer
;
/* package */
String
mOrigin
;
/**
* Construct a Builder instance with the specified URI.
...
...
@@ -205,6 +212,17 @@ public class WebRequest extends WebMessage {
return
this
;
}
/**
* Set the origin URI.
*
* @param origin A URI String
* @return This Builder instance.
*/
public
@NonNull
Builder
origin
(
final
@Nullable
String
origin
)
{
mOrigin
=
origin
;
return
this
;
}
/**
* @return A {@link WebRequest} constructed with the values from this Builder instance.
*/
...
...
widget/android/WebExecutorSupport.cpp
View file @
c330bb32
...
...
@@ -390,6 +390,16 @@ nsresult WebExecutorSupport::CreateStreamLoader(
MOZ_ASSERT
(
cookieJarSettings
);
nsCOMPtr
<
nsILoadInfo
>
loadInfo
=
channel
->
LoadInfo
();
RefPtr
<
nsIURI
>
originUri
;
const
auto
origin
=
req
->
Origin
();
if
(
origin
)
{
rv
=
NS_NewURI
(
getter_AddRefs
(
originUri
),
origin
->
ToString
());
NS_ENSURE_SUCCESS
(
rv
,
NS_ERROR_MALFORMED_URI
);
OriginAttributes
attrs
=
loadInfo
->
GetOriginAttributes
();
attrs
.
SetFirstPartyDomain
(
true
,
originUri
);
loadInfo
->
SetOriginAttributes
(
attrs
);
}
loadInfo
->
SetCookieJarSettings
(
cookieJarSettings
);
// setup http/https specific things
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment