|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
|
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> |
|
4 <!-- |
|
5 Bug 336682: online/offline events tests. |
|
6 |
|
7 Any copyright is dedicated to the Public Domain. |
|
8 http://creativecommons.org/licenses/publicdomain/ |
|
9 --> |
|
10 <window title="Mozilla Bug 336682" |
|
11 onoffline="trace('lt;body onoffline=...'); windowOnoffline(this, event)" |
|
12 ononline="trace('lt;body ononline=...'); windowOnonline(this, event)" |
|
13 |
|
14 xmlns:html="http://www.w3.org/1999/xhtml" |
|
15 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
16 |
|
17 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
18 |
|
19 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
20 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=336682"> |
|
21 Mozilla Bug 336682 (online/offline events)</a> |
|
22 <p id="display"></p> |
|
23 <div id="content" style="display: none"> |
|
24 </div> |
|
25 </body> |
|
26 |
|
27 <script type="text/javascript" src="test_bug336682.js"/> |
|
28 <script class="testbody" type="text/javascript"> |
|
29 <![CDATA[ |
|
30 addLoadEvent(function() { |
|
31 /** @see test_bug336682.js */ |
|
32 MAX_STATE = 4; |
|
33 |
|
34 function makeWindowHandler(eventName) { |
|
35 return function (aThis, aEvent) { |
|
36 var handler = makeHandler("<body on%1='...'>", eventName, [3,4]); |
|
37 handler(aEvent); |
|
38 } |
|
39 } |
|
40 |
|
41 for each(var event in ["online", "offline"]) { |
|
42 document.documentElement.addEventListener( |
|
43 event, |
|
44 makeHandler("document.body.addEventListener('%1', ..., false)", |
|
45 event, [1]), |
|
46 false); |
|
47 |
|
48 document.addEventListener( |
|
49 event, |
|
50 makeHandler("document.addEventListener('%1', ..., false)", |
|
51 event, [2]), |
|
52 false); |
|
53 |
|
54 window["windowOn" + event] = makeWindowHandler(event); |
|
55 |
|
56 window.addEventListener( |
|
57 event, |
|
58 makeHandler("window.addEventListener('%1', ..., false)", |
|
59 event, [3,4]), |
|
60 false); |
|
61 } |
|
62 |
|
63 doTest(); |
|
64 SimpleTest.finish(); |
|
65 }); |
|
66 |
|
67 SimpleTest.waitForExplicitFinish(); |
|
68 ]]> |
|
69 </script> |
|
70 |
|
71 </window> |