Diff
Modified: trunk/LayoutTests/ChangeLog (226095 => 226096)
--- trunk/LayoutTests/ChangeLog 2017-12-19 04:32:43 UTC (rev 226095)
+++ trunk/LayoutTests/ChangeLog 2017-12-19 05:08:52 UTC (rev 226096)
@@ -1,3 +1,21 @@
+2017-12-18 Chris Dumez <cdu...@apple.com>
+
+ Default scope used when registering a service worker is wrong
+ https://bugs.webkit.org/show_bug.cgi?id=180961
+
+ Reviewed by Youenn Fablet.
+
+ Update / Rebaseline WebKit tests due to behavior change.
+
+ * http/tests/workers/service/basic-register-exceptions-expected.txt:
+ * http/tests/workers/service/basic-unregister.https-expected.txt:
+ * http/tests/workers/service/resources/basic-unregister.js:
+ (async.test):
+ * http/tests/workers/service/resources/service-worker-getRegistration.js:
+ (async.test):
+ * http/tests/workers/service/self_registration-expected.txt:
+ * http/tests/workers/service/service-worker-clear.html:
+
2017-12-18 Ryosuke Niwa <rn...@webkit.org>
Assertion hit in DocumentOrderedMap::get while removing a form element
Modified: trunk/LayoutTests/http/tests/workers/service/basic-register-exceptions-expected.txt (226095 => 226096)
--- trunk/LayoutTests/http/tests/workers/service/basic-register-exceptions-expected.txt 2017-12-19 04:32:43 UTC (rev 226095)
+++ trunk/LayoutTests/http/tests/workers/service/basic-register-exceptions-expected.txt 2017-12-19 05:08:52 UTC (rev 226096)
@@ -4,5 +4,6 @@
CONSOLE MESSAGE: line 50: Registration failed with error: TypeError: serviceWorker.register() must be called with a script URL whose path does not contain '%2f' or '%5c'
CONSOLE MESSAGE: line 60: Registration failed with error: TypeError: Scope URL provided to serviceWorker.register() must be either HTTP or HTTPS
CONSOLE MESSAGE: line 70: Registration failed with error: TypeError: Scope URL provided to serviceWorker.register() cannot have a path that contains '%2f' or '%5c'
+CONSOLE MESSAGE: line 80: Registration failed with error: SecurityError: Script origin does not match the registering client's origin
CONSOLE MESSAGE: line 91: Registration failed with error: SecurityError: Scope origin does not match the registering client's origin
Modified: trunk/LayoutTests/http/tests/workers/service/basic-unregister.https-expected.txt (226095 => 226096)
--- trunk/LayoutTests/http/tests/workers/service/basic-unregister.https-expected.txt 2017-12-19 04:32:43 UTC (rev 226095)
+++ trunk/LayoutTests/http/tests/workers/service/basic-unregister.https-expected.txt 2017-12-19 05:08:52 UTC (rev 226096)
@@ -5,6 +5,6 @@
PASS: There is no service worker registered for the origin
PASS: Unregistration failed as expected
PASS: There is no service worker registered for the origin
-PASS: registration scope is https://127.0.0.1:8443/workers/service/
+PASS: registration scope is https://127.0.0.1:8443/workers/service/resources/
PASS: There is a service worker registered for the origin
Modified: trunk/LayoutTests/http/tests/workers/service/resources/basic-unregister.js (226095 => 226096)
--- trunk/LayoutTests/http/tests/workers/service/resources/basic-unregister.js 2017-12-19 04:32:43 UTC (rev 226095)
+++ trunk/LayoutTests/http/tests/workers/service/resources/basic-unregister.js 2017-12-19 05:08:52 UTC (rev 226096)
@@ -45,7 +45,7 @@
log("FAIL: There is a service worker registered for the origin");
registration = await navigator.serviceWorker.register("resources/basic-fetch-worker.js", { });
- if (registration.scope === "https://127.0.0.1:8443/workers/service/")
+ if (registration.scope === "https://127.0.0.1:8443/workers/service/resources/")
log("PASS: registration scope is " + registration.scope);
else
log("FAIL: registration scope is " + registration.scope);
Modified: trunk/LayoutTests/http/tests/workers/service/resources/service-worker-getRegistration.js (226095 => 226096)
--- trunk/LayoutTests/http/tests/workers/service/resources/service-worker-getRegistration.js 2017-12-19 04:32:43 UTC (rev 226095)
+++ trunk/LayoutTests/http/tests/workers/service/resources/service-worker-getRegistration.js 2017-12-19 05:08:52 UTC (rev 226096)
@@ -40,7 +40,7 @@
log("Service worker 1 registered with scope " + newRegistration1.scope);
log("Registering service worker 2");
- var newRegistration2 = await navigator.serviceWorker.register("resources/service-worker-getRegistration-worker.js");
+ var newRegistration2 = await navigator.serviceWorker.register("resources/service-worker-getRegistration-worker.js", { scope: "./" });
log("Service worker 2 registered with scope " + newRegistration2.scope);
var registration4 = await navigator.serviceWorker.getRegistration("/test1/test2");
Modified: trunk/LayoutTests/http/tests/workers/service/self_registration-expected.txt (226095 => 226096)
--- trunk/LayoutTests/http/tests/workers/service/self_registration-expected.txt 2017-12-19 04:32:43 UTC (rev 226095)
+++ trunk/LayoutTests/http/tests/workers/service/self_registration-expected.txt 2017-12-19 05:08:52 UTC (rev 226096)
@@ -3,7 +3,7 @@
Received updatefound event on self.registration
Received install event
* self.registration
-scope: http://127.0.0.1:8000/workers/service/
+scope: http://127.0.0.1:8000/workers/service/resources/
updateViaCache: imports
installing worker:
- scriptURL: http://127.0.0.1:8000/workers/service/resources/self_registration-worker.js
@@ -15,7 +15,7 @@
Received statechange event on service worker
Received activate event
* self.registration
-scope: http://127.0.0.1:8000/workers/service/
+scope: http://127.0.0.1:8000/workers/service/resources/
updateViaCache: imports
installing worker: null
waiting worker: null
@@ -25,7 +25,7 @@
Received statechange event on service worker
* self.registration
-scope: http://127.0.0.1:8000/workers/service/
+scope: http://127.0.0.1:8000/workers/service/resources/
updateViaCache: imports
installing worker: null
waiting worker: null
Modified: trunk/LayoutTests/http/tests/workers/service/service-worker-clear.html (226095 => 226096)
--- trunk/LayoutTests/http/tests/workers/service/service-worker-clear.html 2017-12-19 04:32:43 UTC (rev 226095)
+++ trunk/LayoutTests/http/tests/workers/service/service-worker-clear.html 2017-12-19 05:08:52 UTC (rev 226096)
@@ -14,7 +14,7 @@
var hasRegistration = await internals.hasServiceWorkerRegistration("");
log(hasRegistration ? "FAIL: Got registration" : "PASS: No registration");
- await navigator.serviceWorker.register("resources/service-worker-fetch-worker.js", { });
+ await navigator.serviceWorker.register("resources/service-worker-fetch-worker.js", { scope: "./" });
var hasRegistration = await internals.hasServiceWorkerRegistration("");
log(hasRegistration ? "PASS: Got registration" : "FAIL: No registration");
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (226095 => 226096)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-12-19 04:32:43 UTC (rev 226095)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-12-19 05:08:52 UTC (rev 226096)
@@ -1,5 +1,16 @@
2017-12-18 Chris Dumez <cdu...@apple.com>
+ Default scope used when registering a service worker is wrong
+ https://bugs.webkit.org/show_bug.cgi?id=180961
+
+ Reviewed by Youenn Fablet.
+
+ Rebaseline WPT test now that more checks are passing.
+
+ * web-platform-tests/service-workers/service-worker/register-default-scope.https-expected.txt:
+
+2017-12-18 Chris Dumez <cdu...@apple.com>
+
Unreviewed, rebaseline imported/w3c/web-platform-tests/service-workers/service-worker/registration-security-error.https.html after r226087.
* web-platform-tests/service-workers/service-worker/registration-security-error.https-expected.txt:
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-default-scope.https-expected.txt (226095 => 226096)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-default-scope.https-expected.txt 2017-12-19 04:32:43 UTC (rev 226095)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-default-scope.https-expected.txt 2017-12-19 05:08:52 UTC (rev 226096)
@@ -1,5 +1,5 @@
-FAIL default scope assert_equals: The default scope should be URL("./", script_url) expected "https://localhost:9443/service-workers/service-worker/resources/" but got "https://localhost:9443/service-workers/service-worker/"
-FAIL undefined scope assert_equals: The default scope should be URL("./", script_url) expected "https://localhost:9443/service-workers/service-worker/resources/" but got "https://localhost:9443/service-workers/service-worker/"
+PASS default scope
+PASS undefined scope
FAIL null scope assert_unreached: register should fail Reached unreachable code
Modified: trunk/Source/WebCore/ChangeLog (226095 => 226096)
--- trunk/Source/WebCore/ChangeLog 2017-12-19 04:32:43 UTC (rev 226095)
+++ trunk/Source/WebCore/ChangeLog 2017-12-19 05:08:52 UTC (rev 226096)
@@ -1,3 +1,20 @@
+2017-12-18 Chris Dumez <cdu...@apple.com>
+
+ Default scope used when registering a service worker is wrong
+ https://bugs.webkit.org/show_bug.cgi?id=180961
+
+ Reviewed by Youenn Fablet.
+
+ The default scope we used when registering a service worker was wrong, it did not match:
+ - https://w3c.github.io/ServiceWorker/#start-register (Step 4)
+
+ This patch aligns our behavior with the specification.
+
+ No new tests, rebaselined existing test.
+
+ * workers/service/ServiceWorkerContainer.cpp:
+ (WebCore::ServiceWorkerContainer::addRegistration):
+
2017-12-18 Ryosuke Niwa <rn...@webkit.org>
Assertion hit in DocumentOrderedMap::get while removing a form element
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (226095 => 226096)
--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp 2017-12-19 04:32:43 UTC (rev 226095)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp 2017-12-19 05:08:52 UTC (rev 226096)
@@ -141,9 +141,10 @@
return;
}
- String scope = options.scope.isEmpty() ? ASCIILiteral("./") : options.scope;
- if (!scope.isEmpty())
- jobData.scopeURL = context->completeURL(scope);
+ if (!options.scope.isEmpty())
+ jobData.scopeURL = context->completeURL(options.scope);
+ else
+ jobData.scopeURL = URL(jobData.scriptURL, "./");
if (!jobData.scopeURL.isNull() && !SchemeRegistry::canServiceWorkersHandleURLScheme(jobData.scopeURL.protocol().toStringWithoutCopying())) {
promise->reject(Exception { TypeError, ASCIILiteral("Scope URL provided to serviceWorker.register() must be either HTTP or HTTPS") });