diff options
author | CYBAI <cyb.ai.815@gmail.com> | 2018-05-07 20:36:18 +0800 |
---|---|---|
committer | CYBAI <cyb.ai.815@gmail.com> | 2018-10-18 19:13:22 +0800 |
commit | 924a78c6c678e9448df9983bb370ff40910465bd (patch) | |
tree | 75cf0eaf67c0894536e2a54ce33b3469cf5931ba /components/script/microtask.rs | |
parent | 8b2892113693e6d2eddfc29dd49bbf7d54954912 (diff) | |
download | servo-924a78c6c678e9448df9983bb370ff40910465bd.tar.gz servo-924a78c6c678e9448df9983bb370ff40910465bd.zip |
Implement unhandledrejection event
Diffstat (limited to 'components/script/microtask.rs')
-rw-r--r-- | components/script/microtask.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/components/script/microtask.rs b/components/script/microtask.rs index a4221dd92dc..1a707d8fc3f 100644 --- a/components/script/microtask.rs +++ b/components/script/microtask.rs @@ -15,6 +15,7 @@ use dom::htmlimageelement::ImageElementMicrotask; use dom::htmlmediaelement::MediaElementMicrotask; use dom::mutationobserver::MutationObserver; use msg::constellation_msg::PipelineId; +use script_runtime::notify_about_rejected_promises; use script_thread::ScriptThread; use std::cell::Cell; use std::mem; @@ -59,7 +60,7 @@ impl MicrotaskQueue { /// <https://html.spec.whatwg.org/multipage/#perform-a-microtask-checkpoint> /// Perform a microtask checkpoint, executing all queued microtasks until the queue is empty. - pub fn checkpoint<F>(&self, target_provider: F) + pub fn checkpoint<F>(&self, target_provider: F, globalscopes: Vec<DomRoot<GlobalScope>>) where F: Fn(PipelineId) -> Option<DomRoot<GlobalScope>>, { @@ -70,7 +71,7 @@ impl MicrotaskQueue { // Step 1 self.performing_a_microtask_checkpoint.set(true); - // Steps 2-7 + // Steps 2 while !self.microtask_queue.borrow().is_empty() { rooted_vec!(let mut pending_queue); mem::swap(&mut *pending_queue, &mut *self.microtask_queue.borrow_mut()); @@ -98,9 +99,14 @@ impl MicrotaskQueue { } } - //TODO: Step 8 - notify about rejected promises + // Step 3 + for global in globalscopes.into_iter() { + notify_about_rejected_promises(&global); + } + + // TODO: Step 4 - Cleanup Indexed Database transactions. - // Step 9 + // Step 5 self.performing_a_microtask_checkpoint.set(false); } } |