We weren't serializing nativeImages properly in the remote module, leading to gin conversion errors when trying to, for example, create a new context menu in the renderer with icons using nativeImage. This fixes that by adding a new special case to handle them.
There are use cases of webview where the container holding the webview is not
actually destroyed first, instead just webview gets removed from DOM, in such
situations the browser process map is not updated accordingly and holds reference
to stale guest contents, and any window operations like scroll, resize or keyboard
events that has to chain through browser embedder will lead to UAF crash.
Ref: https://github.com/microsoft/vscode/issues/92420
Prevent issues with menu creation and subsequent pane focus from menu bar by preventing menus from being created from an empty array. I can't conceive a valid use case for this, since if one wants to remove a menu they should be be passing null to win.setMenu() or calling win.removeMenu(). This issue is also specific to top-level menus, and not submenus, so the new check and exception is scoped to top-level menus.
* refactor: port window.open and window.opener to use ctx bridge instead of hole punching
* refactor: only run the isolated init bundle when webview is enabled
* test: add pre-change snapshot of new-window event
* move to .ts file for easier diff
* refactor: improve feature string parsing logic
* test: update snapshots
* update type names per review
* update comma-separated parse test
* use for loop instead of reduce per review
* tighten up types
* avoid variable guest contents id returnValue in test snapshot
* chore: add WebContentsView.webContents helper
* chore: no need to handle webContents option
* chore: Create WebContentsView in C++
* chore: make WebContentsView accept web_preferences
* fix: nativeWindowOpen still passes WebContents to BrowserWindow
* chore: no more need of WebContentsViewRelay
* test: WebContentsView now takes options
* fix: avoid creating 2 constructors
* chore: remove unused views API classes
* chore: remove LayoutManager code
* chore: no more need to make View inherit from TrackabeObject
* chore: make enable_view_api default to true
* chore: enable_view_api => enable_views_api
* fix: remove bad usages of for-in and guard against it
* Apply suggestions from code review
Co-Authored-By: Samuel Maddock <samuel.maddock@gmail.com>
* Apply suggestions from code review
Co-Authored-By: Jeremy Apthorp <jeremya@chromium.org>
* Update remote.js
Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
Co-authored-by: Jeremy Apthorp <jeremya@chromium.org>
* chore: add deprecation warning on setting app.allowRendererProcessReuse to false
* fix: no deprecation warnings in process reuse spec
* chore: add test for new deprecate removeProperty behavior
* feat: add API for receiving logs from service workers
* feat: add new serviceWorkerContext APIs
* chore: add missing #include's
* refactor: rename serviceWorkerContext to serviceWorkers
* chore: clean up based on review
* chore: remove native_mate
* chore: add tests for the service worker module
* Update spec-main/api-service-workers-spec.ts
Co-Authored-By: Jeremy Apthorp <jeremya@chromium.org>
* chore: fix linting
* chore: handle renames
Co-authored-by: Jeremy Apthorp <nornagon@nornagon.net>
* fix: remove cyclic references in BrowserWindow
* fix: prevent TopLevelWindow from garbage collection
* test: garbage collection of BrowserWindow
* chore: createIDWeakMap is used in tests
* docs: add references to app.whenReady() in isReady
* refactor: prefer app.whenReady()
In the docs, specs, and lib, replace instances of `app.once('ready')`
(seen occasionally) and `app.on('ready')` (extremely common) with
`app.whenReady()`.
It's better to encourage users to use whenReady():
1. it handles the edge case of registering for 'ready' after it's fired
2. it avoids the minor wart of leaving an active listener alive for
an event that wll never fire again
* fix: use powerMonitor.on() only after app is ready
powerMonitor can't be used until the app is ready; however, on Linux,
powerMonitor.on() was called as soon as lib/browser/api/power-monitor.ts
was loaded.
This patch takes @vladimiry's suggestion of wrapping that in an
app.on('ready') handler to prevent powerMonitor.on() from being called
prematurely.
Fixes#21716
* test: fix some failing and disabled node specs
These tests were failing due to mismatched stacktraces as a result of
our Module._load hook. This fixes those by adding a flag to optionally
not hook those calls and instead do the asar override eagily.
* ELECTRON_EAGER_ASAR_HOOK => ELECTRON_EAGER_ASAR_HOOK_FOR_TESTING
* test: parallel/test-zlib-unused-weak consistently fails
Co-authored-by: Cheng Zhao <zcbenz@github.com>