2017-03-22 21:14:23 +00:00
<!DOCTYPE html>
< html >
< body >
< script src = "../../resources/js-test-pre.js" > < / script >
< script src = "../../resources/ui-helper.js" > < / script >
< script >
description("Tests that the beforeunload alert is shown when the user interacted with the page. You should see a 'CONFIRM NAVIGATION' message at the top.");
jsTestIsAsync = true;
onload = function() {
const testFrame = document.getElementById("testFrame");
testFrame.contentWindow.onbeforeunload = function(e) {
return "PASS: a beforeunload alert was shown.";
};
// Simulate a user interaction.
const testInput = document.getElementById("testInput");
UIHelper.activateAt(testInput.offsetLeft + 5, testInput.offsetTop + 5).then(function() {
setTimeout(function() {
2018-04-23 20:49:57 +00:00
testFrame.onload = finishJSTest;
2017-03-22 21:14:23 +00:00
testFrame.src = "about:blank";
}, 0);
});
};
< / script >
< iframe id = "testFrame" src = "resources/onclick.html" > < / iframe >
< input id = "testInput" type = "text" > < / input >
< script src = "../../resources/js-test-post.js" > < / script >
< / body >
< / html >