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

Unified Diff: content/browser/service_worker/service_worker_dispatcher_host.cc

Issue 397913003: Kill renderers which try to register Service Workers across domains. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename tests. Created 6 years, 5 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
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_dispatcher_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_dispatcher_host.cc
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc
index 7a75e2de068647ae0921a5063eb0ad076da75bc3..184d1654961d9244637b7c15c64ff124d861ff40 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -28,14 +28,15 @@ namespace {
const char kShutdownErrorMessage[] =
"The Service Worker system has shutdown.";
-const char kDomainMismatchErrorMessage[] =
- "Scope and scripts do not have the same origin";
const uint32 kFilteredMessageClasses[] = {
ServiceWorkerMsgStart,
EmbeddedWorkerMsgStart,
};
+// TODO(dominicc): When crbug.com/362214 is fixed, make
+// Can(R|Unr)egisterServiceWorker also check that these are secure
+// origins to defend against compromised renderers.
bool CanRegisterServiceWorker(const GURL& document_url,
const GURL& pattern,
const GURL& script_url) {
@@ -196,11 +197,7 @@ void ServiceWorkerDispatcherHost::OnRegisterServiceWorker(
if (!CanRegisterServiceWorker(
provider_host->document_url(), pattern, script_url)) {
- Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
- thread_id,
- request_id,
- WebServiceWorkerError::ErrorTypeSecurity,
- base::ASCIIToUTF16(kDomainMismatchErrorMessage)));
+ BadMessageReceived();
return;
}
GetContext()->RegisterServiceWorker(
@@ -244,11 +241,7 @@ void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker(
}
if (!CanUnregisterServiceWorker(provider_host->document_url(), pattern)) {
- Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
- thread_id,
- request_id,
- WebServiceWorkerError::ErrorTypeSecurity,
- base::ASCIIToUTF16(kDomainMismatchErrorMessage)));
+ BadMessageReceived();
return;
}
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_dispatcher_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698