Diff
Modified: branches/safari-605-branch/LayoutTests/ChangeLog (228066 => 228067)
--- branches/safari-605-branch/LayoutTests/ChangeLog 2018-02-05 02:19:11 UTC (rev 228066)
+++ branches/safari-605-branch/LayoutTests/ChangeLog 2018-02-05 05:30:24 UTC (rev 228067)
@@ -1,5 +1,24 @@
2018-02-04 Jason Marcell <jmarc...@apple.com>
+ Cherry-pick r227997. rdar://problem/37220136
+
+ 2018-02-01 Chris Dumez <cdu...@apple.com>
+
+ When SW install fails, null out registration.installing before setting worker state to "redundant"
+ https://bugs.webkit.org/show_bug.cgi?id=182416
+ <rdar://problem/37141997>
+
+ Reviewed by Youenn Fablet.
+
+ Add layout test coverage. I have verified that this test is passing in both Firefox and Chrome.
+
+ * http/tests/workers/service/install-fails-expected.txt: Added.
+ * http/tests/workers/service/install-fails.html: Added.
+ * http/tests/workers/service/resources/install-fails-worker.js: Added.
+ (event.event.waitUntil.new.Promise):
+
+2018-02-04 Jason Marcell <jmarc...@apple.com>
+
Cherry-pick r227992. rdar://problem/37145465
2018-02-01 Megan Gardner <megan_gard...@apple.com>
Added: branches/safari-605-branch/LayoutTests/http/tests/workers/service/install-fails-expected.txt (0 => 228067)
--- branches/safari-605-branch/LayoutTests/http/tests/workers/service/install-fails-expected.txt (rev 0)
+++ branches/safari-605-branch/LayoutTests/http/tests/workers/service/install-fails-expected.txt 2018-02-05 05:30:24 UTC (rev 228067)
@@ -0,0 +1,3 @@
+PASS: Worker became redundant
+PASS: registration.installing should be null
+
Added: branches/safari-605-branch/LayoutTests/http/tests/workers/service/install-fails.html (0 => 228067)
--- branches/safari-605-branch/LayoutTests/http/tests/workers/service/install-fails.html (rev 0)
+++ branches/safari-605-branch/LayoutTests/http/tests/workers/service/install-fails.html 2018-02-05 05:30:24 UTC (rev 228067)
@@ -0,0 +1,26 @@
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+navigator.serviceWorker.register("resources/install-fails-worker.js", { }).then(function(r) {
+ registration = r;
+ worker = registration.installing;
+ worker.addEventListener("statechange", function() {
+ if (worker.state === "redundant") {
+ log("PASS: Worker became redundant");
+ if (registration.installing)
+ log("FAIL: registration.installing should be null");
+ else
+ log("PASS: registration.installing should be null");
+ finishSWTest();
+ }
+ });
+ waitForState(registration.installing, "installed").then(function() {
+ registration.waiting.postMessage("CheckReceivedPageState");
+ });
+});
+</script>
+</body>
+</html>
Added: branches/safari-605-branch/LayoutTests/http/tests/workers/service/resources/install-fails-worker.js (0 => 228067)
--- branches/safari-605-branch/LayoutTests/http/tests/workers/service/resources/install-fails-worker.js (rev 0)
+++ branches/safari-605-branch/LayoutTests/http/tests/workers/service/resources/install-fails-worker.js 2018-02-05 05:30:24 UTC (rev 228067)
@@ -0,0 +1,3 @@
+self.addEventListener("install", (event) => {
+ event.waitUntil(Promise.reject());
+});
Modified: branches/safari-605-branch/LayoutTests/imported/w3c/ChangeLog (228066 => 228067)
--- branches/safari-605-branch/LayoutTests/imported/w3c/ChangeLog 2018-02-05 02:19:11 UTC (rev 228066)
+++ branches/safari-605-branch/LayoutTests/imported/w3c/ChangeLog 2018-02-05 05:30:24 UTC (rev 228067)
@@ -1,5 +1,21 @@
2018-02-04 Jason Marcell <jmarc...@apple.com>
+ Cherry-pick r227997. rdar://problem/37220136
+
+ 2018-02-01 Chris Dumez <cdu...@apple.com>
+
+ When SW install fails, null out registration.installing before setting worker state to "redundant"
+ https://bugs.webkit.org/show_bug.cgi?id=182416
+ <rdar://problem/37141997>
+
+ Reviewed by Youenn Fablet.
+
+ Rebaseline WPT test now that one more check is passing.
+
+ * web-platform-tests/service-workers/service-worker/register-same-scope-different-script-url.https-expected.txt:
+
+2018-02-04 Jason Marcell <jmarc...@apple.com>
+
Cherry-pick r227985. rdar://problem/37145479
2018-02-01 Chris Dumez <cdu...@apple.com>
Modified: branches/safari-605-branch/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-same-scope-different-script-url.https-expected.txt (228066 => 228067)
--- branches/safari-605-branch/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-same-scope-different-script-url.https-expected.txt 2018-02-05 02:19:11 UTC (rev 228066)
+++ branches/safari-605-branch/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/register-same-scope-different-script-url.https-expected.txt 2018-02-05 05:30:24 UTC (rev 228067)
@@ -2,6 +2,6 @@
PASS Register different scripts concurrently
PASS Register then register new script URL
PASS Register then register new script URL that 404s
-FAIL Register then register new script that does not install assert_unreached: unexpected rejection: assert_equals: on redundant, installing should be null expected null but got object "[object ServiceWorker]" Reached unreachable code
+PASS Register then register new script that does not install
PASS Register same-scope new script url effect on controller
Modified: branches/safari-605-branch/Source/WebCore/ChangeLog (228066 => 228067)
--- branches/safari-605-branch/Source/WebCore/ChangeLog 2018-02-05 02:19:11 UTC (rev 228066)
+++ branches/safari-605-branch/Source/WebCore/ChangeLog 2018-02-05 05:30:24 UTC (rev 228067)
@@ -1,5 +1,26 @@
2018-02-04 Jason Marcell <jmarc...@apple.com>
+ Cherry-pick r227997. rdar://problem/37220136
+
+ 2018-02-01 Chris Dumez <cdu...@apple.com>
+
+ When SW install fails, null out registration.installing before setting worker state to "redundant"
+ https://bugs.webkit.org/show_bug.cgi?id=182416
+ <rdar://problem/37141997>
+
+ Reviewed by Youenn Fablet.
+
+ When SW install fails, null out registration.installing before setting worker state to "redundant".
+ This does not match the spec but this is what Firefox and Chrome do. This is also what the
+ web-platform-tests expect.
+
+ Test: http/tests/workers/service/install-fails.html
+
+ * workers/service/server/SWServerJobQueue.cpp:
+ (WebCore::SWServerJobQueue::didFinishInstall):
+
+2018-02-04 Jason Marcell <jmarc...@apple.com>
+
Cherry-pick r227985. rdar://problem/37145479
2018-02-01 Chris Dumez <cdu...@apple.com>
Modified: branches/safari-605-branch/Source/WebCore/workers/service/server/SWServerJobQueue.cpp (228066 => 228067)
--- branches/safari-605-branch/Source/WebCore/workers/service/server/SWServerJobQueue.cpp 2018-02-05 02:19:11 UTC (rev 228066)
+++ branches/safari-605-branch/Source/WebCore/workers/service/server/SWServerJobQueue.cpp 2018-02-05 05:30:24 UTC (rev 228067)
@@ -183,13 +183,14 @@
ASSERT(registration->installingWorker()->identifier() == identifier);
if (!wasSuccessful) {
- auto* worker = m_server.workerByID(identifier);
+ RefPtr<SWServerWorker> worker = m_server.workerByID(identifier);
RELEASE_ASSERT(worker);
+ worker->terminate();
+ // Run the Update Registration State algorithm passing registration, "installing" and null as the arguments.
+ registration->updateRegistrationState(ServiceWorkerRegistrationState::Installing, nullptr);
// Run the Update Worker State algorithm passing registration's installing worker and redundant as the arguments.
registration->updateWorkerState(*worker, ServiceWorkerState::Redundant);
- // Run the Update Registration State algorithm passing registration, "installing" and null as the arguments.
- registration->updateRegistrationState(ServiceWorkerRegistrationState::Installing, nullptr);
// If newestWorker is null, invoke Clear Registration algorithm passing registration as its argument.
if (!registration->getNewestWorker())