mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
Remove Frame.isMainFrame()
This patch removes redundant frame.isMainFrame() method. The suggested way to check for main frame is: ```js frame === page.mainFrame() ``` Fixes #120.
This commit is contained in:
@@ -162,7 +162,7 @@ class FrameManager extends EventEmitter {
|
||||
*/
|
||||
async _evaluateOnFrame(frame, expression) {
|
||||
let contextId = undefined;
|
||||
if (!frame.isMainFrame()) {
|
||||
if (frame !== this._mainFrame) {
|
||||
contextId = this._frameIdToExecutionContextId.get(frame._id);
|
||||
console.assert(contextId, 'Frame does not have default context to evaluate in!');
|
||||
}
|
||||
@@ -244,13 +244,6 @@ class Frame {
|
||||
return Array.from(this._childFrames);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
*/
|
||||
isMainFrame() {
|
||||
return !this._detached && !this._parentFrame;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user