Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 <?xml version="1.0"?>
2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
4 <!--
5 https://bugzilla.mozilla.org/show_bug.cgi?id=817284
6 -->
7 <window title="Mozilla Bug 817284"
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
11 <!-- test results are displayed in the html:body -->
12 <body xmlns="http://www.w3.org/1999/xhtml">
13 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=817284"
14 target="_blank">Mozilla Bug 817284</a>
15 </body>
17 <!-- test code goes here -->
18 <script type="application/javascript">
19 <![CDATA[
21 /** Test for Bug 817284 **/
22 var cu = Components.utils;
23 var sb = cu.Sandbox("http://example.com", { wantGlobalProperties: ["XMLHttpRequest"] });
25 // Test event handler calls
26 var xhr = cu.evalInSandbox(
27 'var xhr = new XMLHttpRequest();\
28 var called = false;\
29 xhr.onload = function() { called = true; };\
30 xhr', sb);
32 var e = document.createEvent("Events");
33 e.initEvent("load", false, false);
34 xhr.dispatchEvent(e);
35 is(cu.evalInSandbox('called', sb), true, "Event handler should have been called");
36 ]]>
37 </script>
38 </window>