From c55f25b3aaeea7719f0864b1e6c1e71af7f05340 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Thu, 11 Jan 2018 11:11:51 -0500 Subject: [PATCH] Take throw-on-dynamic-markup-insertion-counter into account when check script safety. --- components/script/dom/document.rs | 7 ++++++- .../custom-elements/microtasks-and-constructors.html.ini | 3 --- .../parser/parser-fallsback-to-unknown-element.html.ini | 3 --- 3 files changed, 6 insertions(+), 7 deletions(-) delete mode 100644 tests/wpt/metadata/custom-elements/microtasks-and-constructors.html.ini delete mode 100644 tests/wpt/metadata/custom-elements/parser/parser-fallsback-to-unknown-element.html.ini diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index bb1c4b53ff7..aecc0b0d0e7 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -1896,7 +1896,12 @@ impl Document { pub fn can_invoke_script(&self) -> bool { match self.get_current_parser() { - Some(parser) => parser.parser_is_not_active(), + Some(parser) => { + // It is safe to run script if the parser is not actively parsing, + // or if it is impossible to interact with the token stream. + parser.parser_is_not_active() || + self.throw_on_dynamic_markup_insertion_counter.get() > 0 + } None => true, } } diff --git a/tests/wpt/metadata/custom-elements/microtasks-and-constructors.html.ini b/tests/wpt/metadata/custom-elements/microtasks-and-constructors.html.ini deleted file mode 100644 index 22111c6cb3d..00000000000 --- a/tests/wpt/metadata/custom-elements/microtasks-and-constructors.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[microtasks-and-constructors.html] - expected: CRASH - bug: https://github.com/servo/servo/issues/19392 diff --git a/tests/wpt/metadata/custom-elements/parser/parser-fallsback-to-unknown-element.html.ini b/tests/wpt/metadata/custom-elements/parser/parser-fallsback-to-unknown-element.html.ini deleted file mode 100644 index 9f8fb480445..00000000000 --- a/tests/wpt/metadata/custom-elements/parser/parser-fallsback-to-unknown-element.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[parser-fallsback-to-unknown-element.html] - expected: CRASH - bug: https://github.com/servo/servo/issues/19392