Auto merge of #27505 - utsavoza:ugo/issue-24718/05-08-2020, r=jdm

Do not load srcdoc iframes synchronously

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #24718
- [x] There are tests for these changes
This commit is contained in:
bors-servo 2020-08-10 16:41:59 -04:00 committed by GitHub
commit d028d71fe9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 20 deletions

View file

@ -1082,9 +1082,12 @@ where
let (event_loop, host) = match sandbox {
IFrameSandboxState::IFrameSandboxed => (None, None),
IFrameSandboxState::IFrameUnsandboxed => {
// If this is an about:blank load, it must share the creator's event loop.
// This must match the logic in the script thread when determining the proper origin.
if load_data.url.as_str() != "about:blank" {
// If this is an about:blank or about:srcdoc load, it must share the creator's
// event loop. This must match the logic in the script thread when determining
// the proper origin.
if load_data.url.as_str() != "about:blank" &&
load_data.url.as_str() != "about:srcdoc"
{
match reg_host(&load_data.url) {
None => (None, None),
Some(host) => {

View file

@ -248,7 +248,7 @@ impl HTMLIFrameElement {
load_data.srcdoc = String::from(element.get_string_attribute(&local_name!("srcdoc")));
self.navigate_or_reload_child_browsing_context(
load_data,
NavigationType::InitialAboutBlank,
NavigationType::Regular,
HistoryEntryReplacement::Disabled,
);
return;

View file

@ -1503,10 +1503,13 @@ impl ScriptThread {
ScriptThreadEventCategory::AttachLayout,
Some(pipeline_id),
|| {
// If this is an about:blank load, it must share the creator's origin.
// This must match the logic in the constellation when creating a new pipeline
let origin = if new_layout_info.load_data.url.as_str() != "about:blank"
{
// If this is an about:blank or about:srcdoc load, it must share the
// creator's origin. This must match the logic in the constellation
// when creating a new pipeline
let not_an_about_blank_and_about_srcdoc_load =
new_layout_info.load_data.url.as_str() != "about:blank" &&
new_layout_info.load_data.url.as_str() != "about:srcdoc";
let origin = if not_an_about_blank_and_about_srcdoc_load {
MutableOrigin::new(new_layout_info.load_data.url.origin())
} else if let Some(parent) =
new_layout_info.parent_info.and_then(|pipeline_id| {

View file

@ -0,0 +1,5 @@
[cookie-enabled-noncookie-frame.html]
expected: TIMEOUT
[navigator.cookieEnabled behavior on frames without cookie access]
expected: TIMEOUT

View file

@ -1,7 +0,0 @@
[perform-microtask-checkpoint-before-construction.html]
[HTML parser must perform a microtask checkpoint before constructing a custom element]
expected: FAIL
[HTML parser must perform a microtask checkpoint before constructing a custom element during the adoption agency algorithm]
expected: FAIL

View file

@ -1,4 +1,5 @@
[sandbox-disallow-scripts-via-unsandboxed-popup.tentative.html]
expected: ERROR
[Sandboxed => unsandboxed popup]
expected: FAIL
expected: TIMEOUT

View file

@ -1,3 +0,0 @@
[skip-not-fully-active.html]
[Autofocus element in not-fully-active document should be skipped while flusing.]
expected: FAIL

View file

@ -1,5 +1,9 @@
[sandboxed-iframe-with-opaque-origin.html]
type: testharness
expected: TIMEOUT
[Sandboxed iframe with opaque origin doesn't send referrers.]
expected: FAIL
expected: TIMEOUT
[Sandboxed iframe with tuple origin sends referrers.]
expected: TIMEOUT