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

Unified Diff: Source/modules/serviceworkers/ServiceWorkerContainer.cpp

Issue 291263002: ServiceWorker: Strip fragment from scope and script URLs (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make normalizeURL remove fragment Created 6 years, 7 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
« no previous file with comments | « LayoutTests/virtual/serviceworker/http/tests/serviceworker/serviceworkerobject-scope-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/serviceworkers/ServiceWorkerContainer.cpp
diff --git a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
index c4f5c07915dfafe8fcc55491dd95ccf1556583ba..e4f9c07f9ee146e53d139e3cdd0f4736ebff8535 100644
--- a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
+++ b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
@@ -87,12 +87,14 @@ ScriptPromise ServiceWorkerContainer::registerServiceWorker(ExecutionContext* ex
RefPtr<SecurityOrigin> documentOrigin = executionContext->securityOrigin();
KURL patternURL = executionContext->completeURL(options.scope);
+ patternURL.removeFragmentIdentifier();
if (!documentOrigin->canRequest(patternURL)) {
resolver->reject(DOMException::create(SecurityError, "Can only register for patterns in the document's origin."));
return promise;
}
KURL scriptURL = executionContext->completeURL(url);
+ scriptURL.removeFragmentIdentifier();
if (!documentOrigin->canRequest(scriptURL)) {
resolver->reject(DOMException::create(SecurityError, "Script must be in document's origin."));
return promise;
@@ -128,6 +130,7 @@ ScriptPromise ServiceWorkerContainer::unregisterServiceWorker(ExecutionContext*
RefPtr<SecurityOrigin> documentOrigin = executionContext->securityOrigin();
KURL patternURL = executionContext->completeURL(pattern);
+ patternURL.removeFragmentIdentifier();
if (!pattern.isEmpty() && !documentOrigin->canRequest(patternURL)) {
resolver->reject(DOMException::create(SecurityError, "Can only unregister for patterns in the document's origin."));
return promise;
« no previous file with comments | « LayoutTests/virtual/serviceworker/http/tests/serviceworker/serviceworkerobject-scope-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698