Index: Source/modules/serviceworkers/ServiceWorkerContainer.cpp |
diff --git a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp |
index 980bf0088928e4460271c32123ac59685c0a641c..5c7d8fb6b8dde18c1c539c164a73f5d88e4487e0 100644 |
--- a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp |
+++ b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp |
@@ -122,6 +122,11 @@ ScriptPromise ServiceWorkerContainer::registerServiceWorker(ScriptState* scriptS |
return promise; |
} |
+ if (!executionContext->url().protocolIsInHTTPFamily()) { |
+ resolver->reject(DOMException::create(SecurityError, "The URL protocol of the current origin is not supported: " + executionContext->url().protocol())); |
+ return promise; |
+ } |
+ |
KURL patternURL = executionContext->completeURL(options.scope()); |
patternURL.removeFragmentIdentifier(); |
if (!documentOrigin->canRequest(patternURL)) { |
@@ -180,6 +185,11 @@ ScriptPromise ServiceWorkerContainer::getRegistration(ScriptState* scriptState, |
return promise; |
} |
+ if (!executionContext->url().protocolIsInHTTPFamily()) { |
+ resolver->reject(DOMException::create(SecurityError, "The URL protocol of the current origin is not supported: " + executionContext->url().protocol())); |
+ return promise; |
+ } |
+ |
KURL completedURL = executionContext->completeURL(documentURL); |
completedURL.removeFragmentIdentifier(); |
if (!documentOrigin->canRequest(completedURL)) { |