Fix adopted and connected callback reactions

This commit is contained in:
Connor Brewster 2017-07-18 10:06:10 -06:00
parent 77efab8a9e
commit 9ecb931c5e
7 changed files with 16 additions and 92 deletions

View file

@ -1422,13 +1422,12 @@ impl Node {
for descendant in node.traverse_preorder() {
descendant.set_owner_doc(document);
}
for descendant in node.traverse_preorder() {
for descendant in node.traverse_preorder().filter_map(|d| d.as_custom_element()) {
// Step 3.2.
if let Some(element) = node.as_custom_element() {
ScriptThread::enqueue_callback_reaction(&*element,
CallbackReaction::Adopted(old_doc.clone(), Root::from_ref(document)));
}
ScriptThread::enqueue_callback_reaction(&*descendant,
CallbackReaction::Adopted(old_doc.clone(), Root::from_ref(document)));
}
for descendant in node.traverse_preorder() {
// Step 3.3.
vtable_for(&descendant).adopting_steps(&old_doc);
}
@ -1636,9 +1635,17 @@ impl Node {
for kid in new_nodes {
// Step 7.1.
parent.add_child(*kid, child);
// Step 7.2: insertion steps.
if let Some(element) = kid.as_custom_element() {
ScriptThread::enqueue_callback_reaction(&*element, CallbackReaction::Connected);
// Step 7.7.
for descendant in kid.traverse_preorder().filter_map(Root::downcast::<Element>) {
// Step 7.7.2.
if descendant.is_connected() {
// Step 7.7.2.1.
if descendant.get_custom_element_definition().is_some() {
ScriptThread::enqueue_callback_reaction(&*descendant, CallbackReaction::Connected);
}
// TODO: Step 7.7.2.2.
// Try to upgrade descendant.
}
}
}
if let SuppressObserver::Unsuppressed = suppress_observers {

View file

@ -1,11 +1,5 @@
[adopted-callback.html]
type: testharness
[Inserting an ancestor of custom element into the document of the template elements must enqueue and invoke adoptedCallback]
expected: FAIL
[Moving an ancestor of custom element from the owner document into the document of the template elements must enqueue and invoke adoptedCallback]
expected: FAIL
[Inserting a custom element into a shadow tree in the document of the template elements must enqueue and invoke adoptedCallback]
expected: FAIL
@ -18,12 +12,6 @@
[Inserting a custom element into a detached shadow tree that belongs to the document of the template elements must enqueue and invoke adoptedCallback]
expected: FAIL
[Inserting an ancestor of custom element into a new document must enqueue and invoke adoptedCallback]
expected: FAIL
[Moving an ancestor of custom element from the owner document into a new document must enqueue and invoke adoptedCallback]
expected: FAIL
[Inserting a custom element into a shadow tree in a new document must enqueue and invoke adoptedCallback]
expected: FAIL
@ -36,12 +24,6 @@
[Inserting a custom element into a detached shadow tree that belongs to a new document must enqueue and invoke adoptedCallback]
expected: FAIL
[Inserting an ancestor of custom element into a cloned document must enqueue and invoke adoptedCallback]
expected: FAIL
[Moving an ancestor of custom element from the owner document into a cloned document must enqueue and invoke adoptedCallback]
expected: FAIL
[Inserting a custom element into a shadow tree in a cloned document must enqueue and invoke adoptedCallback]
expected: FAIL
@ -54,12 +36,6 @@
[Inserting a custom element into a detached shadow tree that belongs to a cloned document must enqueue and invoke adoptedCallback]
expected: FAIL
[Inserting an ancestor of custom element into a document created by createHTMLDocument must enqueue and invoke adoptedCallback]
expected: FAIL
[Moving an ancestor of custom element from the owner document into a document created by createHTMLDocument must enqueue and invoke adoptedCallback]
expected: FAIL
[Inserting a custom element into a shadow tree in a document created by createHTMLDocument must enqueue and invoke adoptedCallback]
expected: FAIL
@ -72,12 +48,6 @@
[Inserting a custom element into a detached shadow tree that belongs to a document created by createHTMLDocument must enqueue and invoke adoptedCallback]
expected: FAIL
[Inserting an ancestor of custom element into an HTML document created by createDocument must enqueue and invoke adoptedCallback]
expected: FAIL
[Moving an ancestor of custom element from the owner document into an HTML document created by createDocument must enqueue and invoke adoptedCallback]
expected: FAIL
[Inserting a custom element into a shadow tree in an HTML document created by createDocument must enqueue and invoke adoptedCallback]
expected: FAIL
@ -90,12 +60,6 @@
[Inserting a custom element into a detached shadow tree that belongs to an HTML document created by createDocument must enqueue and invoke adoptedCallback]
expected: FAIL
[Inserting an ancestor of custom element into the document of an iframe must enqueue and invoke adoptedCallback]
expected: FAIL
[Moving an ancestor of custom element from the owner document into the document of an iframe must enqueue and invoke adoptedCallback]
expected: FAIL
[Inserting a custom element into a shadow tree in the document of an iframe must enqueue and invoke adoptedCallback]
expected: FAIL
@ -108,12 +72,6 @@
[Inserting a custom element into a detached shadow tree that belongs to the document of an iframe must enqueue and invoke adoptedCallback]
expected: FAIL
[Inserting an ancestor of custom element into an HTML document fetched by XHR must enqueue and invoke adoptedCallback]
expected: FAIL
[Moving an ancestor of custom element from the owner document into an HTML document fetched by XHR must enqueue and invoke adoptedCallback]
expected: FAIL
[Inserting a custom element into a shadow tree in an HTML document fetched by XHR must enqueue and invoke adoptedCallback]
expected: FAIL

View file

@ -1,8 +1,5 @@
[connected-callbacks.html]
type: testharness
[Inserting an ancestor of custom element into the document must enqueue and invoke connectedCallback]
expected: FAIL
[Inserting a custom element into a shadow tree in the document must enqueue and invoke connectedCallback]
expected: FAIL
@ -12,9 +9,6 @@
[Inserting a custom element into a detached shadow tree that belongs to the document must not enqueue and invoke connectedCallback]
expected: FAIL
[Inserting an ancestor of custom element into the document of the template elements must enqueue and invoke connectedCallback]
expected: FAIL
[Inserting a custom element into a shadow tree in the document of the template elements must enqueue and invoke connectedCallback]
expected: FAIL
@ -24,9 +18,6 @@
[Inserting a custom element into a detached shadow tree that belongs to the document of the template elements must not enqueue and invoke connectedCallback]
expected: FAIL
[Inserting an ancestor of custom element into a new document must enqueue and invoke connectedCallback]
expected: FAIL
[Inserting a custom element into a shadow tree in a new document must enqueue and invoke connectedCallback]
expected: FAIL
@ -36,9 +27,6 @@
[Inserting a custom element into a detached shadow tree that belongs to a new document must not enqueue and invoke connectedCallback]
expected: FAIL
[Inserting an ancestor of custom element into a cloned document must enqueue and invoke connectedCallback]
expected: FAIL
[Inserting a custom element into a shadow tree in a cloned document must enqueue and invoke connectedCallback]
expected: FAIL
@ -48,9 +36,6 @@
[Inserting a custom element into a detached shadow tree that belongs to a cloned document must not enqueue and invoke connectedCallback]
expected: FAIL
[Inserting an ancestor of custom element into a document created by createHTMLDocument must enqueue and invoke connectedCallback]
expected: FAIL
[Inserting a custom element into a shadow tree in a document created by createHTMLDocument must enqueue and invoke connectedCallback]
expected: FAIL
@ -60,9 +45,6 @@
[Inserting a custom element into a detached shadow tree that belongs to a document created by createHTMLDocument must not enqueue and invoke connectedCallback]
expected: FAIL
[Inserting an ancestor of custom element into an HTML document created by createDocument must enqueue and invoke connectedCallback]
expected: FAIL
[Inserting a custom element into a shadow tree in an HTML document created by createDocument must enqueue and invoke connectedCallback]
expected: FAIL
@ -72,9 +54,6 @@
[Inserting a custom element into a detached shadow tree that belongs to an HTML document created by createDocument must not enqueue and invoke connectedCallback]
expected: FAIL
[Inserting an ancestor of custom element into the document of an iframe must enqueue and invoke connectedCallback]
expected: FAIL
[Inserting a custom element into a shadow tree in the document of an iframe must enqueue and invoke connectedCallback]
expected: FAIL
@ -84,9 +63,6 @@
[Inserting a custom element into a detached shadow tree that belongs to the document of an iframe must not enqueue and invoke connectedCallback]
expected: FAIL
[Inserting an ancestor of custom element into an HTML document fetched by XHR must enqueue and invoke connectedCallback]
expected: FAIL
[Inserting a custom element into a shadow tree in an HTML document fetched by XHR must enqueue and invoke connectedCallback]
expected: FAIL

View file

@ -6,6 +6,3 @@
[Mutating a undefined custom element while upgrading a custom element must not enqueue or invoke reactions on the mutated element]
expected: FAIL
[Mutating another custom element inside adopted callback must invoke all pending callbacks on the mutated element]
expected: FAIL

View file

@ -9,9 +9,6 @@
[body on Document must enqueue disconnectedCallback when removing a custom element]
expected: FAIL
[body on Document must enqueue connectedCallback when inserting a custom element]
expected: FAIL
[open on Document must enqueue disconnectedCallback when removing a custom element]
expected: FAIL

View file

@ -1,8 +0,0 @@
[HTMLOptionsCollection.html]
type: testharness
[The indexed setter on HTMLOptionsCollection must enqueue connectedCallback when inserting a custom element]
expected: FAIL
[add on HTMLOptionsCollection must enqueue connectedCallback when inserting a custom element]
expected: FAIL

View file

@ -1,8 +1,5 @@
[Range.html]
type: testharness
[extractContents on Range must enqueue a disconnected reaction]
expected: FAIL
[cloneContents on Range must enqueue an attributeChanged reaction when cloning an element with an observed attribute]
expected: FAIL