Add microtask checkpoints on </script> and CE construct

This commit is contained in:
Patrick Shaughnessy 2020-01-13 18:32:16 -05:00
parent 2373769e76
commit c725f9e84d
6 changed files with 37 additions and 31 deletions

View file

@ -558,6 +558,19 @@ impl ServoParser {
Err(script) => script,
};
// https://html.spec.whatwg.org/multipage/#parsing-main-incdata
// branch "An end tag whose tag name is "script"
// The spec says to perform the microtask checkpoint before
// setting the insertion mode back from Text, but this is not
// possible with the way servo and html5ever currently
// relate to each other, and hopefully it is not observable.
if is_execution_stack_empty() {
self.document
.window()
.upcast::<GlobalScope>()
.perform_a_microtask_checkpoint();
}
let script_nesting_level = self.script_nesting_level.get();
self.script_nesting_level.set(script_nesting_level + 1);