From 9b2c791c86443387c16b3d858dbdd22f070bd9cd Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 9 Feb 2016 14:28:01 -0800 Subject: [PATCH] Don't emit window:loaded event until async window initialization completes Signed-off-by: Katrina Uychaco --- src/initialize-test-window.coffee | 4 +++- static/index.js | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/initialize-test-window.coffee b/src/initialize-test-window.coffee index f3507b479..bdd94461a 100644 --- a/src/initialize-test-window.coffee +++ b/src/initialize-test-window.coffee @@ -68,7 +68,9 @@ module.exports = ({blobStore}) -> logFile, headless, testPaths, buildAtomEnvironment, buildDefaultApplicationDelegate, legacyTestRunner }) - promise.then(exitWithStatusCode) if getWindowLoadSettings().headless + promise.then (statusCode) -> + exitWithStatusCode(statusCode) if getWindowLoadSettings().headless + catch error if getWindowLoadSettings().headless console.error(error.stack ? error) diff --git a/static/index.js b/static/index.js index 6d65d3c52..651c2afe6 100644 --- a/static/index.js +++ b/static/index.js @@ -83,8 +83,9 @@ setupCsonCache(CompileCache.getCacheDirectory()) var initialize = require(loadSettings.windowInitializationScript) - initialize({blobStore: blobStore}) - require('ipc').sendChannel('window-command', 'window:loaded') + initialize({blobStore: blobStore}).then(function () { + require('ipc').sendChannel('window-command', 'window:loaded') + }) } function setupCsonCache (cacheDir) {