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:
parent
91cbe561ba
commit
236acec228
@ -87,7 +87,6 @@
|
||||
+ [frame.evaluate(pageFunction, ...args)](#frameevaluatepagefunction-args)
|
||||
+ [frame.hover(selector)](#framehoverselector)
|
||||
+ [frame.isDetached()](#frameisdetached)
|
||||
+ [frame.isMainFrame()](#frameismainframe)
|
||||
+ [frame.name()](#framename)
|
||||
+ [frame.parentFrame()](#frameparentframe)
|
||||
+ [frame.url()](#frameurl)
|
||||
@ -837,11 +836,6 @@ browser.newPage().then(async page =>
|
||||
|
||||
Returns `true` if the frame has being detached, or `false` otherwise.
|
||||
|
||||
#### frame.isMainFrame()
|
||||
- returns: <[boolean]>
|
||||
|
||||
Returns `true` is the frame is page's main frame, or `false` otherwise.
|
||||
|
||||
#### frame.name()
|
||||
- returns: <[string]>
|
||||
|
||||
|
@ -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}
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user