electron-userland / devtron

[LOOKING FOR MAINTAINERS] An Electron DevTools Extension
https://electronjs.org/devtron
MIT License
1.73k stars 100 forks source link

fix: Cannot read property 'BrowserWindow' of undefined issue when ins… #226

Open JasonLiSZ opened 3 years ago

JasonLiSZ commented 3 years ago

…tall devtron

As the methods of: electron.remote.BrowserWindow.getDevToolsExtensions was obsolete, this fix is trying to locate get/add/remove extension methods in [session] instead of BrowserWindow.

raviSussol commented 3 years ago

@JasonLiSZ Is this pr fix working for you for the latest version of the electron (i.e. 12 or higher)? I tried to copy your changes to the devtron repo and started and loaded locally. When I tried to install in the Console tab of the devtool then throws another error: Cannot read property 'defaultSession' of undefined. I suspect that if you try to require the whole electron object in the api.js file and try log in the console then you'll see some of the main module objects are not there (i.e undefined) [remote, session]. Thats why it has been throwing for BrowserWindow undefined at first place despite having the method getDevToolsExtensions is deprecated though.