michael@0: function ok(what, msg) { michael@0: postMessage({ event: msg, test: 'ok', a: what }); michael@0: } michael@0: michael@0: function is(a, b, msg) { michael@0: postMessage({ event: msg, test: 'is', a: a, b: b }); michael@0: } michael@0: michael@0: self.onmessage = function onmessage(event) { michael@0: michael@0: // An XHR with system privileges will be able to do cross-site calls. michael@0: michael@0: const TEST_URL = "http://example.com/tests/content/base/test/test_XHR_system.html"; michael@0: is(location.hostname, "mochi.test", "hostname should be mochi.test"); michael@0: michael@0: var xhr = new XMLHttpRequest({mozSystem: true}); michael@0: is(xhr.mozSystem, true, ".mozSystem == true"); michael@0: xhr.open("GET", TEST_URL); michael@0: xhr.onload = function onload() { michael@0: is(xhr.status, 200); michael@0: ok(xhr.responseText != null); michael@0: ok(xhr.responseText.length); michael@0: postMessage({test: "finish"}); michael@0: }; michael@0: xhr.onerror = function onerror() { michael@0: ok(false, "Got an error event!"); michael@0: postMessage({test: "finish"}); michael@0: } michael@0: xhr.send(); michael@0: };