aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 9ab6fd301bc..a8b20b6cf98 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -481,6 +481,9 @@ pub struct ScriptThread {
microtask_queue: MicrotaskQueue,
+ /// Microtask Queue for adding support for mutation observer microtasks
+ mutation_observer_compound_microtask_queued: Cell<bool>,
+
/// The unit of related similar-origin browsing contexts' list of MutationObserver objects
mutation_observers: DOMRefCell<Vec<JS<MutationObserver>>>,
@@ -589,6 +592,20 @@ impl ScriptThread {
})
}
+ pub fn set_mutation_observer_compound_microtask_queued(value: bool) {
+ SCRIPT_THREAD_ROOT.with(|root| {
+ let script_thread = unsafe { &*root.get().unwrap() };
+ script_thread.mutation_observer_compound_microtask_queued.set(value);
+ })
+ }
+
+ pub fn is_mutation_observer_compound_microtask_queued() -> bool {
+ SCRIPT_THREAD_ROOT.with(|root| {
+ let script_thread = unsafe { &*root.get().unwrap() };
+ return script_thread.mutation_observer_compound_microtask_queued.get();
+ })
+ }
+
pub fn add_mutation_observer(observer: &MutationObserver) {
SCRIPT_THREAD_ROOT.with(|root| {
let script_thread = unsafe { &*root.get().unwrap() };
@@ -598,6 +615,13 @@ impl ScriptThread {
})
}
+ pub fn get_mutation_observers() -> Vec<Root<MutationObserver>> {
+ SCRIPT_THREAD_ROOT.with(|root| {
+ let script_thread = unsafe { &*root.get().unwrap() };
+ script_thread.mutation_observers.borrow().iter().map(|o| Root::from_ref(&**o)).collect()
+ })
+ }
+
pub fn mark_document_with_no_blocked_loads(doc: &Document) {
SCRIPT_THREAD_ROOT.with(|root| {
let script_thread = unsafe { &*root.get().unwrap() };
@@ -750,6 +774,8 @@ impl ScriptThread {
microtask_queue: MicrotaskQueue::default(),
+ mutation_observer_compound_microtask_queued: Default::default(),
+
mutation_observers: Default::default(),
layout_to_constellation_chan: state.layout_to_constellation_chan,