The call stack for one of our top crashes looks like this:
```
node::Abort (node_errors.cc:241)
node::Assert (node_errors.cc:256)
node::MakeCallback (callback.cc:226)
gin_helper::internal::CallMethodWithArgs (event_emitter_caller.cc:23)
gin_helper::EmitEvent<T> (event_emitter_caller.h:51)
gin_helper::EventEmitterMixin<T>::Emit<T> (event_emitter_mixin.h:81)
electron::api::DownloadItem::OnDownloadUpdated (electron_api_download_item.cc:115)
download::DownloadItemImpl::UpdateObservers (download_item_impl.cc:482)
content::DownloadManagerImpl::Shutdown (download_manager_impl.cc:508)
content::BrowserContext::~BrowserContext (browser_context.cc:476)
```
Full stack here: https://sentry.io/share/issue/9b030a0601b547188181b543c16ecda2/
During browser shutdown, the `DownloadManager` was being cleaned up
*after* the Node environment had already been destroyed. This caused the
`DownloadItem::OnDownloadUpdated` callback to crash when trying to emit
the JS `done` event.
To prevent this, we now manually shut down the `DownloadManager`
earlier. This is also mentioned in the comment on
`DownloadManager::Shutdown`:
```
// Shutdown the download manager. Content calls this when BrowserContext is
// being destructed. If the embedder needs this to be called earlier, it can
// call it. In that case, the delegate's Shutdown() method will only be called
// once.
```
* fix: prevent crash when destroyed widget receives keyboard event
Activating a key to close a window will cause a silent crash. Handling the keyboard
event will lead to a nullptr dereferenced in Chromium code if the window widget has
already been destroyed.
* test: ensure BrowserWindow doesn't crash from keyboard events during close
* docs: update devtools extension tutorial
* Update docs/tutorial/devtools-extension.md
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
* update
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
The certificate authority mentioned "Comodo" has recently been renamed
"Sectigo". This updates the name of the certificate authority, and the
link to get the code signing certificates for Sectigo/Comodo.
* docs: correction meaning of DesktopCapturerSource.id
Corrected the meaning of the id string to match observed behavior
(verified on Windows 10 and Ubuntu).
* chore: adjust wordings
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
* Document coordinate system of badly named method getCursorScreenPoint
[Electron inherits this confusing name from Chromium](99314be815/ui/display/win/screen_win.cc (L677-L681)). We can also see there that the return value is a DIPPoint, due to `ScreenToDIPPoint` call:
gfx::Point ScreenWin::GetCursorScreenPoint() {
POINT pt;
::GetCursorPos(&pt);
return gfx::ToFlooredPoint(ScreenToDIPPoint(gfx::PointF(gfx::Point(pt))));
}
I lost over a day due to debugging this. I don't think we can change the method name due to backwards compatibility, but we can at least make amends in the documentation.
* Remove advice
* Softer wording
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
* build: fix missing dependency resulting in a random build failure
* Update chromium_src/BUILD.gn
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
* sort deps
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>