Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cookie-store] Promote stability in test results #16415

Merged
merged 3 commits into from
Jun 18, 2019

Conversation

jugglinmike
Copy link
Contributor

Allow service worker activation to proceed in the absence of the API
under test. This prevents the workers in failing implementations from
entering the "redundant" state, which can interfere with the harness's
ability to detect all tests.


I've observed inconsistent test results from these tests in Safari Technology
Preview 80. This change stabilizes the results and also makes the tests fail
immediately (instead of timing out).

In general, it seems preferable to defer all fallible logic until after the
service worker's been activated. I'm not familiar with the cookie-store draft,
so I've assumed that these operations have to be done during installation.

For cases like that, it might be nice if the harness could be more resilient.
For instance, it might react to the "redundant" state by discarding all tests
(given that it's suspect whether all tests have been transmitted back to the
client) and reporting the "ERROR" status. However, I imagine doing so would
interfere with the service-workers tests that concern redundant workers.
@mattto / @mkruisselbrink do you have any thoughts about that?

Allow service worker activation to proceed in the absence of the API
under test. This prevents the workers in failing implementations from
entering the "redundant" state, which can interfere with the harness's
ability to detect all tests.
Copy link
Member

@inexorabletash inexorabletash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me. Some formatting nits.

{ name: 'cookie-prefix', matchType: 'starts-with' },
]);

// If the worker enters the "redundant" state, the UA may terminate it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should probably be indented 2 more spaces

await cookieStore.subscribeToChanges([
{ name: 'cookie-name', matchType: 'equals', url: '/scope/path' }]);

// If the worker enters the "redundant" state, the UA may terminate it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should probably be indented 2 more spaces

try {
await cookieStore.subscribeToChanges([]);

// If the worker enters the "redundant" state, the UA may terminate it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should probably be indented 2 more spaces

await cookieStore.subscribeToChanges([
{ name: 'cookie-name', matchType: 'equals', url: '/scope/path' }]);

// If the worker enters the "redundant" state, the UA may terminate it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should probably be indented 2 more spaces

await cookieStore.subscribeToChanges([
{ name: 'cookie-name', matchType: 'equals', url: '/scope/path' }]);

// If the worker enters the "redundant" state, the UA may terminate it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should probably be indented 2 more spaces

@@ -6,8 +6,14 @@ importScripts("/resources/testharness.js");

self.addEventListener('install', (event) => {
event.waitUntil((async () => {
await cookieStore.subscribeToChanges([
{ name: 'cookie-name', matchType: 'equals', url: '/scope/path' }]);
try{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: space between try and {

@jugglinmike
Copy link
Contributor Author

Thanks for the review, @inexorabletash.

Here's an initial idea for addressing this in the harness. It triggers a harness error if the worker enters the redundant state. That makes the problem more clear, but it still requires timing out, and it's still susceptible to instability. I think the true solution will require a more involved patch which is not something I'd like to embark on without support from the service workers experts.

Copy link
Member

@inexorabletash inexorabletash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@inexorabletash
Copy link
Member

... not something I'd like to embark on without support from the service workers experts

+1; moar qualified eyeballs needed.

@jugglinmike
Copy link
Contributor Author

@jugglinmike jugglinmike merged commit 199b5fa into web-platform-tests:master Jun 18, 2019
marcoscaceres pushed a commit that referenced this pull request Jul 23, 2019
* [cookie-store] Promote stability in test results

Allow service worker activation to proceed in the absence of the API
under test. This prevents the workers in failing implementations from
entering the "redundant" state, which can interfere with the harness's
ability to detect all tests.

* fixup! [cookie-store] Promote stability in test results

* fixup! [cookie-store] Promote stability in test results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants