Backout 30bfb150da06 (bug 449315) due to unit test timeouts.
[wine-gecko.git] / content / xbl / test / test_bug397934.xhtml
blob46be2351ea659982600e0a72aa1c47d2726fe084
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <!--
3 https://bugzilla.mozilla.org/show_bug.cgi?id=397934
4 -->
5 <head>
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">
12 <implementation>
13 <field name="testAncestor">"ancestor"</field>
14 </implementation>
15 </binding>
16 <binding id="test1" extends="#ancestor">
17 <implementation>
18 <constructor>
19 this.storage = window;
20 </constructor>
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>
31 </implementation>
32 </binding>
33 <binding id="test2" extends="#ancestor">
34 <implementation>
35 <constructor>
36 this.storage = window;
37 </constructor>
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>
47 </implementation>
48 </binding>
49 </bindings>
50 </head>
51 <body>
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">
57 </div>
58 <pre id="test">
59 <script class="testbody" type="text/javascript">
60 <![CDATA[
62 /** Test for Bug 397934 **/
63 SimpleTest.waitForExplicitFinish();
64 addLoadEvent(function() {
65 var d;
66 d = $("display1");
67 is(d.storage, window,
68 "test1" +
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");
82 window.counter = 0;
83 d.testEvalOnce;
84 d.testEvalOnce;
85 is(window.counter, 1, "Field should have evaluated once and only once");
87 d = $("display2");
88 is(d.storage, undefined,
89 "test2" +
90 ": |window| in the constructor should have resolved to undefined");
91 is(typeof(d.storage), "undefined",
92 "test2" +
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);
112 </script>
113 </pre>
114 </body>
115 </html>