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