From 4c637e0601351c052d64c69ec4f806f05a832a80 Mon Sep 17 00:00:00 2001 From: Utsav Oza Date: Thu, 14 May 2020 19:55:37 +0530 Subject: [PATCH] Update wpt-tests metadata --- components/script/dom/document.rs | 7 +++++++ components/script/dom/htmlanchorelement.rs | 2 +- components/script/dom/windowproxy.rs | 10 ++++------ .../navigating-across-documents/010.html.ini | 4 ++++ .../urls/terminology-0/document-base-url.html.ini | 14 -------------- .../the-base-element/base_about_blank.html.ini | 5 ----- .../abort-while-navigating.window.js.ini | 5 ++++- 7 files changed, 20 insertions(+), 27 deletions(-) create mode 100644 tests/wpt/metadata/html/browsers/browsing-the-web/navigating-across-documents/010.html.ini delete mode 100644 tests/wpt/metadata/html/infrastructure/urls/terminology-0/document-base-url.html.ini delete mode 100644 tests/wpt/metadata/html/semantics/document-metadata/the-base-element/base_about_blank.html.ini diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index f548907d6a2..6f1656d1baf 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -579,6 +579,13 @@ impl Document { if let Some(browsing_context) = self.browsing_context() { // Step 1: If document is an iframe srcdoc document, then return the // document base URL of document's browsing context's container document. + let container_base_url = browsing_context + .parent() + .and_then(|parent| parent.document()) + .map(|document| document.base_url()); + if document_url.as_str() == "about:srcdoc" && container_base_url.is_some() { + return container_base_url.unwrap(); + } // Step 2: If document's URL is about:blank, and document's browsing // context's creator base URL is non-null, then return that creator base URL. diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index a0f939b93ad..f61d466afd5 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -637,7 +637,7 @@ pub fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option) { if let Some(suffix) = hyperlink_suffix { href.push_str(&suffix); } - let url = match document.url().join(&href) { + let url = match document.base_url().join(&href) { Ok(url) => url, Err(_) => return, }; diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs index ba2797f6183..9aac99dc447 100644 --- a/components/script/dom/windowproxy.rs +++ b/components/script/dom/windowproxy.rs @@ -731,12 +731,10 @@ impl CreatorBrowsingContextInfo { parent: Option<&WindowProxy>, opener: Option<&WindowProxy>, ) -> CreatorBrowsingContextInfo { - let creator = if parent.is_some() { - parent.unwrap().document() - } else if opener.is_some() { - opener.unwrap().document() - } else { - None + let creator = match (parent, opener) { + (Some(parent), _) => parent.document(), + (None, Some(opener)) => opener.document(), + (None, None) => None, }; let base_url = creator.as_deref().map(|document| document.base_url()); diff --git a/tests/wpt/metadata/html/browsers/browsing-the-web/navigating-across-documents/010.html.ini b/tests/wpt/metadata/html/browsers/browsing-the-web/navigating-across-documents/010.html.ini new file mode 100644 index 00000000000..cf12f241471 --- /dev/null +++ b/tests/wpt/metadata/html/browsers/browsing-the-web/navigating-across-documents/010.html.ini @@ -0,0 +1,4 @@ +[010.html] + type: testharness + [Link with onclick form submit to javascript url with delayed document.write and href navigation ] + expected: FAIL diff --git a/tests/wpt/metadata/html/infrastructure/urls/terminology-0/document-base-url.html.ini b/tests/wpt/metadata/html/infrastructure/urls/terminology-0/document-base-url.html.ini deleted file mode 100644 index 0fa40f12b6d..00000000000 --- a/tests/wpt/metadata/html/infrastructure/urls/terminology-0/document-base-url.html.ini +++ /dev/null @@ -1,14 +0,0 @@ -[document-base-url.html] - type: testharness - [The fallback base URL of a document whose address is about:blank is the document base URL of the creator document.] - expected: FAIL - - [The fallback base URL of an iframe srcdoc document is the document base URL of the document's browsing context's browsing context container's document.] - expected: FAIL - - [about:blank with a base element.] - expected: FAIL - - [The base URL of an iframe srcdoc document with a tag should be set by that tag.] - expected: FAIL - diff --git a/tests/wpt/metadata/html/semantics/document-metadata/the-base-element/base_about_blank.html.ini b/tests/wpt/metadata/html/semantics/document-metadata/the-base-element/base_about_blank.html.ini deleted file mode 100644 index 9cd58e4592f..00000000000 --- a/tests/wpt/metadata/html/semantics/document-metadata/the-base-element/base_about_blank.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[base_about_blank.html] - type: testharness - [base element in about:blank document should resolve against its fallback base URI] - expected: FAIL - diff --git a/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort-while-navigating.window.js.ini b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort-while-navigating.window.js.ini index eff2445da68..7f0d33cef2e 100644 --- a/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort-while-navigating.window.js.ini +++ b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/abort-while-navigating.window.js.ini @@ -1,7 +1,10 @@ [abort-while-navigating.window.html] expected: TIMEOUT [document.open() aborts documents that are navigating through iframe loading (XMLHttpRequest)] - expected: FAIL + expected: TIMEOUT + + [document.open() aborts documents that are navigating through iframe loading (fetch())] + expected: TIMEOUT [document.open() aborts documents that are navigating through Location (fetch())] expected: TIMEOUT