1 <html xmlns=
"http://www.w3.org/1999/xhtml">
3 https://bugzilla.mozilla.org/show_bug.cgi?id=397934
6 <title>Test for Bug
397934</title>
7 <script type=
"text/javascript" src=
"/MochiKit/packed.js"></script>
8 <script type=
"text/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
10 <bindings xmlns=
"http://www.mozilla.org/xbl">
11 <binding id=
"ancestor">
13 <field name=
"testAncestor">"ancestor"</field>
16 <binding id=
"test1" extends=
"#ancestor">
19 this.storage = window;
21 <field name=
"window"></field>
22 <field name=
"storage">null
</field>
23 <field name=
"parentNode"></field>
24 <field name=
"ownerDocument">"ownerDocument"</field>
25 <field name=
"emptyTest1"></field>
26 <field name=
"emptyTest1">"empty1"</field>
27 <field name=
"emptyTest2">"empty2"</field>
28 <field name=
"emptyTest2"></field>
29 <field name=
"testAncestor"></field>
30 <field name=
"testEvalOnce">window.counter++; undefined
</field>
33 <binding id=
"test2" extends=
"#ancestor">
36 this.storage = window;
38 <field name=
"window">undefined
</field>
39 <field name=
"storage">null
</field>
40 <field name=
"parentNode">undefined
</field>
41 <field name=
"ownerDocument">"ownerDocument"</field>
42 <field name=
"emptyTest1">undefined
</field>
43 <field name=
"emptyTest1">"empty1"</field>
44 <field name=
"emptyTest2">"empty2"</field>
45 <field name=
"emptyTest2">undefined
</field>
46 <field name=
"testAncestor">undefined
</field>
52 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=397934">Mozilla Bug
397934</a>
53 <p id=
"display1" style=
"-moz-binding: url(#test1)"></p>
54 <p id=
"display2" style=
"-moz-binding: url(#test2)"></p>
55 <div id=
"content" style=
"display: none">
59 <script class=
"testbody" type=
"text/javascript">
62 /** Test for Bug
397934 **/
63 SimpleTest.waitForExplicitFinish();
64 addLoadEvent(function() {
69 ": |window| in the constructor should have resolved to our window");
70 is(d.ownerDocument,
"ownerDocument",
71 "test1" +
": Control to test field overriding DOM prop");
72 is(d.parentNode, document.body,
"test1" +
": unexpected parent");
73 is(d.emptyTest1, undefined,
74 "test1" +
": First field wins even if undefined");
75 is(typeof(d.emptyTest1),
"undefined",
76 "test1" +
": First field wins even if undefined, double-check");
77 is(d.emptyTest2,
"empty2",
78 "test1" +
": First field wins");
79 is(d.testAncestor,
"ancestor",
80 "test1" +
": Empty field should not override ancestor binding");
85 is(window.counter,
1,
"Field should have evaluated once and only once");
88 is(d.storage, undefined,
90 ": |window| in the constructor should have resolved to undefined");
91 is(typeof(d.storage),
"undefined",
93 ": |window| in the constructor should really have resolved to undefined");
94 is(d.ownerDocument,
"ownerDocument",
95 "test2" +
": Control to test field overriding DOM prop");
96 is(d.parentNode, undefined,
"test2" +
": unexpected parent");
97 is(typeof(d.parentNode),
"undefined",
"test2" +
": unexpected parent for real");
98 is(d.emptyTest1, undefined,
99 "test2" +
": First field wins even if undefined");
100 is(typeof(d.emptyTest1),
"undefined",
101 "test2" +
": First field wins even if undefined, double-check");
102 is(d.emptyTest2,
"empty2",
103 "test2" +
": First field wins");
104 is(d.testAncestor, undefined,
105 "test2" +
": Undefined field should override ancestor binding");
106 is(typeof(d.testAncestor),
"undefined",
107 "test2" +
": Undefined field should really override ancestor binding");
109 addLoadEvent(SimpleTest.finish);