зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset ff9c67df213a (bug 1319342) for failing wpt /dom/nodes/Node-cloneNode.html. r=backout
This commit is contained in:
Родитель
68e468c3ff
Коммит
307be3c2b4
|
@ -477,37 +477,19 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (clone->IsElement() && CustomElementRegistry::IsCustomElementEnabled()) {
|
||||
if (clone->IsElement()) {
|
||||
// The cloned node may be a custom element that may require
|
||||
// enqueing upgrade reaction.
|
||||
// enqueing created callback and prototype swizzling.
|
||||
Element* elem = clone->AsElement();
|
||||
CustomElementDefinition* definition = nullptr;
|
||||
nsCOMPtr<nsIAtom> tagAtom = nodeInfo->NameAtom();
|
||||
if (nsContentUtils::IsCustomElementName(tagAtom)) {
|
||||
definition =
|
||||
nsContentUtils::LookupCustomElementDefinition(nodeInfo->GetDocument(),
|
||||
nodeInfo->LocalName(),
|
||||
nodeInfo->NamespaceID());
|
||||
if (definition) {
|
||||
elem->SetCustomElementData(new CustomElementData(tagAtom));
|
||||
nsContentUtils::EnqueueUpgradeReaction(elem, definition);
|
||||
}
|
||||
if (nsContentUtils::IsCustomElementName(nodeInfo->NameAtom())) {
|
||||
nsContentUtils::SetupCustomElement(elem);
|
||||
} else {
|
||||
// Check if node may be custom element by type extension.
|
||||
// ex. <button is="x-button">
|
||||
nsAutoString extension;
|
||||
if (elem->GetAttr(kNameSpaceID_None, nsGkAtoms::is, extension) &&
|
||||
!extension.IsEmpty()) {
|
||||
definition =
|
||||
nsContentUtils::LookupCustomElementDefinition(nodeInfo->GetDocument(),
|
||||
nodeInfo->LocalName(),
|
||||
nodeInfo->NamespaceID(),
|
||||
&extension);
|
||||
if (definition) {
|
||||
nsCOMPtr<nsIAtom> typeAtom = NS_Atomize(extension);
|
||||
elem->SetCustomElementData(new CustomElementData(typeAtom));
|
||||
nsContentUtils::EnqueueUpgradeReaction(elem, definition);
|
||||
}
|
||||
nsContentUtils::SetupCustomElement(elem, &extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ skip-if = stylo # bug 1293844
|
|||
skip-if = stylo # bug 1293844
|
||||
[test_custom_element_adopt_callbacks.html]
|
||||
[test_custom_element_callback_innerhtml.html]
|
||||
[test_custom_element_clone_callbacks.html]
|
||||
[test_custom_element_clone_callbacks_extended.html]
|
||||
[test_custom_element_htmlconstructor.html]
|
||||
skip-if = os == 'android' # bug 1323645
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1081039
|
||||
-->
|
||||
<head>
|
||||
<title>Test callbacks for cloned custom elements.</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1081039">Bug 1081039</a>
|
||||
<script>
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// Test to make sure created callback is called on clones that are upgraded and clones
|
||||
// created after registering the custom element.
|
||||
|
||||
var callbackCalledOnUpgrade = false;
|
||||
var callbackCalledOnClone = false;
|
||||
|
||||
var foo = document.createElement("x-foo");
|
||||
var fooClone = foo.cloneNode(true);
|
||||
|
||||
var p = Object.create(HTMLElement.prototype);
|
||||
p.createdCallback = function() {
|
||||
is(this.__proto__, p, "Correct prototype should be set on custom elements.");
|
||||
|
||||
if (this == fooClone) {
|
||||
// Callback called for the element created before registering the custom element.
|
||||
// Should be called on element upgrade.
|
||||
is(callbackCalledOnUpgrade, false, "Upgrade should only be called once per clone.");
|
||||
callbackCalledOnUpgrade = true;
|
||||
} else if (this != foo) {
|
||||
// Callback called for the element created after registering the custom element.
|
||||
is(callbackCalledOnClone, false, "Upgrade should only be called once per clone.");
|
||||
callbackCalledOnClone = true;
|
||||
}
|
||||
|
||||
if (callbackCalledOnUpgrade && callbackCalledOnClone) {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
};
|
||||
|
||||
document.registerElement("x-foo", { prototype: p });
|
||||
|
||||
var anotherFooClone = foo.cloneNode(true);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -578665,7 +578665,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"cssom-view/offsetTopLeftInScrollableParent.html": [
|
||||
"82a6920db4d0be087e6ed621313ecf92e3e2ed68",
|
||||
"79b4a278f0e35646cfdffeebf8f0523e2772bc9b",
|
||||
"testharness"
|
||||
],
|
||||
"cssom-view/resources/elementsFromPoint.js": [
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
[reaction-timing.html]
|
||||
type: testharness
|
||||
[Calling Node.prototype.cloneNode(false) must push a new element queue to the processing stack]
|
||||
expected: FAIL
|
||||
|
|
@ -6,6 +6,9 @@
|
|||
[adoptNode on Document must enqueue an adopted reaction when importing a custom element]
|
||||
expected: FAIL
|
||||
|
||||
[importNode on Document must construct a new custom element when importing a custom element from a template]
|
||||
expected: FAIL
|
||||
|
||||
[execCommand on Document must enqueue a disconnected reaction when deleting a custom element from a contenteditable element]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
[Node-cloneNode.html]
|
||||
type: testharness
|
||||
[Node.prototype.cloneNode(true) must set parentNode, previousSibling, and nextSibling before upgrading custom elements]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLElement constructor must throw an InvalidStateError when the top of the construction stack is marked AlreadyConstructed due to a custom element constructor constructing itself after super() call]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLElement constructor must throw an InvalidStateError when the top of the construction stack is marked AlreadyConstructed due to a custom element constructor constructing itself before super() call]
|
||||
expected: FAIL
|
||||
|
||||
[Upgrading a custom element must throw InvalidStateError when the custom element's constructor returns another element]
|
||||
expected: FAIL
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
[Node-cloneNode.html]
|
||||
type: testharness
|
||||
[Node.cloneNode]
|
||||
expected: FAIL
|
||||
|
||||
[createElement(dialog)]
|
||||
expected: FAIL
|
||||
|
||||
[implementation.createDocument]
|
||||
expected: FAIL
|
||||
|
||||
[createElement(applet)]
|
||||
expected: FAIL
|
||||
|
Загрузка…
Ссылка в новой задаче