blob: 7c0f015154fc01dd67e1e735903d51d66a170645 [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script>
description("Testing navigator.sendBeacon() cross-origin.");
window.jsTestIsAsync = true;
function test() {
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
//testRunner.dumpPingLoaderCallbacks();
}
shouldBeTrue('navigator.sendBeacon("http://localhost:8000/blink/sendbeacon/resources/save-beacon.py?name=cross-origin", "CrossOrigin");');
var xhr = new XMLHttpRequest();
xhr.open("GET", "resources/check-beacon.py?name=cross-origin");
xhr.onload = function () {
var lines = xhr.responseText.split("\n");
for (var i in lines)
testPassed(lines[i]);
finishJSTest();
};
xhr.onerror = function () {
testFailed("Unable to fetch beacon status");
finishJSTest();
};
xhr.send();
}
</script>
</head>
<body onload="test();">
</body>
</html>