2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/publicdomain/zero/1.0/
6 /* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
9 postMessage({ type: "status", status: !!a, msg });
12 onmessage = function (event) {
13 function getResponse(url) {
14 var xhr = new XMLHttpRequest();
15 xhr.open("GET", url, false);
17 return xhr.responseText;
20 const testFile1 = "bug1014466_data1.txt";
21 const testFile2 = "bug1014466_data2.txt";
22 const testData1 = getResponse(testFile1);
23 const testData2 = getResponse(testFile2);
25 var response_count = 0;
26 var xhr = new XMLHttpRequest();
27 xhr.onreadystatechange = function () {
28 if (xhr.readyState == xhr.DONE && xhr.status == 200) {
30 switch (response_count) {
32 ok(xhr.responseText == testData1, "Check data 1");
36 ok(xhr.responseText == testData2, "Check data 2");
37 postMessage({ type: "finish" });
40 ok(false, "Unexpected response received");
41 postMessage({ type: "finish" });
46 xhr.onerror = function (e) {
47 ok(false, "Got an error event: " + e);
48 postMessage({ type: "finish" });
51 function test_data1() {
52 xhr.open("GET", testFile1, true);
53 xhr.responseType = "text";
57 function test_data2() {
59 xhr.open("GET", testFile2, true);
60 xhr.responseType = "text";