-
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
What to do with non-srcdoc about:srcdoc documents #9514
Comments
Just to make sure we're on the same page, the difference here would be that the referrer for requests made inside of non-srcdoc Chrome seems to do (1) not just for I'm personally a fan of (1); the distinction between |
Right.
This code doesn't seem to copy over the "is srcdoc document" bit from what I can see. But, I guess if it works, including across browsers, then we should be good! I'd be happy with (1) then. We should write WPTs for the referrer determination in both the document.open() and javascript: URL cases. And ideally we'd run those tests against a Chromium version that removes |
It'd be good to run those WPTs in cases involving |
Yeah, just for completeness I think how this works is: (1) blink::Document gets its bit from the document initializer here, and (2) the initializer gets its bit from the loader, and (3) the loader gets its bit from whether the actual URL that the new URL has is simply I'll work on web platform tests and a spec change, and look into modifying the Chromium implementation. |
I've posted https://chromium-review.googlesource.com/c/chromium/src/+/4690242 for the basic tests, but I'm really running into trouble with
In the latter case, Safari's console error message just thinks that the iframe is sandboxed for some reason. So maybe it's not possible to end up with an |
This CL adds WPTs for some observable behavior (request referrer string resolution) defined for "about:srcdoc" documents, and ensures that the behavior is consistent between normal srcdoc documents and what I'm calling nontraditional srdoc documents, which are those created via: 1. `document.open()` 2. `javascript:` URL navigations See whatwg/html#9514. R=domenic@chromium.org Bug: N/A Change-Id: I62939511995f929f0ad4ce8c121172b1194e2b2e
I just learned about https://html.spec.whatwg.org/#can-have-its-url-rewritten-dev, which seems to explain this. Well, at least the algorithm does. I suppose this table could use more |
Hmm, actually it appears that Safari correctly allows hash mutations to srcdoc documents via Chrome incorrectly disallows this because of this code it seems. |
This CL adds WPTs for some observable behavior (request referrer string resolution) defined for "about:srcdoc" documents, and ensures that the behavior is consistent between normal srcdoc documents and what I'm calling nontraditional srdoc documents, which are those created via: 1. `document.open()` 2. `javascript:` URL navigations See whatwg/html#9514. R=domenic@chromium.org Bug: N/A Change-Id: I62939511995f929f0ad4ce8c121172b1194e2b2e
This CL adds WPTs for some observable behavior (request referrer string resolution) defined for "about:srcdoc" documents, and ensures that the behavior is consistent between normal srcdoc documents and what I'm calling nontraditional srdoc documents, which are those created via: 1. `document.open()` 2. `javascript:` URL navigations Additionally, this CL tests the scenario where we run: `history.replaceState(null, '', 'about:srcdoc#foo')` ... inside the about:srcdoc iframe to give it the above URL. We then re-run the referrer resolution test to ensure the `about:srcdoc#foo` is treated as a normal `about:srcdoc` iframe. Chromium fails that last part due to a bug in `blink::CanChangeToUrlForHistoryApi` causing the implementation to deviate from the spec. See whatwg/html#9514. R=domenic@chromium.org Bug: N/A Change-Id: I62939511995f929f0ad4ce8c121172b1194e2b2e
I've updated the tests in web-platform-tests/wpt#41066 to test the Now for the spec change to actually close this issue out, I'm thinking we can:
This will leave us with three related concepts:
I'll start down this route. Footnotes
|
This CL adds WPTs for some observable behavior (request referrer string resolution) defined for "about:srcdoc" documents, and ensures that the behavior is consistent between normal srcdoc documents and what I'm calling nontraditional srdoc documents, which are those created via: 1. `document.open()` 2. `javascript:` URL navigations Additionally, this CL tests the scenario where we run: `history.replaceState(null, '', 'about:srcdoc#foo')` ... inside the about:srcdoc iframe to give it the above URL. We then re-run the referrer resolution test to ensure the `about:srcdoc#foo` is treated as a normal `about:srcdoc` iframe. Chromium fails that last part due to a bug in `blink::CanChangeToUrlForHistoryApi` causing the implementation to deviate from the spec; see https://crbug.com/1465972. See whatwg/html#9514. R=domenic@chromium.org Bug: 1465972 Change-Id: I62939511995f929f0ad4ce8c121172b1194e2b2e
This CL adds WPTs for some observable behavior (request referrer string resolution) defined for "about:srcdoc" documents, and ensures that the behavior is consistent between normal srcdoc documents and what I'm calling nontraditional srdoc documents, which are those created via: 1. `document.open()` 2. `javascript:` URL navigations Additionally, this CL tests the scenario where we run: `history.replaceState(null, '', 'about:srcdoc#foo')` ... inside the about:srcdoc iframe to give it the above URL. We then re-run the referrer resolution test to ensure the `about:srcdoc#foo` is treated as a normal `about:srcdoc` iframe. Chromium fails that last part due to a bug in `blink::CanChangeToUrlForHistoryApi` causing the implementation to deviate from the spec; see https://crbug.com/1465972. See whatwg/html#9514. R=domenic@chromium.org Bug: 1465972 Change-Id: I62939511995f929f0ad4ce8c121172b1194e2b2e
This CL adds WPTs for some observable behavior (request referrer string resolution) defined for "about:srcdoc" documents, and ensures that the behavior is consistent between normal srcdoc documents and what I'm calling nontraditional srdoc documents, which are those created via: 1. `document.open()` 2. `javascript:` URL navigations Additionally, this CL tests the scenario where we run: `history.replaceState(null, '', 'about:srcdoc#foo')` ... inside the about:srcdoc iframe to give it the above URL. We then re-run the referrer resolution test to ensure the `about:srcdoc#foo` is treated as a normal `about:srcdoc` iframe. Chromium fails that last part due to a bug in `blink::CanChangeToUrlForHistoryApi` causing the implementation to deviate from the spec; see https://crbug.com/1465972. See whatwg/html#9514. R=domenic@chromium.org Bug: 1465972 Change-Id: I62939511995f929f0ad4ce8c121172b1194e2b2e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4690242 Reviewed-by: Domenic Denicola <domenic@chromium.org> Commit-Queue: Dominic Farolino <dom@chromium.org> Cr-Commit-Position: refs/heads/main@{#1172365}
This CL adds WPTs for some observable behavior (request referrer string resolution) defined for "about:srcdoc" documents, and ensures that the behavior is consistent between normal srcdoc documents and what I'm calling nontraditional srdoc documents, which are those created via: 1. `document.open()` 2. `javascript:` URL navigations Additionally, this CL tests the scenario where we run: `history.replaceState(null, '', 'about:srcdoc#foo')` ... inside the about:srcdoc iframe to give it the above URL. We then re-run the referrer resolution test to ensure the `about:srcdoc#foo` is treated as a normal `about:srcdoc` iframe. Chromium fails that last part due to a bug in `blink::CanChangeToUrlForHistoryApi` causing the implementation to deviate from the spec; see https://crbug.com/1465972. See whatwg/html#9514. R=domenic@chromium.org Bug: 1465972 Change-Id: I62939511995f929f0ad4ce8c121172b1194e2b2e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4690242 Reviewed-by: Domenic Denicola <domenic@chromium.org> Commit-Queue: Dominic Farolino <dom@chromium.org> Cr-Commit-Position: refs/heads/main@{#1172365}
This CL adds WPTs for some observable behavior (request referrer string resolution) defined for "about:srcdoc" documents, and ensures that the behavior is consistent between normal srcdoc documents and what I'm calling nontraditional srdoc documents, which are those created via: 1. `document.open()` 2. `javascript:` URL navigations Additionally, this CL tests the scenario where we run: `history.replaceState(null, '', 'about:srcdoc#foo')` ... inside the about:srcdoc iframe to give it the above URL. We then re-run the referrer resolution test to ensure the `about:srcdoc#foo` is treated as a normal `about:srcdoc` iframe. Chromium fails that last part due to a bug in `blink::CanChangeToUrlForHistoryApi` causing the implementation to deviate from the spec; see https://crbug.com/1465972. See whatwg/html#9514. R=domenic@chromium.org Bug: 1465972 Change-Id: I62939511995f929f0ad4ce8c121172b1194e2b2e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4690242 Reviewed-by: Domenic Denicola <domenic@chromium.org> Commit-Queue: Dominic Farolino <dom@chromium.org> Cr-Commit-Position: refs/heads/main@{#1172365}
FYI I think you'd be able to do |
Previously, the standard defined "an iframe srcdoc document" as being solely constructed from the contents of an iframe's srcdoc content attribute. However, it is possible to create documents that are not created in such a way, but do have a URL of about:srcdoc (or about:srcdoc#foo), using document.open() and javascript: URL navigation. Remove the distinction between such nontraditional srcdoc documents and the classic "iframe srcdoc documents" by introducing the "matches about:srcdoc" concept for URLs, and defining "an iframe srcdoc document" as a thin alias over this concept. This proposal was described by #9514 (comment). This matches observed browser behavior, for referrer calculation (the only post-parsing case that is impacted by the "an iframe srcdoc document" concept). Additionally, this new concept ensures that about:srcdoc#foo documents (e.g., created via history.replaceState(null, '', 'about:srcdoc#foo')) are also counted as normal srcdoc documents. Fixes #9514.
… WPTs, a=testonly Automatic update from web-platform-tests Navigation: non-traditional about:srcdoc WPTs This CL adds WPTs for some observable behavior (request referrer string resolution) defined for "about:srcdoc" documents, and ensures that the behavior is consistent between normal srcdoc documents and what I'm calling nontraditional srdoc documents, which are those created via: 1. `document.open()` 2. `javascript:` URL navigations Additionally, this CL tests the scenario where we run: `history.replaceState(null, '', 'about:srcdoc#foo')` ... inside the about:srcdoc iframe to give it the above URL. We then re-run the referrer resolution test to ensure the `about:srcdoc#foo` is treated as a normal `about:srcdoc` iframe. Chromium fails that last part due to a bug in `blink::CanChangeToUrlForHistoryApi` causing the implementation to deviate from the spec; see https://crbug.com/1465972. See whatwg/html#9514. R=domenic@chromium.org Bug: 1465972 Change-Id: I62939511995f929f0ad4ce8c121172b1194e2b2e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4690242 Reviewed-by: Domenic Denicola <domenic@chromium.org> Commit-Queue: Dominic Farolino <dom@chromium.org> Cr-Commit-Position: refs/heads/main@{#1172365} -- wpt-commits: 3dd382a8af6772e198c1b34d6af8d227559923e1 wpt-pr: 41066
… WPTs, a=testonly Automatic update from web-platform-tests Navigation: non-traditional about:srcdoc WPTs This CL adds WPTs for some observable behavior (request referrer string resolution) defined for "about:srcdoc" documents, and ensures that the behavior is consistent between normal srcdoc documents and what I'm calling nontraditional srdoc documents, which are those created via: 1. `document.open()` 2. `javascript:` URL navigations Additionally, this CL tests the scenario where we run: `history.replaceState(null, '', 'about:srcdoc#foo')` ... inside the about:srcdoc iframe to give it the above URL. We then re-run the referrer resolution test to ensure the `about:srcdoc#foo` is treated as a normal `about:srcdoc` iframe. Chromium fails that last part due to a bug in `blink::CanChangeToUrlForHistoryApi` causing the implementation to deviate from the spec; see https://crbug.com/1465972. See whatwg/html#9514. R=domenicchromium.org Bug: 1465972 Change-Id: I62939511995f929f0ad4ce8c121172b1194e2b2e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4690242 Reviewed-by: Domenic Denicola <domenicchromium.org> Commit-Queue: Dominic Farolino <domchromium.org> Cr-Commit-Position: refs/heads/main{#1172365} -- wpt-commits: 3dd382a8af6772e198c1b34d6af8d227559923e1 wpt-pr: 41066 UltraBlame original commit: 610d1fdecf942587602f71a4b956cfdad3b89c2b
… WPTs, a=testonly Automatic update from web-platform-tests Navigation: non-traditional about:srcdoc WPTs This CL adds WPTs for some observable behavior (request referrer string resolution) defined for "about:srcdoc" documents, and ensures that the behavior is consistent between normal srcdoc documents and what I'm calling nontraditional srdoc documents, which are those created via: 1. `document.open()` 2. `javascript:` URL navigations Additionally, this CL tests the scenario where we run: `history.replaceState(null, '', 'about:srcdoc#foo')` ... inside the about:srcdoc iframe to give it the above URL. We then re-run the referrer resolution test to ensure the `about:srcdoc#foo` is treated as a normal `about:srcdoc` iframe. Chromium fails that last part due to a bug in `blink::CanChangeToUrlForHistoryApi` causing the implementation to deviate from the spec; see https://crbug.com/1465972. See whatwg/html#9514. R=domenicchromium.org Bug: 1465972 Change-Id: I62939511995f929f0ad4ce8c121172b1194e2b2e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4690242 Reviewed-by: Domenic Denicola <domenicchromium.org> Commit-Queue: Dominic Farolino <domchromium.org> Cr-Commit-Position: refs/heads/main{#1172365} -- wpt-commits: 3dd382a8af6772e198c1b34d6af8d227559923e1 wpt-pr: 41066 UltraBlame original commit: 610d1fdecf942587602f71a4b956cfdad3b89c2b
… WPTs, a=testonly Automatic update from web-platform-tests Navigation: non-traditional about:srcdoc WPTs This CL adds WPTs for some observable behavior (request referrer string resolution) defined for "about:srcdoc" documents, and ensures that the behavior is consistent between normal srcdoc documents and what I'm calling nontraditional srdoc documents, which are those created via: 1. `document.open()` 2. `javascript:` URL navigations Additionally, this CL tests the scenario where we run: `history.replaceState(null, '', 'about:srcdoc#foo')` ... inside the about:srcdoc iframe to give it the above URL. We then re-run the referrer resolution test to ensure the `about:srcdoc#foo` is treated as a normal `about:srcdoc` iframe. Chromium fails that last part due to a bug in `blink::CanChangeToUrlForHistoryApi` causing the implementation to deviate from the spec; see https://crbug.com/1465972. See whatwg/html#9514. R=domenicchromium.org Bug: 1465972 Change-Id: I62939511995f929f0ad4ce8c121172b1194e2b2e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4690242 Reviewed-by: Domenic Denicola <domenicchromium.org> Commit-Queue: Dominic Farolino <domchromium.org> Cr-Commit-Position: refs/heads/main{#1172365} -- wpt-commits: 3dd382a8af6772e198c1b34d6af8d227559923e1 wpt-pr: 41066 UltraBlame original commit: 610d1fdecf942587602f71a4b956cfdad3b89c2b
… WPTs, a=testonly Automatic update from web-platform-tests Navigation: non-traditional about:srcdoc WPTs This CL adds WPTs for some observable behavior (request referrer string resolution) defined for "about:srcdoc" documents, and ensures that the behavior is consistent between normal srcdoc documents and what I'm calling nontraditional srdoc documents, which are those created via: 1. `document.open()` 2. `javascript:` URL navigations Additionally, this CL tests the scenario where we run: `history.replaceState(null, '', 'about:srcdoc#foo')` ... inside the about:srcdoc iframe to give it the above URL. We then re-run the referrer resolution test to ensure the `about:srcdoc#foo` is treated as a normal `about:srcdoc` iframe. Chromium fails that last part due to a bug in `blink::CanChangeToUrlForHistoryApi` causing the implementation to deviate from the spec; see https://crbug.com/1465972. See whatwg/html#9514. R=domenic@chromium.org Bug: 1465972 Change-Id: I62939511995f929f0ad4ce8c121172b1194e2b2e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4690242 Reviewed-by: Domenic Denicola <domenic@chromium.org> Commit-Queue: Dominic Farolino <dom@chromium.org> Cr-Commit-Position: refs/heads/main@{#1172365} -- wpt-commits: 3dd382a8af6772e198c1b34d6af8d227559923e1 wpt-pr: 41066
Continued from #3989. In that issue, it was noted that you can use
document.open()
to create a document whose URL isabout:srcdoc
, but is not an iframe srcdoc document. (Becausedocument.open()
will setdocument
's URL to the entry global's document's URL.)I think it might also be possible to do this with
javascript:
URL navigation, starting with a srcdoc document and then replacing it with a new non-srcdoc document, that keeps the about:srcdoc URL.I think we have three options here:
Redefine "an iframe srcdoc document" to be "has a URL that matches about:srcdoc", so we don't have two slightly-different concepts. This is not a big change, from what I can tell:
Prevent these scenarios from arising, e.g. by making document.open() skip the URL-change step if it would change the URL to one that matches about:srcdoc, and preventing navigation to javascript: URLs from srcdoc documents.
Accept that this is fine.
Note that Blink seems to do something similar to (1) already: https://source.chromium.org/chromium/chromium/src/+/refs/heads/main:third_party/blink/renderer/core/dom/document.cc;l=3346;drc=1b9ee37d9e583adb8b4f492115bdb8fd268e8188;bpv=1;bpt=1 although it only handles the
document.open()
case, not thejavascript:
URL case.The text was updated successfully, but these errors were encountered: