Chromium Code Reviews| Index: Source/modules/serviceworkers/ServiceWorkerContainer.cpp |
| diff --git a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp |
| index cbb117f1608a182fa1b5eb6f6cb283d14054f27d..715f6532bdee5761e74e2f040bf28543a8607acc 100644 |
| --- a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp |
| +++ b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp |
| @@ -35,6 +35,7 @@ |
| #include "bindings/core/v8/ScriptState.h" |
| #include "bindings/core/v8/SerializedScriptValue.h" |
| #include "bindings/core/v8/SerializedScriptValueFactory.h" |
| +#include "bindings/core/v8/V8ThrowException.h" |
| #include "core/dom/DOMException.h" |
| #include "core/dom/Document.h" |
| #include "core/dom/ExceptionCode.h" |
| @@ -246,6 +247,12 @@ ScriptPromise ServiceWorkerContainer::registerServiceWorker(ScriptState* scriptS |
| return promise; |
| } |
| + WebString webErrorMessage; |
| + if (!m_provider->validateScopeAndScriptURL(patternURL, scriptURL, &webErrorMessage)) { |
|
falken
2015/08/05 06:54:23
Ah it's kind of weird that validateScopeAndScript
nhiroki
2015/08/05 07:15:09
Ah, good point. Moving validateSASURL into Platfor
nhiroki
2015/08/05 07:31:58
I had an offline chat w/ jeremy and falken. We dec
|
| + resolver->reject(V8ThrowException::createTypeError(scriptState->isolate(), WebString::fromUTF8("Failed to register a ServiceWorker: " + webErrorMessage.utf8()))); |
| + return promise; |
| + } |
| + |
| m_provider->registerServiceWorker(patternURL, scriptURL, new RegistrationCallback(resolver)); |
| return promise; |