OLD | NEW |
1 <html><body> | 1 <html><body> |
2 <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=4343">bug 4343</a>: | 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> | 3 XMLHttpRequest doesn't work in a JavaScript-created window.</p> |
4 <p id=result>FAIL</p> | 4 <p id=result>FAIL</p> |
5 <script type="text/javascript"> | 5 <script type="text/javascript"> |
6 if (window.testRunner) { | 6 if (window.testRunner) { |
7 testRunner.dumpAsText(); | 7 testRunner.dumpAsText(); |
8 testRunner.setCanOpenWindows(); | 8 testRunner.setCanOpenWindows(); |
9 testRunner.waitUntilDone(); | 9 testRunner.waitUntilDone(); |
10 } | 10 } |
11 | 11 |
12 winRef=window.open(); | 12 winRef=window.open(); |
13 if (!winRef) | 13 if (!winRef) |
14 alert("Popup window could not be opened, please disable pop-up blocker"); | 14 alert("Popup window could not be opened, please disable pop-up blocker"); |
15 | 15 |
16 winRef.document.writeln("<html><body><script type='text/javascript'>"); | 16 winRef.document.writeln("<html><body><script type='text/javascript'>"); |
17 winRef.document.writeln("var req = new XMLHttpRequest();"); | 17 winRef.document.writeln("var req = new XMLHttpRequest();"); |
18 winRef.document.writeln("req.onreadystatechange = result;"); | 18 winRef.document.writeln("req.onreadystatechange = result;"); |
19 winRef.document.writeln("req.open('GET', 'request-from-popup.html', true);"); | 19 winRef.document.writeln("req.open('GET','/xmlhttprequest/resources/access-contro
l-basic-allow-access-control-origin-header.cgi', true);"); |
20 winRef.document.writeln("req.send(null);"); | 20 winRef.document.writeln("req.send(null);"); |
21 winRef.document.writeln("function result() { if (req.readyState == 4) { opener.d
ocument.getElementById('result').innerHTML='SUCCESS'; if (opener.testRunner) ope
ner.testRunner.notifyDone(); window.close(); } }"); | 21 winRef.document.writeln("function result() { if (req.readyState == 4) { opener.d
ocument.getElementById('result').innerHTML='SUCCESS'; if (opener.testRunner) ope
ner.testRunner.notifyDone(); window.close(); } }"); |
22 winRef.document.writeln("<\/script><\/body><\/html>"); | 22 winRef.document.writeln("<\/script><\/body><\/html>"); |
23 winRef.document.close(); | 23 winRef.document.close(); |
24 </script></body></html> | 24 </script></body></html> |
OLD | NEW |