diff --git a/spec/fixtures/api/close-beforeunload-empty-string.html b/spec/fixtures/api/close-beforeunload-empty-string.html index 13564fba349a..644f4f4530bc 100644 --- a/spec/fixtures/api/close-beforeunload-empty-string.html +++ b/spec/fixtures/api/close-beforeunload-empty-string.html @@ -13,7 +13,7 @@ return ''; } } - window.close(); + window.onload = () => window.close(); diff --git a/spec/fixtures/api/close-beforeunload-false.html b/spec/fixtures/api/close-beforeunload-false.html index 482b8757e435..5f519ab5598b 100644 --- a/spec/fixtures/api/close-beforeunload-false.html +++ b/spec/fixtures/api/close-beforeunload-false.html @@ -12,7 +12,8 @@ return false; } } - window.close(); + // unload events don't get run unless load events have run. + window.onload = () => window.close() diff --git a/spec/fixtures/api/close-beforeunload-undefined.html b/spec/fixtures/api/close-beforeunload-undefined.html index b4e4178f6a1d..910dbc5090fc 100644 --- a/spec/fixtures/api/close-beforeunload-undefined.html +++ b/spec/fixtures/api/close-beforeunload-undefined.html @@ -6,7 +6,7 @@ require('electron').remote.getCurrentWindow().emit('onbeforeunload'); }, 0); } - window.close(); + window.onload = () => window.close(); diff --git a/spec/fixtures/api/close.html b/spec/fixtures/api/close.html index 24846f722836..0388b82a7322 100644 --- a/spec/fixtures/api/close.html +++ b/spec/fixtures/api/close.html @@ -4,7 +4,7 @@ window.addEventListener('unload', function (e) { require('fs').writeFileSync(__dirname + '/close', 'close'); }, false); - window.close(); + window.onload = () => window.close();