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

Unified Diff: third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp

Issue 1760523004: CORS-RFC1918: Teach Workers about address spaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. 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/workers/WorkerScriptLoader.cpp
diff --git a/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp b/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp
index 0e01670271e2e9955087a6d885790879c6e089ac..7b81cd8358b89f19cfc4deea2a657eedd2934eeb 100644
--- a/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp
@@ -34,8 +34,9 @@
#include "platform/HTTPNames.h"
#include "platform/network/ContentSecurityPolicyResponseHeaders.h"
#include "platform/network/ResourceResponse.h"
+#include "platform/weborigin/SecurityOrigin.h"
+#include "public/platform/Platform.h"
#include "public/platform/WebURLRequest.h"
-
#include "wtf/OwnPtr.h"
#include "wtf/RefPtr.h"
@@ -49,6 +50,7 @@ WorkerScriptLoader::WorkerScriptLoader()
, m_identifier(0)
, m_appCacheID(0)
, m_requestContext(WebURLRequest::RequestContextWorker)
+ , m_responseAddressSpace(WebURLRequest::AddressSpacePublic)
{
}
@@ -133,6 +135,13 @@ void WorkerScriptLoader::didReceiveResponse(unsigned long identifier, const Reso
m_responseEncoding = response.textEncodingName();
m_appCacheID = response.appCacheID();
processContentSecurityPolicy(response);
+
+ if (Platform::current()->isReservedIPAddress(response.remoteIPAddress())) {
+ m_responseAddressSpace = SecurityOrigin::create(m_responseURL)->isLocalhost()
+ ? WebURLRequest::AddressSpaceLocal
+ : WebURLRequest::AddressSpacePrivate;
+ }
+
if (m_responseCallback)
(*m_responseCallback)();
}

Powered by Google App Engine
This is Rietveld 408576698