Closed Bug 1598278 Opened 6 years ago Closed 6 years ago

Service Workers can navigate out-of-scope clients

Categories

(Core :: DOM: Service Workers, defect, P2)

72 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla76
Tracking Status
firefox76 --- fixed

People

(Reporter: twiss, Assigned: twiss)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0

Steps to reproduce:

  1. Open https://out-of-scope-sw-navigation.glitch.me/test/
  2. In another tab, open https://out-of-scope-sw-navigation.glitch.me/
  3. In the first tab, click "Try to navigate"

This sends a request to the service worker (scoped to /test/) which then attempts to navigate the second client to /test/ as well.

Actual results:

The second tab is navigated. The service worker's console outputs:

[fetch event] https://out-of-scope-sw-navigation.glitch.me/test/navigate
scope: https://out-of-scope-sw-navigation.glitch.me/test/
controlled clients: Array [ WindowClient ]
all clients: Array [ WindowClient, WindowClient ]
navigated client to /test/

Expected results:

This navigation should not be allowed, as discussed in https://github.com/w3c/ServiceWorker/issues/752.

Priority: -- → P2

Unfortunately, some of the above web platform tests are currently broken (the "NOTRUN" ones). I've submitted a PR here: https://github.com/web-platform-tests/wpt/pull/22063.

With that PR and the above patch, Firefox passes all tests.

Assignee: nobody → d.huigens

Mark dependency on the WPT fix https://github.com/web-platform-tests/wpt/pull/22063 being synced to mozilla-central in bug 1619613.

Depends on: 1619613
Pushed by bugmail@asutherland.org: https://hg.mozilla.org/integration/autoland/rev/3a4dc0ad1266 Check that Service Worker controls client in navigate() r=asuth
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla76

Woo! Thanks so much for the fix!

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: