Repository navigation
Conversation
This adds tests that ensure that changes to the iframe sandbox attribute after a navigation starts do not affect the document which is loaded into the iframe. The value of the attribute should be snapshotted at the beginning of a navigation, to take effect when the navigation completes.
|
FYI, these are the current results in Chrome tip-of-tree and Firefox nightly 72.0a1 (haven't tried Safari yet; I don't have the WPT server running on my mac)
|
This adds an h1 element to the framed document which will read 'No scripts' if scripts are not allowed in the document, and 'Allows scripts' if they are.
|
@clelland you can view results on wpt.fyi (linked from e.g. the wpt.fyi - chrome[experimental] check). |
|
Ooh, thanks -- the |
|
So Safari appears to match Chrome's behaviour for |
|
I've added a separate set of tests for 'srcdoc' iframes. in those, Firefox passes all three, while Chrome is currently failing. |
|
@bzbarsky, can you take a look at these tests and see if they cover the relevant cases for sandbox timing? There's still the issue of having the navigation initiated by the framed document, while the attribute is changed by the parent, but that may be fundamentally racy when the two are in separate processes. Otherwise, I think these tests should cover most of the potential paths. |
bzbarsky
left a comment
There was a problem hiding this comment.
I'm sorry for the lag here. Two things:
-
Ideally we would test flags other than the allows-same-origin flag. I say this because for a while in Firefox that flag was captured at navigation start but the other flags were captured at new-document-creation time.
-
The test naming is a bit confusing, because these have nothing to do with the Navigation Timing spec. Might be better to call these sandbox-flag-timing or something?
| } catch (e) { | ||
| window.parent.postMessage("Sandboxed", "*"); | ||
| } | ||
| document.querySelector('h1').innerText = "Allows scripts" |
There was a problem hiding this comment.
Please use textContent instead of innerText? It's much more interoperable in terms of behavior....
Though I'm not sure why this line is here.
| </head> | ||
| <body> | ||
| <script> | ||
| const resourcePath = |
There was a problem hiding this comment.
I guess this works, but this might have been simpler:
const resourceURL = new URL("resources/", location);
and then later:
iframe.src = new URL("post-sandbox-state-to-parent.html", resourceURL);
or so. Similar elsewhere.
This adds tests that ensure that changes to the iframe sandbox
attribute after a navigation starts do not affect the document which
is loaded into the iframe. The value of the attribute should be
snapshotted at the beginning of a navigation, to take effect when
the navigation completes.