electron/shell/browser
Biru Mohanathas 7f1e3ca3de
fix: shutdown crash in DownloadItem callback (#27342)
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.
```
2021-01-20 11:30:08 -08:00
..
api fix: make SetWindowButtonVisibility work for customButtonsOnHover (#27073) 2021-01-19 19:12:09 +09:00
extensions chore: bump chromium to a264339194bfa02f5ecb3b8cba449 (master) (#27111) 2021-01-12 15:31:23 -08:00
lib chore: bump chromium to 6b9fa6b352d824d052222e1abe541 (master) (#25558) 2020-10-15 18:30:41 -07:00
linux
mac fix: hover text only working when VO enabled (#26183) 2020-10-28 20:24:37 -07:00
media chore: cleanup some typos in comments (#25770) 2020-10-13 10:25:21 -07:00
net fix: improve redirect behavior in protocol module (#26297) 2021-01-19 19:06:14 +09:00
notifications chore: use consistent parameter names (#26162) 2020-10-27 10:18:36 -05:00
osr chore: bump chromium to a264339194bfa02f5ecb3b8cba449 (master) (#27111) 2021-01-12 15:31:23 -08:00
plugins
printing chore: bump chromium to a264339194bfa02f5ecb3b8cba449 (master) (#27111) 2021-01-12 15:31:23 -08:00
resources Bump v13.0.0-nightly.20210120 2021-01-20 06:33:03 -08:00
serial chore: use auto to avoid repeating type (#26113) 2020-10-26 11:56:31 -07:00
ui chore: bump chromium to a264339194bfa02f5ecb3b8cba449 (master) (#27111) 2021-01-12 15:31:23 -08:00
win feat: honor nativeTheme.themeSource = 'dark' before creating BrowserWindow on Windows (#25373) 2020-10-28 15:00:21 -05:00
auto_updater.cc chore: bump chromium to 0e4ca9c0a63d7a39bd910997ad4c6 (master) (#24687) 2020-08-12 11:33:58 -07:00
auto_updater.h
auto_updater_mac.mm
browser.cc chore: remove ancient Browser::Focus implementation on Windows (#27279) 2021-01-13 13:46:54 -08:00
browser.h refactor: remove path from nativeImage converter (#26546) 2021-01-04 12:58:31 -08:00
browser_linux.cc chore: remove ancient Browser::Focus implementation on Windows (#27279) 2021-01-13 13:46:54 -08:00
browser_mac.mm refactor: remove path from nativeImage converter (#26546) 2021-01-04 12:58:31 -08:00
browser_observer.h chore: bump chromium to 0e4ca9c0a63d7a39bd910997ad4c6 (master) (#24687) 2020-08-12 11:33:58 -07:00
browser_process_impl.cc chore: bump chromium to 9b2191ea59cba1e2f6da4dbb7dee0 (master) (#25995) 2020-10-27 17:33:04 -07:00
browser_process_impl.h chore: bump chromium to 9b2191ea59cba1e2f6da4dbb7dee0 (master) (#25995) 2020-10-27 17:33:04 -07:00
browser_win.cc chore: remove ancient Browser::Focus implementation on Windows (#27279) 2021-01-13 13:46:54 -08:00
child_web_contents_tracker.cc
child_web_contents_tracker.h
cookie_change_notifier.cc chore: bump chromium to 096e5313aaf19dfa0c4710145c34d (master) (#26535) 2020-12-14 10:57:36 -08:00
cookie_change_notifier.h chore: bump chromium to 096e5313aaf19dfa0c4710145c34d (master) (#26535) 2020-12-14 10:57:36 -08:00
electron_autofill_driver.cc Bump v12.0.0-nightly.20200827 2020-08-27 07:31:51 -07:00
electron_autofill_driver.h Bump v12.0.0-nightly.20200827 2020-08-27 07:31:51 -07:00
electron_autofill_driver_factory.cc Bump v12.0.0-nightly.20200827 2020-08-27 07:31:51 -07:00
electron_autofill_driver_factory.h Bump v12.0.0-nightly.20200827 2020-08-27 07:31:51 -07:00
electron_browser_client.cc chore: bump chromium to a264339194bfa02f5ecb3b8cba449 (master) (#27111) 2021-01-12 15:31:23 -08:00
electron_browser_client.h chore: bump chromium to 096e5313aaf19dfa0c4710145c34d (master) (#26535) 2020-12-14 10:57:36 -08:00
electron_browser_context.cc chore: remove ScopedAllowBlockingForTesting (#26447) 2020-11-12 09:13:34 -05:00
electron_browser_context.h feat: allow setting SSL config (#25461) 2020-09-23 16:22:10 -04:00
electron_browser_handler_impl.cc chore: bump chromium to 096e5313aaf19dfa0c4710145c34d (master) (#26535) 2020-12-14 10:57:36 -08:00
electron_browser_handler_impl.h chore: bump chromium to 096e5313aaf19dfa0c4710145c34d (master) (#26535) 2020-12-14 10:57:36 -08:00
electron_browser_main_parts.cc fix: shutdown crash in DownloadItem callback (#27342) 2021-01-20 11:30:08 -08:00
electron_browser_main_parts.h refactor: use public node::CallbackScope where possible (#27001) 2020-12-15 11:39:25 -08:00
electron_browser_main_parts_mac.mm
electron_browser_main_parts_posix.cc refactor: align shutdown signal handling with upstream (#26559) 2020-11-19 16:00:34 -08:00
electron_download_manager_delegate.cc chore: use auto to avoid repeating type (#26113) 2020-10-26 11:56:31 -07:00
electron_download_manager_delegate.h chore: use consistent parameter names (#26162) 2020-10-27 10:18:36 -05:00
electron_gpu_client.cc
electron_gpu_client.h
electron_javascript_dialog_manager.cc
electron_javascript_dialog_manager.h
electron_navigation_throttle.cc refactor: wire will-navigate up to a navigation throttle instead of OpenURL (#25065) 2020-08-21 12:34:09 -07:00
electron_navigation_throttle.h refactor: wire will-navigate up to a navigation throttle instead of OpenURL (#25065) 2020-08-21 12:34:09 -07:00
electron_pdf_web_contents_helper_client.cc
electron_pdf_web_contents_helper_client.h
electron_permission_manager.cc feat: route frame based permission checks through our permission check handler (#19903) 2020-12-07 15:44:56 -08:00
electron_permission_manager.h
electron_quota_permission_context.cc
electron_quota_permission_context.h
electron_speech_recognition_manager_delegate.cc
electron_speech_recognition_manager_delegate.h
electron_web_ui_controller_factory.cc chore: bump chromium to 7264889ce3aad1568ff3d211c81fe (master) (#27003) 2020-12-22 14:14:44 -08:00
electron_web_ui_controller_factory.h chore: bump chromium to 7264889ce3aad1568ff3d211c81fe (master) (#27003) 2020-12-22 14:14:44 -08:00
event_emitter_mixin.cc
event_emitter_mixin.h feat: add webContents.setWindowOpenHandler API (#24517) 2020-11-10 09:06:03 -08:00
extended_web_contents_observer.h fix: make draggable regions work when devtools is opened on macOS (#26361) 2020-11-09 16:54:04 -05:00
fake_location_provider.cc
fake_location_provider.h
feature_list.cc chore: bump chromium to 096e5313aaf19dfa0c4710145c34d (master) (#26535) 2020-12-14 10:57:36 -08:00
feature_list.h
file_select_helper.cc fix: transparently package bundles as zip archives (#25030) 2020-10-27 17:05:28 -07:00
file_select_helper.h fix: transparently package bundles as zip archives (#25030) 2020-10-27 17:05:28 -07:00
file_select_helper_mac.mm fix: transparently package bundles as zip archives (#25030) 2020-10-27 17:05:28 -07:00
font_defaults.cc chore: bump chromium to ec5bc1743792d64724693eb357083 (master) (#24984) 2020-09-21 01:00:36 -07:00
font_defaults.h chore: bump chromium to ec5bc1743792d64724693eb357083 (master) (#24984) 2020-09-21 01:00:36 -07:00
javascript_environment.cc fix: use the gin PageAllocator instead of V8::PageAllocator (#26331) 2020-11-09 13:57:24 -08:00
javascript_environment.h
login_handler.cc
login_handler.h
microtasks_runner.cc refactor: use public node::CallbackScope where possible (#27001) 2020-12-15 11:39:25 -08:00
microtasks_runner.h
native_browser_view.cc refactor: remove native_browser_view web contents get function (#25526) 2020-09-21 10:39:58 -07:00
native_browser_view.h fix: draggable regions calculation in BrowserWindow/BrowserView (#26690) 2020-11-30 21:02:04 -08:00
native_browser_view_mac.h fix: draggable regions calculation in BrowserWindow/BrowserView (#26690) 2020-11-30 21:02:04 -08:00
native_browser_view_mac.mm fix: default offset when no drag regions (#27147) 2021-01-04 14:01:32 -08:00
native_browser_view_views.cc fix: unclickable regions in some draggable BrowserViews (#27143) 2021-01-04 11:22:14 -08:00
native_browser_view_views.h fix: draggable views on BrowserViews on Windows (#26738) 2020-12-01 15:03:00 -08:00
native_window.cc fix: make SetWindowButtonVisibility work for customButtonsOnHover (#27073) 2021-01-19 19:12:09 +09:00
native_window.h fix: make SetWindowButtonVisibility work for customButtonsOnHover (#27073) 2021-01-19 19:12:09 +09:00
native_window_mac.h fix: make SetWindowButtonVisibility work for customButtonsOnHover (#27073) 2021-01-19 19:12:09 +09:00
native_window_mac.mm fix: make SetWindowButtonVisibility work for customButtonsOnHover (#27073) 2021-01-19 19:12:09 +09:00
native_window_observer.h feat: add 'resized' event to BrowserWindow (#26216) 2020-11-11 19:27:24 -05:00
native_window_views.cc fix: prevent crash when keyboard event immediately precedes calling BrowserWindow.close() (#27315) 2021-01-19 11:37:21 +09:00
native_window_views.h fix: prevent crash when keyboard event immediately precedes calling BrowserWindow.close() (#27315) 2021-01-19 11:37:21 +09:00
native_window_views_win.cc fix: add check in IsMaximized for non-WS_THICKFRAME windows (#26586) 2020-12-01 15:27:58 +09:00
network_hints_handler_impl.cc
network_hints_handler_impl.h
pref_store_delegate.cc
pref_store_delegate.h
protocol_registry.cc chore: bump chromium to ec5bc1743792d64724693eb357083 (master) (#24984) 2020-09-21 01:00:36 -07:00
protocol_registry.h
relauncher.cc
relauncher.h
relauncher_linux.cc
relauncher_mac.cc
relauncher_win.cc
session_preferences.cc feat: add webContents.setWindowOpenHandler API (#24517) 2020-11-10 09:06:03 -08:00
session_preferences.h feat: add webContents.setWindowOpenHandler API (#24517) 2020-11-10 09:06:03 -08:00
special_storage_policy.cc
special_storage_policy.h
unresponsive_suppressor.cc
unresponsive_suppressor.h
web_contents_permission_helper.cc feat: add serial api support (#25237) 2020-09-28 12:22:03 -04:00
web_contents_permission_helper.h feat: add serial api support (#25237) 2020-09-28 12:22:03 -04:00
web_contents_preferences.cc feat: add webContents.setWindowOpenHandler API (#24517) 2020-11-10 09:06:03 -08:00
web_contents_preferences.h feat: add webContents.setWindowOpenHandler API (#24517) 2020-11-10 09:06:03 -08:00
web_contents_zoom_controller.cc refactor: Chromium code style for enum classes (#26165) 2020-10-27 10:51:45 -07:00
web_contents_zoom_controller.h refactor: Chromium code style for enum classes (#26165) 2020-10-27 10:51:45 -07:00
web_dialog_helper.cc fix: transparently package bundles as zip archives (#25030) 2020-10-27 17:05:28 -07:00
web_dialog_helper.h
web_view_guest_delegate.cc feat: add webContents.setWindowOpenHandler API (#24517) 2020-11-10 09:06:03 -08:00
web_view_guest_delegate.h chore: bump chromium to 6b9fa6b352d824d052222e1abe541 (master) (#25558) 2020-10-15 18:30:41 -07:00
web_view_manager.cc chore: bump chromium to 6b9fa6b352d824d052222e1abe541 (master) (#25558) 2020-10-15 18:30:41 -07:00
web_view_manager.h chore: bump chromium to 6b9fa6b352d824d052222e1abe541 (master) (#25558) 2020-10-15 18:30:41 -07:00
window_list.cc chore: bump chromium to 0e4ca9c0a63d7a39bd910997ad4c6 (master) (#24687) 2020-08-12 11:33:58 -07:00
window_list.h
window_list_observer.h
zoom_level_delegate.cc
zoom_level_delegate.h chore: bump chromium to 096e5313aaf19dfa0c4710145c34d (master) (#26535) 2020-12-14 10:57:36 -08:00