|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=578096 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 578096</title> |
|
8 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script> |
|
9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
11 </head> |
|
12 <body> |
|
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=578096">Mozilla Bug 578096</a> |
|
14 <p id="display"></p> |
|
15 <div id="content"> |
|
16 <input type="file" id="file" onchange="fireXHR()"> |
|
17 </div> |
|
18 <pre id="test"> |
|
19 <script class="testbody" type="text/javascript"> |
|
20 SimpleTest.waitForExplicitFinish(); |
|
21 |
|
22 var url = SimpleTest.getTestFileURL("bug578096LoadChromeScript.js"); |
|
23 var script = SpecialPowers.loadChromeScript(url); |
|
24 |
|
25 script.addMessageListener("file.path", function (message) { |
|
26 SpecialPowers.wrap(document.getElementById('file')).value = message; |
|
27 |
|
28 var xhr = new XMLHttpRequest(); |
|
29 xhr.onreadystatechange = function(event) { |
|
30 if (xhr.readyState == 4) { |
|
31 script.sendAsyncMessage("file.remove", {}); |
|
32 } |
|
33 } |
|
34 |
|
35 xhr.open('POST', window.location, true); |
|
36 xhr.send(document.getElementById('file').files[0]); |
|
37 }); |
|
38 |
|
39 script.addMessageListener("file.removed", function (message) { |
|
40 ok(true, "We didn't throw! Yay!"); |
|
41 script.destroy(); |
|
42 SimpleTest.finish(); |
|
43 }); |
|
44 |
|
45 script.sendAsyncMessage("file.create", {}); |
|
46 </script> |
|
47 </pre> |
|
48 </body> |
|
49 </html> |