-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Service worker: self.serviceWorker #17285
Service worker: self.serviceWorker #17285
Conversation
@mattto this test feels small, but I can't think of anything I'm missing |
(Needs a rebase to pass CI, due to #17286. Sorry!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
It took me a bit to wrap my head around how the tests are setup at the 'parsed' eval state and then the later async tests wait for the service worker installation process to progress. Maybe a comment would be worth it?
e42dc20
to
efb73fe
Compare
@wanderview yeah, setting the tests up early means it doesn't pass just because some of the tests weren't defined in time. I'll add some comments. |
@gsnedders thanks for letting me know. Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. I guess it's ok to assume the SW stays alive until activate is fired... if it causes problems someday we can split the test up.
@@ -0,0 +1,53 @@ | |||
// META: title=serviceWorker on service worker global | |||
// META: global=!default,serviceworker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see there are some tests today with names like "can-make-payment-event-constructor.https.serviceworker.js". Does it work to make this a "serviceworker.js" test, then you don't need this META?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this would be better, but it doesn't seem to work.
https://web-platform-tests.org/writing-tests/testharness.html#auto-generated-test-boilerplate suggests only window
and worker
work in the URL.
The global=!default,serviceworker
line is also directly from their documentation.
Maybe I'm holding it wrong though. I agree it's a little weird having an 'any' test that's limited to just service workers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok.
* Tests for self.serviceWorker * Don't need `self` * Add read only test * Adding comments & test the object doesn't change * Swap order
For w3c/ServiceWorker#1426