1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/xbl/test/test_bug400705.xhtml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,48 @@ 1.4 +<html xmlns="http://www.w3.org/1999/xhtml"> 1.5 +<!-- 1.6 +https://bugzilla.mozilla.org/show_bug.cgi?id=400705 1.7 +--> 1.8 +<head> 1.9 + <title>Test for Bug 400705</title> 1.10 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.11 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.12 + <bindings xmlns="http://www.mozilla.org/xbl"> 1.13 + <binding id="test"> 1.14 + <implementation> 1.15 + <field name="a">XPCNativeWrapper.unwrap(window).countera++</field> 1.16 + <field name="b">XPCNativeWrapper.unwrap(window).counterb++</field> 1.17 + </implementation> 1.18 + </binding> 1.19 + </bindings> 1.20 +</head> 1.21 +<body> 1.22 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=400705">Mozilla Bug 400705</a> 1.23 +<p id="display" style="-moz-binding: url(#test)"></p> 1.24 +<div id="content" style="display: none"> 1.25 + 1.26 +</div> 1.27 +<pre id="test"> 1.28 +<script class="testbody" type="text/javascript"> 1.29 +<![CDATA[ 1.30 +/** Test for Bug 400705 **/ 1.31 +SimpleTest.waitForExplicitFinish(); 1.32 + 1.33 +addLoadEvent(function() { 1.34 + window.countera = 0; 1.35 + window.counterb = 0; 1.36 + 1.37 + var d = $("display"); 1.38 + // Control to make sure fields are lazy and all 1.39 + d.a; 1.40 + is(window.countera, 1, "Should have evaluated field"); 1.41 + 1.42 + d.parentNode.removeChild(d); 1.43 + is(window.counterb, 0, "Should not evaluate field on binding teardown"); 1.44 + SimpleTest.finish(); 1.45 +}); 1.46 +]]> 1.47 +</script> 1.48 +</pre> 1.49 +</body> 1.50 +</html> 1.51 +