Re: [w3c/ServiceWorker] OpenWindow lacks either sourceDocument or userInvolvement argument when running Navigate algorithm (Issue #1776)

domenic left a comment (w3c/ServiceWorker#1776)

Yeah, this is a recent change, and I agree we didn't think there were any other cases where navigation happened without a source document.

Here is an audit of the places that in HTML depend on the assumption no sourceDocument <-> "browser UI":

- navigate step 5 and 6
  - What happens if you do `openWindow("javascript:...")` from a service worker? Should we carry over the origin or not?
  - It doesn't matter, since the fresh window has an opaque origin anyway. So we can relax the assumption here.
- navigate step 21
  - This takes care of firing the navigate event, which is also inapplicable to fresh windows.
  - So we just would need to fix the "null pointer reference" that would occur when referencing sourceDocument.
- snapshot source snapshot params
  - This sets "has transient activation" to true on the basis that it's user-initiated. We would probably need to set it to false.
  - This sets fetch client to null. Should it instead be the service worker?
- create navigation params by fetching
  - This sets the request's origin, service-workers mode, and referrer to values that are appropriate for browser UI navigations
  - Are these values correct for `openWindow()`? E.g. do we send a referrer header?

I think @annevk might have similar considerations for declarative web push?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1776#issuecomment-2942390143
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/ServiceWorker/issues/1776/2942390143@github.com>

Received on Thursday, 5 June 2025 01:19:31 UTC