w3c / w3c/ServiceWorker

navigate() behavior in browsers for file:/// and mixed content does not match spec

Open
#1,500 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

TPAC2026
Dominant language
Bikeshed
Stars
3.6k
Forks
324
Avg merge
14d 22h
Merged PRs (30d)
1

Description

I was looking at the service-workers/service-worker/client-navigate.https.html test, and in particular the "Navigating to mixed-content iframe should reject with TypeError" subtest, and I don't think that test matches the spec. Mixed-content lods lead to a network error on the HTML/fetch level, and I don't see anything in the serviceworker spec that says to reject with TypeError when that happens. Am I just missing it?

Similar for the "invalid url (file:///)" test in service-workers/service-worker/windowclient-navigate.https.html: that's perfectly valid URL per the URL spec, gets blocked by some sort of browser-internal policy and should not lead to TypeErroras far as I can tell.

These tests pass in Firefox because in Firefox the navigation algorithm actually throws in these two cases (which is not HTML-spec-compliant) and the service worker spec says to convert exceptions from "navigate" into TypeError. I have no idea why these tests pass in Chrome, which does not throw from the location.href setter (which synchronously calls the navigation algorithm) in these two cases.

Anyway, either the spec needs to change here or the browsers and tests.

@wanderview @asutherland

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with service-workers/service-worker/client-navigate.https.html and its mixed-content iframe subtest, then inspect service-workers/service-worker/windowclient-navigate.https.html and the related specification algorithms. Compare Firefox and Chrome behavior for the two cases against the URL, HTML, and Service Worker specifications. Done means the spec, browser behavior, and tests have an agreed consistent interpretation.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript
Domain
testing-qa, web-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.