WebCore:
[WebKit-https.git] / LayoutTests / http / tests / workers / worker-redirect.html
1 <body>
2 <p>Test that loading the worker's script does not allow a cross origin redirect (<a href="https://bugs.webkit.org/show_bug.cgi?id=26146">bug 26146</a>)</p>
3 <div id=result></div>
4 <script>
5 function log(message)
6 {
7     document.getElementById("result").innerHTML += message + "<br>";
8 }
9
10 if (window.layoutTestController) {
11     layoutTestController.dumpAsText();
12     layoutTestController.waitUntilDone();
13 }
14
15 var worker = new Worker('/resources/redirect.php?url=http://localhost:8000/workers/resources/worker-redirect-target.js');
16 worker.onerror = function(evt) {
17     log("SUCCESS: threw error when attempting to redirected cross origin while loading the worker script.");
18     if (window.layoutTestController)
19         layoutTestController.notifyDone();
20 }
21 worker.onmessage = function(evt) {
22     log("FAIL: executed script when redirect cross origin.");
23     if (window.layoutTestController)
24         layoutTestController.notifyDone();
25 }
26 </script>
27 </body>
28 </html>