Load devtools in a <webview>

58 views
Skip to first unread message

Eryk Rakowski

unread,
Jul 19, 2020, 8:28:45 AM7/19/20
to Chromium Embedders
Hi,

I'm trying to figure out why loading devtools in a guest WebContents doesn't work at all in Electron.

The following code does not trigger, specifically `HandleMessageFromDevToolsFrontend`.
```
    frontend_host_ = content::DevToolsFrontendHost::Create(
        web_contents()->GetMainFrame(),
        base::BindRepeating(
            &InspectableWebContents::HandleMessageFromDevToolsFrontend,
            base::Unretained(this)));
```
Therefore it cannot load properly the Elements tab and it prints errors like this:
```
[9752:0719/142051.656:ERROR:CONSOLE(1)] "This is a stub connection, can't dispatch message.", source: devtools://devtools/bundled/sdk/sdk.js (1)
[9752:0719/142051.865:ERROR:CONSOLE(1)] "No document", source: devtools://devtools/bundled/sdk/sdk.js (1)
```

The regression was introduced somewhere between Electron 2.0.0/Chromium M61 and Electron 3.0.0/Chromium M66.

Is there a security concern to block loading devtools inside a guest view or is it just a bug in Chromium? Could someone at least guide me what needs to be patched in order to fix this?
Reply all
Reply to author
Forward
0 new messages