| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="/js-test-resources/js-test.js"></script> | 4 <script src="/js-test-resources/js-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 description("Testing navigator.sendBeacon() cross-origin."); | 6 description("Testing navigator.sendBeacon() cross-origin."); |
| 7 | 7 |
| 8 window.jsTestIsAsync = true; | 8 window.jsTestIsAsync = true; |
| 9 | 9 |
| 10 function test() { | 10 function test() { |
| 11 if (window.testRunner) { | 11 if (window.testRunner) { |
| 12 testRunner.dumpAsText(); | 12 testRunner.dumpAsText(); |
| 13 testRunner.waitUntilDone(); | 13 testRunner.waitUntilDone(); |
| 14 testRunner.dumpPingLoaderCallbacks(); | 14 testRunner.dumpPingLoaderCallbacks(); |
| 15 } | 15 } |
| 16 | 16 |
| 17 shouldBeTrue('navigator.sendBeacon("http://localhost:8000/navigation/resourc
es/save-beacon.php?name=cross-origin", "CrossOrigin");'); | 17 shouldBeTrue('navigator.sendBeacon("http://localhost:8000/navigation/resourc
es/save-beacon.php?name=cross-origin", "CrossOrigin");'); |
| 18 var xhr = new XMLHttpRequest(); | 18 setTimeout(() => { |
| 19 var xhr = new XMLHttpRequest(); |
| 19 xhr.open("GET", "resources/check-beacon.php?name=cross-origin"); | 20 xhr.open("GET", "resources/check-beacon.php?name=cross-origin"); |
| 20 xhr.onload = function () { | 21 xhr.onload = function () { |
| 21 var lines = xhr.responseText.split("\n"); | 22 var lines = xhr.responseText.split("\n"); |
| 22 for (var i in lines) | 23 for (var i in lines) |
| 23 testPassed(lines[i]); | 24 testPassed(lines[i]); |
| 24 finishJSTest(); | 25 finishJSTest(); |
| 25 }; | 26 }; |
| 26 xhr.onerror = function () { | 27 xhr.onerror = function () { |
| 27 testFailed("Unable to fetch beacon status"); | 28 testFailed("Unable to fetch beacon status"); |
| 28 finishJSTest(); | 29 finishJSTest(); |
| 29 }; | 30 }; |
| 30 xhr.send(); | 31 xhr.send(); |
| 32 }, 1000); |
| 31 } | 33 } |
| 32 </script> | 34 </script> |
| 33 </head> | 35 </head> |
| 34 <body onload="test();"> | 36 <body onload="test();"> |
| 35 </body> | 37 </body> |
| 36 </html> | 38 </html> |
| OLD | NEW |