reload-service-worker-fetch-event.html is served over HTTP (no .https), and its worker calls event.transitionWhile() instead of respondWith()
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- testing
Research direction
Read navigation-api/navigation-methods/reload-service-worker-fetch-event.html and navigation-api/navigation-methods/resources/fetch-event-test-worker.js; the report identifies both the insecure HTTP test URL and the invalid FetchEvent method. Rename the test with the .https.html suffix and restore event.respondWith(...) in the worker. Done means the test runs in a secure context and the fetch handler returns the expected reload navigation text.
Written by the indexing model from the issue text.
Description
navigation-api/navigation-methods/reload-service-worker-fetch-event.html registers a service worker with service_worker_unregister_and_register from /service-workers/service-worker/resources/test-helpers.sub.js. The file name has no .https flag, so the test is served from an http:// origin. That is not a secure context, navigator.serviceWorker is not exposed (it is [SecureContext]), and the test throws before the reload:
- Chrome:
TypeError: Cannot read properties of undefined (reading 'getRegistration') - Firefox:
TypeError: can't access property "getRegistration", navigator.serviceWorker is undefined - Safari:
TypeError: undefined is not an object (evaluating 'navigator.serviceWorker.getRegistration')
The result is 0/1 in all six wpt.fyi runs aligned at 71b58bb191. Stable: Chrome 158.0.8127.36 (run 5091530419994624), Firefox 160.0.1 (5102456061820928), Safari 27.2 (5121161130934272). Experimental: Chrome 160.0.8168.0 (5165587534446592), Firefox 162.0a1 (5188734707040256), Safari Technology Preview 256 (5096019650674688).
Renaming the file is not enough on its own. Its worker, navigation-api/navigation-methods/resources/fetch-event-test-worker.js, responds with
event.transitionWhile(new Response(body));
FetchEvent has no transitionWhile(). The line was event.respondWith(new Response(body)) until 93e7dda5c5 ("App history: rename respondWith() to transitionWhile()", 2021-08-18), which renamed this FetchEvent call along with the app history method. As it stands, the fetch handler throws and the request falls back to the network. The frame then shows the text of service-worker-page.html instead of "method = GET, isReloadNavigation = ...".
Suggested fix
- Rename the test to
reload-service-worker-fetch-event.https.html. - In
resources/fetch-event-test-worker.js, changeevent.transitionWhile(...)back toevent.respondWith(...).
- Dominant language
- HTML
- Stars
- 6.3k
- Forks
- 4.1k
- Avg merge
- 17h 20m
- Merged PRs (30d)
- 841
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from web-platform-tests/wpt
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
web-platform-tests/wpt#65844 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
web-platform-tests/wpt#65836 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
web-platform-tests/wpt#65831 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
web-platform-tests/wpt#65826 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
web-platform-tests/wpt#65823 ·
Maintainers usually reply within 1 day
All issues in web-platform-tests/wpt
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
enhancement good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
agent/scanner bug stage/010-actionable
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
torch-spyre/spyre-inference#1849 ·
Maintainers usually reply within 2 days
-
tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day