Commit 2852e870 authored by jochen@chromium.org's avatar jochen@chromium.org

Add a test for cross-origin XMLHttpRequest and CORS (which doesn't work currently)

https://bugs.webkit.org/show_bug.cgi?id=57600

Reviewed by Adam Barth.

* http/tests/security/resources/cors-redirect.php: Added.
* http/tests/security/resources/empty.html: Added.
* http/tests/security/xhr-cors-redirect-expected.txt: Added.
* http/tests/security/xhr-cors-redirect.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105009 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9110a03b
2012-01-13 Jochen Eisinger <jochen@chromium.org>
Add a test for cross-origin XMLHttpRequest and CORS (which doesn't work currently)
https://bugs.webkit.org/show_bug.cgi?id=57600
Reviewed by Adam Barth.
* http/tests/security/resources/cors-redirect.php: Added.
* http/tests/security/resources/empty.html: Added.
* http/tests/security/xhr-cors-redirect-expected.txt: Added.
* http/tests/security/xhr-cors-redirect.html: Added.
2012-01-13 Raymond Toy <rtoy@google.com>
noteOn, noteGrainOn and noteOff idl should take doubles
<?php
header("Access-Control-Allow-Origin: http://127.0.0.1:8000");
header("Location: http://localhost:8000/security/resources/empty.html");
?>
Test that a cross-origin XHR involving redirects works correctly. If this test passes, you will see a series of PASS messages.
Currently not working, see http://webkit.org/b/57600
FAIL: sync XHR failed
FAIL: async XHR failed
<html>
<head>
<script>
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
function log(msg) {
document.getElementById("log").innerHTML += msg + "<br>";
}
function test() {
var xhr = new XMLHttpRequest();
var url = "http://localhost:8000/security/resources/cors-redirect.php?no-cache";
xhr.open("GET", url, false);
try {
xhr.send(null);
if (xhr.status == 200)
log("PASS: sync XHR successful");
else
log("FAIL: sync XHR failed");
} catch (e) {
log("FAIL: sync XHR failed");
}
xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.onreadystatechanged = function(e) {
if (xhr.readystate == 4) {
if (xhr.status == 200)
log("PASS: async XHR successful");
else
log("FAIL: async XHR failed");
if (window.layoutTestController)
layoutTestController.notifyDone();
}
};
xhr.onerror = function() {
log("FAIL: async XHR failed");
if (window.layoutTestController)
layoutTestController.notifyDone();
};
xhr.send(null);
}
</script>
</head>
<body onload="test()">
<p>
Test that a cross-origin XHR involving redirects works correctly. If this test
passes, you will see a series of PASS messages.
</p>
<p>
Currently not working, see http://webkit.org/b/57600
</p>
<div id="log"></div>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment