-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify a new document's URL #4205
Conversation
Yeah, I think that's correct. Note also that request can be null, e.g., for srcdoc, so that those wouldn't work universally anyway. @wanderview usually has good insights on this so copying to get this checked twice. |
I'm pretty sure we do not use the service worker final response URL for the document URL. This was explicitly designed to allow a separate "offline" page to be loaded by service worker without changing the URL bar. So I think its the second option, maybe? |
Oooh right, it was different for navigations, indeed. Thanks! So yeah, it's the final request URL, but that also means there needs to be accounting here for callers such as srcdoc (and |
I would expect the document URL to remain about:srcdoc, about:blank, javascript: etc when a service worker controller is inherited from the parent. |
@wanderview, do you know where the SW behavior is or should be tested? service-workers/service-worker/navigation-redirect.https.html looks like where I'd expect, but nothing there uses |
…14288) The resulting document's location should be the originally requested URL. See also whatwg/html#4205
I've updated the change to use the "request's current URL", and the SW implication is now tested. srcdocs seem to be covered by https://github.com/web-platform-tests/wpt/blob/master/html/browsers/history/the-location-interface/location_hash.html#L24. |
The behavior of |
The use of address here seems to have gone away in https://github.com/whatwg/html/pull/3946/files#diff-36cd38f49b9afa08222c0dc9ebfe35ebL82043, which led to @TimothyGu filing #3953, which this PR is trying to fix. :) |
Probably also related: web-platform-tests/wpt#14262 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a strict improvement to me from the current spec. @annevk, do you agree?
Yeah, thanks! |
Oh wait, upon re-reading I realized we didn't actually answer @jyasskin's question about javascript: URLs:
Based on the discussions in #1565 and https://bugzilla.mozilla.org/show_bug.cgi?id=1281375#c7 it sounds like Chrome's behavior is probably more web-compatible... Let's do that? |
The "URL that was originally to be fetched" isn't clear about which URL that actually is. The choices here are: * The request's URL: The original URL before any redirects. * The request's current URL: The final URL after any redirects, and treating a Service Worker's response as from that URL. * The response's URL: Either the final URL after any redirects, or, if a Service Worker intercepted the fetch and returned a response from a different URL, that different URL. Fixes whatwg#3953.
Per wanderview's comment. On a null request, I just fall back to the response's URL. I still haven't located or written web-platform-tests for this.
2ff5b2e
to
3bdd217
Compare
… a different URL, a=testonly Automatic update from web-platform-tests Test navigation when a SW replies with a fetch from a different URL (#14288) The resulting document's location should be the originally requested URL. See also whatwg/html#4205 -- wpt-commits: 38eec61c5e43b9757351d63c55205fa2d8d3bb2d wpt-pr: 14288
… a different URL, a=testonly Automatic update from web-platform-tests Test navigation when a SW replies with a fetch from a different URL (#14288) The resulting document's location should be the originally requested URL. See also whatwg/html#4205 -- wpt-commits: 38eec61c5e43b9757351d63c55205fa2d8d3bb2d wpt-pr: 14288
The document.URL should be about:blank. Follows whatwg/html#4205.
Commented at https://bugzilla.mozilla.org/show_bug.cgi?id=836567#c55. |
…ript:...">, a=testonly Automatic update from web-platform-tests Test document.URL of <iframe src="javascript:..."> The document.URL should be about:blank. Follows whatwg/html#4205. -- wpt-commits: ed74c4f67f0529a7439f7b656ef0a35049873b9e wpt-pr: 14316
…ript:...">, a=testonly Automatic update from web-platform-tests Test document.URL of <iframe src="javascript:..."> The document.URL should be about:blank. Follows whatwg/html#4205. -- wpt-commits: ed74c4f67f0529a7439f7b656ef0a35049873b9e wpt-pr: 14316
…ript:...">, a=testonly Automatic update from web-platform-tests Test document.URL of <iframe src="javascript:..."> The document.URL should be about:blank. Follows whatwg/html#4205. -- wpt-commits: ed74c4f67f0529a7439f7b656ef0a35049873b9e wpt-pr: 14316
…ript:...">, a=testonly Automatic update from web-platform-tests Test document.URL of <iframe src="javascript:..."> The document.URL should be about:blank. Follows whatwg/html#4205. -- wpt-commits: ed74c4f67f0529a7439f7b656ef0a35049873b9e wpt-pr: 14316
… a different URL, a=testonly Automatic update from web-platform-tests Test navigation when a SW replies with a fetch from a different URL (#14288) The resulting document's location should be the originally requested URL. See also whatwg/html#4205 -- wpt-commits: 38eec61c5e43b9757351d63c55205fa2d8d3bb2d wpt-pr: 14288 UltraBlame original commit: 44cd01e40fe7de4a055a200dcec4c7c40102dba7
… a different URL, a=testonly Automatic update from web-platform-tests Test navigation when a SW replies with a fetch from a different URL (#14288) The resulting document's location should be the originally requested URL. See also whatwg/html#4205 -- wpt-commits: 38eec61c5e43b9757351d63c55205fa2d8d3bb2d wpt-pr: 14288 UltraBlame original commit: 44cd01e40fe7de4a055a200dcec4c7c40102dba7
… a different URL, a=testonly Automatic update from web-platform-tests Test navigation when a SW replies with a fetch from a different URL (#14288) The resulting document's location should be the originally requested URL. See also whatwg/html#4205 -- wpt-commits: 38eec61c5e43b9757351d63c55205fa2d8d3bb2d wpt-pr: 14288 UltraBlame original commit: 44cd01e40fe7de4a055a200dcec4c7c40102dba7
…ript:...">, a=testonly Automatic update from web-platform-tests Test document.URL of <iframe src="javascript:..."> The document.URL should be about:blank. Follows whatwg/html#4205. -- wpt-commits: ed74c4f67f0529a7439f7b656ef0a35049873b9e wpt-pr: 14316 UltraBlame original commit: 5a41d52b6c385a2dfb4d9d50fb5023561363e824
…ript:...">, a=testonly Automatic update from web-platform-tests Test document.URL of <iframe src="javascript:..."> The document.URL should be about:blank. Follows whatwg/html#4205. -- wpt-commits: ed74c4f67f0529a7439f7b656ef0a35049873b9e wpt-pr: 14316 UltraBlame original commit: 6f5b6857d05659dddc0fa555824569fa4f5f52b5
…ript:...">, a=testonly Automatic update from web-platform-tests Test document.URL of <iframe src="javascript:..."> The document.URL should be about:blank. Follows whatwg/html#4205. -- wpt-commits: ed74c4f67f0529a7439f7b656ef0a35049873b9e wpt-pr: 14316 UltraBlame original commit: 5a41d52b6c385a2dfb4d9d50fb5023561363e824
…ript:...">, a=testonly Automatic update from web-platform-tests Test document.URL of <iframe src="javascript:..."> The document.URL should be about:blank. Follows whatwg/html#4205. -- wpt-commits: ed74c4f67f0529a7439f7b656ef0a35049873b9e wpt-pr: 14316 UltraBlame original commit: 6f5b6857d05659dddc0fa555824569fa4f5f52b5
…ript:...">, a=testonly Automatic update from web-platform-tests Test document.URL of <iframe src="javascript:..."> The document.URL should be about:blank. Follows whatwg/html#4205. -- wpt-commits: ed74c4f67f0529a7439f7b656ef0a35049873b9e wpt-pr: 14316 UltraBlame original commit: 5a41d52b6c385a2dfb4d9d50fb5023561363e824
…ript:...">, a=testonly Automatic update from web-platform-tests Test document.URL of <iframe src="javascript:..."> The document.URL should be about:blank. Follows whatwg/html#4205. -- wpt-commits: ed74c4f67f0529a7439f7b656ef0a35049873b9e wpt-pr: 14316 UltraBlame original commit: 6f5b6857d05659dddc0fa555824569fa4f5f52b5
The "URL that was originally to be fetched" isn't clear about which URL
that actually is.
I believe the reasonable choices here are the following, of which I'm guessing browsers do the third, but I'm not very confident I've got this right:
treating a Service Worker's response as from that URL.
Service Worker intercepted the fetch and returned a response from a
different URL, that different URL.
Fixes #3953.
I suspect this is tested in the Service Worker tests, but I haven't yet found the specific test. I'm sending this PR anyway in case you already know it is or isn't tested.
/browsing-the-web.html ( diff )
/infrastructure.html ( diff )