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

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

Issue 26442004: Service worker registration error support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update to reflect changes from dependent bug Created 7 years, 2 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: 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 a60f8bb3e936befb84b226ca651ac1e316f8ea87..bab772259d901a67ce9611b10f78481a010623b7 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -4,11 +4,15 @@
#include "content/browser/service_worker/service_worker_dispatcher_host.h"
+#include "base/strings/utf_string_conversions.h"
#include "content/browser/service_worker/service_worker_context.h"
#include "content/common/service_worker_messages.h"
#include "ipc/ipc_message_macros.h"
+#include "third_party/WebKit/public/platform/WebServiceWorkerError.h"
#include "url/gurl.h"
+using WebKit::WebServiceWorkerError;
+
namespace content {
ServiceWorkerDispatcherHost::ServiceWorkerDispatcherHost(
@@ -56,6 +60,15 @@ void ServiceWorkerDispatcherHost::OnRegisterServiceWorker(
if (scope.GetOrigin() != script_url.GetOrigin())
return;
+ if (!context_->enabled()) {
+ Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
+ thread_id,
+ request_id,
+ WebKit::WebServiceWorkerError::DisabledError,
+ ASCIIToUTF16("ServiceWorker is disabled")));
Tom Sepez 2013/10/25 18:46:59 nit: maybe a kSomething constant instead of the st
alecflett 2013/10/25 20:05:02 This merely a temporary state until the flag is re
+ return;
+ }
+
Send(new ServiceWorkerMsg_ServiceWorkerRegistered(
thread_id, request_id, NextWorkerId()));
}
@@ -66,6 +79,15 @@ void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker(int32 thread_id,
// TODO(alecflett): add a ServiceWorker-specific policy query in
// ChildProcessSecurityImpl. See http://crbug.com/311631.
+ if (!context_->enabled()) {
+ Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
+ thread_id,
+ request_id,
+ WebServiceWorkerError::DisabledError,
+ ASCIIToUTF16("ServiceWorker is disabled")));
+ return;
+ }
+
Send(new ServiceWorkerMsg_ServiceWorkerUnregistered(
thread_id, request_id));
}

Powered by Google App Engine
This is Rietveld 408576698