mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
Properly cleanup FrameManager._frameIdToExecutionContextId. (#73)
This commit is contained in:
parent
ff838d8e83
commit
b77ae4b77c
@ -45,7 +45,6 @@ class FrameManager extends EventEmitter {
|
|||||||
this._client.on('Page.frameNavigated', event => this._onFrameNavigated(event.frame));
|
this._client.on('Page.frameNavigated', event => this._onFrameNavigated(event.frame));
|
||||||
this._client.on('Page.frameDetached', event => this._onFrameDetached(event.frameId));
|
this._client.on('Page.frameDetached', event => this._onFrameDetached(event.frameId));
|
||||||
this._client.on('Runtime.executionContextCreated', event => this._onExecutionContextCreated(event.context));
|
this._client.on('Runtime.executionContextCreated', event => this._onExecutionContextCreated(event.context));
|
||||||
this._client.on('Runtime.executionContextDestroyed', event => this._onExecutionContextDestroyed(event.executionContextId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,10 +108,6 @@ class FrameManager extends EventEmitter {
|
|||||||
this._frameIdToExecutionContextId.set(context.auxData.frameId, context.id);
|
this._frameIdToExecutionContextId.set(context.auxData.frameId, context.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onExecutionContextDestroyed(executionContextId) {
|
|
||||||
this._frameIdToExecutionContextId.delete(executionContextId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {!Frame} frame
|
* @param {!Frame} frame
|
||||||
* @param {string} newFrameId
|
* @param {string} newFrameId
|
||||||
@ -123,6 +118,7 @@ class FrameManager extends EventEmitter {
|
|||||||
for (let child of frame.childFrames())
|
for (let child of frame.childFrames())
|
||||||
this._removeFramesRecursively(child);
|
this._removeFramesRecursively(child);
|
||||||
this._frames.delete(frame._id, frame);
|
this._frames.delete(frame._id, frame);
|
||||||
|
this._frameIdToExecutionContextId.delete(frame._id);
|
||||||
frame._id = newFrameId;
|
frame._id = newFrameId;
|
||||||
frame._adoptPayload(newFramePayload);
|
frame._adoptPayload(newFramePayload);
|
||||||
this._frames.set(newFrameId, frame);
|
this._frames.set(newFrameId, frame);
|
||||||
@ -152,6 +148,7 @@ class FrameManager extends EventEmitter {
|
|||||||
this._removeFramesRecursively(child);
|
this._removeFramesRecursively(child);
|
||||||
frame._detach();
|
frame._detach();
|
||||||
this._frames.delete(frame._id);
|
this._frames.delete(frame._id);
|
||||||
|
this._frameIdToExecutionContextId.delete(frame._id);
|
||||||
this.emit(FrameManager.Events.FrameDetached, frame);
|
this.emit(FrameManager.Events.FrameDetached, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user