test: fix flaky onbeforeunload tests (#19085)
This commit is contained in:
parent
c2d78deeca
commit
616856552f
4 changed files with 5 additions and 4 deletions
|
@ -13,7 +13,7 @@
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.close();
|
window.onload = () => window.close();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.close();
|
// unload events don't get run unless load events have run.
|
||||||
|
window.onload = () => window.close()
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
require('electron').remote.getCurrentWindow().emit('onbeforeunload');
|
require('electron').remote.getCurrentWindow().emit('onbeforeunload');
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
window.close();
|
window.onload = () => window.close();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
2
spec/fixtures/api/close.html
vendored
2
spec/fixtures/api/close.html
vendored
|
@ -4,7 +4,7 @@
|
||||||
window.addEventListener('unload', function (e) {
|
window.addEventListener('unload', function (e) {
|
||||||
require('fs').writeFileSync(__dirname + '/close', 'close');
|
require('fs').writeFileSync(__dirname + '/close', 'close');
|
||||||
}, false);
|
}, false);
|
||||||
window.close();
|
window.onload = () => window.close();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue