Auto merge of #21236 - emilio:mutation-observer, r=jdm

script: A couple mutation observer fixes.

I felt like doing Servo stuff while trying to catch Gecko intermittents :)

This fixes most of #21233. I haven't dug into the other test.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21236)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-07-23 13:33:45 -04:00 committed by GitHub
commit 41f9f85040
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 28 deletions

View file

@ -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();
}

View file

@ -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;
}
}
@ -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)

View file

@ -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

View file

@ -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