aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/mutationobserver.rs
diff options
context:
space:
mode:
authorNupur Baghel <nupurbaghel@gmail.com>2018-02-14 02:11:58 +0530
committerNupur Baghel <nupurbaghel@gmail.com>2018-02-16 21:52:29 +0530
commita1fd6c39a213fbe50db4138304c8cccbfa196486 (patch)
tree299b2af4f9dbedda15844f4cd3a390db7820c3bc /components/script/dom/mutationobserver.rs
parent7945dff8ea18cd4084c1baa075d506837359ebe5 (diff)
downloadservo-a1fd6c39a213fbe50db4138304c8cccbfa196486.tar.gz
servo-a1fd6c39a213fbe50db4138304c8cccbfa196486.zip
Added extra bool in Window object to know about its Mutation Observers
Diffstat (limited to 'components/script/dom/mutationobserver.rs')
-rw-r--r--components/script/dom/mutationobserver.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/components/script/dom/mutationobserver.rs b/components/script/dom/mutationobserver.rs
index 5aee5adecd9..902f0dcce97 100644
--- a/components/script/dom/mutationobserver.rs
+++ b/components/script/dom/mutationobserver.rs
@@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationCallback;
use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverBinding::MutationObserverMethods;
use dom::bindings::codegen::Bindings::MutationObserverBinding::MutationObserverInit;
use dom::bindings::error::{Error, Fallible};
-use dom::bindings::reflector::{Reflector, reflect_dom_object};
+use dom::bindings::reflector::{Reflector, reflect_dom_object, DomObject};
use dom::bindings::root::DomRoot;
use dom::bindings::str::DOMString;
use dom::mutationrecord::MutationRecord;
@@ -67,6 +67,7 @@ impl MutationObserver {
}
pub fn Constructor(global: &Window, callback: Rc<MutationCallback>) -> Fallible<DomRoot<MutationObserver>> {
+ global.set_exists_mut_observer();
let observer = MutationObserver::new(global, callback);
ScriptThread::add_mutation_observer(&*observer);
Ok(observer)
@@ -105,6 +106,9 @@ impl MutationObserver {
/// <https://dom.spec.whatwg.org/#queueing-a-mutation-record>
pub fn queue_a_mutation_record(target: &Node, attr_type: Mutation) {
+ if !target.global().as_window().get_exists_mut_observer() {
+ return;
+ }
// Step 1
let mut interestedObservers: Vec<(DomRoot<MutationObserver>, Option<DOMString>)> = vec![];
// Step 2 & 3