Reviewed by Adam Roben.
[WebKit-https.git] / LayoutTests / http / tests / xmlhttprequest / request-from-popup.html
1 <html><body>
2 <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=4343">bug 4343</a>:
3 XMLHttpRequest doesn't work in a JavaScript-created window.</p>
4 <p id=result>FAIL</p>
5 <script type="text/javascript">
6 if (window.layoutTestController) {
7     layoutTestController.dumpAsText();
8     layoutTestController.setCanOpenWindows();
9     layoutTestController.waitUntilDone();
10 }
11
12 winRef=window.open();
13 if (!winRef)
14     alert("Popup window could not be opened, please disable pop-up blocker");
15
16 winRef.document.writeln("<html><body><script type='text/javascript'>");
17 winRef.document.writeln("var req = new XMLHttpRequest();");
18 winRef.document.writeln("req.onreadystatechange = result;");
19 winRef.document.writeln("req.open('GET', 'request-from-popup.html', true);");
20 winRef.document.writeln("req.send(null);");
21 winRef.document.writeln("function result() { if (req.readyState == 4) { opener.document.getElementById('result').innerHTML='SUCCESS'; if (opener.layoutTestController) opener.layoutTestController.notifyDone(); window.close(); } }");
22 winRef.document.writeln("<\/script><\/body><\/html>");
23 winRef.document.close();
24 </script></body></html>