fix: don't pass a reference to the page into frames (#2766)

This commit is contained in:
Joel Einbinder 2018-06-19 00:33:45 -07:00 committed by Andrey Lushnikov
parent b20cde67c6
commit f197d2e208

View File

@ -118,7 +118,7 @@ class FrameManager extends EventEmitter {
return; return;
assert(parentFrameId); assert(parentFrameId);
const parentFrame = this._frames.get(parentFrameId); const parentFrame = this._frames.get(parentFrameId);
const frame = new Frame(this._client, this._page, parentFrame, frameId); const frame = new Frame(this._client, parentFrame, frameId);
this._frames.set(frame._id, frame); this._frames.set(frame._id, frame);
this.emit(FrameManager.Events.FrameAttached, frame); this.emit(FrameManager.Events.FrameAttached, frame);
} }
@ -145,7 +145,7 @@ class FrameManager extends EventEmitter {
frame._id = framePayload.id; frame._id = framePayload.id;
} else { } else {
// Initial main frame navigation. // Initial main frame navigation.
frame = new Frame(this._client, this._page, null, framePayload.id); frame = new Frame(this._client, null, framePayload.id);
} }
this._frames.set(framePayload.id, frame); this._frames.set(framePayload.id, frame);
this._mainFrame = frame; this._mainFrame = frame;
@ -256,9 +256,8 @@ class Frame {
* @param {?Frame} parentFrame * @param {?Frame} parentFrame
* @param {string} frameId * @param {string} frameId
*/ */
constructor(client, page, parentFrame, frameId) { constructor(client, parentFrame, frameId) {
this._client = client; this._client = client;
this._page = page;
this._parentFrame = parentFrame; this._parentFrame = parentFrame;
this._url = ''; this._url = '';
this._id = frameId; this._id = frameId;