Closed Bug 1727582 Opened 3 years ago Closed 3 years ago

client.url doesn't update on URL change

Categories

(Core :: DOM: Service Workers, defect)

Firefox 91
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: kolesker, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36

Steps to reproduce:

Pre-requisite: Install a Service Worker.

  1. Open a tab of your web app
  2. Change the URL by history.push() or history.replace().
  3. From the Service Worker, run (I'm actually running it on 'notificationclick' event):
    a. const clients = self.clients.matchAll({ type: 'window', includeUncontrolled: true });

Actual results:

You will find a client and "clients[0].url" will have a stale URL, which is the one when you landed on the tab, but it will never update when you navigate with history.push() or history.replace().

Expected results:

clients[0].url should update when navigating on the web app which is a Service Worker WindowClient. So client.url should be up to date when requesting self.clients.matchAll().
This is used to focus to existing tab or open a new one on notification click.

Component: Untriaged → DOM: Service Workers
Product: Firefox → Core

The client URL is specified to be the creation URL as defined in the HTML spec, noting that there are implementation consistency issues as documented at https://github.com/w3c/ServiceWorker/issues/1515 and that the general use-case you're describing for being able to reuse open tabs also has some discussion at https://github.com/w3c/ServiceWorker/issues/1475 as once can imagine there's also potentially relevant state that may not be fully represented in the URI.

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.