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.
This commit is contained in:
Andrey Lushnikov 2017-11-20 14:47:11 -08:00 committed by GitHub
parent 6512ce768d
commit ea70ac9003
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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