aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2018-01-11 11:11:51 -0500
committerJosh Matthews <josh@joshmatthews.net>2018-01-11 11:14:41 -0500
commitc55f25b3aaeea7719f0864b1e6c1e71af7f05340 (patch)
treeb9b8ed07b22a1758a3f61de784666b55d6176e21 /components/script/dom
parent4593195b493e819b56b8f34376b1058a80210c53 (diff)
downloadservo-c55f25b3aaeea7719f0864b1e6c1e71af7f05340.tar.gz
servo-c55f25b3aaeea7719f0864b1e6c1e71af7f05340.zip
Take throw-on-dynamic-markup-insertion-counter into account when check script safety.
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/document.rs7
1 files changed, 6 insertions, 1 deletions
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,
}
}