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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1754713006: CORS-RFC1918: Introduce the 'addressSpace' IDL attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar webexposed Created 4 years, 10 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/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 2dcaf63d8c8d9efcd981b3ddcf8c38892f1dceca..a716c3679a1c3ba53662cf38a4915a6ffa886282 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -4918,8 +4918,6 @@ void Document::initSecurityContext(const DocumentInit& initializer)
{
ASSERT(!securityOrigin());
- setHostedInReservedIPRange(initializer.isHostedInReservedIPRange());
-
if (!initializer.hasSecurityContext()) {
// No source for a security context.
// This can occur via document.implementation.createDocument().
@@ -4960,6 +4958,16 @@ void Document::initSecurityContext(const DocumentInit& initializer)
setSecurityOrigin(SecurityOrigin::create(m_url));
}
+ // Set the address space before setting up CSP, as the latter may override
philipj_slow 2016/03/04 04:35:08 OK, so that's https://mikewest.github.io/cors-rfc1
Mike West 2016/03/04 08:58:21 Done.
+ // the former.
+ if (initializer.isHostedInReservedIPRange()) {
+ setAddressSpace(securityOrigin()->isLocalhost()
+ ? WebURLRequest::AddressSpaceLocal
+ : WebURLRequest::AddressSpacePrivate);
+ } else {
+ setAddressSpace(WebURLRequest::AddressSpacePublic);
+ }
+
if (importsController()) {
// If this document is an HTML import, grab a reference to it's master document's Content
// Security Policy. We don't call 'initContentSecurityPolicy' in this case, as we can't

Powered by Google App Engine
This is Rietveld 408576698