summaryrefslogtreecommitdiffstats
path: root/dom/base/test/test_bug1198095.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/base/test/test_bug1198095.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/base/test/test_bug1198095.html')
-rw-r--r--dom/base/test/test_bug1198095.html71
1 files changed, 71 insertions, 0 deletions
diff --git a/dom/base/test/test_bug1198095.html b/dom/base/test/test_bug1198095.html
new file mode 100644
index 000000000..cebf56888
--- /dev/null
+++ b/dom/base/test/test_bug1198095.html
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1198095
+-->
+ <title>Test for Bug 1198095</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1198095">Mozilla Bug 1198095</a>
+
+<pre id="test">
+<script class="testbody" type="text/javascript;version=1.7">
+
+var fileData1 = '1234567890';
+var fileData2 = '43210';
+var r, firstBlob;
+
+var openerURL = SimpleTest.getTestFileURL("file_bug1198095.js");
+
+var opener = SpecialPowers.loadChromeScript(openerURL);
+opener.addMessageListener("file.opened", onFileOpened);
+opener.addMessageListener("file.modified", onFileModified);
+opener.sendAsyncMessage("file.open", fileData1);
+
+function onLoadEnd1(e) {
+ e.target.removeEventListener('loadend', onLoadEnd1);
+
+ is(e.target, r, "Target and r are ok");
+ ok(e.target.readyState, FileReader.DONE, "The file has been read.");
+ ok(e.target.result instanceof ArrayBuffer, "The result is an ArrayBuffer");
+
+ var view = new Uint8Array(e.target.result);
+ is(view.length, fileData1.length, "File data length matches");
+ for (var i = 0; i < fileData1.length; ++i) {
+ is(String.fromCharCode(view[i]), fileData1[i], "Byte matches");
+ }
+
+ opener.sendAsyncMessage("file.modify", fileData2);
+}
+
+function onError1(e) {
+ ok(false, "This method should not be called - error1!");
+}
+
+function onError2(e) {
+ e.target.removeEventListener('error', onError2);
+ SimpleTest.finish();
+}
+
+function onFileOpened(blob) {
+ firstBlob = blob;
+ r = new FileReader();
+ r.addEventListener("loadend", onLoadEnd1);
+ r.addEventListener("error", onError1);
+ r.readAsArrayBuffer(firstBlob);
+}
+
+function onFileModified(blob) {
+ r.removeEventListener('error', onError1);
+ r.addEventListener("error", onError2);
+ r.readAsArrayBuffer(firstBlob);
+}
+
+SimpleTest.waitForExplicitFinish();
+</script>
+</pre>
+</body> </html>