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