Backed out changeset 004abcb3322e (bug 1626015) for perma failures on idlharness.window.html. CLOSED TREE

This commit is contained in:
Razvan Maries 2020-05-28 01:23:57 +03:00
parent f247187965
commit f8a2bcc110
5 changed files with 83 additions and 40 deletions

View File

@ -2025,35 +2025,6 @@ void nsINode::Append(const Sequence<OwningNodeOrString>& aNodes,
AppendChild(*node, aRv);
}
// https://dom.spec.whatwg.org/#dom-parentnode-replacechildren
void nsINode::ReplaceChildren(const Sequence<OwningNodeOrString>& aNodes,
ErrorResult& aRv) {
nsCOMPtr<Document> doc = OwnerDoc();
nsCOMPtr<nsINode> node = ConvertNodesOrStringsIntoNode(aNodes, doc, aRv);
if (aRv.Failed()) {
return;
}
EnsurePreInsertionValidity(*node, nullptr, aRv);
if (aRv.Failed()) {
return;
}
// Needed when used in combination with contenteditable (maybe)
mozAutoDocUpdate updateBatch(doc, true);
nsAutoMutationBatch mb(this, true, false);
// Replace all with node within this.
while (mFirstChild) {
RemoveChildNode(mFirstChild, true);
}
mb.RemovalDone();
AppendChild(*node, aRv);
mb.NodesAdded();
}
void nsINode::RemoveChildNode(nsIContent* aKid, bool aNotify) {
// NOTE: This function must not trigger any calls to
// Document::GetRootElement() calls until *after* it has removed aKid from

View File

@ -2033,8 +2033,6 @@ class nsINode : public mozilla::dom::EventTarget {
ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT void Append(const Sequence<OwningNodeOrString>& aNodes,
ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT void ReplaceChildren(
const Sequence<OwningNodeOrString>& aNodes, ErrorResult& aRv);
void GetBoxQuads(const BoxQuadOptions& aOptions,
nsTArray<RefPtr<DOMQuad>>& aResult, CallerType aCallerType,

View File

@ -28,6 +28,4 @@ interface mixin ParentNode {
void prepend((Node or DOMString)... nodes);
[CEReactions, Throws, Unscopable]
void append((Node or DOMString)... nodes);
[CEReactions, Throws, Unscopable]
void replaceChildren((Node or DOMString)... nodes);
};

View File

@ -0,0 +1,76 @@
[ParentNode-replaceChildren.html]
[DocumentFragment.replaceChildren() with null as an argument, on a parent having a child.]
expected: FAIL
[DocumentFragment.replaceChildren() with only text as an argument, on a parent having no child.]
expected: FAIL
[Element.replaceChildren() with null as an argument, on a parent having no child.]
expected: FAIL
[Element.replaceChildren() without any argument, on a parent having no child.]
expected: FAIL
[If node is a host-including inclusive ancestor of parent, then throw a HierarchyRequestError DOMException.]
expected: FAIL
[If node is an Element and parent is a document with another element, then throw a HierarchyRequestError DOMException.]
expected: FAIL
[DocumentFragment.replaceChildren() with null as an argument, on a parent having no child.]
expected: FAIL
[DocumentFragment.replaceChildren() with one element and text as argument, on a parent having a child.]
expected: FAIL
[Element.replaceChildren() with null as an argument, on a parent having a child.]
expected: FAIL
[DocumentFragment.replaceChildren() with only one element as an argument, on a parent having no child.]
expected: FAIL
[Element.replaceChildren() should move nodes in the right order]
expected: FAIL
[If node is a Text node and parent is a document, then throw a HierarchyRequestError DOMException.]
expected: FAIL
[If node is a DocumentFragment with an element and parent is a document with another element, then throw a HierarchyRequestError DOMException.]
expected: FAIL
[DocumentFragment.replaceChildren() with undefined as an argument, on a parent having no child.]
expected: FAIL
[If node is a doctype and parent is not a document, then throw a HierarchyRequestError DOMException.]
expected: FAIL
[If node is a doctype and parent is a document with another doctype, then throw a HierarchyRequestError DOMException.]
expected: FAIL
[If node is a DocumentFragment with multiple elements and parent is a document, then throw a HierarchyRequestError DOMException.]
expected: FAIL
[Element.replaceChildren() with undefined as an argument, on a parent having no child.]
expected: FAIL
[Element.replaceChildren() with only one element as an argument, on a parent having no child.]
expected: FAIL
[Element.replaceChildren() with one element and text as argument, on a parent having a child.]
expected: FAIL
[DocumentFragment.replaceChildren() should move nodes in the right order]
expected: FAIL
[If node is a doctype and parent is a document with an element, then throw a HierarchyRequestError DOMException.]
expected: FAIL
[Element.replaceChildren() with only text as an argument, on a parent having no child.]
expected: FAIL
[DocumentFragment.replaceChildren() without any argument, on a parent having no child.]
expected: FAIL
[If node is not a DocumentFragment, DocumentType, Element, Text, ProcessingInstruction, or Comment node, then throw a HierarchyRequestError DOMException.]
expected: FAIL

View File

@ -94,14 +94,14 @@
const observer = new MutationObserver(mutations => {
t.step(() => {
assert_equals(phase, 1, "phase");
assert_equals(mutations.length, 1, "mutations.length");
assert_equals(phase, 1);
assert_equals(mutations.length, 1);
const mutation = mutations[0];
assert_equals(mutation.type, "childList", "mutation.type");
assert_equals(mutation.addedNodes.length, 2, "added nodes length");
assert_array_equals([...mutation.addedNodes], insertions, "added nodes");
assert_equals(mutation.removedNodes.length, 2, "removed nodes length");
assert_array_equals([...mutation.removedNodes], children, "removed nodes");
assert_equals(mutation.type, "childList");
assert_equals(mutation.addedNodes.length, 2);
assert_array_equals([...mutation.addedNodes], insertions);
assert_equals(mutation.removedNodes.length, 2);
assert_array_equals([...mutation.removedNodes], children);
});
t.done();
});