Bug 179441 - [Service Workers] Implement better support for "Clear Registration" algorithm
Summary: [Service Workers] Implement better support for "Clear Registration" algorithm
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://w3c.github.io/ServiceWorker/#...
Keywords: InRadar
Depends on: 179401 179436
Blocks:
  Show dependency treegraph
 
Reported: 2017-11-08 13:19 PST by Chris Dumez
Modified: 2017-11-15 09:41 PST (History)
7 users (show)

See Also:


Attachments
WIP Patch (8.27 KB, patch)
2017-11-08 15:05 PST, Chris Dumez
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews105 for mac-elcapitan-wk2 (3.98 MB, application/zip)
2017-11-08 17:03 PST, Build Bot
no flags Details
Archive of layout-test-results from ews122 for ios-simulator-wk2 (2.44 MB, application/zip)
2017-11-08 19:33 PST, Build Bot
no flags Details
WIP Patch (7.65 KB, patch)
2017-11-10 12:48 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
WIP Patch (6.27 KB, patch)
2017-11-10 12:48 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews104 for mac-elcapitan-wk2 (2.55 MB, application/zip)
2017-11-10 13:56 PST, Build Bot
no flags Details
Archive of layout-test-results from ews125 for ios-simulator-wk2 (2.12 MB, application/zip)
2017-11-10 14:11 PST, Build Bot
no flags Details
Patch (10.05 KB, patch)
2017-11-10 14:29 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (8.91 KB, patch)
2017-11-10 15:24 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2017-11-08 13:19:07 PST
Implement better support for "Clear" algorithm.
Comment 1 Chris Dumez 2017-11-08 15:05:53 PST
Created attachment 326389 [details]
WIP Patch
Comment 2 Build Bot 2017-11-08 17:03:30 PST
Comment on attachment 326389 [details]
WIP Patch

Attachment 326389 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/5155137

New failing tests:
http/tests/workers/service/registration-clear-redundant-worker.html
svg/wicd/test-rightsizing-a.xhtml
Comment 3 Build Bot 2017-11-08 17:03:31 PST
Created attachment 326409 [details]
Archive of layout-test-results from ews105 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 4 Build Bot 2017-11-08 19:33:14 PST
Comment on attachment 326389 [details]
WIP Patch

Attachment 326389 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/5156952

New failing tests:
http/tests/workers/service/registration-clear-redundant-worker.html
Comment 5 Build Bot 2017-11-08 19:33:15 PST
Created attachment 326418 [details]
Archive of layout-test-results from ews122 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.6
Comment 6 Chris Dumez 2017-11-10 12:48:03 PST
Created attachment 326619 [details]
WIP Patch
Comment 7 Chris Dumez 2017-11-10 12:48:45 PST
Created attachment 326620 [details]
WIP Patch
Comment 8 Build Bot 2017-11-10 13:56:04 PST
Comment on attachment 326620 [details]
WIP Patch

Attachment 326620 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/5181514

New failing tests:
http/tests/workers/service/registration-clear-redundant-worker.html
Comment 9 Build Bot 2017-11-10 13:56:06 PST
Created attachment 326625 [details]
Archive of layout-test-results from ews104 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 10 Build Bot 2017-11-10 14:11:53 PST
Comment on attachment 326620 [details]
WIP Patch

Attachment 326620 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/5181537

New failing tests:
http/tests/workers/service/registration-clear-redundant-worker.html
Comment 11 Build Bot 2017-11-10 14:11:54 PST
Created attachment 326629 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.6
Comment 12 Chris Dumez 2017-11-10 14:29:25 PST
Created attachment 326632 [details]
Patch
Comment 13 Brady Eidson 2017-11-10 15:16:22 PST
Comment on attachment 326632 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=326632&action=review

> Source/WebCore/workers/service/server/SWServerJobQueue.cpp:364
> +    if (auto* installingWorker = registration.installingWorker()) {
> +        // Terminate registration's installing worker.
> +        installingWorker->terminate();
> +        // Run the Update Worker State algorithm passing registration's installing worker and redundant as the arguments.
> +        registration.updateWorkerState(*installingWorker, ServiceWorkerState::Redundant);
> +        // Run the Update Registration State algorithm passing registration, "installing" and null as the arguments.
> +        registration.updateRegistrationState(ServiceWorkerRegistrationState::Installing, nullptr);
> +    }
> +    // If registration's waiting worker is not null, then:
> +    if (auto* waitingWorker = registration.waitingWorker()) {
> +        // Terminate registration's waiting worker.
> +        waitingWorker->terminate();
> +        // Run the Update Worker State algorithm passing registration's waiting worker and redundant as the arguments.
> +        registration.updateWorkerState(*waitingWorker, ServiceWorkerState::Redundant);
> +        // Run the Update Registration State algorithm passing registration, "waiting" and null as the arguments.
> +        registration.updateRegistrationState(ServiceWorkerRegistrationState::Waiting, nullptr);
> +    }
> +    // If registration's active worker is not null, then:
> +    if (auto* activeWorker = registration.activeWorker()) {
> +        // Terminate registration's active worker.
> +        activeWorker->terminate();
> +        // Run the Update Worker State algorithm passing registration's active worker and redundant as the arguments.
> +        registration.updateWorkerState(*activeWorker, ServiceWorkerState::Redundant);
> +        // Run the Update Registration State algorithm passing registration, "active" and null as the arguments.
> +        registration.updateRegistrationState(ServiceWorkerRegistrationState::Active, nullptr);
> +    }

All this code clearly needs to be broken out into a utility function
Comment 14 Chris Dumez 2017-11-10 15:24:28 PST
Created attachment 326640 [details]
Patch
Comment 15 Brady Eidson 2017-11-10 15:55:31 PST
Comment on attachment 326640 [details]
Patch

Much better!
Comment 16 Chris Dumez 2017-11-10 16:00:05 PST
Comment on attachment 326640 [details]
Patch

Clearing flags on attachment: 326640

Committed r224710: <https://trac.webkit.org/changeset/224710>
Comment 17 Chris Dumez 2017-11-10 16:00:07 PST
All reviewed patches have been landed.  Closing bug.
Comment 18 Radar WebKit Bug Importer 2017-11-15 09:41:24 PST
<rdar://problem/35562229>