content/base/test/test_bug578096.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_bug578096.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=578096
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 578096</title>
    1.11 +  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
    1.12 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=578096">Mozilla Bug 578096</a>
    1.17 +<p id="display"></p>
    1.18 +<div id="content">
    1.19 +   <input type="file" id="file" onchange="fireXHR()">
    1.20 +</div>
    1.21 +<pre id="test">
    1.22 +<script class="testbody" type="text/javascript">
    1.23 +SimpleTest.waitForExplicitFinish();
    1.24 +
    1.25 +var url = SimpleTest.getTestFileURL("bug578096LoadChromeScript.js");
    1.26 +var script = SpecialPowers.loadChromeScript(url);
    1.27 +
    1.28 +script.addMessageListener("file.path", function (message) {
    1.29 +  SpecialPowers.wrap(document.getElementById('file')).value = message;
    1.30 +
    1.31 +  var xhr = new XMLHttpRequest();
    1.32 +  xhr.onreadystatechange = function(event) {
    1.33 +    if (xhr.readyState == 4) {
    1.34 +      script.sendAsyncMessage("file.remove", {});
    1.35 +    }
    1.36 +  }
    1.37 +
    1.38 +  xhr.open('POST', window.location, true);
    1.39 +  xhr.send(document.getElementById('file').files[0]);
    1.40 +});
    1.41 +
    1.42 +script.addMessageListener("file.removed", function (message) {
    1.43 +  ok(true, "We didn't throw! Yay!");
    1.44 +  script.destroy();
    1.45 +  SimpleTest.finish();
    1.46 +});
    1.47 +
    1.48 +script.sendAsyncMessage("file.create", {});
    1.49 +</script>
    1.50 +</pre>
    1.51 +</body>
    1.52 +</html>

mercurial