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

Unified Diff: content/child/service_worker/service_worker_dispatcher.cc

Issue 813673005: Service Worker: Improve some exception messages (Chromium). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 5 years, 11 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/child/service_worker/service_worker_dispatcher.cc
diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc
index d95e5b94d4612c216f1f5ab95c22e2a540710b0e..53c55a2ec86941aa19c7051ac68a56aa58a2601e 100644
--- a/content/child/service_worker/service_worker_dispatcher.cc
+++ b/content/child/service_worker/service_worker_dispatcher.cc
@@ -17,9 +17,11 @@
#include "content/child/thread_safe_sender.h"
#include "content/child/webmessageportchannel_impl.h"
#include "content/common/service_worker/service_worker_messages.h"
+#include "content/common/service_worker/service_worker_types.h"
#include "content/public/common/url_utils.h"
#include "third_party/WebKit/public/platform/WebServiceWorkerClientsInfo.h"
#include "third_party/WebKit/public/platform/WebServiceWorkerProviderClient.h"
+#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/web/WebSecurityOrigin.h"
using blink::WebServiceWorkerError;
@@ -102,8 +104,11 @@ void ServiceWorkerDispatcher::RegisterServiceWorker(
script_url.possibly_invalid_spec().size() > GetMaxURLChars()) {
scoped_ptr<WebServiceWorkerRegistrationCallbacks>
owned_callbacks(callbacks);
- scoped_ptr<WebServiceWorkerError> error(new WebServiceWorkerError(
- WebServiceWorkerError::ErrorTypeSecurity, "URL too long"));
+ std::string error_message(kServiceWorkerRegisterErrorPrefix);
+ error_message += "The provided scriptURL or scope is too long.";
+ scoped_ptr<WebServiceWorkerError> error(
+ new WebServiceWorkerError(WebServiceWorkerError::ErrorTypeSecurity,
+ blink::WebString::fromUTF8(error_message)));
callbacks->onError(error.release());
return;
}
@@ -127,8 +132,11 @@ void ServiceWorkerDispatcher::UnregisterServiceWorker(
if (pattern.possibly_invalid_spec().size() > GetMaxURLChars()) {
scoped_ptr<WebServiceWorkerUnregistrationCallbacks>
owned_callbacks(callbacks);
- scoped_ptr<WebServiceWorkerError> error(new WebServiceWorkerError(
- WebServiceWorkerError::ErrorTypeSecurity, "URL too long"));
+ std::string error_message(kServiceWorkerUnregisterErrorPrefix);
+ error_message += "The provided scope is too long.";
+ scoped_ptr<WebServiceWorkerError> error(
+ new WebServiceWorkerError(WebServiceWorkerError::ErrorTypeSecurity,
+ blink::WebString::fromUTF8(error_message)));
callbacks->onError(error.release());
return;
}
@@ -151,8 +159,11 @@ void ServiceWorkerDispatcher::GetRegistration(
if (document_url.possibly_invalid_spec().size() > GetMaxURLChars()) {
scoped_ptr<WebServiceWorkerRegistrationCallbacks>
owned_callbacks(callbacks);
- scoped_ptr<WebServiceWorkerError> error(new WebServiceWorkerError(
- WebServiceWorkerError::ErrorTypeSecurity, "URL too long"));
+ std::string error_message(kServiceWorkerGetRegistrationErrorPrefix);
+ error_message += "The provided documentURL is too long.";
+ scoped_ptr<WebServiceWorkerError> error(
+ new WebServiceWorkerError(WebServiceWorkerError::ErrorTypeSecurity,
+ blink::WebString::fromUTF8(error_message)));
callbacks->onError(error.release());
return;
}

Powered by Google App Engine
This is Rietveld 408576698