From ea70ac9003ab0ff98467bd6037171e8b0c3981bd Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Mon, 20 Nov 2017 14:47:11 -0800 Subject: [PATCH] fix(Page.goto): check navigation completeness on frame detachment (#1419) Currently, the NavigatorWatcher ensures that all the frames in the frame subtree reach the desired lifecycle events state. For this to be fully correct, NavigatorWatcher should also check navigation status whenever frames are detached. --- lib/NavigatorWatcher.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/NavigatorWatcher.js b/lib/NavigatorWatcher.js index d238a679d24..5a23c7933b4 100644 --- a/lib/NavigatorWatcher.js +++ b/lib/NavigatorWatcher.js @@ -43,7 +43,8 @@ class NavigatorWatcher { this._initialLoaderId = frame._loaderId; this._timeout = typeof options.timeout === 'number' ? options.timeout : 30000; this._eventListeners = [ - helper.addEventListener(this._frameManager, FrameManager.Events.LifecycleEvent, this._checkLifecycleComplete.bind(this)) + helper.addEventListener(this._frameManager, FrameManager.Events.LifecycleEvent, this._checkLifecycleComplete.bind(this)), + helper.addEventListener(this._frameManager, FrameManager.Events.FrameDetached, this._checkLifecycleComplete.bind(this)) ]; const lifecycleCompletePromise = new Promise(fulfill => {