Bug 1201498 - Service worker update should compare scriptURL to worker URL without fragment, r=bkelly, a=ritu
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 11 Nov 2015 10:46:29 +0000
changeset 284621 4b6161cc379b78e4fef8195c3f62a1603acf7b59
parent 284620 953f0b711d38c84d4aefdfbc59f652245c77831b
child 284622 8efe7a54bafea994bfaa1fce37e9bf84283d160f
push id148
push usercbook@mozilla.com
push dateMon, 16 Nov 2015 07:23:21 +0000
reviewersbkelly, ritu
bugs1201498
milestone44.0a2
Bug 1201498 - Service worker update should compare scriptURL to worker URL without fragment, r=bkelly, a=ritu
dom/workers/ServiceWorkerManager.cpp
testing/web-platform/mozilla/tests/service-workers/service-worker/serviceworkerobject-scripturl.https.html
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -1469,17 +1469,17 @@ ServiceWorkerManager::Register(nsIDOMWin
 
   nsCString cleanedScope;
   rv = aScopeURI->GetSpecIgnoringRef(cleanedScope);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return NS_ERROR_FAILURE;
   }
 
   nsAutoCString spec;
-  rv = aScriptURI->GetSpec(spec);
+  rv = aScriptURI->GetSpecIgnoringRef(spec);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   nsCOMPtr<nsIGlobalObject> sgo = do_QueryInterface(window);
   ErrorResult result;
   RefPtr<Promise> promise = Promise::Create(sgo, result);
   if (result.Failed()) {
--- a/testing/web-platform/mozilla/tests/service-workers/service-worker/serviceworkerobject-scripturl.https.html
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/serviceworkerobject-scripturl.https.html
@@ -16,12 +16,11 @@ function url_test(name, url) {
                         'Returned ServiceWorker object should have scriptURL');
           service_worker_unregister_and_done(t, scope);
         })
       .catch(unreached_rejection(t));
   }, 'Verify the scriptURL property: ' + name);
 }
 
 url_test('relative', 'resources/empty-worker.js');
-url_test('with-fragment', 'resources/empty-worker.js#ref');
 url_test('absolute', (new URL('./resources/empty-worker.js', window.location)).href);
 
 </script>