Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1242)

Unified Diff: third_party/WebKit/Source/core/fetch/ResourceLoaderOptions.h

Issue 1801513003: Cross origin requests to same origin should match Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed failing CORS tests Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fetch/ResourceLoaderOptions.h
diff --git a/third_party/WebKit/Source/core/fetch/ResourceLoaderOptions.h b/third_party/WebKit/Source/core/fetch/ResourceLoaderOptions.h
index 01c166359647675269fa866b8745f02d37723981..e35e12e5d4acc799d6b26c66f196cad23d80ccd8 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceLoaderOptions.h
+++ b/third_party/WebKit/Source/core/fetch/ResourceLoaderOptions.h
@@ -79,6 +79,11 @@ enum CORSEnabled {
IsCORSEnabled
};
+enum SameOrigin {
+ NotSameOrigin,
+ IsSameOrigin
+};
+
struct ResourceLoaderOptions {
USING_FAST_MALLOC(ResourceLoaderOptions);
public:
@@ -90,6 +95,7 @@ public:
, requestInitiatorContext(DocumentContext)
, synchronousPolicy(RequestAsynchronously)
, corsEnabled(NotCORSEnabled)
+ , sameOrigin(NotSameOrigin)
Nate Chapin 2016/03/17 22:58:18 This will make non-CORS loads always be marked Not
Yoav Weiss 2016/03/18 07:53:14 True. Maybe a third value is needed
{
}
@@ -106,24 +112,14 @@ public:
, requestInitiatorContext(requestInitiatorContext)
, synchronousPolicy(RequestAsynchronously)
, corsEnabled(NotCORSEnabled)
+ , sameOrigin(NotSameOrigin)
{
}
// Answers the question "can a separate request with these
// different options be re-used" (e.g. preload request)
// The safe (but possibly slow) answer is always false.
- bool canReuseRequest(const ResourceLoaderOptions& other) const
- {
- // dataBufferingPolicy differences are believed to be safe for re-use.
- // FIXME: check allowCredentials.
- // FIXME: check credentialsRequested.
- // FIXME: check contentSecurityPolicyOption.
- // initiatorInfo is purely informational and should be benign for re-use.
- // requestInitiatorContext is benign (indicates document vs. worker)
- // synchronousPolicy (safe to re-use an async XHR response for sync, etc.)
- return corsEnabled == other.corsEnabled;
- // securityOrigin has more complicated checks which callers are responsible for.
- }
+ bool canReuseRequest(const ResourceLoaderOptions& other) const;
// When adding members, CrossThreadResourceLoaderOptionsData should be
// updated.
@@ -136,6 +132,7 @@ public:
SynchronousPolicy synchronousPolicy;
CORSEnabled corsEnabled; // If the resource is loaded out-of-origin, whether or not to use CORS.
RefPtr<SecurityOrigin> securityOrigin;
+ SameOrigin sameOrigin;
};
// Encode AtomicString (in FetchInitiatorInfo) as String to cross threads.
@@ -150,7 +147,8 @@ struct CrossThreadResourceLoaderOptionsData {
, requestInitiatorContext(options.requestInitiatorContext)
, synchronousPolicy(options.synchronousPolicy)
, corsEnabled(options.corsEnabled)
- , securityOrigin(options.securityOrigin ? options.securityOrigin->isolatedCopy() : nullptr) { }
+ , securityOrigin(options.securityOrigin ? options.securityOrigin->isolatedCopy() : nullptr)
+ , sameOrigin(options.sameOrigin) { }
operator ResourceLoaderOptions() const
{
@@ -164,6 +162,7 @@ struct CrossThreadResourceLoaderOptionsData {
options.synchronousPolicy = synchronousPolicy;
options.corsEnabled = corsEnabled;
options.securityOrigin = securityOrigin;
+ options.sameOrigin = sameOrigin;
return options;
}
@@ -176,6 +175,7 @@ struct CrossThreadResourceLoaderOptionsData {
SynchronousPolicy synchronousPolicy;
CORSEnabled corsEnabled;
RefPtr<SecurityOrigin> securityOrigin;
+ SameOrigin sameOrigin;
};
template <>

Powered by Google App Engine
This is Rietveld 408576698