diff --git a/lib/browser/api/browser-view.js b/lib/browser/api/browser-view.js index 60023fef92b..fe693d27c0d 100644 --- a/lib/browser/api/browser-view.js +++ b/lib/browser/api/browser-view.js @@ -5,4 +5,12 @@ const {BrowserView} = process.atomBinding('browser_view') Object.setPrototypeOf(BrowserView.prototype, EventEmitter.prototype) +BrowserView.fromWebContents = (webContents) => { + for (const view of BrowserView.getAllViews()) { + if (view.webContents.equal(webContents)) return window + } + + return null +} + module.exports = BrowserView