diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/xbl/test/test_bug398135.xul | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/xbl/test/test_bug398135.xul')
-rw-r--r-- | dom/xbl/test/test_bug398135.xul | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/dom/xbl/test/test_bug398135.xul b/dom/xbl/test/test_bug398135.xul new file mode 100644 index 000000000..6b0b68c62 --- /dev/null +++ b/dom/xbl/test/test_bug398135.xul @@ -0,0 +1,135 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=398135 +--> +<window title="Mozilla Bug 398135" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> + <script type="application/javascript">window.log = ""</script> + <bindings xmlns="http://www.mozilla.org/xbl"> + <binding id="ancestor"> + <implementation> + <constructor> + window.log += "ancestorConstructor:"; + </constructor> + <destructor> + window.log += "ancestorDestructor:"; + </destructor> + <field name="ancestorField">"ancestorField"</field> + <property name="ancestorProp" onget="return 'ancestorProp'"/> + <method name="ancestorMethod"> + <body> + return "ancestorMethod"; + </body> + </method> + </implementation> + </binding> + <binding id="test" extends="#ancestor"> + <implementation> + <constructor> + window.log += "descendantConstructor:"; + </constructor> + <destructor> + window.log += "descendantDestructor:"; + </destructor> + <field name="descendantField">"descendantField"</field> + <field name="contentField"> + document.getAnonymousNodes(this)[0]; + </field> + <property name="descendantProp" onget="return 'descendantProp'"/> + <method name="descendantMethod"> + <body> + return "descendantMethod"; + </body> + </method> + </implementation> + <content> + <span/> + <children/> + </content> + </binding> + </bindings> + + <!-- test results are displayed in the html:body --> + <body xmlns="http://www.w3.org/1999/xhtml"> + <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=398135" + target="_blank">Mozilla Bug 398135</a> + </body> + + <hbox id="display" style="-moz-binding: url(#test)"></hbox> + +<script type="application/javascript"> +<![CDATA[ +/** Test for Bug 398135 **/ +SimpleTest.waitForExplicitFinish(); +addLoadEvent(function() { + var d; + d = $("display"); + + function testInTree(type) { + is(d.ancestorField, "ancestorField", "Wrong ancestor field " + type); + is(d.descendantField, "descendantField", "Wrong descendant field " + type); + is(d.ancestorProp, "ancestorProp", "Wrong ancestor prop " + type); + is(d.descendantProp, "descendantProp", "Wrong descendant prop " + type); + is(d.ancestorMethod(), "ancestorMethod", "Wrong ancestor method " + type); + is(d.descendantMethod(), "descendantMethod", + "Wrong descendant method " + type); + is(d.contentField, document.getAnonymousNodes(d)[0], + "Unexpected content field " + type); + } + + function testNotInTree(type) { + is(typeof(d.ancestorField), "undefined", "Wrong ancestor field " + type); + is(typeof(d.descendantField), "undefined", + "Wrong descendant field " + type); + is(typeof(d.ancestorProp), "undefined", "Wrong ancestor prop " + type); + is(typeof(d.descendantProp), "undefined", "Wrong descendant prop " + type); + is(typeof(d.ancestorMethod), "undefined", "Wrong ancestor method " + type); + is(typeof(d.descendantMethod), "undefined", + "Wrong descendant method " + type); + is(typeof(d.contentField), "undefined", + "Unexpected content field " + type); + } + + is(window.log, "ancestorConstructor:descendantConstructor:", + "Constructors did not fire?"); + window.log = ""; + testInTree("before removal"); + + var parent = d.parentNode; + var nextSibling = d.nextSibling; + parent.removeChild(d); + testNotInTree("after first removal"); + + todo(window.log == "descendantDestructor:ancestorDestructor:", + "Destructors did not fire"); + window.log = ""; + + parent.insertBefore(d, nextSibling); + is(window.log, "ancestorConstructor:descendantConstructor:", + "Constructors did not fire a second time?"); + window.log = ""; + testInTree("after reinsertion"); + + // Now munge the proto chain to test the robustness of the proto-unhooking + // code + var origProto = d.__proto__; + var origProtoProto = origProto.__proto__; + var newProto = new Object(); + origProto.__proto__ = newProto; + newProto.__proto__ = origProtoProto; + + parent.removeChild(d); + todo(window.log == "descendantDestructor:ancestorDestructor:", + "Destructors did not fire a second time?"); + + testNotInTree("after second removal"); +}); +addLoadEvent(SimpleTest.finish); + +]]> +</script> +</window> + |