mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Add a check for when the js execution stack is empty
This commit is contained in:
parent
87475b11d3
commit
43526c80bb
2 changed files with 10 additions and 1 deletions
|
@ -35,6 +35,12 @@ pub unsafe fn trace(tracer: *mut JSTracer) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_execution_stack_empty() -> bool {
|
||||||
|
STACK.with(|stack| {
|
||||||
|
stack.borrow().is_empty()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// RAII struct that pushes and pops entries from the script settings stack.
|
/// RAII struct that pushes and pops entries from the script settings stack.
|
||||||
pub struct AutoEntryScript {
|
pub struct AutoEntryScript {
|
||||||
global: DomRoot<GlobalScope>,
|
global: DomRoot<GlobalScope>,
|
||||||
|
|
|
@ -13,6 +13,7 @@ use dom::bindings::inheritance::Castable;
|
||||||
use dom::bindings::refcounted::Trusted;
|
use dom::bindings::refcounted::Trusted;
|
||||||
use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||||
use dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootedReference};
|
use dom::bindings::root::{Dom, DomRoot, MutNullableDom, RootedReference};
|
||||||
|
use dom::bindings::settings_stack::is_execution_stack_empty;
|
||||||
use dom::bindings::str::DOMString;
|
use dom::bindings::str::DOMString;
|
||||||
use dom::characterdata::CharacterData;
|
use dom::characterdata::CharacterData;
|
||||||
use dom::comment::Comment;
|
use dom::comment::Comment;
|
||||||
|
@ -1001,7 +1002,9 @@ fn create_element_for_token(
|
||||||
// Step 6.1.
|
// Step 6.1.
|
||||||
// TODO: handle throw-on-dynamic-markup-insertion counter.
|
// TODO: handle throw-on-dynamic-markup-insertion counter.
|
||||||
// Step 6.2
|
// Step 6.2
|
||||||
// TODO: If the JavaScript execution context stack is empty, then perform a microtask checkpoint.
|
if is_execution_stack_empty() {
|
||||||
|
document.window().upcast::<GlobalScope>().perform_a_microtask_checkpoint();
|
||||||
|
}
|
||||||
// Step 6.3
|
// Step 6.3
|
||||||
ScriptThread::push_new_element_queue()
|
ScriptThread::push_new_element_queue()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue