From e4f978e2155dc31118be5562e135f004de5397f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 23 Jul 2018 19:06:22 +0200 Subject: [PATCH 1/3] script: Queue a mutation record from CharacterData::append_data. --- components/script/dom/characterdata.rs | 1 + .../nodes/MutationObserver-characterData.html.ini | 12 ------------ 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 tests/wpt/metadata/dom/nodes/MutationObserver-characterData.html.ini diff --git a/components/script/dom/characterdata.rs b/components/script/dom/characterdata.rs index ade189739c3..2d6bfbb706f 100644 --- a/components/script/dom/characterdata.rs +++ b/components/script/dom/characterdata.rs @@ -64,6 +64,7 @@ impl CharacterData { #[inline] pub fn append_data(&self, data: &str) { + self.queue_mutation_record(); self.data.borrow_mut().push_str(data); self.content_changed(); } diff --git a/tests/wpt/metadata/dom/nodes/MutationObserver-characterData.html.ini b/tests/wpt/metadata/dom/nodes/MutationObserver-characterData.html.ini deleted file mode 100644 index 9a4b39b2421..00000000000 --- a/tests/wpt/metadata/dom/nodes/MutationObserver-characterData.html.ini +++ /dev/null @@ -1,12 +0,0 @@ -[MutationObserver-characterData.html] - type: testharness - expected: TIMEOUT - [characterData Text.appendData: simple mutation] - expected: TIMEOUT - - [characterData Text.appendData: empty string mutation] - expected: TIMEOUT - - [characterData Text.appendData: null string mutation] - expected: TIMEOUT - From 073629076f9268f8c8a4aa1e1ad1ca656ba18e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 23 Jul 2018 19:16:13 +0200 Subject: [PATCH 2/3] script: Avoid useless string clones in mutation observer stuff. --- components/script/dom/mutationobserver.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/script/dom/mutationobserver.rs b/components/script/dom/mutationobserver.rs index d0dc201f12e..ff01ce96ba9 100644 --- a/components/script/dom/mutationobserver.rs +++ b/components/script/dom/mutationobserver.rs @@ -184,7 +184,7 @@ impl MutationObserver { } // Step 4 - for &(ref observer, ref paired_string) in &interested_observers { + for (observer, paired_string) in interested_observers { // Steps 4.1-4.7 let record = match attr_type { Mutation::Attribute { ref name, ref namespace, .. } => { @@ -193,10 +193,10 @@ impl MutationObserver { } else { None }; - MutationRecord::attribute_mutated(target, name, namespace, paired_string.clone()) + MutationRecord::attribute_mutated(target, name, namespace, paired_string) }, Mutation::CharacterData { .. } => { - MutationRecord::character_data_mutated(target, paired_string.clone()) + MutationRecord::character_data_mutated(target, paired_string) } Mutation::ChildList { ref added, ref removed, ref next, ref prev } => { MutationRecord::child_list_mutated(target, *added, *removed, *next, *prev) From 39e647de06b3d2c15f1fc99388a56972c7ae6883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 23 Jul 2018 19:28:01 +0200 Subject: [PATCH 3/3] script: Fix the logic for mutation observer attributes. --- components/script/dom/mutationobserver.rs | 4 ++-- .../dom/nodes/MutationObserver-attributes.html.ini | 11 ----------- 2 files changed, 2 insertions(+), 13 deletions(-) delete mode 100644 tests/wpt/metadata/dom/nodes/MutationObserver-attributes.html.ini diff --git a/components/script/dom/mutationobserver.rs b/components/script/dom/mutationobserver.rs index ff01ce96ba9..65f8081c900 100644 --- a/components/script/dom/mutationobserver.rs +++ b/components/script/dom/mutationobserver.rs @@ -132,8 +132,8 @@ impl MutationObserver { if *namespace != ns!() { continue; } - if registered.options.attribute_filter.iter() - .find(|s| &**s == &**name).is_some() { + if !registered.options.attribute_filter.iter() + .any(|s| &**s == &**name) { continue; } } diff --git a/tests/wpt/metadata/dom/nodes/MutationObserver-attributes.html.ini b/tests/wpt/metadata/dom/nodes/MutationObserver-attributes.html.ini deleted file mode 100644 index 3adb1f43ffa..00000000000 --- a/tests/wpt/metadata/dom/nodes/MutationObserver-attributes.html.ini +++ /dev/null @@ -1,11 +0,0 @@ -[MutationObserver-attributes.html] - type: testharness - [attributes/attributeFilter Element.id/Element.className: update mutation] - expected: FAIL - - [attributes/attributeFilter Element.id/Element.className: multiple filter update mutation] - expected: FAIL - - [attributeFilter alone Element.id/Element.className: multiple filter update mutation] - expected: FAIL -