From 63e89eb94a5bc36fa8f6f422ee475100bcbc768d Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Sun, 25 Nov 2018 05:47:09 +0000 Subject: [PATCH] DevTools: ensure all auto-start modules are loaded before starting the app. Change-Id: I9dcdabed9e8e255bfb9911234b5c2c2a37d57fd1 Reviewed-on: https://chromium-review.googlesource.com/c/1349501 Reviewed-by: Aleksey Kozyatinskiy Commit-Queue: Pavel Feldman Cr-Original-Commit-Position: refs/heads/master@{#610722} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 89caaba1c8fadd39eb064b5dc2f9314436acbdea --- front_end/Runtime.js | 13 ++++++------- front_end/main/Main.js | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/front_end/Runtime.js b/front_end/Runtime.js index 11093b84ce..46698e7727 100644 --- a/front_end/Runtime.js +++ b/front_end/Runtime.js @@ -66,8 +66,6 @@ var Runtime = class { // eslint-disable-line for (let i = 0; i < descriptors.length; ++i) this._registerModule(descriptors[i]); - - Runtime._runtimeReadyPromiseCallback(); } /** @@ -237,8 +235,8 @@ var Runtime = class { // eslint-disable-line /** * @return {!Promise} */ - static async runtimeReady() { - return Runtime._runtimeReadyPromise; + static async appStarted() { + return Runtime._appStartedPromise; } /** @@ -289,7 +287,8 @@ var Runtime = class { // eslint-disable-line } self.runtime = new Runtime(moduleDescriptors); if (coreModuleNames) - return /** @type {!Promise} */ (self.runtime._loadAutoStartModules(coreModuleNames)); + await self.runtime._loadAutoStartModules(coreModuleNames); + Runtime._appStartedPromiseCallback(); } /** @@ -1069,8 +1068,8 @@ Runtime.Experiment = class { Runtime.experiments = new Runtime.ExperimentsSupport(); /** @type {Function} */ -Runtime._runtimeReadyPromiseCallback; -Runtime._runtimeReadyPromise = new Promise(fulfil => Runtime._runtimeReadyPromiseCallback = fulfil); +Runtime._appStartedPromiseCallback; +Runtime._appStartedPromise = new Promise(fulfil => Runtime._appStartedPromiseCallback = fulfil); /** * @type {?string} */ diff --git a/front_end/main/Main.js b/front_end/main/Main.js index 297b32b0d3..646164f3c5 100644 --- a/front_end/main/Main.js +++ b/front_end/main/Main.js @@ -60,7 +60,7 @@ Main.Main = class { async _loaded() { console.timeStamp('Main._loaded'); - await Runtime.runtimeReady(); + await Runtime.appStarted(); Runtime.setPlatform(Host.platform()); InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this)); }