Take throw-on-dynamic-markup-insertion-counter into account when check script safety.

This commit is contained in:
Josh Matthews 2018-01-11 11:11:51 -05:00
parent 4593195b49
commit c55f25b3aa
3 changed files with 6 additions and 7 deletions

View file

@ -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,
}
}