1 <p>Tests the behavior of whitelisting origins using exact matching.
</p>
3 <pre id=
"console"></pre>
5 testRunner
.dumpAsText();
6 testRunner
.waitUntilDone();
7 testRunner
.addOriginAccessWhitelistEntry("http://127.0.0.1:8000", "http", "localhost", false);
11 document
.getElementById('console').appendChild(document
.createTextNode(message
+ '\n'));
14 function test(url
, expectSuccess
)
16 log("Testing: " + url
+ " (sync)");
17 var req
= new XMLHttpRequest();
18 req
.open("GET", url
, false);
21 log((expectSuccess
? "PASS: " : "FAIL: ") + req
.responseText
);
23 log((expectSuccess
? "FAIL: " : "PASS: ") + e
);
26 log("Testing: " + url
+ " (async)");
27 req
= new XMLHttpRequest();
28 req
.open("GET", url
, true);
29 req
.onload = function() {
30 log((expectSuccess
? "PASS: " : "FAIL: ") + req
.responseText
);
33 req
.onerror = function() {
34 log((expectSuccess
? "FAIL: " : "PASS: ") + req
.status
);
41 ["http://localhost:8000/xmlhttprequest/resources/get.txt", true],
42 ["http://loCALhost:8000/xmlhttprequest/resources/get.txt", true]
43 // FIXME: Is it possible to setup the following tests?
44 // ["http://localhost:8001/xmlhttprequest/resources/get.txt", false],
45 // ["http://foo.localhost:8000/xmlhttprequest/resources/get.txt", false],
46 // ["https://localhost:8000/xmlhttprequest/resources/get.txt", false]
53 if (currentTest
< tests
.length
)
54 test
.apply(null, tests
[currentTest
++]);
56 testRunner
.notifyDone();