3 <pre id='console'
></pre>
4 <script type=
"text/javascript">
6 testRunner
.dumpAsText();
10 document
.getElementById('console').appendChild(document
.createTextNode(message
+ "\n"));
15 function testAllowed(name
)
17 if (xhr
.getResponseHeader(name
))
18 log("PASS: Response header " + name
+ " allowed.");
20 log("FAIL: Response header " + name
+ " not allowed.");
23 function testDenied(name
)
25 if (!xhr
.getResponseHeader(name
))
26 log("PASS: Response header " + name
+ " denied.");
28 log("FAIL: Response header " + name
+ " not denied.");
32 xhr
= new XMLHttpRequest
;
33 xhr
.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-whitelist-response-headers.cgi", false);
36 // Test getResponseHeader()
37 testAllowed("cache-control");
38 testAllowed("content-language");
39 testAllowed("content-type");
40 testAllowed("expires");
41 testAllowed("last-modified");
42 testAllowed("pragma");
43 testDenied("x-webkit");
45 // Test getAllResponseHeaders()
46 if (!xhr
.getAllResponseHeaders().match("foobar"))
47 log("PASS: Non-whitelisted headers not passed to getAllResponseHeaders().");
49 log("FAIL: Non-whitelisted headers passed to getAllResponseHeaders().");