Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
1 function ok(what, msg) {
2 postMessage({ event: msg, test: 'ok', a: what });
3 }
5 function is(a, b, msg) {
6 postMessage({ event: msg, test: 'is', a: a, b: b });
7 }
9 self.onmessage = function onmessage(event) {
11 // An XHR with system privileges will be able to do cross-site calls.
13 const TEST_URL = "http://example.com/tests/content/base/test/test_XHR_system.html";
14 is(location.hostname, "mochi.test", "hostname should be mochi.test");
16 var xhr = new XMLHttpRequest({mozSystem: true});
17 is(xhr.mozSystem, true, ".mozSystem == true");
18 xhr.open("GET", TEST_URL);
19 xhr.onload = function onload() {
20 is(xhr.status, 200);
21 ok(xhr.responseText != null);
22 ok(xhr.responseText.length);
23 postMessage({test: "finish"});
24 };
25 xhr.onerror = function onerror() {
26 ok(false, "Got an error event!");
27 postMessage({test: "finish"});
28 }
29 xhr.send();
30 };