electron: [Bug]: Typing in Devtools causes crashes (onerror handler is hit)

Preflight Checklist

Electron Version

19.0.0

What operating system are you using?

Windows

Operating System Version

Windows 10

What arch are you using?

x64

Last Known Working Electron version

18.3.0

Expected Behavior

I should be able to type in the devtools without triggering the window’s onerror handler.

Actual Behavior

onerror is triggered with the error: “Possible side-effect in debug-evaluate”

Testcase Gist URL

https://gist.github.com/54d5f29ef2094fe21e5ba6b2de4ca876

Additional Information

  1. start app
  2. type something in devtools
  3. observe the error popup

Here’s the code I’m running:

main.js:

const {app, BrowserWindow} = require('electron')

async function createWindow () {
  const mainWindow = new BrowserWindow()
  await mainWindow.loadFile('index.html')
  mainWindow.webContents.openDevTools()
}

app.whenReady().then(() => {
  createWindow()
})

app.on('window-all-closed', function () {
  if (process.platform !== 'darwin') app.quit()
})

index.html:

<script src="./renderer.js"></script>

renderer.js:

window.onerror = (e, url, line, col, error) => {
  alert(error.message);
};

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 5
  • Comments: 19 (5 by maintainers)

Commits related to this issue

Most upvoted comments

This was caused by https://chromium-review.googlesource.com/c/v8/v8/+/3557234/ and fixed in https://chromium-review.googlesource.com/c/v8/v8/+/3660253 - it’ll be resolved when we roll Chromium to contain the fix.

@codebytere Are you sure? I just tested in 19.0.8 and 20.0.0-beta.8 and it wasn’t for me (Windows).

@remss Oh, I think we’re talking about different issues. You’re saying that if you execute code in the devtools that causes an error (because foo isn’t defined for example), the error handler gets triggered.

This issue was meant to track that typing any character into devtools (without hitting Enter) was triggering the onerror handler per character. That behavior was fixed in Electron 20.

The same problem with 102.0.5005.63 Chrome version, should wait for the next release?