test: fix flaky onbeforeunload tests (#19085)

This commit is contained in:
Jeremy Apthorp 2019-07-02 13:48:58 -07:00 committed by GitHub
parent c2d78deeca
commit 616856552f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 4 deletions

View file

@ -13,7 +13,7 @@
return ''; return '';
} }
} }
window.close(); window.onload = () => window.close();
</script> </script>
</body> </body>
</html> </html>

View file

@ -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>

View file

@ -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>

View file

@ -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>