From ca9cee084e5ee8282c5d074f763b23936efc394f Mon Sep 17 00:00:00 2001 From: Alan Jeffrey Date: Wed, 11 Jan 2017 12:57:08 -0600 Subject: [PATCH] Fix document.write check for activity. --- components/script/dom/document.rs | 3 +- components/script/script_thread.rs | 1 + tests/wpt/metadata/MANIFEST.json | 6 ++++ .../write-active-document.html.ini | 4 +++ .../document-write/empty.html | 1 + .../document-write/write-active-document.html | 35 +++++++++++++++++++ 6 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 tests/wpt/metadata/html/dom/dynamic-markup-insertion/document-write/write-active-document.html.ini create mode 100644 tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/empty.html create mode 100644 tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/write-active-document.html diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 10ce0f3bf28..3a96d369c23 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -3271,8 +3271,7 @@ impl DocumentMethods for Document { // Step 2. // TODO: handle throw-on-dynamic-markup-insertion counter. - // FIXME: this should check for being active rather than fully active - if !self.is_fully_active() { + if !self.is_active() { // Step 3. return Ok(()); } diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 44fc267b2bd..2bdb75a486f 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -1304,6 +1304,7 @@ impl ScriptThread { /// Handles activity change message fn handle_set_document_activity_msg(&self, id: PipelineId, activity: DocumentActivity) { + debug!("Setting activity of {} to be {:?}.", id, activity); let document = self.documents.borrow().find_document(id); if let Some(document) = document { document.set_activity(activity); diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 82c13ee87e5..51d045d6c52 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -45873,6 +45873,12 @@ "url": "/cssom/stylesheet-same-origin.sub.html" } ], + "html/dom/dynamic-markup-insertion/document-write/write-active-document.html": [ + { + "path": "html/dom/dynamic-markup-insertion/document-write/write-active-document.html", + "url": "/html/dom/dynamic-markup-insertion/document-write/write-active-document.html" + } + ], "html/semantics/embedded-content/the-iframe-element/iframe-synchronously-discard.html": [ { "path": "html/semantics/embedded-content/the-iframe-element/iframe-synchronously-discard.html", diff --git a/tests/wpt/metadata/html/dom/dynamic-markup-insertion/document-write/write-active-document.html.ini b/tests/wpt/metadata/html/dom/dynamic-markup-insertion/document-write/write-active-document.html.ini new file mode 100644 index 00000000000..09620a4a26b --- /dev/null +++ b/tests/wpt/metadata/html/dom/dynamic-markup-insertion/document-write/write-active-document.html.ini @@ -0,0 +1,4 @@ +[write-active-document.html] + type: testharness + [document.write only writes to active documents] + expected: FAIL diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/empty.html b/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/empty.html new file mode 100644 index 00000000000..0dc101b5335 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/empty.html @@ -0,0 +1 @@ + diff --git a/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/write-active-document.html b/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/write-active-document.html new file mode 100644 index 00000000000..6faffd81de4 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/dom/dynamic-markup-insertion/document-write/write-active-document.html @@ -0,0 +1,35 @@ + +document.write only writes to active documents + + +
+