electron: How to open chrome://inspect special urls in BrowserWindow to debug SharedWorkers

1.1k Views Asked by At

My need is to access debug information from SharedWorkers. In a regular chrome window I would do this by opening chrome://inspect, but I wasn't able to achieve the same in an electron's BrowserWindow.

I tried by issuing

window.open("chrome://inspect")

from the dev-tools console, but I get a blank window, and opening dev-tools in the new window will show a

Not allowed to load local resource: chrome://inspect/

Any clues ?

1

There are 1 best solutions below

3
On BEST ANSWER

You cannot access to chrome://inspect in electron because it doesn't exist, you are not using Chrome but Chromium. Your option is to open console window is toggleDevTools()

Also, each window has its own console. If you are using something like this;

  workerWindow = new BrowserWindow({
    show: false,
    webPreferences: { nodeIntegration: true }
  });
  workerWindow.loadFile('worker.html');

Then to see console logs your best option may be sending console logs to another window or to main process with IPC.

If you use workers in your main page like this then your worker logs should appear in that window's console. Which you can show with toggleDevTools or Ctrl+Shift+I