| Index: Source/modules/serviceworkers/ServiceWorkerContainer.cpp
|
| diff --git a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
|
| index 7218343c7d6762070601ac46fb0ede71750f2fc7..bcd8c92622ed14dfc4ab692acbe8c928f5ac34cb 100644
|
| --- a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
|
| +++ b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
|
| @@ -48,6 +48,7 @@
|
| #include "modules/serviceworkers/ServiceWorkerError.h"
|
| #include "modules/serviceworkers/ServiceWorkerRegistration.h"
|
| #include "platform/RuntimeEnabledFeatures.h"
|
| +#include "platform/weborigin/SchemeRegistry.h"
|
| #include "public/platform/WebServiceWorker.h"
|
| #include "public/platform/WebServiceWorkerProvider.h"
|
| #include "public/platform/WebServiceWorkerRegistration.h"
|
| @@ -219,7 +220,7 @@ ScriptPromise ServiceWorkerContainer::registerServiceWorker(ScriptState* scriptS
|
| }
|
|
|
| KURL pageURL = KURL(KURL(), documentOrigin->toString());
|
| - if (!pageURL.protocolIsInHTTPFamily()) {
|
| + if (!SchemeRegistry::shouldTreatURLSchemeAsAllowServiceWorkers(pageURL.protocol())) {
|
| resolver->reject(DOMException::create(SecurityError, "Failed to register a ServiceWorker: The URL protocol of the current origin ('" + documentOrigin->toString() + "') is not supported."));
|
| return promise;
|
| }
|
| @@ -231,7 +232,7 @@ ScriptPromise ServiceWorkerContainer::registerServiceWorker(ScriptState* scriptS
|
| resolver->reject(DOMException::create(SecurityError, "Failed to register a ServiceWorker: The origin of the provided scriptURL ('" + scriptOrigin->toString() + "') does not match the current origin ('" + documentOrigin->toString() + "')."));
|
| return promise;
|
| }
|
| - if (!scriptURL.protocolIsInHTTPFamily()) {
|
| + if (!SchemeRegistry::shouldTreatURLSchemeAsAllowServiceWorkers(scriptURL.protocol())) {
|
| resolver->reject(DOMException::create(SecurityError, "Failed to register a ServiceWorker: The URL protocol of the script ('" + scriptURL.string() + "') is not supported."));
|
| return promise;
|
| }
|
| @@ -248,7 +249,7 @@ ScriptPromise ServiceWorkerContainer::registerServiceWorker(ScriptState* scriptS
|
| resolver->reject(DOMException::create(SecurityError, "Failed to register a ServiceWorker: The origin of the provided scope ('" + patternOrigin->toString() + "') does not match the current origin ('" + documentOrigin->toString() + "')."));
|
| return promise;
|
| }
|
| - if (!patternURL.protocolIsInHTTPFamily()) {
|
| + if (!SchemeRegistry::shouldTreatURLSchemeAsAllowServiceWorkers(patternURL.protocol())) {
|
| resolver->reject(DOMException::create(SecurityError, "Failed to register a ServiceWorker: The URL protocol of the scope ('" + patternURL.string() + "') is not supported."));
|
| return promise;
|
| }
|
| @@ -281,7 +282,7 @@ ScriptPromise ServiceWorkerContainer::getRegistration(ScriptState* scriptState,
|
| }
|
|
|
| KURL pageURL = KURL(KURL(), documentOrigin->toString());
|
| - if (!pageURL.protocolIsInHTTPFamily()) {
|
| + if (!SchemeRegistry::shouldTreatURLSchemeAsAllowServiceWorkers(pageURL.protocol())) {
|
| resolver->reject(DOMException::create(SecurityError, "Failed to get a ServiceWorkerRegistration: The URL protocol of the current origin ('" + documentOrigin->toString() + "') is not supported."));
|
| return promise;
|
| }
|
| @@ -317,7 +318,7 @@ ScriptPromise ServiceWorkerContainer::getRegistrations(ScriptState* scriptState)
|
| }
|
|
|
| KURL pageURL = KURL(KURL(), documentOrigin->toString());
|
| - if (!pageURL.protocolIsInHTTPFamily()) {
|
| + if (!SchemeRegistry::shouldTreatURLSchemeAsAllowServiceWorkers(pageURL.protocol())) {
|
| resolver->reject(DOMException::create(SecurityError, "Failed to get ServiceWorkerRegistration objects: The URL protocol of the current origin ('" + documentOrigin->toString() + "') is not supported."));
|
| return promise;
|
| }
|
|
|