From 7291a0886d823497a994734fa92f34112f05b85d Mon Sep 17 00:00:00 2001 From: Nilay Arya <84241885+nilayarya@users.noreply.github.com> Date: Thu, 10 Jul 2025 21:36:36 +0530 Subject: [PATCH 001/268] feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr Co-authored-by: David Sanders Co-authored-by: Erick Zhao --- docs/api/structures/base-window-options.md | 4 +- .../structures/window-state-persistence.md | 4 + filenames.auto.gni | 1 + shell/browser/api/electron_api_base_window.cc | 4 +- shell/browser/browser_process_impl.cc | 5 +- shell/browser/native_window.cc | 95 ++++- shell/browser/native_window.h | 28 ++ shell/common/electron_constants.h | 17 + shell/common/options_switches.h | 13 + spec/api-browser-window-spec.ts | 340 ++++++++++++++++++ .../api/window-state-save/close-save/index.js | 27 ++ .../fullscreen-save/index.js | 28 ++ .../api/window-state-save/kiosk-save/index.js | 28 ++ .../window-state-save/maximize-save/index.js | 28 ++ .../window-state-save/minimize-save/index.js | 28 ++ .../api/window-state-save/move-save/index.js | 23 ++ .../window-state-save/resize-save/index.js | 23 ++ .../window-state-save/schema-check/index.js | 23 ++ .../work-area-primary/index.js | 41 +++ 19 files changed, 755 insertions(+), 5 deletions(-) create mode 100644 docs/api/structures/window-state-persistence.md create mode 100644 spec/fixtures/api/window-state-save/close-save/index.js create mode 100644 spec/fixtures/api/window-state-save/fullscreen-save/index.js create mode 100644 spec/fixtures/api/window-state-save/kiosk-save/index.js create mode 100644 spec/fixtures/api/window-state-save/maximize-save/index.js create mode 100644 spec/fixtures/api/window-state-save/minimize-save/index.js create mode 100644 spec/fixtures/api/window-state-save/move-save/index.js create mode 100644 spec/fixtures/api/window-state-save/resize-save/index.js create mode 100644 spec/fixtures/api/window-state-save/schema-check/index.js create mode 100644 spec/fixtures/api/window-state-save/work-area-primary/index.js diff --git a/docs/api/structures/base-window-options.md b/docs/api/structures/base-window-options.md index 375c6adc3b59b..5a2b73efb505d 100644 --- a/docs/api/structures/base-window-options.md +++ b/docs/api/structures/base-window-options.md @@ -42,6 +42,8 @@ Default is `false`. * `hiddenInMissionControl` boolean (optional) _macOS_ - Whether window should be hidden when the user toggles into mission control. * `kiosk` boolean (optional) - Whether the window is in kiosk mode. Default is `false`. +* `name` string (optional) - An identifier for the window that enables features such as state persistence. +* `windowStatePersistence` ([WindowStatePersistence](window-state-persistence.md) | boolean) (optional) - Configures or enables the persistence of window state (position, size, maximized state, etc.) across application restarts. Has no effect if window `name` is not provided. _Experimental_ * `title` string (optional) - Default window title. Default is `"Electron"`. If the HTML tag `` is defined in the HTML file loaded by `loadURL()`, this property will be ignored. * `icon` ([NativeImage](../native-image.md) | string) (optional) - The window icon. On Windows it is recommended to use `ICO` icons to get best visual effects, you can also @@ -91,7 +93,7 @@ title bar and a full size content window, the traffic light buttons will display when being hovered over in the top left of the window. **Note:** This option is currently experimental. -* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`. +* `titleBarOverlay` Object | boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`. * `color` String (optional) _Windows_ _Linux_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color. * `symbolColor` String (optional) _Windows_ _Linux_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color. * `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. Default is system height. diff --git a/docs/api/structures/window-state-persistence.md b/docs/api/structures/window-state-persistence.md new file mode 100644 index 0000000000000..efb02bb56d09f --- /dev/null +++ b/docs/api/structures/window-state-persistence.md @@ -0,0 +1,4 @@ +# WindowStatePersistence Object + +* `bounds` boolean (optional) - Whether to persist window position and size across application restarts. Defaults to `true` if not specified. +* `displayMode` boolean (optional) - Whether to persist display modes (fullscreen, kiosk, maximized, etc.) across application restarts. Defaults to `true` if not specified. diff --git a/filenames.auto.gni b/filenames.auto.gni index 6cf8661dd4f42..0f1757dcbf16b 100644 --- a/filenames.auto.gni +++ b/filenames.auto.gni @@ -163,6 +163,7 @@ auto_filenames = { "docs/api/structures/web-source.md", "docs/api/structures/window-open-handler-response.md", "docs/api/structures/window-session-end-event.md", + "docs/api/structures/window-state-persistence.md", ] sandbox_bundle_deps = [ diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index fd7ba60029bfc..e78c78fd7c74b 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -178,7 +178,7 @@ void BaseWindow::OnWindowClosed() { // We can not call Destroy here because we need to call Emit first, but we // also do not want any method to be used, so just mark as destroyed here. MarkDestroyed(); - + window_->FlushWindowState(); Emit("closed"); RemoveFromParentChildWindows(); @@ -267,6 +267,7 @@ void BaseWindow::OnWindowWillResize(const gfx::Rect& new_bounds, } void BaseWindow::OnWindowResize() { + window_->DebouncedSaveWindowState(); Emit("resize"); } @@ -282,6 +283,7 @@ void BaseWindow::OnWindowWillMove(const gfx::Rect& new_bounds, } void BaseWindow::OnWindowMove() { + window_->DebouncedSaveWindowState(); Emit("move"); } diff --git a/shell/browser/browser_process_impl.cc b/shell/browser/browser_process_impl.cc index 7c6cc917ed9a8..013f317993758 100644 --- a/shell/browser/browser_process_impl.cc +++ b/shell/browser/browser_process_impl.cc @@ -38,6 +38,7 @@ #include "services/device/public/cpp/geolocation/geolocation_system_permission_manager.h" #include "services/network/public/cpp/network_switches.h" #include "shell/browser/net/resolve_proxy_helper.h" +#include "shell/common/electron_constants.h" #include "shell/common/electron_paths.h" #include "shell/common/thread_restrictions.h" @@ -106,12 +107,12 @@ void BrowserProcessImpl::PostEarlyInitialization() { OSCrypt::RegisterLocalPrefs(pref_registry.get()); #endif + pref_registry->RegisterDictionaryPref(electron::kWindowStates); + in_memory_pref_store_ = base::MakeRefCounted<ValueMapPrefStore>(); ApplyProxyModeFromCommandLine(in_memory_pref_store()); prefs_factory.set_command_line_prefs(in_memory_pref_store()); - // Only use a persistent prefs store when cookie encryption is enabled as that - // is the only key that needs it base::FilePath prefs_path; CHECK(base::PathService::Get(electron::DIR_SESSION_DATA, &prefs_path)); prefs_path = prefs_path.Append(FILE_PATH_LITERAL("Local State")); diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index f69be2feb6051..502a0086602a9 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -10,22 +10,30 @@ #include "base/containers/contains.h" #include "base/memory/ptr_util.h" +#include "base/memory/raw_ptr.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" +#include "components/prefs/pref_service.h" +#include "components/prefs/scoped_user_pref_update.h" #include "content/public/browser/web_contents_user_data.h" #include "include/core/SkColor.h" #include "shell/browser/background_throttling_source.h" #include "shell/browser/browser.h" +#include "shell/browser/browser_process_impl.h" #include "shell/browser/draggable_region_provider.h" +#include "shell/browser/electron_browser_main_parts.h" #include "shell/browser/native_window_features.h" #include "shell/browser/ui/drag_util.h" #include "shell/browser/window_list.h" #include "shell/common/color_util.h" +#include "shell/common/electron_constants.h" #include "shell/common/gin_helper/dictionary.h" #include "shell/common/gin_helper/persistent_dictionary.h" #include "shell/common/options_switches.h" #include "ui/base/hit_test.h" #include "ui/compositor/compositor.h" +#include "ui/display/display.h" +#include "ui/display/screen.h" #include "ui/views/widget/widget.h" #if !BUILDFLAG(IS_MAC) @@ -114,6 +122,29 @@ NativeWindow::NativeWindow(const gin_helper::Dictionary& options, options.Get(options::kVibrancyType, &vibrancy_); #endif + options.Get(options::kName, &window_name_); + + if (gin_helper::Dictionary persistence_options; + options.Get(options::kWindowStatePersistence, &persistence_options)) { + // Other options will be parsed here in the future. + window_state_persistence_enabled_ = true; + } else if (bool flag; options.Get(options::kWindowStatePersistence, &flag)) { + window_state_persistence_enabled_ = flag; + } + + // Initialize prefs_ to save/restore window bounds if we have a valid window + // name and window state persistence is enabled. + if (window_state_persistence_enabled_ && !window_name_.empty()) { + if (auto* browser_process = + electron::ElectronBrowserMainParts::Get()->browser_process()) { + DCHECK(browser_process); + prefs_ = browser_process->local_state(); + } + } else if (window_state_persistence_enabled_ && window_name_.empty()) { + LOG(WARNING) << "Window state persistence enabled but no window name " + "provided. Window state will not be persisted."; + } + if (gin_helper::Dictionary dict; options.Get(options::ktitleBarOverlay, &dict)) { titlebar_overlay_ = true; @@ -242,7 +273,9 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) { SetBackgroundColor(background_color); SetTitle(options.ValueOrDefault(options::kTitle, Browser::Get()->GetName())); - + // TODO(nilayarya): Save window state after restoration logic is implemented + // here. + SaveWindowState(); // Then show it. if (options.ValueOrDefault(options::kShow, true)) Show(); @@ -793,6 +826,66 @@ bool NativeWindow::IsTranslucent() const { return false; } +void NativeWindow::DebouncedSaveWindowState() { + save_window_state_timer_.Start( + FROM_HERE, base::Milliseconds(200), + base::BindOnce(&NativeWindow::SaveWindowState, base::Unretained(this))); +} + +void NativeWindow::SaveWindowState() { + if (!prefs_ || window_name_.empty()) + return; + + ScopedDictPrefUpdate update(prefs_, electron::kWindowStates); + const base::Value::Dict* existing_prefs = update->FindDict(window_name_); + + gfx::Rect bounds = GetBounds(); + // When the window is in a special display mode (fullscreen, kiosk, or + // maximized), save the previously stored window bounds instead of + // the current bounds. This ensures that when the window is restored, it can + // be restored to its original position and size if display mode is not + // preserved via windowStatePersistence. + if (!IsNormal() && existing_prefs) { + std::optional<int> left = existing_prefs->FindInt(electron::kLeft); + std::optional<int> top = existing_prefs->FindInt(electron::kTop); + std::optional<int> right = existing_prefs->FindInt(electron::kRight); + std::optional<int> bottom = existing_prefs->FindInt(electron::kBottom); + + if (left && top && right && bottom) { + bounds = gfx::Rect(*left, *top, *right - *left, *bottom - *top); + } + } + + base::Value::Dict window_preferences; + window_preferences.Set(electron::kLeft, bounds.x()); + window_preferences.Set(electron::kTop, bounds.y()); + window_preferences.Set(electron::kRight, bounds.right()); + window_preferences.Set(electron::kBottom, bounds.bottom()); + + window_preferences.Set(electron::kMaximized, IsMaximized()); + window_preferences.Set(electron::kFullscreen, IsFullscreen()); + window_preferences.Set(electron::kKiosk, IsKiosk()); + + const display::Screen* screen = display::Screen::GetScreen(); + const display::Display display = screen->GetDisplayMatching(bounds); + gfx::Rect work_area = display.work_area(); + + window_preferences.Set(electron::kWorkAreaLeft, work_area.x()); + window_preferences.Set(electron::kWorkAreaTop, work_area.y()); + window_preferences.Set(electron::kWorkAreaRight, work_area.right()); + window_preferences.Set(electron::kWorkAreaBottom, work_area.bottom()); + + update->Set(window_name_, std::move(window_preferences)); +} + +void NativeWindow::FlushWindowState() { + if (save_window_state_timer_.IsRunning()) { + save_window_state_timer_.FireNow(); + } else { + SaveWindowState(); + } +} + // static bool NativeWindow::PlatformHasClientFrame() { #if defined(USE_OZONE) diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index 42a239a65b048..a3ae5e8e89ffd 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -18,6 +18,7 @@ #include "base/observer_list.h" #include "base/strings/cstring_view.h" #include "base/supports_user_data.h" +#include "base/timer/timer.h" #include "content/public/browser/desktop_media_id.h" #include "content/public/browser/web_contents_user_data.h" #include "extensions/browser/app_window/size_constraints.h" @@ -27,6 +28,7 @@ class SkRegion; class DraggableRegionProvider; +class PrefService; namespace input { struct NativeWebKeyboardEvent; @@ -429,6 +431,17 @@ class NativeWindow : public base::SupportsUserData, // throttling, then throttling in the `ui::Compositor` will be disabled. void UpdateBackgroundThrottlingState(); + // Saves current window state to the Local State JSON file in + // app.getPath('userData') via PrefService. + // This does NOT immediately write to disk - it updates the in-memory + // preference store and queues an asynchronous write operation. The actual + // disk write is batched and flushed later. + void SaveWindowState(); + void DebouncedSaveWindowState(); + // Flushes save_window_state_timer_ that was queued by + // DebouncedSaveWindowState. This does NOT flush the actual disk write. + void FlushWindowState(); + protected: friend class api::BrowserView; @@ -490,6 +503,10 @@ class NativeWindow : public base::SupportsUserData, static inline int32_t next_id_ = 0; const int32_t window_id_ = ++next_id_; + // Identifier for the window provided by the application. + // Used by Electron internally for features such as state persistence. + std::string window_name_; + // The "titleBarStyle" option. const TitleBarStyle title_bar_style_; @@ -548,6 +565,17 @@ class NativeWindow : public base::SupportsUserData, gfx::Rect overlay_rect_; + // The boolean parsing of the "windowStatePersistence" option + bool window_state_persistence_enabled_ = false; + + // PrefService is used to persist window bounds and state. + // Only populated when windowStatePersistence is enabled and window has a + // valid name. + raw_ptr<PrefService> prefs_ = nullptr; + + // Timer to debounce window state saving operations. + base::OneShotTimer save_window_state_timer_; + base::WeakPtrFactory<NativeWindow> weak_factory_{this}; }; diff --git a/shell/common/electron_constants.h b/shell/common/electron_constants.h index 2ddf98d25acf4..d8313e906a94d 100644 --- a/shell/common/electron_constants.h +++ b/shell/common/electron_constants.h @@ -21,6 +21,23 @@ inline constexpr std::string_view kDeviceVendorIdKey = "vendorId"; inline constexpr std::string_view kDeviceProductIdKey = "productId"; inline constexpr std::string_view kDeviceSerialNumberKey = "serialNumber"; +// Window state preference keys +inline constexpr std::string_view kLeft = "left"; +inline constexpr std::string_view kTop = "top"; +inline constexpr std::string_view kRight = "right"; +inline constexpr std::string_view kBottom = "bottom"; + +inline constexpr std::string_view kMaximized = "maximized"; +inline constexpr std::string_view kFullscreen = "fullscreen"; +inline constexpr std::string_view kKiosk = "kiosk"; + +inline constexpr std::string_view kWorkAreaLeft = "workAreaLeft"; +inline constexpr std::string_view kWorkAreaTop = "workAreaTop"; +inline constexpr std::string_view kWorkAreaRight = "workAreaRight"; +inline constexpr std::string_view kWorkAreaBottom = "workAreaBottom"; + +inline constexpr std::string_view kWindowStates = "windowStates"; + inline constexpr base::cstring_view kRunAsNode = "ELECTRON_RUN_AS_NODE"; // Per-profile UUID to distinguish global shortcut sessions for diff --git a/shell/common/options_switches.h b/shell/common/options_switches.h index b07313f033ec1..e6a7ca4ceb44b 100644 --- a/shell/common/options_switches.h +++ b/shell/common/options_switches.h @@ -107,6 +107,19 @@ inline constexpr std::string_view kFocusable = "focusable"; // The WebPreferences. inline constexpr std::string_view kWebPreferences = "webPreferences"; +// Window state persistence for BaseWindow +inline constexpr std::string_view kWindowStatePersistence = + "windowStatePersistence"; + +// Identifier for the window provided by the application +inline constexpr std::string_view kName = "name"; + +// Whether to save the window bounds +inline constexpr std::string_view kBounds = "bounds"; + +// Whether to save the window display mode +inline constexpr std::string_view kDisplayMode = "displayMode"; + // Add a vibrancy effect to the browser window inline constexpr std::string_view kVibrancyType = "vibrancy"; diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 326f098f78f5c..c2e0b7435592a 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -6984,4 +6984,344 @@ describe('BrowserWindow module', () => { expect(startPos).to.not.deep.equal(endPos); }); }); + + describe('windowStatePersistence', () => { + describe('save window state', () => { + const fixturesPath = path.resolve(__dirname, 'fixtures', 'api', 'window-state-save'); + const sharedUserDataPath = path.join(os.tmpdir(), 'electron-window-state-test'); + const sharedPreferencesPath = path.join(sharedUserDataPath, 'Local State'); + + const getWindowStateFromDisk = (windowName: string, preferencesPath: string) => { + if (!fs.existsSync(preferencesPath)) { + throw new Error(`Preferences file does not exist at path: ${preferencesPath}. Window state was not saved to disk.`); + } + const prefsContent = fs.readFileSync(preferencesPath, 'utf8'); + const prefs = JSON.parse(prefsContent); + return prefs?.windowStates?.[windowName] || null; + }; + + // Clean up before each test + beforeEach(() => { + if (fs.existsSync(sharedUserDataPath)) { + fs.rmSync(sharedUserDataPath, { recursive: true, force: true }); + } + }); + + describe('state saving after window operations', () => { + it('should save window state with required properties', async () => { + const appPath = path.join(fixturesPath, 'schema-check'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-window-state-schema', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-window-state-schema" does not exist'); + expect(savedState).to.have.property('left'); + expect(savedState).to.have.property('top'); + expect(savedState).to.have.property('right'); + expect(savedState).to.have.property('bottom'); + expect(savedState).to.have.property('maximized'); + expect(savedState).to.have.property('fullscreen'); + expect(savedState).to.have.property('kiosk'); + expect(savedState).to.have.property('workAreaLeft'); + expect(savedState).to.have.property('workAreaTop'); + expect(savedState).to.have.property('workAreaRight'); + expect(savedState).to.have.property('workAreaBottom'); + }); + + ifit(hasCapturableScreen())('should save window state after window is closed and app exit', async () => { + const appPath = path.join(fixturesPath, 'close-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-close-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-close-save" does not exist'); + expect(savedState.right - savedState.left).to.equal(400); + expect(savedState.bottom - savedState.top).to.equal(300); + expect(savedState.maximized).to.equal(false); + expect(savedState.fullscreen).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state after window is resized and app exit', async () => { + const appPath = path.join(fixturesPath, 'resize-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-resize-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-resize-save" does not exist'); + expect(savedState.right - savedState.left).to.equal(500); + expect(savedState.bottom - savedState.top).to.equal(400); + expect(savedState.maximized).to.equal(false); + expect(savedState.fullscreen).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state after window is moved and app exit', async () => { + const appPath = path.join(fixturesPath, 'move-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-move-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-move-save" does not exist'); + expect(savedState.left).to.equal(100); + expect(savedState.top).to.equal(150); + expect(savedState.maximized).to.equal(false); + expect(savedState.fullscreen).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state after window is fullscreened and app exit', async () => { + const appPath = path.join(fixturesPath, 'fullscreen-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-fullscreen-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-fullscreen-save" does not exist'); + expect(savedState.fullscreen).to.equal(true); + expect(savedState.maximized).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state after window is maximized and app exit', async () => { + const appPath = path.join(fixturesPath, 'maximize-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-maximize-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-maximize-save" does not exist'); + expect(savedState.maximized).to.equal(true); + expect(savedState.fullscreen).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state if in a minimized state and app exit', async () => { + const appPath = path.join(fixturesPath, 'minimize-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-minimize-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-minimize-save" does not exist'); + // Should save the bounds from before minimizing + expect(savedState.right - savedState.left).to.equal(400); + expect(savedState.bottom - savedState.top).to.equal(300); + expect(savedState.maximized).to.equal(false); + expect(savedState.fullscreen).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state after window is kiosked and app exit', async () => { + const appPath = path.join(fixturesPath, 'kiosk-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-kiosk-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-kiosk-save" does not exist'); + expect(savedState.kiosk).to.equal(true); + expect(savedState.fullscreen).to.equal(true); + expect(savedState.maximized).to.equal(false); + }); + }); + + describe('work area tests', () => { + ifit(hasCapturableScreen())('should save valid work area bounds', async () => { + const appPath = path.join(fixturesPath, 'schema-check'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-window-state-schema', sharedPreferencesPath); + + expect(savedState).to.not.be.null('window state with window name "test-window-state-schema" does not exist'); + expect(savedState.workAreaLeft).to.be.a('number'); + expect(savedState.workAreaTop).to.be.a('number'); + expect(savedState.workAreaRight).to.be.a('number'); + expect(savedState.workAreaBottom).to.be.a('number'); + + expect(savedState.workAreaLeft).to.be.lessThan(savedState.workAreaRight); + expect(savedState.workAreaTop).to.be.lessThan(savedState.workAreaBottom); + }); + + ifit(hasCapturableScreen())('should save work area bounds that contain the window bounds on primary display', async () => { + // Fixture will center the window on the primary display + const appPath = path.join(fixturesPath, 'work-area-primary'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-work-area-primary', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-work-area-primary" does not exist'); + + expect(savedState.left).to.be.greaterThanOrEqual(savedState.workAreaLeft); + expect(savedState.top).to.be.greaterThanOrEqual(savedState.workAreaTop); + expect(savedState.right).to.be.lessThanOrEqual(savedState.workAreaRight); + expect(savedState.bottom).to.be.lessThanOrEqual(savedState.workAreaBottom); + }); + }); + + describe('asynchronous batching behavior', () => { + let w: BrowserWindow; + const windowName = 'test-batching-behavior'; + const preferencesPath = path.join(app.getPath('userData'), 'Local State'); + + // Helper to get preferences file modification time + const getPrefsModTime = (): Date => { + try { + return fs.statSync(preferencesPath).mtime; + } catch { + throw new Error(`Test requires preferences file to exist at path: ${preferencesPath}.`); + } + }; + + // Helper to wait for file modification with 20 second default timeout + const waitForPrefsUpdate = async (initialModTime: Date, timeoutMs: number = 20000): Promise<void> => { + const startTime = Date.now(); + + while (true) { + const currentModTime = getPrefsModTime(); + + if (currentModTime > initialModTime) { + return; + } + + if (Date.now() - startTime > timeoutMs) { + throw new Error(`Window state was not flushed to disk within ${timeoutMs}ms`); + } + // Wait for 1 second before checking again + await setTimeout(1000); + } + }; + + const waitForPrefsFileCreation = async (preferencesPath: string) => { + while (!fs.existsSync(preferencesPath)) { + await setTimeout(1000); + } + }; + + beforeEach(async () => { + await setTimeout(2000); + w = new BrowserWindow({ + show: false, + width: 400, + height: 300, + name: windowName, + windowStatePersistence: true + }); + }); + + afterEach(closeAllWindows); + + it('should not immediately save window state to disk when window is moved/resized', async () => { + // Wait for preferences file to be created if its the first time we're running the test + await waitForPrefsFileCreation(preferencesPath); + + const initialModTime = getPrefsModTime(); + + const moved = once(w, 'move'); + w.setPosition(150, 200); + await moved; + // Wait for any potential save to occur from the move operation + await setTimeout(1000); + + const resized = once(w, 'resize'); + w.setSize(500, 400); + await resized; + // Wait for any potential save to occur from the resize operation + await setTimeout(1000); + + const afterMoveModTime = getPrefsModTime(); + + expect(afterMoveModTime.getTime()).to.equal(initialModTime.getTime()); + }); + + it('should eventually flush window state to disk after batching period', async () => { + // Wait for preferences file to be created if its the first time we're running the test + await waitForPrefsFileCreation(preferencesPath); + + const initialModTime = getPrefsModTime(); + + const resized = once(w, 'resize'); + w.setSize(500, 400); + await resized; + + await waitForPrefsUpdate(initialModTime); + + const savedState = getWindowStateFromDisk(windowName, preferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-batching-behavior" does not exist'); + expect(savedState.right - savedState.left).to.equal(500); + expect(savedState.bottom - savedState.top).to.equal(400); + }); + + it('should batch multiple window operations and save final state', async () => { + // Wait for preferences file to be created if its the first time we're running the test + await waitForPrefsFileCreation(preferencesPath); + + const initialModTime = getPrefsModTime(); + + const resize1 = once(w, 'resize'); + w.setSize(500, 400); + await resize1; + // Wait for any potential save to occur + await setTimeout(1000); + + const afterFirstResize = getPrefsModTime(); + + const resize2 = once(w, 'resize'); + w.setSize(600, 500); + await resize2; + // Wait for any potential save to occur + await setTimeout(1000); + + const afterSecondResize = getPrefsModTime(); + + const resize3 = once(w, 'resize'); + w.setSize(700, 600); + await resize3; + // Wait for any potential save to occur + await setTimeout(1000); + + const afterThirdResize = getPrefsModTime(); + + await waitForPrefsUpdate(initialModTime); + + const savedState = getWindowStateFromDisk(windowName, preferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-batching-behavior" does not exist'); + + [afterFirstResize, afterSecondResize, afterThirdResize].forEach(time => { + expect(time.getTime()).to.equal(initialModTime.getTime()); + }); + + expect(savedState.right - savedState.left).to.equal(700); + expect(savedState.bottom - savedState.top).to.equal(600); + }); + + it('should not save window bounds when main thread is busy', async () => { + // Wait for preferences file to be created if its the first time we're running the test + await waitForPrefsFileCreation(preferencesPath); + + const initialModTime = getPrefsModTime(); + + const moved = once(w, 'move'); + w.setPosition(100, 100); + await moved; + + const startTime = Date.now(); + + // Keep main thread busy for 25 seconds + while (Date.now() - startTime < 25000); + + const finalModTime = getPrefsModTime(); + + expect(finalModTime.getTime()).to.equal(initialModTime.getTime()); + }); + }); + }); + }); }); diff --git a/spec/fixtures/api/window-state-save/close-save/index.js b/spec/fixtures/api/window-state-save/close-save/index.js new file mode 100644 index 0000000000000..6dcd5e935f1cf --- /dev/null +++ b/spec/fixtures/api/window-state-save/close-save/index.js @@ -0,0 +1,27 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-close-save', + windowStatePersistence: true, + show: false + }); + + w.on('close', () => { + app.quit(); + }); + + w.close(); + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); diff --git a/spec/fixtures/api/window-state-save/fullscreen-save/index.js b/spec/fixtures/api/window-state-save/fullscreen-save/index.js new file mode 100644 index 0000000000000..bd2f2cbabb659 --- /dev/null +++ b/spec/fixtures/api/window-state-save/fullscreen-save/index.js @@ -0,0 +1,28 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-fullscreen-save', + windowStatePersistence: true + }); + + w.on('enter-full-screen', () => { + setTimeout(() => { + app.quit(); + }, 1000); + }); + + w.setFullScreen(true); + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); diff --git a/spec/fixtures/api/window-state-save/kiosk-save/index.js b/spec/fixtures/api/window-state-save/kiosk-save/index.js new file mode 100644 index 0000000000000..29f3b5f1675b4 --- /dev/null +++ b/spec/fixtures/api/window-state-save/kiosk-save/index.js @@ -0,0 +1,28 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-kiosk-save', + windowStatePersistence: true + }); + + w.on('enter-full-screen', () => { + setTimeout(() => { + app.quit(); + }, 1000); + }); + + w.setKiosk(true); + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); diff --git a/spec/fixtures/api/window-state-save/maximize-save/index.js b/spec/fixtures/api/window-state-save/maximize-save/index.js new file mode 100644 index 0000000000000..3e0dcd8915f52 --- /dev/null +++ b/spec/fixtures/api/window-state-save/maximize-save/index.js @@ -0,0 +1,28 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-maximize-save', + windowStatePersistence: true + }); + + w.on('maximize', () => { + setTimeout(() => { + app.quit(); + }, 1000); + }); + + w.maximize(); + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); diff --git a/spec/fixtures/api/window-state-save/minimize-save/index.js b/spec/fixtures/api/window-state-save/minimize-save/index.js new file mode 100644 index 0000000000000..36c7018abb464 --- /dev/null +++ b/spec/fixtures/api/window-state-save/minimize-save/index.js @@ -0,0 +1,28 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-minimize-save', + windowStatePersistence: true + }); + + w.on('minimize', () => { + setTimeout(() => { + app.quit(); + }, 1000); + }); + + w.minimize(); + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); diff --git a/spec/fixtures/api/window-state-save/move-save/index.js b/spec/fixtures/api/window-state-save/move-save/index.js new file mode 100644 index 0000000000000..56fb079b32741 --- /dev/null +++ b/spec/fixtures/api/window-state-save/move-save/index.js @@ -0,0 +1,23 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-move-save', + windowStatePersistence: true, + show: false + }); + + w.setPosition(100, 150); + + setTimeout(() => { + app.quit(); + }, 1000); +}); diff --git a/spec/fixtures/api/window-state-save/resize-save/index.js b/spec/fixtures/api/window-state-save/resize-save/index.js new file mode 100644 index 0000000000000..a25d399f657e7 --- /dev/null +++ b/spec/fixtures/api/window-state-save/resize-save/index.js @@ -0,0 +1,23 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(async () => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-resize-save', + windowStatePersistence: true, + show: false + }); + + w.setSize(500, 400); + + setTimeout(() => { + app.quit(); + }, 1000); +}); diff --git a/spec/fixtures/api/window-state-save/schema-check/index.js b/spec/fixtures/api/window-state-save/schema-check/index.js new file mode 100644 index 0000000000000..cad32f1e82636 --- /dev/null +++ b/spec/fixtures/api/window-state-save/schema-check/index.js @@ -0,0 +1,23 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-window-state-schema', + windowStatePersistence: true, + show: false + }); + + w.close(); + + setTimeout(() => { + app.quit(); + }, 1000); +}); diff --git a/spec/fixtures/api/window-state-save/work-area-primary/index.js b/spec/fixtures/api/window-state-save/work-area-primary/index.js new file mode 100644 index 0000000000000..4f7b0f86b7a6f --- /dev/null +++ b/spec/fixtures/api/window-state-save/work-area-primary/index.js @@ -0,0 +1,41 @@ +const { app, BrowserWindow, screen } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(async () => { + const primaryDisplay = screen.getPrimaryDisplay(); + const workArea = primaryDisplay.workArea; + + const maxWidth = Math.max(200, Math.floor(workArea.width * 0.8)); + const maxHeight = Math.max(150, Math.floor(workArea.height * 0.8)); + const windowWidth = Math.min(400, maxWidth); + const windowHeight = Math.min(300, maxHeight); + + const w = new BrowserWindow({ + width: windowWidth, + height: windowHeight, + name: 'test-work-area-primary', + windowStatePersistence: true + }); + + // Center the window on the primary display to prevent overflow + const centerX = workArea.x + Math.floor((workArea.width - windowWidth) / 2); + const centerY = workArea.y + Math.floor((workArea.height - windowHeight) / 2); + + w.setPosition(centerX, centerY); + + w.on('close', () => { + app.quit(); + }); + + w.close(); + + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); From e172bfbef5eaee0e933239c00dc4896a551b610a Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 16 Jul 2025 19:25:19 +0530 Subject: [PATCH 002/268] feat: restore window state --- shell/browser/native_window.cc | 154 +++++++++++++++++++++++++++++++-- shell/browser/native_window.h | 25 ++++++ 2 files changed, 173 insertions(+), 6 deletions(-) diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 502a0086602a9..37ea04bd632f4 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -126,10 +126,17 @@ NativeWindow::NativeWindow(const gin_helper::Dictionary& options, if (gin_helper::Dictionary persistence_options; options.Get(options::kWindowStatePersistence, &persistence_options)) { - // Other options will be parsed here in the future. + // Restore bounds by default + restore_bounds_ = true; + persistence_options.Get(options::kBounds, &restore_bounds_); + // Restore display mode by default + restore_display_mode_ = true; + persistence_options.Get(options::kDisplayMode, &restore_display_mode_); window_state_persistence_enabled_ = true; } else if (bool flag; options.Get(options::kWindowStatePersistence, &flag)) { window_state_persistence_enabled_ = flag; + restore_bounds_ = flag; + restore_display_mode_ = flag; } // Initialize prefs_ to save/restore window bounds if we have a valid window @@ -244,7 +251,15 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) { options.Get(options::kFullScreenable, &fullscreenable); SetFullScreenable(fullscreenable); - if (fullscreen) + // Restore window state (bounds and display mode) at this point in + // initialization. We deliberately restore bounds before display modes + // (fullscreen/kiosk) since the target display for these states depends on the + // window's initial bounds. Also, restoring here ensures we respect min/max + // width/height and fullscreenable constraints. + if (prefs_ && !window_name_.empty()) + RestoreWindowState(options); + + if (fullscreen && !restore_display_mode_) SetFullScreen(true); if (bool val; options.Get(options::kResizable, &val)) @@ -253,7 +268,8 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) { if (bool val; options.Get(options::kSkipTaskbar, &val)) SetSkipTaskbar(val); - if (bool val; options.Get(options::kKiosk, &val) && val) + if (bool val; + options.Get(options::kKiosk, &val) && val && !restore_display_mode_) SetKiosk(val); #if BUILDFLAG(IS_MAC) @@ -273,8 +289,8 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) { SetBackgroundColor(background_color); SetTitle(options.ValueOrDefault(options::kTitle, Browser::Get()->GetName())); - // TODO(nilayarya): Save window state after restoration logic is implemented - // here. + // Save updated window state after restoration adjustments are complete if + // any. SaveWindowState(); // Then show it. if (options.ValueOrDefault(options::kShow, true)) @@ -833,7 +849,7 @@ void NativeWindow::DebouncedSaveWindowState() { } void NativeWindow::SaveWindowState() { - if (!prefs_ || window_name_.empty()) + if (!prefs_ || window_name_.empty() || is_being_restored_) return; ScopedDictPrefUpdate update(prefs_, electron::kWindowStates); @@ -886,6 +902,132 @@ void NativeWindow::FlushWindowState() { } } +void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { + is_being_restored_ = true; + const base::Value& value = prefs_->GetValue(electron::kWindowStates); + const base::Value::Dict* window_preferences = + value.is_dict() ? value.GetDict().FindDict(window_name_) : nullptr; + + if (!window_preferences) { + is_being_restored_ = false; + return; + } + + if (restore_bounds_) { + RestoreBounds(*window_preferences); + } + + if (restore_display_mode_) { + RestoreDisplayMode(*window_preferences); + } + + is_being_restored_ = false; +} + +void NativeWindow::RestoreDisplayMode( + const base::Value::Dict& window_preferences) { + std::optional<bool> fullscreen = + window_preferences.FindBool(electron::kFullscreen); + std::optional<bool> maximized = + window_preferences.FindBool(electron::kMaximized); + std::optional<bool> kiosk = window_preferences.FindBool(electron::kKiosk); + + if (kiosk && *kiosk) { + SetKiosk(true); + } else if (fullscreen && *fullscreen) { + SetFullScreen(true); + } else if (maximized && *maximized) { + Maximize(); + } +} + +void NativeWindow::RestoreBounds(const base::Value::Dict& window_preferences) { + std::optional<int> saved_left = window_preferences.FindInt(electron::kLeft); + std::optional<int> saved_top = window_preferences.FindInt(electron::kTop); + std::optional<int> saved_right = window_preferences.FindInt(electron::kRight); + std::optional<int> saved_bottom = + window_preferences.FindInt(electron::kBottom); + + std::optional<int> work_area_left = + window_preferences.FindInt(electron::kWorkAreaLeft); + std::optional<int> work_area_top = + window_preferences.FindInt(electron::kWorkAreaTop); + std::optional<int> work_area_right = + window_preferences.FindInt(electron::kWorkAreaRight); + std::optional<int> work_area_bottom = + window_preferences.FindInt(electron::kWorkAreaBottom); + + if (!saved_left || !saved_top || !saved_right || !saved_bottom || + !work_area_left || !work_area_top || !work_area_right || + !work_area_bottom) { + return; + } + + gfx::Rect bounds = + gfx::Rect(*saved_left, *saved_top, *saved_right - *saved_left, + *saved_bottom - *saved_top); + + display::Screen* screen = display::Screen::GetScreen(); + const display::Display display = screen->GetDisplayMatching(bounds); + + gfx::Rect saved_work_area = gfx::Rect(*work_area_left, *work_area_top, + *work_area_right - *work_area_left, + *work_area_bottom - *work_area_top); + + AdjustBoundsToBeVisibleOnDisplay(display, saved_work_area, &bounds); + + SetBounds(bounds); +} + +void NativeWindow::AdjustBoundsToBeVisibleOnDisplay( + const display::Display& display, + const gfx::Rect& saved_work_area, + gfx::Rect* bounds) { + // Ensure that the window is at least kMinVisibleHeight * kMinVisibleWidth. + bounds->set_height(std::max(kMinVisibleHeight, bounds->height())); + bounds->set_width(std::max(kMinVisibleWidth, bounds->width())); + + const gfx::Rect work_area = display.work_area(); + // Ensure that the title bar is not above the work area. + if (bounds->y() < work_area.y()) { + bounds->set_y(work_area.y()); + } + + // Reposition and resize the bounds if the saved_work_area is different from + // the current work area and the current work area doesn't completely contain + // the bounds. + if (!saved_work_area.IsEmpty() && saved_work_area != work_area && + !work_area.Contains(*bounds)) { + bounds->AdjustToFit(work_area); + } + +#if BUILDFLAG(IS_MAC) + // On mac, we want to be aggressive about repositioning windows that are + // partially offscreen. If the window is partially offscreen horizontally, + // snap to the nearest edge of the work area. This call also adjusts the + // height, width if needed to make the window fully visible. + bounds->AdjustToFit(work_area); +#else + // On non-Mac platforms, we are less aggressive about repositioning. Simply + // ensure that at least kMinVisibleWidth * kMinVisibleHeight is visible + + const int min_y = work_area.y() + kMinVisibleHeight - bounds->height(); + const int min_x = work_area.x() + kMinVisibleWidth - bounds->width(); + const int max_y = work_area.bottom() - kMinVisibleHeight; + const int max_x = work_area.right() - kMinVisibleWidth; + // Reposition and resize the bounds to make it fully visible inside the work + // area if the work area and bounds are both small. + // `min_x >= max_x` happens when `work_area.width() + bounds.width() <= 2 * + // min_visible_width`. Similar for `min_y >= max_y` in height dimension. + if (min_x >= max_x || min_y >= max_y) { + bounds->AdjustToFit(work_area); + } else { + bounds->set_y(std::clamp(bounds->y(), min_y, max_y)); + bounds->set_x(std::clamp(bounds->x(), min_x, max_x)); + } +#endif // BUILDFLAG(IS_MAC) +} + // static bool NativeWindow::PlatformHasClientFrame() { #if defined(USE_OZONE) diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index a3ae5e8e89ffd..f0785e2f084a9 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -442,6 +442,18 @@ class NativeWindow : public base::SupportsUserData, // DebouncedSaveWindowState. This does NOT flush the actual disk write. void FlushWindowState(); + // Restores window state - bounds first and then display mode. + void RestoreWindowState(const gin_helper::Dictionary& options); + // Applies saved bounds to the window. + void RestoreBounds(const base::Value::Dict& window_preferences); + // Helper function to adjust window bounds to ensure visibility on the target + // display. + void AdjustBoundsToBeVisibleOnDisplay(const display::Display& display, + const gfx::Rect& saved_work_area, + gfx::Rect* bounds); + // Applies saved display mode (fullscreen, maximized, or kiosk) to the window. + void RestoreDisplayMode(const base::Value::Dict& window_preferences); + protected: friend class api::BrowserView; @@ -565,6 +577,9 @@ class NativeWindow : public base::SupportsUserData, gfx::Rect overlay_rect_; + // Flag to prevent SaveWindowState calls during window restoration. + bool is_being_restored_ = false; + // The boolean parsing of the "windowStatePersistence" option bool window_state_persistence_enabled_ = false; @@ -573,9 +588,19 @@ class NativeWindow : public base::SupportsUserData, // valid name. raw_ptr<PrefService> prefs_ = nullptr; + // Whether to restore bounds. + bool restore_bounds_; + // Whether to restore display mode. + bool restore_display_mode_; + // Timer to debounce window state saving operations. base::OneShotTimer save_window_state_timer_; + // Minimum height of the visible part of a window. + const int kMinVisibleHeight = 100; + // Minimum width of the visible part of a window. + const int kMinVisibleWidth = 100; + base::WeakPtrFactory<NativeWindow> weak_factory_{this}; }; From 9536459a0e4f2b328c0bab80ed5c474ba903a05c Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Mon, 21 Jul 2025 23:31:08 +0530 Subject: [PATCH 003/268] feat: flush display modes on show --- default_app/default_app.ts | 10 +++++- shell/browser/api/electron_api_base_window.cc | 1 + shell/browser/native_window.cc | 33 ++++++++++--------- shell/browser/native_window.h | 12 ++++--- 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/default_app/default_app.ts b/default_app/default_app.ts index 6cd280bb555c0..5db818c55f0bf 100644 --- a/default_app/default_app.ts +++ b/default_app/default_app.ts @@ -57,6 +57,12 @@ async function createWindow (backgroundColor?: string) { sandbox: true, nodeIntegration: false }, + name: 'default_app', + // windowStatePersistence: true, + windowStatePersistence: { + bounds: true, + displayMode: false + }, useContentSize: true, show: false }; @@ -66,7 +72,9 @@ async function createWindow (backgroundColor?: string) { } mainWindow = new BrowserWindow(options); - mainWindow.on('ready-to-show', () => mainWindow!.show()); + setTimeout(() => { + mainWindow!.show(); + }, 3000); mainWindow.webContents.setWindowOpenHandler(details => { shell.openExternal(decorateURL(details.url)); diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index e78c78fd7c74b..ebd5545c9af45 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -230,6 +230,7 @@ void BaseWindow::OnWindowFocus() { } void BaseWindow::OnWindowShow() { + window_->FlushPendingDisplayMode(); Emit("show"); } diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 37ea04bd632f4..63b37c2c74cbf 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -134,9 +134,9 @@ NativeWindow::NativeWindow(const gin_helper::Dictionary& options, persistence_options.Get(options::kDisplayMode, &restore_display_mode_); window_state_persistence_enabled_ = true; } else if (bool flag; options.Get(options::kWindowStatePersistence, &flag)) { - window_state_persistence_enabled_ = flag; restore_bounds_ = flag; restore_display_mode_ = flag; + window_state_persistence_enabled_ = flag; } // Initialize prefs_ to save/restore window bounds if we have a valid window @@ -918,26 +918,27 @@ void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { } if (restore_display_mode_) { - RestoreDisplayMode(*window_preferences); + restore_display_mode_callback_ = base::BindOnce( + [](NativeWindow* window, base::Value::Dict prefs) { + if (auto kiosk = prefs.FindBool(electron::kKiosk); kiosk && *kiosk) { + window->SetKiosk(true); + } else if (auto fs = prefs.FindBool(electron::kFullscreen); + fs && *fs) { + window->SetFullScreen(true); + } else if (auto max = prefs.FindBool(electron::kMaximized); + max && *max) { + window->Maximize(); + } + }, + base::Unretained(this), window_preferences->Clone()); } is_being_restored_ = false; } -void NativeWindow::RestoreDisplayMode( - const base::Value::Dict& window_preferences) { - std::optional<bool> fullscreen = - window_preferences.FindBool(electron::kFullscreen); - std::optional<bool> maximized = - window_preferences.FindBool(electron::kMaximized); - std::optional<bool> kiosk = window_preferences.FindBool(electron::kKiosk); - - if (kiosk && *kiosk) { - SetKiosk(true); - } else if (fullscreen && *fullscreen) { - SetFullScreen(true); - } else if (maximized && *maximized) { - Maximize(); +void NativeWindow::FlushPendingDisplayMode() { + if (restore_display_mode_callback_) { + std::move(restore_display_mode_callback_).Run(); } } diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index f0785e2f084a9..cec5240035739 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -451,8 +451,10 @@ class NativeWindow : public base::SupportsUserData, void AdjustBoundsToBeVisibleOnDisplay(const display::Display& display, const gfx::Rect& saved_work_area, gfx::Rect* bounds); - // Applies saved display mode (fullscreen, maximized, or kiosk) to the window. - void RestoreDisplayMode(const base::Value::Dict& window_preferences); + // Flushes pending display mode restoration (fullscreen, maximized, kiosk) + // that was deferred during initialization to respect show=false. This + // consumes and clears the restore_display_mode_callback_. + void FlushPendingDisplayMode(); protected: friend class api::BrowserView; @@ -589,9 +591,11 @@ class NativeWindow : public base::SupportsUserData, raw_ptr<PrefService> prefs_ = nullptr; // Whether to restore bounds. - bool restore_bounds_; + bool restore_bounds_ = false; // Whether to restore display mode. - bool restore_display_mode_; + bool restore_display_mode_ = false; + // Callback to restore display mode. + base::OnceCallback<void()> restore_display_mode_callback_; // Timer to debounce window state saving operations. base::OneShotTimer save_window_state_timer_; From 242d2138ae6541cd770073c5bf669a1bb379ab38 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Tue, 22 Jul 2025 19:13:07 +0530 Subject: [PATCH 004/268] refactor: move utility functions to common area --- spec/api-browser-window-spec.ts | 127 +++++++++++++++++--------------- 1 file changed, 69 insertions(+), 58 deletions(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index c2e0b7435592a..16a53906a06c7 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -6986,20 +6986,53 @@ describe('BrowserWindow module', () => { }); describe('windowStatePersistence', () => { + const getWindowStateFromDisk = (windowName: string, preferencesPath: string) => { + if (!fs.existsSync(preferencesPath)) { + throw new Error(`Preferences file does not exist at path: ${preferencesPath}. Window state was not saved to disk.`); + } + const prefsContent = fs.readFileSync(preferencesPath, 'utf8'); + const prefs = JSON.parse(prefsContent); + return prefs?.windowStates?.[windowName] || null; + }; + + // Helper to get preferences file modification time + const getPrefsModTime = (preferencesPath: string): Date => { + try { + return fs.statSync(preferencesPath).mtime; + } catch { + throw new Error(`Test requires preferences file to exist at path: ${preferencesPath}.`); + } + }; + + const waitForPrefsUpdate = async (initialModTime: Date, preferencesPath: string): Promise<void> => { + const startTime = Date.now(); + const timeoutMs = 20000; + while (true) { + const currentModTime = getPrefsModTime(preferencesPath); + + if (currentModTime > initialModTime) { + return; + } + + if (Date.now() - startTime > timeoutMs) { + throw new Error(`Window state was not flushed to disk within ${timeoutMs}ms`); + } + // Wait for 1 second before checking again + await setTimeout(1000); + } + }; + + const waitForPrefsFileCreation = async (preferencesPath: string) => { + while (!fs.existsSync(preferencesPath)) { + await setTimeout(1000); + } + }; + describe('save window state', () => { const fixturesPath = path.resolve(__dirname, 'fixtures', 'api', 'window-state-save'); const sharedUserDataPath = path.join(os.tmpdir(), 'electron-window-state-test'); const sharedPreferencesPath = path.join(sharedUserDataPath, 'Local State'); - const getWindowStateFromDisk = (windowName: string, preferencesPath: string) => { - if (!fs.existsSync(preferencesPath)) { - throw new Error(`Preferences file does not exist at path: ${preferencesPath}. Window state was not saved to disk.`); - } - const prefsContent = fs.readFileSync(preferencesPath, 'utf8'); - const prefs = JSON.parse(prefsContent); - return prefs?.windowStates?.[windowName] || null; - }; - // Clean up before each test beforeEach(() => { if (fs.existsSync(sharedUserDataPath)) { @@ -7171,49 +7204,27 @@ describe('BrowserWindow module', () => { const windowName = 'test-batching-behavior'; const preferencesPath = path.join(app.getPath('userData'), 'Local State'); - // Helper to get preferences file modification time - const getPrefsModTime = (): Date => { - try { - return fs.statSync(preferencesPath).mtime; - } catch { - throw new Error(`Test requires preferences file to exist at path: ${preferencesPath}.`); - } - }; - - // Helper to wait for file modification with 20 second default timeout - const waitForPrefsUpdate = async (initialModTime: Date, timeoutMs: number = 20000): Promise<void> => { - const startTime = Date.now(); - - while (true) { - const currentModTime = getPrefsModTime(); - - if (currentModTime > initialModTime) { - return; - } - - if (Date.now() - startTime > timeoutMs) { - throw new Error(`Window state was not flushed to disk within ${timeoutMs}ms`); - } - // Wait for 1 second before checking again - await setTimeout(1000); - } - }; - - const waitForPrefsFileCreation = async (preferencesPath: string) => { - while (!fs.existsSync(preferencesPath)) { - await setTimeout(1000); - } - }; - beforeEach(async () => { await setTimeout(2000); w = new BrowserWindow({ - show: false, - width: 400, - height: 300, name: windowName, - windowStatePersistence: true + windowStatePersistence: true, + show: false }); + // Ensure window bounds are set to 0,0 and 400x300 as windowStatePersistence + // overrides bounds during window construction and might cause tests to timeout + const bounds = w.getBounds(); + + if (bounds.width !== 400 && bounds.height !== 300) { + const resized = once(w, 'resize'); + w.setSize(400, 300); + await resized; + } + if (bounds.x !== 0 && bounds.y !== 0) { + const moved = once(w, 'move'); + w.setPosition(0, 0); + await moved; + } }); afterEach(closeAllWindows); @@ -7222,7 +7233,7 @@ describe('BrowserWindow module', () => { // Wait for preferences file to be created if its the first time we're running the test await waitForPrefsFileCreation(preferencesPath); - const initialModTime = getPrefsModTime(); + const initialModTime = getPrefsModTime(preferencesPath); const moved = once(w, 'move'); w.setPosition(150, 200); @@ -7236,7 +7247,7 @@ describe('BrowserWindow module', () => { // Wait for any potential save to occur from the resize operation await setTimeout(1000); - const afterMoveModTime = getPrefsModTime(); + const afterMoveModTime = getPrefsModTime(preferencesPath); expect(afterMoveModTime.getTime()).to.equal(initialModTime.getTime()); }); @@ -7245,13 +7256,13 @@ describe('BrowserWindow module', () => { // Wait for preferences file to be created if its the first time we're running the test await waitForPrefsFileCreation(preferencesPath); - const initialModTime = getPrefsModTime(); + const initialModTime = getPrefsModTime(preferencesPath); const resized = once(w, 'resize'); w.setSize(500, 400); await resized; - await waitForPrefsUpdate(initialModTime); + await waitForPrefsUpdate(initialModTime, preferencesPath); const savedState = getWindowStateFromDisk(windowName, preferencesPath); expect(savedState).to.not.be.null('window state with window name "test-batching-behavior" does not exist'); @@ -7263,7 +7274,7 @@ describe('BrowserWindow module', () => { // Wait for preferences file to be created if its the first time we're running the test await waitForPrefsFileCreation(preferencesPath); - const initialModTime = getPrefsModTime(); + const initialModTime = getPrefsModTime(preferencesPath); const resize1 = once(w, 'resize'); w.setSize(500, 400); @@ -7271,7 +7282,7 @@ describe('BrowserWindow module', () => { // Wait for any potential save to occur await setTimeout(1000); - const afterFirstResize = getPrefsModTime(); + const afterFirstResize = getPrefsModTime(preferencesPath); const resize2 = once(w, 'resize'); w.setSize(600, 500); @@ -7279,7 +7290,7 @@ describe('BrowserWindow module', () => { // Wait for any potential save to occur await setTimeout(1000); - const afterSecondResize = getPrefsModTime(); + const afterSecondResize = getPrefsModTime(preferencesPath); const resize3 = once(w, 'resize'); w.setSize(700, 600); @@ -7287,9 +7298,9 @@ describe('BrowserWindow module', () => { // Wait for any potential save to occur await setTimeout(1000); - const afterThirdResize = getPrefsModTime(); + const afterThirdResize = getPrefsModTime(preferencesPath); - await waitForPrefsUpdate(initialModTime); + await waitForPrefsUpdate(initialModTime, preferencesPath); const savedState = getWindowStateFromDisk(windowName, preferencesPath); expect(savedState).to.not.be.null('window state with window name "test-batching-behavior" does not exist'); @@ -7306,7 +7317,7 @@ describe('BrowserWindow module', () => { // Wait for preferences file to be created if its the first time we're running the test await waitForPrefsFileCreation(preferencesPath); - const initialModTime = getPrefsModTime(); + const initialModTime = getPrefsModTime(preferencesPath); const moved = once(w, 'move'); w.setPosition(100, 100); @@ -7317,7 +7328,7 @@ describe('BrowserWindow module', () => { // Keep main thread busy for 25 seconds while (Date.now() - startTime < 25000); - const finalModTime = getPrefsModTime(); + const finalModTime = getPrefsModTime(preferencesPath); expect(finalModTime.getTime()).to.equal(initialModTime.getTime()); }); From 0b8391e754bb8ee0cfb7749ce6cbb1a85d8fd59e Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 23 Jul 2025 04:43:50 +0530 Subject: [PATCH 005/268] feat: clear window state --- default_app/default_app.ts | 6 -- docs/api/base-window.md | 8 ++ lib/browser/api/browser-window.ts | 2 + shell/browser/api/electron_api_base_window.cc | 26 ++++++ shell/browser/api/electron_api_base_window.h | 4 + spec/api-browser-window-spec.ts | 87 +++++++++++++++---- 6 files changed, 111 insertions(+), 22 deletions(-) diff --git a/default_app/default_app.ts b/default_app/default_app.ts index 5db818c55f0bf..95eff7e9c6a94 100644 --- a/default_app/default_app.ts +++ b/default_app/default_app.ts @@ -57,12 +57,6 @@ async function createWindow (backgroundColor?: string) { sandbox: true, nodeIntegration: false }, - name: 'default_app', - // windowStatePersistence: true, - windowStatePersistence: { - bounds: true, - displayMode: false - }, useContentSize: true, show: false }; diff --git a/docs/api/base-window.md b/docs/api/base-window.md index e56530eed58e0..20b94be73ef2f 100644 --- a/docs/api/base-window.md +++ b/docs/api/base-window.md @@ -387,6 +387,14 @@ Returns `BaseWindow | null` - The window that is focused in this application, ot Returns `BaseWindow | null` - The window with the given `id`. +#### `BaseWindow.clearWindowState(windowName)` + +* `windowName` string - The window `name` to clear state for (see [BaseWindowConstructorOptions](structures/base-window-options.md)). + +Clears the saved state for a window with the given name. This removes all persisted window bounds, display mode, and work area information that was previously saved when `windowStatePersistence` was enabled. + +If the window name is empty or the window state doesn't exist, the method will log a warning. + ### Instance Properties Objects created with `new BaseWindow` have the following properties: diff --git a/lib/browser/api/browser-window.ts b/lib/browser/api/browser-window.ts index 909b442c3d27c..0b9b7c7abe512 100644 --- a/lib/browser/api/browser-window.ts +++ b/lib/browser/api/browser-window.ts @@ -111,6 +111,8 @@ BrowserWindow.getAllWindows = () => { return BaseWindow.getAllWindows().filter(isBrowserWindow) as any[] as BWT[]; }; +BrowserWindow.clearWindowState = BaseWindow.clearWindowState; + BrowserWindow.getFocusedWindow = () => { for (const window of BrowserWindow.getAllWindows()) { if (!window.isDestroyed() && window.webContents && !window.webContents.isDestroyed()) { diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index ebd5545c9af45..c07fcf50b5074 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -10,6 +10,7 @@ #include <vector> #include "base/task/single_thread_task_runner.h" +#include "components/prefs/scoped_user_pref_update.h" #include "content/public/common/color_parser.h" #include "electron/buildflags/buildflags.h" #include "gin/dictionary.h" @@ -17,9 +18,12 @@ #include "shell/browser/api/electron_api_menu.h" #include "shell/browser/api/electron_api_view.h" #include "shell/browser/api/electron_api_web_contents.h" +#include "shell/browser/browser_process_impl.h" +#include "shell/browser/electron_browser_main_parts.h" #include "shell/browser/javascript_environment.h" #include "shell/browser/native_window.h" #include "shell/common/color_util.h" +#include "shell/common/electron_constants.h" #include "shell/common/gin_converters/callback_converter.h" #include "shell/common/gin_converters/file_path_converter.h" #include "shell/common/gin_converters/gfx_converter.h" @@ -1117,6 +1121,27 @@ void BaseWindow::RemoveFromParentChildWindows() { parent->child_windows_.Remove(weak_map_id()); } +// static +void BaseWindow::ClearWindowState(const std::string& window_name) { + if (window_name.empty()) { + LOG(WARNING) << "Cannot clear window state: window name is empty"; + return; + } + + if (auto* browser_process = + electron::ElectronBrowserMainParts::Get()->browser_process()) { + DCHECK(browser_process); + if (auto* prefs = browser_process->local_state()) { + ScopedDictPrefUpdate update(prefs, electron::kWindowStates); + + if (!update->Remove(window_name)) { + LOG(WARNING) << "Window state '" << window_name + << "' not found, nothing to clear"; + } + } + } +} + // static gin_helper::WrappableBase* BaseWindow::New(gin_helper::Arguments* args) { auto options = gin_helper::Dictionary::CreateEmpty(args->isolate()); @@ -1314,6 +1339,7 @@ void Initialize(v8::Local<v8::Object> exports, .ToLocalChecked()); constructor.SetMethod("fromId", &BaseWindow::FromWeakMapID); constructor.SetMethod("getAllWindows", &BaseWindow::GetAll); + constructor.SetMethod("clearWindowState", &BaseWindow::ClearWindowState); gin_helper::Dictionary dict(isolate, exports); dict.Set("BaseWindow", constructor); diff --git a/shell/browser/api/electron_api_base_window.h b/shell/browser/api/electron_api_base_window.h index 103f33c357cbf..b3fa328a4d4eb 100644 --- a/shell/browser/api/electron_api_base_window.h +++ b/shell/browser/api/electron_api_base_window.h @@ -42,6 +42,10 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>, static void BuildPrototype(v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> prototype); + // Clears window state from the Local State JSON file in + // app.getPath('userData') via PrefService. + static void ClearWindowState(const std::string& window_name); + const NativeWindow* window() const { return window_.get(); } NativeWindow* window() { return window_.get(); } diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 16a53906a06c7..e478a8bdbc559 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -7206,25 +7206,14 @@ describe('BrowserWindow module', () => { beforeEach(async () => { await setTimeout(2000); + BrowserWindow.clearWindowState(windowName); w = new BrowserWindow({ + show: false, + width: 400, + height: 300, name: windowName, - windowStatePersistence: true, - show: false + windowStatePersistence: true }); - // Ensure window bounds are set to 0,0 and 400x300 as windowStatePersistence - // overrides bounds during window construction and might cause tests to timeout - const bounds = w.getBounds(); - - if (bounds.width !== 400 && bounds.height !== 300) { - const resized = once(w, 'resize'); - w.setSize(400, 300); - await resized; - } - if (bounds.x !== 0 && bounds.y !== 0) { - const moved = once(w, 'move'); - w.setPosition(0, 0); - await moved; - } }); afterEach(closeAllWindows); @@ -7334,5 +7323,71 @@ describe('BrowserWindow module', () => { }); }); }); + + describe('clear window state', () => { + const windowName = 'test-window-clear'; + const preferencesPath = path.join(app.getPath('userData'), 'Local State'); + + afterEach(closeAllWindows); + + it('should clear existing window state', async () => { + const initialModTime = getPrefsModTime(preferencesPath); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true + }); + w.close(); + + await waitForPrefsUpdate(initialModTime, preferencesPath); + + const stateBefore = getWindowStateFromDisk(windowName, preferencesPath); + expect(stateBefore).to.not.be.null('window state with window name "test-window-clear" should exist but does not'); + + BrowserWindow.clearWindowState(windowName); + + await waitForPrefsUpdate(initialModTime, preferencesPath); + + const stateAfter = getWindowStateFromDisk(windowName, preferencesPath); + expect(stateAfter).to.be.null('window state with window name "test-window-clear" should be cleared'); + }); + + it('should not throw when clearing non-existent window state', () => { + expect(() => { + BrowserWindow.clearWindowState('non-existent-window'); + }).to.not.throw(); + }); + + it('should not affect other window states when clearing specific window', async () => { + const windowName1 = 'test-window-1'; + const windowName2 = 'test-window-2'; + const initialModTime = getPrefsModTime(preferencesPath); + + const w1 = new BrowserWindow({ + name: windowName1, + windowStatePersistence: true + }); + w1.close(); + + const w2 = new BrowserWindow({ + name: windowName2, + windowStatePersistence: true + }); + w2.close(); + + await waitForPrefsUpdate(initialModTime, preferencesPath); + + expect(getWindowStateFromDisk(windowName1, preferencesPath)).to.not.be.null('window state with window name "test-window-1" should exist but does not'); + expect(getWindowStateFromDisk(windowName2, preferencesPath)).to.not.be.null('window state with window name "test-window-2" should exist but does not'); + + BrowserWindow.clearWindowState(windowName1); + + await waitForPrefsUpdate(initialModTime, preferencesPath); + + // Verify if only window1 was cleared + expect(getWindowStateFromDisk(windowName1, preferencesPath)).to.be.null('window state with window name "test-window-1" should be cleared'); + expect(getWindowStateFromDisk(windowName2, preferencesPath)).to.not.be.null('window state with window name "test-window-2" should not be cleared'); + }); + }); }); }); From 32b26d06fcdc76f4977eaceb03970efb2f030b2f Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 23 Jul 2025 05:23:34 +0530 Subject: [PATCH 006/268] fix: wait for the prefs to update --- default_app/default_app.ts | 4 +--- spec/api-browser-window-spec.ts | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/default_app/default_app.ts b/default_app/default_app.ts index 95eff7e9c6a94..86b748a743e36 100644 --- a/default_app/default_app.ts +++ b/default_app/default_app.ts @@ -66,9 +66,7 @@ async function createWindow (backgroundColor?: string) { } mainWindow = new BrowserWindow(options); - setTimeout(() => { - mainWindow!.show(); - }, 3000); + mainWindow.once('ready-to-show', () => mainWindow!.show()); mainWindow.webContents.setWindowOpenHandler(details => { shell.openExternal(decorateURL(details.url)); diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index e478a8bdbc559..1184bd97920cb 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -7346,7 +7346,7 @@ describe('BrowserWindow module', () => { BrowserWindow.clearWindowState(windowName); - await waitForPrefsUpdate(initialModTime, preferencesPath); + await waitForPrefsUpdate(getPrefsModTime(preferencesPath), preferencesPath); const stateAfter = getWindowStateFromDisk(windowName, preferencesPath); expect(stateAfter).to.be.null('window state with window name "test-window-clear" should be cleared'); @@ -7382,7 +7382,7 @@ describe('BrowserWindow module', () => { BrowserWindow.clearWindowState(windowName1); - await waitForPrefsUpdate(initialModTime, preferencesPath); + await waitForPrefsUpdate(getPrefsModTime(preferencesPath), preferencesPath); // Verify if only window1 was cleared expect(getWindowStateFromDisk(windowName1, preferencesPath)).to.be.null('window state with window name "test-window-1" should be cleared'); From fe1611d8da157ea83bf32971e91956d8501d7049 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 23 Jul 2025 07:37:49 +0530 Subject: [PATCH 007/268] test: clearWindowState extra test --- spec/api-browser-window-spec.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 1184bd97920cb..dfa5d94aa59ef 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -7352,6 +7352,37 @@ describe('BrowserWindow module', () => { expect(stateAfter).to.be.null('window state with window name "test-window-clear" should be cleared'); }); + it('should clear existing window state from memory immediately', async () => { + // Clean up from previous runs + BrowserWindow.clearWindowState(windowName); + await waitForPrefsUpdate(getPrefsModTime(preferencesPath), preferencesPath); + + const w = new BrowserWindow({ + height: 200, + width: 200, + name: windowName, + windowStatePersistence: true, + show: false + }); + + const closed = once(w, 'closed'); + w.close(); + await closed; + + BrowserWindow.clearWindowState(windowName); + + const w2 = new BrowserWindow({ + height: 100, + width: 100, + name: windowName, + windowStatePersistence: true, + show: false + }); + + expect(w2.getBounds().width).to.equal(100); + expect(w2.getBounds().height).to.equal(100); + }); + it('should not throw when clearing non-existent window state', () => { expect(() => { BrowserWindow.clearWindowState('non-existent-window'); From 5f7db53977a2e0c5a9ca8e326da9c3b4f617215f Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 23 Jul 2025 11:54:25 +0530 Subject: [PATCH 008/268] test: refine clear window state tests --- spec/api-browser-window-spec.ts | 34 +++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index dfa5d94aa59ef..484dbd06e4121 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -7328,6 +7328,13 @@ describe('BrowserWindow module', () => { const windowName = 'test-window-clear'; const preferencesPath = path.join(app.getPath('userData'), 'Local State'); + beforeEach(async () => { + // Timeout here plays nice with CI + await setTimeout(2000); + // Let's start with a clean slate everytime + BrowserWindow.clearWindowState(windowName); + }); + afterEach(closeAllWindows); it('should clear existing window state', async () => { @@ -7335,7 +7342,8 @@ describe('BrowserWindow module', () => { const w = new BrowserWindow({ name: windowName, - windowStatePersistence: true + windowStatePersistence: true, + show: false }); w.close(); @@ -7369,6 +7377,21 @@ describe('BrowserWindow module', () => { w.close(); await closed; + const w1 = new BrowserWindow({ + height: 200, + width: 200, + name: windowName, + windowStatePersistence: true, + show: false + }); + + expect(w1.getBounds().width).to.equal(200); + expect(w1.getBounds().height).to.equal(200); + + const close = once(w1, 'closed'); + w1.close(); + await close; + BrowserWindow.clearWindowState(windowName); const w2 = new BrowserWindow({ @@ -7378,7 +7401,8 @@ describe('BrowserWindow module', () => { windowStatePersistence: true, show: false }); - + // windowStatePersistence: true should override the constructor bounds if not cleared + // If the window has dimensions 100x100, it indicates that the state was cleared expect(w2.getBounds().width).to.equal(100); expect(w2.getBounds().height).to.equal(100); }); @@ -7396,13 +7420,15 @@ describe('BrowserWindow module', () => { const w1 = new BrowserWindow({ name: windowName1, - windowStatePersistence: true + windowStatePersistence: true, + show: false }); w1.close(); const w2 = new BrowserWindow({ name: windowName2, - windowStatePersistence: true + windowStatePersistence: true, + show: false }); w2.close(); From 9e1d47d461e46f7dd446f404bb45985a5a7e6740 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 23 Jul 2025 12:28:53 +0530 Subject: [PATCH 009/268] test: single monitor restore window tests chore: rebase on gsoc-2025 --- spec/api-browser-window-spec.ts | 384 +++++++++++++++++++++++++++++++- 1 file changed, 379 insertions(+), 5 deletions(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 484dbd06e4121..9baf06584f09b 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, net, protocol, screen, webContents, webFrameMain, session, WebContents, WebFrameMain } from 'electron/main'; +import { app, BrowserWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, net, protocol, screen, webContents, webFrameMain, session, WebContents, WebFrameMain, BrowserWindowConstructorOptions } from 'electron/main'; import { expect } from 'chai'; @@ -7361,10 +7361,6 @@ describe('BrowserWindow module', () => { }); it('should clear existing window state from memory immediately', async () => { - // Clean up from previous runs - BrowserWindow.clearWindowState(windowName); - await waitForPrefsUpdate(getPrefsModTime(preferencesPath), preferencesPath); - const w = new BrowserWindow({ height: 200, width: 200, @@ -7446,5 +7442,383 @@ describe('BrowserWindow module', () => { expect(getWindowStateFromDisk(windowName2, preferencesPath)).to.not.be.null('window state with window name "test-window-2" should not be cleared'); }); }); + + describe('restore window state', () => { + const preferencesPath = path.join(app.getPath('userData'), 'Local State'); + const windowName = 'test-restore-window'; + + const createAndSaveWindowState = async (options?: BrowserWindowConstructorOptions) => { + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: { + displayMode: false + }, + show: false, + ...options + }); + if (!fs.existsSync(preferencesPath)) { + // File doesn't exist, wait for creation + await waitForPrefsFileCreation(preferencesPath); + } else { + // File exists, wait for update + const initialModTime = getPrefsModTime(preferencesPath); + await waitForPrefsUpdate(initialModTime, preferencesPath); + } + // Ensure window is closed because we can't create another window with the same name + const closed = once(w, 'closed'); + w.close(); + await closed; + }; + + beforeEach(async () => { + // Timeout here plays nice with CI + await setTimeout(2000); + // Let's start with a clean slate everytime + BrowserWindow.clearWindowState(windowName); + }); + + afterEach(closeAllWindows); + + describe('single monitor tests', () => { + it('should restore bounds when windowStatePersistence is true', async () => { + const bounds = { width: 400, height: 300, x: 100, y: 150 }; + await createAndSaveWindowState(bounds); + // Should override default constructor bounds + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + width: 500, + height: 400, + x: 200, + y: 250, + show: false + }); + + expectBoundsEqual(w.getBounds(), bounds); + }); + + it('should use default window options when no saved state exists', async () => { + const defaultBounds = { width: 500, height: 400, x: 200, y: 250 }; + // BrowserWindow.clearWindowState(windowName) is called in beforeEach + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + ...defaultBounds, + show: false + }); + // Should take the default bounds from the constructor as there is no saved state + expectBoundsEqual(w.getBounds(), defaultBounds); + expect(w.isFullScreen()).to.equal(false); + expect(w.isMaximized()).to.equal(false); + }); + + it('should restore fullscreen state when windowStatePersistence is true', async () => { + await createAndSaveWindowState({ fullscreen: true }); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true + }); + + const enterFullScreen = once(w, 'enter-full-screen'); + if (!w.isFullScreen()) await enterFullScreen; + + expect(w.isFullScreen()).to.equal(true); + }); + + ifit(hasCapturableScreen())('should restore maximized state when windowStatePersistence is true', async () => { + const width = screen.getPrimaryDisplay().workArea.width; + const height = screen.getPrimaryDisplay().workArea.height; + await createAndSaveWindowState({ width, height }); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const maximized = once(w, 'maximize'); + if (!w.isMaximized()) await maximized; + + expect(w.isMaximized()).to.equal(true); + }); + + it('should not restore state when windowStatePersistence is false', async () => { + const bounds = { width: 400, height: 300, x: 100, y: 150 }; + await createAndSaveWindowState(bounds); + + const defaultBounds = { width: 500, height: 400, x: 200, y: 250 }; + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: false, + ...defaultBounds, + show: false + }); + + expectBoundsEqual(w.getBounds(), defaultBounds); + }); + + it('should restore bounds only when displayMode is disabled', async () => { + // We don't use the utility createAndSaveWindowState here because the default bounds + // passed through the constructor get affected by setting fullscreen: true alongside it. + // It particularly affects this test because we want to ensure initial bounds stay the same + // on restore. + const defaultBounds = { width: 500, height: 400, x: 200, y: 250 }; + const initialWindow = new BrowserWindow({ + ...defaultBounds, + show: false, + name: windowName, + windowStatePersistence: true + }); + + initialWindow.setFullScreen(true); + + const closed = once(initialWindow, 'closed'); + initialWindow.close(); + await closed; + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: { + displayMode: false + }, + show: false + }); + // We expect the bounds to restore to the values same as before the fullscreen state was set + expectBoundsEqual(w.getBounds(), defaultBounds); + expect(w.isFullScreen()).to.equal(false); + }); + + it('should restore display modes when bounds is disabled', async () => { + await createAndSaveWindowState({ fullscreen: true }); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: { + bounds: false + } + }); + + const enterFullScreen = once(w, 'enter-full-screen'); + if (!w.isFullScreen()) await enterFullScreen; + expect(w.isFullScreen()).to.equal(true); + }); + + it('should respect fullscreenable property', async () => { + await createAndSaveWindowState({ fullscreen: true }); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + fullscreenable: false, + show: false + }); + + expect(w.isFullScreen()).to.equal(false); + expect(w.isFullScreenable()).to.equal(false); + }); + + it('should respect minWidth and minHeight properly', async () => { + await createAndSaveWindowState({ width: 200, height: 200 }); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + minWidth: 400, + minHeight: 400, + show: false + }); + + const bounds = w.getBounds(); + expect(bounds.width).to.be.at.least(400); + expect(bounds.height).to.be.at.least(400); + }); + + it('should respect maxWidth and maxHeight properly', async () => { + await createAndSaveWindowState({ width: 800, height: 800 }); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + maxWidth: 400, + maxHeight: 400, + show: false + }); + + const bounds = w.getBounds(); + expect(bounds.width).to.be.at.most(400); + expect(bounds.height).to.be.at.most(400); + }); + + it('should restore correct state for each named window independently - multi window check', async () => { + const window1Name = 'test-window-1'; + const window2Name = 'test-window-2'; + + // Clear any existing state + BrowserWindow.clearWindowState(window1Name); + BrowserWindow.clearWindowState(window2Name); + + // Create and save different states for each window + await waitForPrefsFileCreation(preferencesPath); + const initialModTime = getPrefsModTime(preferencesPath); + + const bounds1 = { width: 300, height: 200, x: 50, y: 75 }; + const w1 = new BrowserWindow({ + name: window1Name, + windowStatePersistence: true, + ...bounds1, + show: false + }); + const closed1 = once(w1, 'closed'); + + const bounds2 = { width: 500, height: 400, x: 150, y: 200 }; + const w2 = new BrowserWindow({ + name: window2Name, + windowStatePersistence: true, + ...bounds2, + show: false + }); + const closed2 = once(w2, 'closed'); + + w1.close(); + w2.close(); + await closed1; + await closed2; + + await waitForPrefsUpdate(initialModTime, preferencesPath); + + const restored1 = new BrowserWindow({ + name: window1Name, + windowStatePersistence: true, + show: false + }); + + const restored2 = new BrowserWindow({ + name: window2Name, + windowStatePersistence: true, + show: false + }); + + expectBoundsEqual(restored1.getBounds(), bounds1); + expectBoundsEqual(restored2.getBounds(), bounds2); + + restored1.destroy(); + restored2.destroy(); + }); + + ifit(hasCapturableScreen())('should adjust restored bounds if they overflow current work area entirely', async () => { + const workArea = screen.getPrimaryDisplay().workArea; + // Completely off-screen to the right + const offscreenBounds = { + width: 400, + height: 300, + x: workArea.x + workArea.width + 100, + y: workArea.y + workArea.height + 100 + }; + + await createAndSaveWindowState(offscreenBounds); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const bounds = w.getBounds(); + + // Window should be moved to be entirely visible + expect(bounds.x + bounds.width).to.be.at.most(workArea.x + workArea.width); + expect(bounds.y + bounds.height).to.be.at.most(workArea.y + workArea.height); + expect(bounds.x).to.be.at.least(workArea.x); + expect(bounds.y).to.be.at.least(workArea.y); + expect(bounds.width).to.equal(400); + expect(bounds.height).to.equal(300); + }); + + ifit(hasCapturableScreen() && process.platform === 'darwin')('should adjust bounds if window overflows work area such that the window is entirely visible', async () => { + const workArea = screen.getPrimaryDisplay().workArea; + const overflowBounds = { + width: 400, + height: 300, + x: workArea.x + workArea.width - 200, + y: workArea.y + workArea.height - 150 + }; + + await createAndSaveWindowState(overflowBounds); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const bounds = w.getBounds(); + + // On macOS, window should be adjusted to be entirely visible + expect(bounds.x + bounds.width).to.be.at.most(workArea.x + workArea.width); + expect(bounds.y + bounds.height).to.be.at.most(workArea.y + workArea.height); + expect(bounds.width).to.equal(400); + expect(bounds.height).to.equal(300); + }); + + ifit(hasCapturableScreen() && process.platform !== 'darwin')('should adjust bounds if window overflows work area such that the window has minimum visible height/width 100x100', async () => { + const workArea = screen.getPrimaryDisplay().workArea; + // Initialize with 50x50 of the window visible + const overflowBounds = { + width: 400, + height: 300, + x: workArea.x + workArea.width - 50, + y: workArea.y + workArea.height - 50 + }; + + await createAndSaveWindowState(overflowBounds); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const bounds = w.getBounds(); + // Calculate the boundaries of the visible intersection rectangle + const leftMost = Math.max(bounds.x, workArea.x); + const rightMost = Math.min(bounds.x + bounds.width, workArea.x + workArea.width); + const topMost = Math.max(bounds.y, workArea.y); + const bottomMost = Math.min(bounds.y + bounds.height, workArea.y + workArea.height); + // On non-macOS platforms, at least 100x100 should be visible + const visibleWidth = rightMost - leftMost; + const visibleHeight = bottomMost - topMost; + + expect(visibleWidth).to.be.at.least(100); + expect(visibleHeight).to.be.at.least(100); + expect(bounds.width).to.equal(400); + expect(bounds.height).to.equal(300); + }); + + it('should respect show:false when restoring display modes', async () => { + await createAndSaveWindowState({ fullscreen: true }); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const shown = once(w, 'show'); + const enterFullScreen = once(w, 'enter-full-screen'); + + await setTimeout(2000); + expect(w.isVisible()).to.equal(false); + + w.show(); + await shown; + expect(w.isVisible()).to.equal(true); + + // Fullscreen state should still be restored correctly + if (!w.isFullScreen()) await enterFullScreen; + expect(w.isFullScreen()).to.equal(true); + }); + }); + }); }); }); From c157c444781cc65ff3e8c02dce1ad8c03c29dbda Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 23 Jul 2025 21:11:40 +0530 Subject: [PATCH 010/268] refactor: refine clearWindowState test --- spec/api-browser-window-spec.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 9baf06584f09b..4aee172a92933 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -7658,10 +7658,6 @@ describe('BrowserWindow module', () => { BrowserWindow.clearWindowState(window1Name); BrowserWindow.clearWindowState(window2Name); - // Create and save different states for each window - await waitForPrefsFileCreation(preferencesPath); - const initialModTime = getPrefsModTime(preferencesPath); - const bounds1 = { width: 300, height: 200, x: 50, y: 75 }; const w1 = new BrowserWindow({ name: window1Name, @@ -7685,7 +7681,14 @@ describe('BrowserWindow module', () => { await closed1; await closed2; - await waitForPrefsUpdate(initialModTime, preferencesPath); + if (!fs.existsSync(preferencesPath)) { + // File doesn't exist, wait for creation + await waitForPrefsFileCreation(preferencesPath); + } else { + // File exists, wait for update + const initialModTime = getPrefsModTime(preferencesPath); + await waitForPrefsUpdate(initialModTime, preferencesPath); + } const restored1 = new BrowserWindow({ name: window1Name, From 7d31f0c0b226a0c4ce746045039f9ec8677a00b9 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 23 Jul 2025 21:59:12 +0530 Subject: [PATCH 011/268] fix: revert default_app back to original --- default_app/default_app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default_app/default_app.ts b/default_app/default_app.ts index 86b748a743e36..6cd280bb555c0 100644 --- a/default_app/default_app.ts +++ b/default_app/default_app.ts @@ -66,7 +66,7 @@ async function createWindow (backgroundColor?: string) { } mainWindow = new BrowserWindow(options); - mainWindow.once('ready-to-show', () => mainWindow!.show()); + mainWindow.on('ready-to-show', () => mainWindow!.show()); mainWindow.webContents.setWindowOpenHandler(details => { shell.openExternal(decorateURL(details.url)); From 8a92e1317d826a1d6403e5dd0b25cbc623f5ffd2 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 23 Jul 2025 22:00:01 +0530 Subject: [PATCH 012/268] docs: add comment linking AdjustBoundsToBeVisibleOnDisplay to Chromium code --- shell/browser/native_window.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 63b37c2c74cbf..547ad21cc88b3 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -979,7 +979,8 @@ void NativeWindow::RestoreBounds(const base::Value::Dict& window_preferences) { SetBounds(bounds); } - +// This function is similar to Chromium's window bounds adjustment logic +// https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/window_sizer/window_sizer.cc;l=368;drc=0ec56065ba588552f21633aa47280ba02c3cd160#:~:text=349-,350,-351 void NativeWindow::AdjustBoundsToBeVisibleOnDisplay( const display::Display& display, const gfx::Rect& saved_work_area, From d3fbf179f9b9156b0ace92f25a1d676d4230f5d4 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 23 Jul 2025 22:27:33 +0530 Subject: [PATCH 013/268] fix: add correct permalink --- shell/browser/native_window.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 547ad21cc88b3..03c609b453342 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -980,7 +980,7 @@ void NativeWindow::RestoreBounds(const base::Value::Dict& window_preferences) { SetBounds(bounds); } // This function is similar to Chromium's window bounds adjustment logic -// https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/window_sizer/window_sizer.cc;l=368;drc=0ec56065ba588552f21633aa47280ba02c3cd160#:~:text=349-,350,-351 +// https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/window_sizer/window_sizer.cc;l=350;drc=0ec56065ba588552f21633aa47280ba02c3cd160 void NativeWindow::AdjustBoundsToBeVisibleOnDisplay( const display::Display& display, const gfx::Rect& saved_work_area, From c08ccb0672e8368ac7cfbd6e0c65f9f413bb2a18 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Thu, 24 Jul 2025 05:40:22 +0530 Subject: [PATCH 014/268] refactor: ci friendly --- spec/api-browser-window-spec.ts | 165 ++++++++++++++++++++------------ 1 file changed, 103 insertions(+), 62 deletions(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 4aee172a92933..6c7c651b50bcf 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -7345,7 +7345,7 @@ describe('BrowserWindow module', () => { windowStatePersistence: true, show: false }); - w.close(); + w.destroy(); await waitForPrefsUpdate(initialModTime, preferencesPath); @@ -7362,45 +7362,42 @@ describe('BrowserWindow module', () => { it('should clear existing window state from memory immediately', async () => { const w = new BrowserWindow({ - height: 200, - width: 200, + height: 100, + width: 100, name: windowName, windowStatePersistence: true, show: false }); - const closed = once(w, 'closed'); - w.close(); - await closed; + w.destroy(); const w1 = new BrowserWindow({ - height: 200, - width: 200, name: windowName, windowStatePersistence: true, show: false }); - expect(w1.getBounds().width).to.equal(200); - expect(w1.getBounds().height).to.equal(200); + // This proves that the window state exists in memory + expect(w1.getBounds().width).to.equal(100); + expect(w1.getBounds().height).to.equal(100); - const close = once(w1, 'closed'); - w1.close(); - await close; + w1.destroy(); BrowserWindow.clearWindowState(windowName); const w2 = new BrowserWindow({ - height: 100, - width: 100, + height: 200, + width: 200, name: windowName, windowStatePersistence: true, show: false }); // windowStatePersistence: true should override the constructor bounds if not cleared - // If the window has dimensions 100x100, it indicates that the state was cleared - expect(w2.getBounds().width).to.equal(100); - expect(w2.getBounds().height).to.equal(100); + // If the window has dimensions 200x200, it indicates that the state was indeed cleared + expect(w2.getBounds().width).to.equal(200); + expect(w2.getBounds().height).to.equal(200); + + w2.destroy(); }); it('should not throw when clearing non-existent window state', () => { @@ -7419,14 +7416,14 @@ describe('BrowserWindow module', () => { windowStatePersistence: true, show: false }); - w1.close(); + w1.destroy(); const w2 = new BrowserWindow({ name: windowName2, windowStatePersistence: true, show: false }); - w2.close(); + w2.destroy(); await waitForPrefsUpdate(initialModTime, preferencesPath); @@ -7464,10 +7461,8 @@ describe('BrowserWindow module', () => { const initialModTime = getPrefsModTime(preferencesPath); await waitForPrefsUpdate(initialModTime, preferencesPath); } - // Ensure window is closed because we can't create another window with the same name - const closed = once(w, 'closed'); - w.close(); - await closed; + // Ensure window is destroyed because we can't create another window with the same name otherwise + w.destroy(); }; beforeEach(async () => { @@ -7480,8 +7475,12 @@ describe('BrowserWindow module', () => { afterEach(closeAllWindows); describe('single monitor tests', () => { - it('should restore bounds when windowStatePersistence is true', async () => { - const bounds = { width: 400, height: 300, x: 100, y: 150 }; + // Window state restoration takes into account current work area bounds to readjust height/width + // height and width will be readjusted to kMinimumVisibleWidth*kMinimumVisibleHeight (100x100) + // if there is no capturable screen + ifit(hasCapturableScreen())('should restore bounds when windowStatePersistence is true', async () => { + const workArea = screen.getPrimaryDisplay().workArea; + const bounds = { width: 100, height: 100, x: workArea.x, y: workArea.y }; await createAndSaveWindowState(bounds); // Should override default constructor bounds const w = new BrowserWindow({ @@ -7495,6 +7494,8 @@ describe('BrowserWindow module', () => { }); expectBoundsEqual(w.getBounds(), bounds); + + w.destroy(); }); it('should use default window options when no saved state exists', async () => { @@ -7510,11 +7511,29 @@ describe('BrowserWindow module', () => { expectBoundsEqual(w.getBounds(), defaultBounds); expect(w.isFullScreen()).to.equal(false); expect(w.isMaximized()).to.equal(false); + + w.destroy(); }); - it('should restore fullscreen state when windowStatePersistence is true', async () => { + ifit(hasCapturableScreen())('should restore fullscreen state when windowStatePersistence is true', async () => { await createAndSaveWindowState({ fullscreen: true }); + await setTimeout(2000); + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true + }); + + const enterFullScreen = once(w, 'enter-full-screen'); + if (!w.isFullScreen()) await enterFullScreen; + + expect(w.isFullScreen()).to.equal(true); + + w.destroy(); + }); + ifit(hasCapturableScreen())('should restore kiosk state when windowStatePersistence is true', async () => { + await createAndSaveWindowState({ kiosk: true }); + await setTimeout(2000); const w = new BrowserWindow({ name: windowName, windowStatePersistence: true @@ -7524,6 +7543,9 @@ describe('BrowserWindow module', () => { if (!w.isFullScreen()) await enterFullScreen; expect(w.isFullScreen()).to.equal(true); + expect(w.isKiosk()).to.equal(true); + + w.destroy(); }); ifit(hasCapturableScreen())('should restore maximized state when windowStatePersistence is true', async () => { @@ -7541,6 +7563,8 @@ describe('BrowserWindow module', () => { if (!w.isMaximized()) await maximized; expect(w.isMaximized()).to.equal(true); + + w.destroy(); }); it('should not restore state when windowStatePersistence is false', async () => { @@ -7556,26 +7580,28 @@ describe('BrowserWindow module', () => { }); expectBoundsEqual(w.getBounds(), defaultBounds); + + w.destroy(); }); - it('should restore bounds only when displayMode is disabled', async () => { + ifit(hasCapturableScreen())('should restore bounds only when displayMode is disabled', async () => { // We don't use the utility createAndSaveWindowState here because the default bounds // passed through the constructor get affected by setting fullscreen: true alongside it. // It particularly affects this test because we want to ensure initial bounds stay the same // on restore. - const defaultBounds = { width: 500, height: 400, x: 200, y: 250 }; + const workArea = screen.getPrimaryDisplay().workArea; + const defaultBounds = { width: 100, height: 100, x: workArea.x, y: workArea.y }; const initialWindow = new BrowserWindow({ ...defaultBounds, show: false, name: windowName, windowStatePersistence: true }); - + const enterFullScreen = once(initialWindow, 'enter-full-screen'); initialWindow.setFullScreen(true); + if (!initialWindow.isFullScreen()) await enterFullScreen; - const closed = once(initialWindow, 'closed'); - initialWindow.close(); - await closed; + initialWindow.destroy(); const w = new BrowserWindow({ name: windowName, @@ -7587,11 +7613,13 @@ describe('BrowserWindow module', () => { // We expect the bounds to restore to the values same as before the fullscreen state was set expectBoundsEqual(w.getBounds(), defaultBounds); expect(w.isFullScreen()).to.equal(false); + + w.destroy(); }); - it('should restore display modes when bounds is disabled', async () => { + ifit(hasCapturableScreen())('should restore display modes when bounds is disabled', async () => { await createAndSaveWindowState({ fullscreen: true }); - + await setTimeout(2000); const w = new BrowserWindow({ name: windowName, windowStatePersistence: { @@ -7602,9 +7630,11 @@ describe('BrowserWindow module', () => { const enterFullScreen = once(w, 'enter-full-screen'); if (!w.isFullScreen()) await enterFullScreen; expect(w.isFullScreen()).to.equal(true); + + w.destroy(); }); - it('should respect fullscreenable property', async () => { + ifit(hasCapturableScreen())('should respect fullscreenable property', async () => { await createAndSaveWindowState({ fullscreen: true }); const w = new BrowserWindow({ @@ -7613,9 +7643,13 @@ describe('BrowserWindow module', () => { fullscreenable: false, show: false }); + // Wait for the window to potentially enter fullscreen + await setTimeout(2000); expect(w.isFullScreen()).to.equal(false); expect(w.isFullScreenable()).to.equal(false); + + w.destroy(); }); it('should respect minWidth and minHeight properly', async () => { @@ -7650,7 +7684,7 @@ describe('BrowserWindow module', () => { expect(bounds.height).to.be.at.most(400); }); - it('should restore correct state for each named window independently - multi window check', async () => { + ifit(hasCapturableScreen())('should restore correct state for each named window independently - multi window check', async () => { const window1Name = 'test-window-1'; const window2Name = 'test-window-2'; @@ -7658,28 +7692,27 @@ describe('BrowserWindow module', () => { BrowserWindow.clearWindowState(window1Name); BrowserWindow.clearWindowState(window2Name); - const bounds1 = { width: 300, height: 200, x: 50, y: 75 }; + const workArea = screen.getPrimaryDisplay().workArea; + + const bounds1 = { width: 100, height: 100, x: workArea.x, y: workArea.y }; const w1 = new BrowserWindow({ name: window1Name, windowStatePersistence: true, ...bounds1, show: false }); - const closed1 = once(w1, 'closed'); - const bounds2 = { width: 500, height: 400, x: 150, y: 200 }; + w1.destroy(); + + const bounds2 = { width: 120, height: 100, x: workArea.x, y: workArea.y }; const w2 = new BrowserWindow({ name: window2Name, windowStatePersistence: true, ...bounds2, show: false }); - const closed2 = once(w2, 'closed'); - w1.close(); - w2.close(); - await closed1; - await closed2; + w2.destroy(); if (!fs.existsSync(preferencesPath)) { // File doesn't exist, wait for creation @@ -7713,10 +7746,10 @@ describe('BrowserWindow module', () => { const workArea = screen.getPrimaryDisplay().workArea; // Completely off-screen to the right const offscreenBounds = { - width: 400, - height: 300, - x: workArea.x + workArea.width + 100, - y: workArea.y + workArea.height + 100 + width: 100, + height: 100, + x: workArea.x + workArea.width + 10, + y: workArea.y + workArea.height + 10 }; await createAndSaveWindowState(offscreenBounds); @@ -7734,17 +7767,19 @@ describe('BrowserWindow module', () => { expect(bounds.y + bounds.height).to.be.at.most(workArea.y + workArea.height); expect(bounds.x).to.be.at.least(workArea.x); expect(bounds.y).to.be.at.least(workArea.y); - expect(bounds.width).to.equal(400); - expect(bounds.height).to.equal(300); + expect(bounds.width).to.equal(100); + expect(bounds.height).to.equal(100); + + w.destroy(); }); ifit(hasCapturableScreen() && process.platform === 'darwin')('should adjust bounds if window overflows work area such that the window is entirely visible', async () => { const workArea = screen.getPrimaryDisplay().workArea; const overflowBounds = { - width: 400, - height: 300, - x: workArea.x + workArea.width - 200, - y: workArea.y + workArea.height - 150 + width: 100, + height: 100, + x: workArea.x + workArea.width - 20, + y: workArea.y + workArea.height - 20 }; await createAndSaveWindowState(overflowBounds); @@ -7760,16 +7795,18 @@ describe('BrowserWindow module', () => { // On macOS, window should be adjusted to be entirely visible expect(bounds.x + bounds.width).to.be.at.most(workArea.x + workArea.width); expect(bounds.y + bounds.height).to.be.at.most(workArea.y + workArea.height); - expect(bounds.width).to.equal(400); - expect(bounds.height).to.equal(300); + expect(bounds.width).to.equal(100); + expect(bounds.height).to.equal(100); + + w.destroy(); }); ifit(hasCapturableScreen() && process.platform !== 'darwin')('should adjust bounds if window overflows work area such that the window has minimum visible height/width 100x100', async () => { const workArea = screen.getPrimaryDisplay().workArea; // Initialize with 50x50 of the window visible const overflowBounds = { - width: 400, - height: 300, + width: 120, + height: 120, x: workArea.x + workArea.width - 50, y: workArea.y + workArea.height - 50 }; @@ -7794,11 +7831,13 @@ describe('BrowserWindow module', () => { expect(visibleWidth).to.be.at.least(100); expect(visibleHeight).to.be.at.least(100); - expect(bounds.width).to.equal(400); - expect(bounds.height).to.equal(300); + expect(bounds.width).to.equal(120); + expect(bounds.height).to.equal(120); + + w.destroy(); }); - it('should respect show:false when restoring display modes', async () => { + ifit(hasCapturableScreen())('should respect show:false when restoring display modes', async () => { await createAndSaveWindowState({ fullscreen: true }); const w = new BrowserWindow({ @@ -7820,6 +7859,8 @@ describe('BrowserWindow module', () => { // Fullscreen state should still be restored correctly if (!w.isFullScreen()) await enterFullScreen; expect(w.isFullScreen()).to.equal(true); + + w.destroy(); }); }); }); From 326aa632a72675cdf1e1577b15cebabbfe3e1f00 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Fri, 25 Jul 2025 06:22:40 +0530 Subject: [PATCH 015/268] fix: disable windowStatePersistence when no display --- docs/api/structures/base-window-options.md | 2 +- shell/browser/native_window.cc | 108 ++++++++++++--------- shell/browser/native_window.h | 9 +- spec/api-browser-window-spec.ts | 46 ++++----- 4 files changed, 91 insertions(+), 74 deletions(-) diff --git a/docs/api/structures/base-window-options.md b/docs/api/structures/base-window-options.md index 5a2b73efb505d..6155c1b78c43b 100644 --- a/docs/api/structures/base-window-options.md +++ b/docs/api/structures/base-window-options.md @@ -43,7 +43,7 @@ * `hiddenInMissionControl` boolean (optional) _macOS_ - Whether window should be hidden when the user toggles into mission control. * `kiosk` boolean (optional) - Whether the window is in kiosk mode. Default is `false`. * `name` string (optional) - An identifier for the window that enables features such as state persistence. -* `windowStatePersistence` ([WindowStatePersistence](window-state-persistence.md) | boolean) (optional) - Configures or enables the persistence of window state (position, size, maximized state, etc.) across application restarts. Has no effect if window `name` is not provided. _Experimental_ +* `windowStatePersistence` ([WindowStatePersistence](window-state-persistence.md) | boolean) (optional) - Configures or enables the persistence of window state (position, size, maximized state, etc.) across application restarts. Has no effect if window `name` is not provided. Automatically disabled when there is no available display. _Experimental_ * `title` string (optional) - Default window title. Default is `"Electron"`. If the HTML tag `<title>` is defined in the HTML file loaded by `loadURL()`, this property will be ignored. * `icon` ([NativeImage](../native-image.md) | string) (optional) - The window icon. On Windows it is recommended to use `ICO` icons to get best visual effects, you can also diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 03c609b453342..2a89e93dcb549 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -852,10 +852,21 @@ void NativeWindow::SaveWindowState() { if (!prefs_ || window_name_.empty() || is_being_restored_) return; + gfx::Rect bounds = GetBounds(); + const display::Screen* screen = display::Screen::GetScreen(); + const display::Display display = screen->GetDisplayMatching(bounds); + + // We don't want to save window state when the current display has invalid + // dimensions, as it could cause issues when restoring window bounds. + if (!screen || display.size().width() == 0 || display.size().height() == 0) { + LOG(WARNING) << "Window state not saved - current display has invalid " + "dimensions"; + return; + } + ScopedDictPrefUpdate update(prefs_, electron::kWindowStates); const base::Value::Dict* existing_prefs = update->FindDict(window_name_); - gfx::Rect bounds = GetBounds(); // When the window is in a special display mode (fullscreen, kiosk, or // maximized), save the previously stored window bounds instead of // the current bounds. This ensures that when the window is restored, it can @@ -882,8 +893,6 @@ void NativeWindow::SaveWindowState() { window_preferences.Set(electron::kFullscreen, IsFullscreen()); window_preferences.Set(electron::kKiosk, IsKiosk()); - const display::Screen* screen = display::Screen::GetScreen(); - const display::Display display = screen->GetDisplayMatching(bounds); gfx::Rect work_area = display.work_area(); window_preferences.Set(electron::kWorkAreaLeft, work_area.x()); @@ -913,8 +922,53 @@ void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { return; } + std::optional<int> saved_left = window_preferences->FindInt(electron::kLeft); + std::optional<int> saved_top = window_preferences->FindInt(electron::kTop); + std::optional<int> saved_right = + window_preferences->FindInt(electron::kRight); + std::optional<int> saved_bottom = + window_preferences->FindInt(electron::kBottom); + + std::optional<int> work_area_left = + window_preferences->FindInt(electron::kWorkAreaLeft); + std::optional<int> work_area_top = + window_preferences->FindInt(electron::kWorkAreaTop); + std::optional<int> work_area_right = + window_preferences->FindInt(electron::kWorkAreaRight); + std::optional<int> work_area_bottom = + window_preferences->FindInt(electron::kWorkAreaBottom); + + if (!saved_left || !saved_top || !saved_right || !saved_bottom || + !work_area_left || !work_area_top || !work_area_right || + !work_area_bottom) { + LOG(WARNING) << "Window state not restored - corrupted values found"; + is_being_restored_ = false; + return; + } + + gfx::Rect saved_bounds = + gfx::Rect(*saved_left, *saved_top, *saved_right - *saved_left, + *saved_bottom - *saved_top); + + display::Screen* screen = display::Screen::GetScreen(); + const display::Display display = screen->GetDisplayMatching(saved_bounds); + + // We avoid restoring the window state when no valid display matches the saved + // bounds. Doing so would cause the window to automatically resize and save + // its state again, which could lead to problems when a valid display becomes + // available in the future. + if (!screen || display.size().width() == 0 || display.size().height() == 0) { + LOG(WARNING) << "Window state not restored - no valid display found"; + is_being_restored_ = false; + return; + } + + gfx::Rect saved_work_area = gfx::Rect(*work_area_left, *work_area_top, + *work_area_right - *work_area_left, + *work_area_bottom - *work_area_top); + if (restore_bounds_) { - RestoreBounds(*window_preferences); + RestoreBounds(display, saved_work_area, &saved_bounds); } if (restore_display_mode_) { @@ -942,49 +996,11 @@ void NativeWindow::FlushPendingDisplayMode() { } } -void NativeWindow::RestoreBounds(const base::Value::Dict& window_preferences) { - std::optional<int> saved_left = window_preferences.FindInt(electron::kLeft); - std::optional<int> saved_top = window_preferences.FindInt(electron::kTop); - std::optional<int> saved_right = window_preferences.FindInt(electron::kRight); - std::optional<int> saved_bottom = - window_preferences.FindInt(electron::kBottom); - - std::optional<int> work_area_left = - window_preferences.FindInt(electron::kWorkAreaLeft); - std::optional<int> work_area_top = - window_preferences.FindInt(electron::kWorkAreaTop); - std::optional<int> work_area_right = - window_preferences.FindInt(electron::kWorkAreaRight); - std::optional<int> work_area_bottom = - window_preferences.FindInt(electron::kWorkAreaBottom); - - if (!saved_left || !saved_top || !saved_right || !saved_bottom || - !work_area_left || !work_area_top || !work_area_right || - !work_area_bottom) { - return; - } - - gfx::Rect bounds = - gfx::Rect(*saved_left, *saved_top, *saved_right - *saved_left, - *saved_bottom - *saved_top); - - display::Screen* screen = display::Screen::GetScreen(); - const display::Display display = screen->GetDisplayMatching(bounds); - - gfx::Rect saved_work_area = gfx::Rect(*work_area_left, *work_area_top, - *work_area_right - *work_area_left, - *work_area_bottom - *work_area_top); - - AdjustBoundsToBeVisibleOnDisplay(display, saved_work_area, &bounds); - - SetBounds(bounds); -} // This function is similar to Chromium's window bounds adjustment logic // https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/window_sizer/window_sizer.cc;l=350;drc=0ec56065ba588552f21633aa47280ba02c3cd160 -void NativeWindow::AdjustBoundsToBeVisibleOnDisplay( - const display::Display& display, - const gfx::Rect& saved_work_area, - gfx::Rect* bounds) { +void NativeWindow::RestoreBounds(const display::Display& display, + const gfx::Rect& saved_work_area, + gfx::Rect* bounds) { // Ensure that the window is at least kMinVisibleHeight * kMinVisibleWidth. bounds->set_height(std::max(kMinVisibleHeight, bounds->height())); bounds->set_width(std::max(kMinVisibleWidth, bounds->width())); @@ -1028,6 +1044,8 @@ void NativeWindow::AdjustBoundsToBeVisibleOnDisplay( bounds->set_x(std::clamp(bounds->x(), min_x, max_x)); } #endif // BUILDFLAG(IS_MAC) + + SetBounds(*bounds); } // static diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index cec5240035739..bb7d042378a1a 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -445,12 +445,9 @@ class NativeWindow : public base::SupportsUserData, // Restores window state - bounds first and then display mode. void RestoreWindowState(const gin_helper::Dictionary& options); // Applies saved bounds to the window. - void RestoreBounds(const base::Value::Dict& window_preferences); - // Helper function to adjust window bounds to ensure visibility on the target - // display. - void AdjustBoundsToBeVisibleOnDisplay(const display::Display& display, - const gfx::Rect& saved_work_area, - gfx::Rect* bounds); + void RestoreBounds(const display::Display& display, + const gfx::Rect& saved_work_area, + gfx::Rect* bounds); // Flushes pending display mode restoration (fullscreen, maximized, kiosk) // that was deferred during initialization to respect show=false. This // consumes and clears the restore_display_mode_callback_. diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 6c7c651b50bcf..bbc8aa510ab8a 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -6985,7 +6985,7 @@ describe('BrowserWindow module', () => { }); }); - describe('windowStatePersistence', () => { + ifdescribe(hasCapturableScreen())('windowStatePersistence', () => { const getWindowStateFromDisk = (windowName: string, preferencesPath: string) => { if (!fs.existsSync(preferencesPath)) { throw new Error(`Preferences file does not exist at path: ${preferencesPath}. Window state was not saved to disk.`); @@ -7062,7 +7062,7 @@ describe('BrowserWindow module', () => { expect(savedState).to.have.property('workAreaBottom'); }); - ifit(hasCapturableScreen())('should save window state after window is closed and app exit', async () => { + it('should save window state after window is closed and app exit', async () => { const appPath = path.join(fixturesPath, 'close-save'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); @@ -7077,7 +7077,7 @@ describe('BrowserWindow module', () => { expect(savedState.kiosk).to.equal(false); }); - ifit(hasCapturableScreen())('should save window state after window is resized and app exit', async () => { + it('should save window state after window is resized and app exit', async () => { const appPath = path.join(fixturesPath, 'resize-save'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); @@ -7092,7 +7092,7 @@ describe('BrowserWindow module', () => { expect(savedState.kiosk).to.equal(false); }); - ifit(hasCapturableScreen())('should save window state after window is moved and app exit', async () => { + it('should save window state after window is moved and app exit', async () => { const appPath = path.join(fixturesPath, 'move-save'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); @@ -7107,7 +7107,7 @@ describe('BrowserWindow module', () => { expect(savedState.kiosk).to.equal(false); }); - ifit(hasCapturableScreen())('should save window state after window is fullscreened and app exit', async () => { + it('should save window state after window is fullscreened and app exit', async () => { const appPath = path.join(fixturesPath, 'fullscreen-save'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); @@ -7120,7 +7120,7 @@ describe('BrowserWindow module', () => { expect(savedState.kiosk).to.equal(false); }); - ifit(hasCapturableScreen())('should save window state after window is maximized and app exit', async () => { + it('should save window state after window is maximized and app exit', async () => { const appPath = path.join(fixturesPath, 'maximize-save'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); @@ -7133,7 +7133,7 @@ describe('BrowserWindow module', () => { expect(savedState.kiosk).to.equal(false); }); - ifit(hasCapturableScreen())('should save window state if in a minimized state and app exit', async () => { + it('should save window state if in a minimized state and app exit', async () => { const appPath = path.join(fixturesPath, 'minimize-save'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); @@ -7149,7 +7149,7 @@ describe('BrowserWindow module', () => { expect(savedState.kiosk).to.equal(false); }); - ifit(hasCapturableScreen())('should save window state after window is kiosked and app exit', async () => { + it('should save window state after window is kiosked and app exit', async () => { const appPath = path.join(fixturesPath, 'kiosk-save'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); @@ -7164,7 +7164,7 @@ describe('BrowserWindow module', () => { }); describe('work area tests', () => { - ifit(hasCapturableScreen())('should save valid work area bounds', async () => { + it('should save valid work area bounds', async () => { const appPath = path.join(fixturesPath, 'schema-check'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); @@ -7182,7 +7182,7 @@ describe('BrowserWindow module', () => { expect(savedState.workAreaTop).to.be.lessThan(savedState.workAreaBottom); }); - ifit(hasCapturableScreen())('should save work area bounds that contain the window bounds on primary display', async () => { + it('should save work area bounds that contain the window bounds on primary display', async () => { // Fixture will center the window on the primary display const appPath = path.join(fixturesPath, 'work-area-primary'); const appProcess = childProcess.spawn(process.execPath, [appPath]); @@ -7372,6 +7372,8 @@ describe('BrowserWindow module', () => { w.destroy(); const w1 = new BrowserWindow({ + height: 200, + width: 200, name: windowName, windowStatePersistence: true, show: false @@ -7478,7 +7480,7 @@ describe('BrowserWindow module', () => { // Window state restoration takes into account current work area bounds to readjust height/width // height and width will be readjusted to kMinimumVisibleWidth*kMinimumVisibleHeight (100x100) // if there is no capturable screen - ifit(hasCapturableScreen())('should restore bounds when windowStatePersistence is true', async () => { + it('should restore bounds when windowStatePersistence is true', async () => { const workArea = screen.getPrimaryDisplay().workArea; const bounds = { width: 100, height: 100, x: workArea.x, y: workArea.y }; await createAndSaveWindowState(bounds); @@ -7515,7 +7517,7 @@ describe('BrowserWindow module', () => { w.destroy(); }); - ifit(hasCapturableScreen())('should restore fullscreen state when windowStatePersistence is true', async () => { + it('should restore fullscreen state when windowStatePersistence is true', async () => { await createAndSaveWindowState({ fullscreen: true }); await setTimeout(2000); const w = new BrowserWindow({ @@ -7531,7 +7533,7 @@ describe('BrowserWindow module', () => { w.destroy(); }); - ifit(hasCapturableScreen())('should restore kiosk state when windowStatePersistence is true', async () => { + it('should restore kiosk state when windowStatePersistence is true', async () => { await createAndSaveWindowState({ kiosk: true }); await setTimeout(2000); const w = new BrowserWindow({ @@ -7548,7 +7550,7 @@ describe('BrowserWindow module', () => { w.destroy(); }); - ifit(hasCapturableScreen())('should restore maximized state when windowStatePersistence is true', async () => { + it('should restore maximized state when windowStatePersistence is true', async () => { const width = screen.getPrimaryDisplay().workArea.width; const height = screen.getPrimaryDisplay().workArea.height; await createAndSaveWindowState({ width, height }); @@ -7584,7 +7586,7 @@ describe('BrowserWindow module', () => { w.destroy(); }); - ifit(hasCapturableScreen())('should restore bounds only when displayMode is disabled', async () => { + it('should restore bounds only when displayMode is disabled', async () => { // We don't use the utility createAndSaveWindowState here because the default bounds // passed through the constructor get affected by setting fullscreen: true alongside it. // It particularly affects this test because we want to ensure initial bounds stay the same @@ -7617,7 +7619,7 @@ describe('BrowserWindow module', () => { w.destroy(); }); - ifit(hasCapturableScreen())('should restore display modes when bounds is disabled', async () => { + it('should restore display modes when bounds is disabled', async () => { await createAndSaveWindowState({ fullscreen: true }); await setTimeout(2000); const w = new BrowserWindow({ @@ -7634,7 +7636,7 @@ describe('BrowserWindow module', () => { w.destroy(); }); - ifit(hasCapturableScreen())('should respect fullscreenable property', async () => { + it('should respect fullscreenable property', async () => { await createAndSaveWindowState({ fullscreen: true }); const w = new BrowserWindow({ @@ -7684,7 +7686,7 @@ describe('BrowserWindow module', () => { expect(bounds.height).to.be.at.most(400); }); - ifit(hasCapturableScreen())('should restore correct state for each named window independently - multi window check', async () => { + it('should restore correct state for each named window independently - multi window check', async () => { const window1Name = 'test-window-1'; const window2Name = 'test-window-2'; @@ -7742,7 +7744,7 @@ describe('BrowserWindow module', () => { restored2.destroy(); }); - ifit(hasCapturableScreen())('should adjust restored bounds if they overflow current work area entirely', async () => { + it('should adjust restored bounds if they overflow current work area entirely', async () => { const workArea = screen.getPrimaryDisplay().workArea; // Completely off-screen to the right const offscreenBounds = { @@ -7773,7 +7775,7 @@ describe('BrowserWindow module', () => { w.destroy(); }); - ifit(hasCapturableScreen() && process.platform === 'darwin')('should adjust bounds if window overflows work area such that the window is entirely visible', async () => { + ifit(process.platform === 'darwin')('should adjust bounds if window overflows work area such that the window is entirely visible', async () => { const workArea = screen.getPrimaryDisplay().workArea; const overflowBounds = { width: 100, @@ -7801,7 +7803,7 @@ describe('BrowserWindow module', () => { w.destroy(); }); - ifit(hasCapturableScreen() && process.platform !== 'darwin')('should adjust bounds if window overflows work area such that the window has minimum visible height/width 100x100', async () => { + ifit(process.platform !== 'darwin')('should adjust bounds if window overflows work area such that the window has minimum visible height/width 100x100', async () => { const workArea = screen.getPrimaryDisplay().workArea; // Initialize with 50x50 of the window visible const overflowBounds = { @@ -7837,7 +7839,7 @@ describe('BrowserWindow module', () => { w.destroy(); }); - ifit(hasCapturableScreen())('should respect show:false when restoring display modes', async () => { + it('should respect show:false when restoring display modes', async () => { await createAndSaveWindowState({ fullscreen: true }); const w = new BrowserWindow({ From b792146e0d7f2323a04df7df7912d13077db9fe7 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Fri, 25 Jul 2025 06:58:50 +0530 Subject: [PATCH 016/268] refactor: use reference instead pointer --- shell/browser/native_window.cc | 42 ++++++++++++++++------------------ shell/browser/native_window.h | 2 +- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 2a89e93dcb549..9746271697969 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -953,10 +953,10 @@ void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { display::Screen* screen = display::Screen::GetScreen(); const display::Display display = screen->GetDisplayMatching(saved_bounds); - // We avoid restoring the window state when no valid display matches the saved - // bounds. Doing so would cause the window to automatically resize and save - // its state again, which could lead to problems when a valid display becomes - // available in the future. + // We avoid restoring the window state when no valid display matching the + // saved bounds. Doing so would cause the window to automatically resize and + // save its state again, which could lead to problems when a valid display + // becomes available in the future. if (!screen || display.size().width() == 0 || display.size().height() == 0) { LOG(WARNING) << "Window state not restored - no valid display found"; is_being_restored_ = false; @@ -968,7 +968,7 @@ void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { *work_area_bottom - *work_area_top); if (restore_bounds_) { - RestoreBounds(display, saved_work_area, &saved_bounds); + RestoreBounds(display, saved_work_area, saved_bounds); } if (restore_display_mode_) { @@ -1000,23 +1000,23 @@ void NativeWindow::FlushPendingDisplayMode() { // https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/window_sizer/window_sizer.cc;l=350;drc=0ec56065ba588552f21633aa47280ba02c3cd160 void NativeWindow::RestoreBounds(const display::Display& display, const gfx::Rect& saved_work_area, - gfx::Rect* bounds) { + gfx::Rect& saved_bounds) { // Ensure that the window is at least kMinVisibleHeight * kMinVisibleWidth. - bounds->set_height(std::max(kMinVisibleHeight, bounds->height())); - bounds->set_width(std::max(kMinVisibleWidth, bounds->width())); + saved_bounds.set_height(std::max(kMinVisibleHeight, saved_bounds.height())); + saved_bounds.set_width(std::max(kMinVisibleWidth, saved_bounds.width())); const gfx::Rect work_area = display.work_area(); // Ensure that the title bar is not above the work area. - if (bounds->y() < work_area.y()) { - bounds->set_y(work_area.y()); + if (saved_bounds.y() < work_area.y()) { + saved_bounds.set_y(work_area.y()); } // Reposition and resize the bounds if the saved_work_area is different from // the current work area and the current work area doesn't completely contain // the bounds. if (!saved_work_area.IsEmpty() && saved_work_area != work_area && - !work_area.Contains(*bounds)) { - bounds->AdjustToFit(work_area); + !work_area.Contains(saved_bounds)) { + saved_bounds.AdjustToFit(work_area); } #if BUILDFLAG(IS_MAC) @@ -1024,28 +1024,26 @@ void NativeWindow::RestoreBounds(const display::Display& display, // partially offscreen. If the window is partially offscreen horizontally, // snap to the nearest edge of the work area. This call also adjusts the // height, width if needed to make the window fully visible. - bounds->AdjustToFit(work_area); + saved_bounds.AdjustToFit(work_area); #else // On non-Mac platforms, we are less aggressive about repositioning. Simply // ensure that at least kMinVisibleWidth * kMinVisibleHeight is visible - const int min_y = work_area.y() + kMinVisibleHeight - bounds->height(); - const int min_x = work_area.x() + kMinVisibleWidth - bounds->width(); + const int min_y = work_area.y() + kMinVisibleHeight - saved_bounds.height(); + const int min_x = work_area.x() + kMinVisibleWidth - saved_bounds.width(); const int max_y = work_area.bottom() - kMinVisibleHeight; const int max_x = work_area.right() - kMinVisibleWidth; // Reposition and resize the bounds to make it fully visible inside the work - // area if the work area and bounds are both small. - // `min_x >= max_x` happens when `work_area.width() + bounds.width() <= 2 * - // min_visible_width`. Similar for `min_y >= max_y` in height dimension. + // area. `min_x >= max_x` happens when work area and bounds are both small. if (min_x >= max_x || min_y >= max_y) { - bounds->AdjustToFit(work_area); + saved_bounds.AdjustToFit(work_area); } else { - bounds->set_y(std::clamp(bounds->y(), min_y, max_y)); - bounds->set_x(std::clamp(bounds->x(), min_x, max_x)); + saved_bounds.set_y(std::clamp(saved_bounds.y(), min_y, max_y)); + saved_bounds.set_x(std::clamp(saved_bounds.x(), min_x, max_x)); } #endif // BUILDFLAG(IS_MAC) - SetBounds(*bounds); + SetBounds(saved_bounds); } // static diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index bb7d042378a1a..5daf0f46f29ab 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -447,7 +447,7 @@ class NativeWindow : public base::SupportsUserData, // Applies saved bounds to the window. void RestoreBounds(const display::Display& display, const gfx::Rect& saved_work_area, - gfx::Rect* bounds); + gfx::Rect& saved_bounds); // Flushes pending display mode restoration (fullscreen, maximized, kiosk) // that was deferred during initialization to respect show=false. This // consumes and clears the restore_display_mode_callback_. From 64f89815819d35f77c15902260913e14f0f7d388 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Fri, 25 Jul 2025 08:06:50 +0530 Subject: [PATCH 017/268] fix: skip window state persistence for invalid/fake displays --- shell/browser/native_window.cc | 37 ++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 9746271697969..afc71596aeb1a 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -34,6 +34,7 @@ #include "ui/compositor/compositor.h" #include "ui/display/display.h" #include "ui/display/screen.h" +#include "ui/display/types/display_constants.h" #include "ui/views/widget/widget.h" #if !BUILDFLAG(IS_MAC) @@ -854,13 +855,21 @@ void NativeWindow::SaveWindowState() { gfx::Rect bounds = GetBounds(); const display::Screen* screen = display::Screen::GetScreen(); + DCHECK(screen); + // GetDisplayMatching returns a fake display with 1920x1080 resolution at + // (0,0) when no physical displays are attached. + // https://source.chromium.org/chromium/chromium/src/+/main:ui/display/display.cc;l=184;drc=e4f1aef5f3ec30a28950d766612cc2c04c822c71 const display::Display display = screen->GetDisplayMatching(bounds); - // We don't want to save window state when the current display has invalid - // dimensions, as it could cause issues when restoring window bounds. - if (!screen || display.size().width() == 0 || display.size().height() == 0) { - LOG(WARNING) << "Window state not saved - current display has invalid " - "dimensions"; + // Skip window state persistence when display has invalid dimensions (0x0) or + // is fake (ID 0xFF). Invalid displays could cause incorrect window bounds to + // be saved, leading to positioning issues during restoration. + // https://source.chromium.org/chromium/chromium/src/+/main:ui/display/types/display_constants.h;l=28;drc=e4f1aef5f3ec30a28950d766612cc2c04c822c71 + if (display.id() == display::kDefaultDisplayId || + display.size().width() == 0 || display.size().height() == 0) { + LOG(WARNING) + << "Window state not saved - no physical display attached or current " + "display has invalid bounds"; return; } @@ -951,14 +960,20 @@ void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { *saved_bottom - *saved_top); display::Screen* screen = display::Screen::GetScreen(); + DCHECK(screen); + // GetDisplayMatching returns a fake display with 1920x1080 resolution at + // (0,0) when no physical displays are attached. + // https://source.chromium.org/chromium/chromium/src/+/main:ui/display/display.cc;l=184;drc=e4f1aef5f3ec30a28950d766612cc2c04c822c71 const display::Display display = screen->GetDisplayMatching(saved_bounds); - // We avoid restoring the window state when no valid display matching the - // saved bounds. Doing so would cause the window to automatically resize and - // save its state again, which could lead to problems when a valid display - // becomes available in the future. - if (!screen || display.size().width() == 0 || display.size().height() == 0) { - LOG(WARNING) << "Window state not restored - no valid display found"; + // Skip window state restoration if current display has invalid dimensions or + // is fake. Restoring from invalid displays (0x0) or fake displays (ID 0xFF) + // could cause incorrect window positioning when later moved to real displays. + // https://source.chromium.org/chromium/chromium/src/+/main:ui/display/types/display_constants.h;l=28;drc=e4f1aef5f3ec30a28950d766612cc2c04c822c71 + if (display.id() == display::kDefaultDisplayId || + display.size().width() == 0 || display.size().height() == 0) { + LOG(WARNING) << "Window state not restored - no physical display attached " + "or current display has invalid bounds"; is_being_restored_ = false; return; } From b4b2b81d852a10ea416eac51dfc241d7b3e70cc4 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Fri, 25 Jul 2025 09:20:30 +0530 Subject: [PATCH 018/268] refactor: better flag placement --- shell/browser/native_window.cc | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index afc71596aeb1a..43322437f96c4 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -143,12 +143,14 @@ NativeWindow::NativeWindow(const gin_helper::Dictionary& options, // Initialize prefs_ to save/restore window bounds if we have a valid window // name and window state persistence is enabled. if (window_state_persistence_enabled_ && !window_name_.empty()) { + // Move this out if there's a need to initialize prefs_ for other features if (auto* browser_process = electron::ElectronBrowserMainParts::Get()->browser_process()) { DCHECK(browser_process); prefs_ = browser_process->local_state(); } } else if (window_state_persistence_enabled_ && window_name_.empty()) { + window_state_persistence_enabled_ = false; LOG(WARNING) << "Window state persistence enabled but no window name " "provided. Window state will not be persisted."; } @@ -257,8 +259,7 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) { // (fullscreen/kiosk) since the target display for these states depends on the // window's initial bounds. Also, restoring here ensures we respect min/max // width/height and fullscreenable constraints. - if (prefs_ && !window_name_.empty()) - RestoreWindowState(options); + RestoreWindowState(options); if (fullscreen && !restore_display_mode_) SetFullScreen(true); @@ -850,7 +851,7 @@ void NativeWindow::DebouncedSaveWindowState() { } void NativeWindow::SaveWindowState() { - if (!prefs_ || window_name_.empty() || is_being_restored_) + if (!window_state_persistence_enabled_ || is_being_restored_) return; gfx::Rect bounds = GetBounds(); @@ -921,15 +922,15 @@ void NativeWindow::FlushWindowState() { } void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { - is_being_restored_ = true; + if (!window_state_persistence_enabled_) + return; + const base::Value& value = prefs_->GetValue(electron::kWindowStates); const base::Value::Dict* window_preferences = value.is_dict() ? value.GetDict().FindDict(window_name_) : nullptr; - if (!window_preferences) { - is_being_restored_ = false; + if (!window_preferences) return; - } std::optional<int> saved_left = window_preferences->FindInt(electron::kLeft); std::optional<int> saved_top = window_preferences->FindInt(electron::kTop); @@ -951,7 +952,6 @@ void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { !work_area_left || !work_area_top || !work_area_right || !work_area_bottom) { LOG(WARNING) << "Window state not restored - corrupted values found"; - is_being_restored_ = false; return; } @@ -974,7 +974,6 @@ void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { display.size().width() == 0 || display.size().height() == 0) { LOG(WARNING) << "Window state not restored - no physical display attached " "or current display has invalid bounds"; - is_being_restored_ = false; return; } @@ -982,6 +981,10 @@ void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { *work_area_right - *work_area_left, *work_area_bottom - *work_area_top); + // Set this to true before RestoreBounds to prevent SaveWindowState from being + // inadvertently triggered during the restoration process. + is_being_restored_ = true; + if (restore_bounds_) { RestoreBounds(display, saved_work_area, saved_bounds); } From 032d706158fcc40062c378ac3380305715d44073 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Fri, 25 Jul 2025 11:45:15 +0530 Subject: [PATCH 019/268] test: add test to verify window state is not saved when no display --- spec/api-browser-window-spec.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index bbc8aa510ab8a..6cc21f5ac9ab9 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -83,6 +83,23 @@ describe('BrowserWindow module', () => { w.destroy(); }).not.to.throw(); }); + + ifit(!hasCapturableScreen())('should not save window state when there is no valid display (fake display)', async () => { + const appPath = path.resolve(__dirname, 'fixtures', 'api', 'window-state-save', 'schema-check'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const sharedPreferencesPath = path.join(os.tmpdir(), 'electron-window-state-test', 'Local State'); + if (!fs.existsSync(sharedPreferencesPath)) { + throw new Error(`Preferences file does not exist at path: ${sharedPreferencesPath}. Window state was not saved to disk.`); + } + const prefsContent = fs.readFileSync(sharedPreferencesPath, 'utf8'); + const prefs = JSON.parse(prefsContent); + const savedState = prefs?.windowStates?.['test-window-state-schema'] || null; + + expect(savedState).to.be.null('window state with window name "test-window-state-schema" should not exist'); + }); }); describe('garbage collection', () => { From 95e54167ec53e072738de8c022e7853a20ff138e Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Tue, 29 Jul 2025 18:21:27 +0530 Subject: [PATCH 020/268] fix: restore display mode inside show() --- shell/browser/api/electron_api_base_window.cc | 1 - shell/browser/native_window_mac.mm | 2 ++ shell/browser/native_window_views.cc | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index c07fcf50b5074..e7bec51b13814 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -234,7 +234,6 @@ void BaseWindow::OnWindowFocus() { } void BaseWindow::OnWindowShow() { - window_->FlushPendingDisplayMode(); Emit("show"); } diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index fbb9ee8946c3f..e48bf10cebdc5 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -416,6 +416,8 @@ static bool FromV8(v8::Isolate* isolate, return; } + FlushPendingDisplayMode(); + set_wants_to_be_visible(true); // Reattach the window to the parent to actually show it. diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index 10afaf001810c..fe161bea7ae42 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -557,6 +557,8 @@ void NativeWindowViews::Show() { if (is_modal() && NativeWindow::parent() && !widget()->IsVisible()) static_cast<NativeWindowViews*>(parent())->IncrementChildModals(); + FlushPendingDisplayMode(); + widget()->native_widget_private()->Show(GetRestoredState(), gfx::Rect()); // explicitly focus the window From f482562e34c74a5d624fed9de6cd007f4ebbcf60 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 30 Jul 2025 21:05:08 +0530 Subject: [PATCH 021/268] feat: support for multimonitor tests --- .../native-addon/virtual-display/binding.gyp | 88 +++++++++ .../include/VirtualDisplayBridge.h | 120 ++++++++++++ .../virtual-display/lib/virtual-display.js | 6 + .../native-addon/virtual-display/package.json | 20 ++ .../virtual-display/src/VirtualDisplay.swift | 175 ++++++++++++++++++ .../src/VirtualDisplayBridge.m | 14 ++ .../native-addon/virtual-display/src/addon.mm | 66 +++++++ spec/package.json | 1 + 8 files changed, 490 insertions(+) create mode 100644 spec/fixtures/native-addon/virtual-display/binding.gyp create mode 100644 spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h create mode 100644 spec/fixtures/native-addon/virtual-display/lib/virtual-display.js create mode 100644 spec/fixtures/native-addon/virtual-display/package.json create mode 100644 spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift create mode 100644 spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m create mode 100644 spec/fixtures/native-addon/virtual-display/src/addon.mm diff --git a/spec/fixtures/native-addon/virtual-display/binding.gyp b/spec/fixtures/native-addon/virtual-display/binding.gyp new file mode 100644 index 0000000000000..2f8c82f4489cf --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/binding.gyp @@ -0,0 +1,88 @@ +{ + "targets": [{ + "target_name": "virtual_display", + "conditions": [ + ['OS=="mac"', { + "sources": [ + "src/addon.mm", + "src/VirtualDisplayBridge.m" + ], + "include_dirs": [ + "<!@(node -p \"require('node-addon-api').include\")", + "include", + "build_swift" + ], + "dependencies": [ + "<!(node -p \"require('node-addon-api').gyp\")" + ], + "libraries": [ + "<(PRODUCT_DIR)/libVirtualDisplay.dylib" + ], + "defines": [ + "NODE_ADDON_API_CPP_EXCEPTIONS" + ], + "cflags!": [ "-fno-exceptions" ], + "cflags_cc!": [ "-fno-exceptions" ], + "xcode_settings": { + "GCC_ENABLE_CPP_EXCEPTIONS": "YES", + "CLANG_ENABLE_OBJC_ARC": "YES", + "CLANG_CXX_LIBRARY": "libc++", + "SWIFT_OBJC_BRIDGING_HEADER": "include/VirtualDisplayBridge.h", + "SWIFT_VERSION": "5.0", + "SWIFT_OBJC_INTERFACE_HEADER_NAME": "virtual_display-Swift.h", + "MACOSX_DEPLOYMENT_TARGET": "11.0", + "OTHER_CFLAGS": [ + "-ObjC++", + "-fobjc-arc" + ], + "OTHER_LDFLAGS": [ + "-lswiftCore", + "-lswiftFoundation", + "-lswiftObjectiveC", + "-lswiftDarwin", + "-lswiftDispatch", + "-L/usr/lib/swift", + "-Wl,-rpath,/usr/lib/swift", + "-Wl,-rpath,@loader_path" + ] + }, + "actions": [ + { + "action_name": "build_swift", + "inputs": [ + "src/VirtualDisplay.swift", + "include/VirtualDisplayBridge.h" + ], + "outputs": [ + "build_swift/libVirtualDisplay.dylib", + "build_swift/virtual_display-Swift.h" + ], + "action": [ + "swiftc", + "src/VirtualDisplay.swift", + "-import-objc-header", "include/VirtualDisplayBridge.h", + "-emit-objc-header-path", "./build_swift/virtual_display-Swift.h", + "-emit-library", "-o", "./build_swift/libVirtualDisplay.dylib", + "-emit-module", "-module-name", "virtual_display", + "-module-link-name", "VirtualDisplay" + ] + }, + { + "action_name": "copy_swift_lib", + "inputs": [ + "<(module_root_dir)/build_swift/libVirtualDisplay.dylib" + ], + "outputs": [ + "<(PRODUCT_DIR)/libVirtualDisplay.dylib" + ], + "action": [ + "sh", + "-c", + "cp -f <(module_root_dir)/build_swift/libVirtualDisplay.dylib <(PRODUCT_DIR)/libVirtualDisplay.dylib && install_name_tool -id @rpath/libVirtualDisplay.dylib <(PRODUCT_DIR)/libVirtualDisplay.dylib" + ] + } + ] + }] + ] + }] +} \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h b/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h new file mode 100644 index 0000000000000..05a597f156860 --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h @@ -0,0 +1,120 @@ +#ifndef VirtualDisplayBridge_h +#define VirtualDisplayBridge_h + +#import <CoreGraphics/CoreGraphics.h> +#import <Foundation/Foundation.h> + +@interface VirtualDisplayBridge : NSObject + ++ (NSInteger)addDisplay; ++ (BOOL)removeDisplay:(NSInteger)displayId; + +@end + +@interface CGVirtualDisplay : NSObject { + unsigned int _vendorID; + unsigned int _productID; + unsigned int _serialNum; + NSString* _name; + struct CGSize _sizeInMillimeters; + unsigned int _maxPixelsWide; + unsigned int _maxPixelsHigh; + struct CGPoint _redPrimary; + struct CGPoint _greenPrimary; + struct CGPoint _bluePrimary; + struct CGPoint _whitePoint; + id _queue; + id _terminationHandler; + void* _client; + unsigned int _displayID; + unsigned int _hiDPI; + NSArray* _modes; + unsigned int _serverRPC_port; + unsigned int _proxyRPC_port; + unsigned int _clientHandler_port; +} + +@property(readonly, nonatomic) NSArray* modes; +@property(readonly, nonatomic) unsigned int hiDPI; +@property(readonly, nonatomic) unsigned int displayID; +@property(readonly, nonatomic) id terminationHandler; +@property(readonly, nonatomic) id queue; +@property(readonly, nonatomic) struct CGPoint whitePoint; +@property(readonly, nonatomic) struct CGPoint bluePrimary; +@property(readonly, nonatomic) struct CGPoint greenPrimary; +@property(readonly, nonatomic) struct CGPoint redPrimary; +@property(readonly, nonatomic) unsigned int maxPixelsHigh; +@property(readonly, nonatomic) unsigned int maxPixelsWide; +@property(readonly, nonatomic) struct CGSize sizeInMillimeters; +@property(readonly, nonatomic) NSString* name; +@property(readonly, nonatomic) unsigned int serialNum; +@property(readonly, nonatomic) unsigned int productID; +@property(readonly, nonatomic) unsigned int vendorID; +- (BOOL)applySettings:(id)arg1; +- (void)dealloc; +- (id)initWithDescriptor:(id)arg1; + +@end + +@interface CGVirtualDisplayDescriptor : NSObject { + unsigned int _vendorID; + unsigned int _productID; + unsigned int _serialNum; + NSString* _name; + struct CGSize _sizeInMillimeters; + unsigned int _maxPixelsWide; + unsigned int _maxPixelsHigh; + struct CGPoint _redPrimary; + struct CGPoint _greenPrimary; + struct CGPoint _bluePrimary; + struct CGPoint _whitePoint; + id _queue; + id _terminationHandler; +} + +@property(retain, nonatomic) id queue; +@property(retain, nonatomic) NSString* name; +@property(nonatomic) struct CGPoint whitePoint; +@property(nonatomic) struct CGPoint bluePrimary; +@property(nonatomic) struct CGPoint greenPrimary; +@property(nonatomic) struct CGPoint redPrimary; +@property(nonatomic) unsigned int maxPixelsHigh; +@property(nonatomic) unsigned int maxPixelsWide; +@property(nonatomic) struct CGSize sizeInMillimeters; +@property(nonatomic) unsigned int serialNum; +@property(nonatomic) unsigned int productID; +@property(nonatomic) unsigned int vendorID; +- (void)dealloc; +- (id)init; +@property(copy, nonatomic) id terminationHandler; + +@end + +@interface CGVirtualDisplayMode : NSObject { + unsigned int _width; + unsigned int _height; + double _refreshRate; +} + +@property(readonly, nonatomic) double refreshRate; +@property(readonly, nonatomic) unsigned int height; +@property(readonly, nonatomic) unsigned int width; +- (id)initWithWidth:(unsigned int)arg1 + height:(unsigned int)arg2 + refreshRate:(double)arg3; + +@end + +@interface CGVirtualDisplaySettings : NSObject { + NSArray* _modes; + unsigned int _hiDPI; +} + +@property(nonatomic) unsigned int hiDPI; +- (void)dealloc; +- (id)init; +@property(retain, nonatomic) NSArray* modes; + +@end + +#endif \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js b/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js new file mode 100644 index 0000000000000..6f49685c32117 --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js @@ -0,0 +1,6 @@ +module.exports = process.platform === 'darwin' + ? require('../build/Release/virtual_display.node') + : { + addDisplay: () => { throw new Error('Virtual displays only supported on macOS'); }, + removeDisplay: () => { throw new Error('Virtual displays only supported on macOS'); } + }; diff --git a/spec/fixtures/native-addon/virtual-display/package.json b/spec/fixtures/native-addon/virtual-display/package.json new file mode 100644 index 0000000000000..16fd059920b2c --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/package.json @@ -0,0 +1,20 @@ +{ + "name": "@electron-ci/virtual-display", + "version": "1.0.0", + "description": "Virtual display for multi-monitor testing", + "main": "./lib/virtual-display.js", + "scripts": { + "clean": "rm -rf build", + "build-electron": "electron-rebuild", + "build": "node-gyp configure && node-gyp build" + }, + "license": "MIT", + "dependencies": { + "bindings": "^1.5.0", + "node-addon-api": "^8.3.0" + }, + "devDependencies": { + "@types/jest": "^30.0.0", + "node-gyp": "^11.1.0" + } +} diff --git a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift new file mode 100644 index 0000000000000..7631fe2b8e67b --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift @@ -0,0 +1,175 @@ +import Foundation +import Cocoa +import os.log + +@objc public class VirtualDisplay: NSObject { + @objc public static func addDisplay() -> Int { + return DummyManager.createDummyByDefinitionId(10) ?? 0 + } + + @objc public static func removeDisplay(id: Int) -> Bool { + DummyManager.discardDummyByNumber(id) + return true + } +} + +class DummyManager { + struct DefinedDummy { + var dummy: Dummy + var definitionId: Int? + } + + static var definedDummies: [Int: DefinedDummy] = [:] + static var dummyCounter: Int = 0 + static var dummyDefinitions: [Int: DummyDefinition] = [:] + + static func createDummyByDefinitionId(_ dummyDefinitionId: Int, isPortrait: Bool = false, serialNum: UInt32 = 0, doConnect: Bool = true) -> Int? { + updateDummyDefinitions() + if let dummyDefinition = self.dummyDefinitions[dummyDefinitionId] { + return self.createDummy(dummyDefinition, dummyDefinitionId: dummyDefinitionId, isPortrait: isPortrait, serialNum: serialNum, doConnect: doConnect) + } + return nil + } + + static func createDummy(_ dummyDefinition: DummyDefinition, dummyDefinitionId: Int? = nil, isPortrait _: Bool = false, serialNum: UInt32 = 0, doConnect: Bool = true) -> Int { + let dummy = Dummy(dummyDefinition: dummyDefinition, serialNum: serialNum, doConnect: doConnect) + self.dummyCounter += 1 + self.definedDummies[self.dummyCounter] = DefinedDummy(dummy: dummy, definitionId: dummyDefinitionId) + return self.dummyCounter + } + + static func discardDummyByNumber(_ number: Int) { + if let definedDummy = self.definedDummies[number] { + if definedDummy.dummy.isConnected { + definedDummy.dummy.disconnect() + } + } + self.definedDummies[number] = nil + } + + static func updateDummyDefinitions() { + let refreshRates: [Double] = [60] + self.dummyDefinitions = [ + 10: DummyDefinition(16, 9, 2, refreshRates, "16:9 (HD/4K/5K/6K)", false), + 20: DummyDefinition(16, 10, 2, refreshRates, "16:10 (WXGA)", false), + 30: DummyDefinition(4, 3, 2, refreshRates, "4:3 (VGA)", false), + ] + } +} + +struct DummyDefinition { + let aspectWidth, aspectHeight, multiplierStep, minMultiplier, maxMultiplier: Int + let refreshRates: [Double] + let description: String + let addSeparatorAfter: Bool + + init(_ aspectWidth: Int, _ aspectHeight: Int, _ step: Int, _ refreshRates: [Double], _ description: String, _ addSeparatorAfter: Bool = false) { + let minX: Int = 720 + let minY: Int = 720 + let maxX: Int = 8192 + let maxY: Int = 8192 + let minMultiplier = max(Int(ceil(Float(minX) / (Float(aspectWidth) * Float(step)))), Int(ceil(Float(minY) / (Float(aspectHeight) * Float(step))))) + let maxMultiplier = min(Int(floor(Float(maxX) / (Float(aspectWidth) * Float(step)))), Int(floor(Float(maxY) / (Float(aspectHeight) * Float(step))))) + + self.aspectWidth = aspectWidth + self.aspectHeight = aspectHeight + self.minMultiplier = minMultiplier + self.maxMultiplier = maxMultiplier + self.multiplierStep = step + self.refreshRates = refreshRates + self.description = description + self.addSeparatorAfter = addSeparatorAfter + } +} + +class Dummy: Equatable { + var virtualDisplay: CGVirtualDisplay? + var dummyDefinition: DummyDefinition + let serialNum: UInt32 + var isConnected: Bool = false + var displayIdentifier: CGDirectDisplayID = 0 + + static func == (lhs: Dummy, rhs: Dummy) -> Bool { + lhs.serialNum == rhs.serialNum + } + + init(dummyDefinition: DummyDefinition, serialNum: UInt32 = 0, doConnect: Bool = true) { + var storedSerialNum: UInt32 = serialNum + if storedSerialNum == 0 { + storedSerialNum = UInt32.random(in: 0 ... UInt32.max) + } + self.dummyDefinition = dummyDefinition + self.serialNum = storedSerialNum + if doConnect { + _ = self.connect() + } + } + + func getName() -> String { + "Dummy \(self.dummyDefinition.description.components(separatedBy: " ").first ?? self.dummyDefinition.description)" + } + + func connect() -> Bool { + if self.virtualDisplay != nil || self.isConnected { + self.disconnect() + } + let name: String = self.getName() + if let virtualDisplay = Dummy.createVirtualDisplay(self.dummyDefinition, name: name, serialNum: self.serialNum) { + self.virtualDisplay = virtualDisplay + self.displayIdentifier = virtualDisplay.displayID + self.isConnected = true + os_log("Display %{public}@ successfully connected", type: .info, "\(name)") + return true + } else { + os_log("Failed to connect display %{public}@", type: .info, "\(name)") + return false + } + } + + func disconnect() { + self.virtualDisplay = nil + self.isConnected = false + os_log("Disconnected virtual display: %{public}@", type: .info, "\(self.getName())") + } + + static func createVirtualDisplay(_ definition: DummyDefinition, name: String, serialNum: UInt32, hiDPI: Bool = true) -> CGVirtualDisplay? { + os_log("Creating virtual display: %{public}@", type: .info, "\(name)") + if let descriptor = CGVirtualDisplayDescriptor() { + os_log("- Preparing descriptor...", type: .info) + descriptor.queue = DispatchQueue.global(qos: .userInteractive) + descriptor.name = name + descriptor.whitePoint = CGPoint(x: 0.950, y: 1.000) + descriptor.redPrimary = CGPoint(x: 0.454, y: 0.242) + descriptor.greenPrimary = CGPoint(x: 0.353, y: 0.674) + descriptor.bluePrimary = CGPoint(x: 0.157, y: 0.084) + descriptor.maxPixelsWide = UInt32(definition.aspectWidth * definition.multiplierStep * definition.maxMultiplier) + descriptor.maxPixelsHigh = UInt32(definition.aspectHeight * definition.multiplierStep * definition.maxMultiplier) + let diagonalSizeRatio: Double = (24 * 25.4) / sqrt(Double(definition.aspectWidth * definition.aspectWidth + definition.aspectHeight * definition.aspectHeight)) + descriptor.sizeInMillimeters = CGSize(width: Double(definition.aspectWidth) * diagonalSizeRatio, height: Double(definition.aspectHeight) * diagonalSizeRatio) + descriptor.serialNum = serialNum + descriptor.productID = UInt32(min(definition.aspectWidth - 1, 255) * 256 + min(definition.aspectHeight - 1, 255)) + descriptor.vendorID = UInt32(0xF0F0) + if let display = CGVirtualDisplay(descriptor: descriptor) { + os_log("- Creating display, preparing modes...", type: .info) + var modes = [CGVirtualDisplayMode?](repeating: nil, count: definition.maxMultiplier - definition.minMultiplier + 1) + for multiplier in definition.minMultiplier ... definition.maxMultiplier { + for refreshRate in definition.refreshRates { + let width = UInt32(definition.aspectWidth * multiplier * definition.multiplierStep) + let height = UInt32(definition.aspectHeight * multiplier * definition.multiplierStep) + modes[multiplier - definition.minMultiplier] = CGVirtualDisplayMode(width: width, height: height, refreshRate: refreshRate)! + } + } + if let settings = CGVirtualDisplaySettings() { + os_log("- Preparing settings for display...", type: .info) + settings.hiDPI = hiDPI ? 1 : 0 + settings.modes = modes as [Any] + if display.applySettings(settings) { + os_log("- Settings are successfully applied. Dummy Display ID is %{public}@", type: .info, String(display.displayID)) + return display + } + } + } + } + return nil + } +} \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m new file mode 100644 index 0000000000000..ad4dae4d552a8 --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m @@ -0,0 +1,14 @@ +#import "VirtualDisplayBridge.h" +#import "../build_swift/virtual_display-Swift.h" + +@implementation VirtualDisplayBridge + ++ (NSInteger)addDisplay { + return [VirtualDisplay addDisplay]; +} + ++ (BOOL)removeDisplay:(NSInteger)displayId { + return [VirtualDisplay removeDisplayWithId:displayId]; +} + +@end \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/src/addon.mm b/spec/fixtures/native-addon/virtual-display/src/addon.mm new file mode 100644 index 0000000000000..63e3370ecf40c --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/src/addon.mm @@ -0,0 +1,66 @@ +#include <js_native_api.h> +#include <node_api.h> +#include "VirtualDisplayBridge.h" + +namespace { + +napi_value AddDisplay(napi_env env, napi_callback_info info) { + NSInteger displayId = [VirtualDisplayBridge addDisplay]; + + napi_value result; + napi_status status = napi_create_int64(env, displayId, &result); + if (status != napi_ok) + return NULL; + + return result; +} + +napi_value RemoveDisplay(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + napi_status status; + + status = napi_get_cb_info(env, info, &argc, args, NULL, NULL); + if (status != napi_ok) + return NULL; + + if (argc < 1) { + napi_throw_error(env, NULL, "Expected number argument"); + return NULL; + } + + int64_t displayId; + status = napi_get_value_int64(env, args[0], &displayId); + if (status != napi_ok) { + napi_throw_error(env, NULL, "Expected number argument"); + return NULL; + } + + BOOL result = [VirtualDisplayBridge removeDisplay:(NSInteger)displayId]; + + napi_value js_result; + status = napi_get_boolean(env, result, &js_result); + if (status != napi_ok) + return NULL; + + return js_result; +} + +napi_value Init(napi_env env, napi_value exports) { + napi_status status; + napi_property_descriptor descriptors[] = { + {"addDisplay", NULL, AddDisplay, NULL, NULL, NULL, napi_default, NULL}, + {"removeDisplay", NULL, RemoveDisplay, NULL, NULL, NULL, napi_default, + NULL}}; + + status = napi_define_properties( + env, exports, sizeof(descriptors) / sizeof(*descriptors), descriptors); + if (status != napi_ok) + return NULL; + + return exports; +} + +} // namespace + +NAPI_MODULE(NODE_GYP_MODULE_NAME, Init) \ No newline at end of file diff --git a/spec/package.json b/spec/package.json index 797b4d8bc5e46..4bc6ace3937f2 100644 --- a/spec/package.json +++ b/spec/package.json @@ -24,6 +24,7 @@ "@electron-ci/uv-dlopen": "file:./fixtures/native-addon/uv-dlopen/", "@electron-ci/osr-gpu": "file:./fixtures/native-addon/osr-gpu/", "@electron-ci/external-ab": "file:./fixtures/native-addon/external-ab/", + "@electron-ci/virtual-display": "file:./fixtures/native-addon/virtual-display/", "@electron/fuses": "^1.8.0", "@electron/packager": "^18.3.2", "@types/sinon": "^9.0.4", From 1242d4dae6e01bc72f2eaedc8970825811edfdb4 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 30 Jul 2025 23:38:08 +0530 Subject: [PATCH 022/268] fix: update yarn.lock file --- spec/yarn.lock | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/spec/yarn.lock b/spec/yarn.lock index b37a017d30807..2ab549ff5162b 100644 --- a/spec/yarn.lock +++ b/spec/yarn.lock @@ -19,6 +19,12 @@ "@electron-ci/uv-dlopen@file:./fixtures/native-addon/uv-dlopen": version "0.0.1" +"@electron-ci/virtual-display@file:./fixtures/native-addon/virtual-display": + version "1.0.0" + dependencies: + bindings "^1.5.0" + node-addon-api "^8.3.0" + "@electron/asar@^3.2.1", "@electron/asar@^3.2.7": version "3.2.10" resolved "https://registry.yarnpkg.com/@electron/asar/-/asar-3.2.10.tgz#615cf346b734b23cafa4e0603551010bd0e50aa8" @@ -517,7 +523,7 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== -bindings@^1.2.1: +bindings@^1.2.1, bindings@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== @@ -1892,6 +1898,11 @@ node-addon-api@8.0.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-8.0.0.tgz#5453b7ad59dd040d12e0f1a97a6fa1c765c5c9d2" integrity sha512-ipO7rsHEBqa9STO5C5T10fj732ml+5kLN1cAG8/jdHd56ldQeGj3Q7+scUS+VHK/qy1zLEwC4wMK5+yM0btPvw== +node-addon-api@^8.3.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-8.5.0.tgz#c91b2d7682fa457d2e1c388150f0dff9aafb8f3f" + integrity sha512-/bRZty2mXUIFY/xU5HLvveNHlswNJej+RnxBjOMkidWfwZzgTbPG1E3K5TOxRLOR+5hX7bSofy8yf1hZevMS8A== + node-fetch@^2.6.7: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" From a7a0ab2e432664ea2dd9d7b1086ca97068159f6b Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Sun, 3 Aug 2025 10:20:14 +0530 Subject: [PATCH 023/268] feat: support any resolution for new displays --- .../include/VirtualDisplayBridge.h | 2 +- .../virtual-display/src/VirtualDisplay.swift | 32 ++----- .../src/VirtualDisplayBridge.m | 6 +- .../native-addon/virtual-display/src/addon.mm | 88 ++++++++++++++++--- 4 files changed, 86 insertions(+), 42 deletions(-) diff --git a/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h b/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h index 05a597f156860..d280de0f8d0e2 100644 --- a/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h +++ b/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h @@ -6,7 +6,7 @@ @interface VirtualDisplayBridge : NSObject -+ (NSInteger)addDisplay; ++ (NSInteger)addDisplay:(int)width height:(int)height; + (BOOL)removeDisplay:(NSInteger)displayId; @end diff --git a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift index 7631fe2b8e67b..1c14c7c3b9686 100644 --- a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift +++ b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift @@ -3,8 +3,11 @@ import Cocoa import os.log @objc public class VirtualDisplay: NSObject { - @objc public static func addDisplay() -> Int { - return DummyManager.createDummyByDefinitionId(10) ?? 0 + @objc public static func addDisplay(width: Int, height: Int) -> Int { + let refreshRates: [Double] = [60.0] // Always 60Hz default + let description = "\(width)x\(height) Display" + let definition = DummyDefinition(width, height, 1, refreshRates, description, false) + return DummyManager.createDummy(definition) ?? 0 } @objc public static func removeDisplay(id: Int) -> Bool { @@ -16,25 +19,15 @@ import os.log class DummyManager { struct DefinedDummy { var dummy: Dummy - var definitionId: Int? } static var definedDummies: [Int: DefinedDummy] = [:] static var dummyCounter: Int = 0 - static var dummyDefinitions: [Int: DummyDefinition] = [:] - static func createDummyByDefinitionId(_ dummyDefinitionId: Int, isPortrait: Bool = false, serialNum: UInt32 = 0, doConnect: Bool = true) -> Int? { - updateDummyDefinitions() - if let dummyDefinition = self.dummyDefinitions[dummyDefinitionId] { - return self.createDummy(dummyDefinition, dummyDefinitionId: dummyDefinitionId, isPortrait: isPortrait, serialNum: serialNum, doConnect: doConnect) - } - return nil - } - - static func createDummy(_ dummyDefinition: DummyDefinition, dummyDefinitionId: Int? = nil, isPortrait _: Bool = false, serialNum: UInt32 = 0, doConnect: Bool = true) -> Int { + static func createDummy(_ dummyDefinition: DummyDefinition, isPortrait _: Bool = false, serialNum: UInt32 = 0, doConnect: Bool = true) -> Int? { let dummy = Dummy(dummyDefinition: dummyDefinition, serialNum: serialNum, doConnect: doConnect) self.dummyCounter += 1 - self.definedDummies[self.dummyCounter] = DefinedDummy(dummy: dummy, definitionId: dummyDefinitionId) + self.definedDummies[self.dummyCounter] = DefinedDummy(dummy: dummy) return self.dummyCounter } @@ -46,15 +39,6 @@ class DummyManager { } self.definedDummies[number] = nil } - - static func updateDummyDefinitions() { - let refreshRates: [Double] = [60] - self.dummyDefinitions = [ - 10: DummyDefinition(16, 9, 2, refreshRates, "16:9 (HD/4K/5K/6K)", false), - 20: DummyDefinition(16, 10, 2, refreshRates, "16:10 (WXGA)", false), - 30: DummyDefinition(4, 3, 2, refreshRates, "4:3 (VGA)", false), - ] - } } struct DummyDefinition { @@ -132,7 +116,7 @@ class Dummy: Equatable { os_log("Disconnected virtual display: %{public}@", type: .info, "\(self.getName())") } - static func createVirtualDisplay(_ definition: DummyDefinition, name: String, serialNum: UInt32, hiDPI: Bool = true) -> CGVirtualDisplay? { + static func createVirtualDisplay(_ definition: DummyDefinition, name: String, serialNum: UInt32, hiDPI: Bool = false) -> CGVirtualDisplay? { os_log("Creating virtual display: %{public}@", type: .info, "\(name)") if let descriptor = CGVirtualDisplayDescriptor() { os_log("- Preparing descriptor...", type: .info) diff --git a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m index ad4dae4d552a8..a488385a90ffb 100644 --- a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m +++ b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m @@ -3,12 +3,12 @@ @implementation VirtualDisplayBridge -+ (NSInteger)addDisplay { - return [VirtualDisplay addDisplay]; ++ (NSInteger)addDisplay:(int)width height:(int)height { + return [VirtualDisplay addDisplayWithWidth:width height:height]; } + (BOOL)removeDisplay:(NSInteger)displayId { - return [VirtualDisplay removeDisplayWithId:displayId]; + return [VirtualDisplay removeDisplayWithId:(int)displayId]; } @end \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/src/addon.mm b/spec/fixtures/native-addon/virtual-display/src/addon.mm index 63e3370ecf40c..8f9537d06601d 100644 --- a/spec/fixtures/native-addon/virtual-display/src/addon.mm +++ b/spec/fixtures/native-addon/virtual-display/src/addon.mm @@ -4,13 +4,75 @@ namespace { +// Helper function to extract integer property from object +bool GetIntProperty(napi_env env, + napi_value object, + const char* prop_name, + int* result, + int default_value) { + *result = default_value; + + bool has_prop; + if (napi_has_named_property(env, object, prop_name, &has_prop) != napi_ok || + !has_prop) { + return true; // Use default + } + + napi_value prop_value; + if (napi_get_named_property(env, object, prop_name, &prop_value) != napi_ok) { + return false; + } + + if (napi_get_value_int32(env, prop_value, result) != napi_ok) { + return false; + } + + return true; +} + napi_value AddDisplay(napi_env env, napi_callback_info info) { - NSInteger displayId = [VirtualDisplayBridge addDisplay]; + size_t argc = 1; + napi_value args[1]; + + if (napi_get_cb_info(env, info, &argc, args, NULL, NULL) != napi_ok) { + return NULL; + } + + // Default values + int width = 1920; + int height = 1080; + + // If object argument provided, extract properties + if (argc >= 1) { + napi_valuetype valuetype; + if (napi_typeof(env, args[0], &valuetype) != napi_ok) { + napi_throw_error(env, NULL, "Failed to get argument type"); + return NULL; + } + + if (valuetype == napi_object) { + if (!GetIntProperty(env, args[0], "width", &width, 1920)) { + napi_throw_error(env, NULL, "Width must be a number"); + return NULL; + } + + if (!GetIntProperty(env, args[0], "height", &height, 1080)) { + napi_throw_error(env, NULL, "Height must be a number"); + return NULL; + } + } else { + napi_throw_error(env, NULL, + "Expected object with width/height properties"); + return NULL; + } + } + + NSInteger displayId = [VirtualDisplayBridge addDisplay:width height:height]; napi_value result; - napi_status status = napi_create_int64(env, displayId, &result); - if (status != napi_ok) + if (napi_create_int64(env, displayId, &result) != napi_ok) { return NULL; + } return result; } @@ -18,11 +80,10 @@ napi_value AddDisplay(napi_env env, napi_callback_info info) { napi_value RemoveDisplay(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; - napi_status status; - status = napi_get_cb_info(env, info, &argc, args, NULL, NULL); - if (status != napi_ok) + if (napi_get_cb_info(env, info, &argc, args, NULL, NULL) != napi_ok) { return NULL; + } if (argc < 1) { napi_throw_error(env, NULL, "Expected number argument"); @@ -30,8 +91,7 @@ napi_value RemoveDisplay(napi_env env, napi_callback_info info) { } int64_t displayId; - status = napi_get_value_int64(env, args[0], &displayId); - if (status != napi_ok) { + if (napi_get_value_int64(env, args[0], &displayId) != napi_ok) { napi_throw_error(env, NULL, "Expected number argument"); return NULL; } @@ -39,24 +99,24 @@ napi_value RemoveDisplay(napi_env env, napi_callback_info info) { BOOL result = [VirtualDisplayBridge removeDisplay:(NSInteger)displayId]; napi_value js_result; - status = napi_get_boolean(env, result, &js_result); - if (status != napi_ok) + if (napi_get_boolean(env, result, &js_result) != napi_ok) { return NULL; + } return js_result; } napi_value Init(napi_env env, napi_value exports) { - napi_status status; napi_property_descriptor descriptors[] = { {"addDisplay", NULL, AddDisplay, NULL, NULL, NULL, napi_default, NULL}, {"removeDisplay", NULL, RemoveDisplay, NULL, NULL, NULL, napi_default, NULL}}; - status = napi_define_properties( - env, exports, sizeof(descriptors) / sizeof(*descriptors), descriptors); - if (status != napi_ok) + if (napi_define_properties(env, exports, + sizeof(descriptors) / sizeof(*descriptors), + descriptors) != napi_ok) { return NULL; + } return exports; } From 135e801fb021be13908308e70dd5c05e556358c3 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Sun, 3 Aug 2025 16:09:18 +0530 Subject: [PATCH 024/268] feat: support display positioning --- spec/api-browser-window-spec.ts | 20 +++ .../native-addon/virtual-display/binding.gyp | 2 + .../include/VirtualDisplayBridge.h | 4 +- .../virtual-display/lib/virtual-display.js | 4 +- .../virtual-display/src/Dummy.swift | 151 ++++++++++++++++ .../virtual-display/src/VirtualDisplay.swift | 165 ++++-------------- .../src/VirtualDisplayBridge.m | 8 +- .../native-addon/virtual-display/src/addon.mm | 101 ++++++++--- 8 files changed, 290 insertions(+), 165 deletions(-) create mode 100644 spec/fixtures/native-addon/virtual-display/src/Dummy.swift diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 6cc21f5ac9ab9..56e546c05b058 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -7884,4 +7884,24 @@ describe('BrowserWindow module', () => { }); }); }); + + describe('virtual-display', async () => { + it('should load the addon and add a display', async () => { + const virtualDisplay = require('@electron-ci/virtual-display'); + const displayId = virtualDisplay.create({ + height: 1080, // height of the display + width: 1920, // width of the display + x: 0, // origin x of the display + y: 0 // origin y of the display + }); + expect(displayId).to.not.be.null(); + + screen.getAllDisplays().forEach(display => { + console.log(display.bounds); + }); + + const result = virtualDisplay.destroy(displayId); + expect(result).to.equal(true); + }); + }); }); diff --git a/spec/fixtures/native-addon/virtual-display/binding.gyp b/spec/fixtures/native-addon/virtual-display/binding.gyp index 2f8c82f4489cf..f8ef0b280660f 100644 --- a/spec/fixtures/native-addon/virtual-display/binding.gyp +++ b/spec/fixtures/native-addon/virtual-display/binding.gyp @@ -51,6 +51,7 @@ "action_name": "build_swift", "inputs": [ "src/VirtualDisplay.swift", + "src/Dummy.swift", "include/VirtualDisplayBridge.h" ], "outputs": [ @@ -60,6 +61,7 @@ "action": [ "swiftc", "src/VirtualDisplay.swift", + "src/Dummy.swift", "-import-objc-header", "include/VirtualDisplayBridge.h", "-emit-objc-header-path", "./build_swift/virtual_display-Swift.h", "-emit-library", "-o", "./build_swift/libVirtualDisplay.dylib", diff --git a/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h b/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h index d280de0f8d0e2..6ac5cbacb8f9a 100644 --- a/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h +++ b/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h @@ -6,8 +6,8 @@ @interface VirtualDisplayBridge : NSObject -+ (NSInteger)addDisplay:(int)width height:(int)height; -+ (BOOL)removeDisplay:(NSInteger)displayId; ++ (NSInteger)create:(int)width height:(int)height x:(int)x y:(int)y; ++ (BOOL)destroy:(NSInteger)displayId; @end diff --git a/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js b/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js index 6f49685c32117..f43c420599df0 100644 --- a/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js +++ b/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js @@ -1,6 +1,6 @@ module.exports = process.platform === 'darwin' ? require('../build/Release/virtual_display.node') : { - addDisplay: () => { throw new Error('Virtual displays only supported on macOS'); }, - removeDisplay: () => { throw new Error('Virtual displays only supported on macOS'); } + create: () => { throw new Error('Virtual displays only supported on macOS'); }, + destroy: () => { throw new Error('Virtual displays only supported on macOS'); } }; diff --git a/spec/fixtures/native-addon/virtual-display/src/Dummy.swift b/spec/fixtures/native-addon/virtual-display/src/Dummy.swift new file mode 100644 index 0000000000000..ef0195f3039fe --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/src/Dummy.swift @@ -0,0 +1,151 @@ +import Foundation +import Cocoa +import os.log + +class DummyManager { + struct DefinedDummy { + var dummy: Dummy + } + + static var definedDummies: [Int: DefinedDummy] = [:] + static var dummyCounter: Int = 0 + + static func createDummy(_ dummyDefinition: DummyDefinition, isPortrait _: Bool = false, serialNum: UInt32 = 0, doConnect: Bool = true) -> Int? { + let dummy = Dummy(dummyDefinition: dummyDefinition, serialNum: serialNum, doConnect: doConnect) + self.dummyCounter += 1 + self.definedDummies[self.dummyCounter] = DefinedDummy(dummy: dummy) + return self.dummyCounter + } + + static func discardDummyByNumber(_ number: Int) { + if let definedDummy = self.definedDummies[number] { + if definedDummy.dummy.isConnected { + definedDummy.dummy.disconnect() + } + } + self.definedDummies[number] = nil + } +} + +struct DummyDefinition { + let aspectWidth, aspectHeight, multiplierStep, minMultiplier, maxMultiplier: Int + let refreshRates: [Double] + let description: String + let addSeparatorAfter: Bool + + init(_ aspectWidth: Int, _ aspectHeight: Int, _ step: Int, _ refreshRates: [Double], _ description: String, _ addSeparatorAfter: Bool = false) { + let minX: Int = 720 + let minY: Int = 720 + let maxX: Int = 8192 + let maxY: Int = 8192 + let minMultiplier = max(Int(ceil(Float(minX) / (Float(aspectWidth) * Float(step)))), Int(ceil(Float(minY) / (Float(aspectHeight) * Float(step))))) + let maxMultiplier = min(Int(floor(Float(maxX) / (Float(aspectWidth) * Float(step)))), Int(floor(Float(maxY) / (Float(aspectHeight) * Float(step))))) + + self.aspectWidth = aspectWidth + self.aspectHeight = aspectHeight + self.minMultiplier = minMultiplier + self.maxMultiplier = maxMultiplier + self.multiplierStep = step + self.refreshRates = refreshRates + self.description = description + self.addSeparatorAfter = addSeparatorAfter + } +} + +class Dummy: Equatable { + var virtualDisplay: CGVirtualDisplay? + var dummyDefinition: DummyDefinition + let serialNum: UInt32 + var isConnected: Bool = false + var displayIdentifier: CGDirectDisplayID = 0 + + static func == (lhs: Dummy, rhs: Dummy) -> Bool { + lhs.serialNum == rhs.serialNum + } + + init(dummyDefinition: DummyDefinition, serialNum: UInt32 = 0, doConnect: Bool = true) { + var storedSerialNum: UInt32 = serialNum + if storedSerialNum == 0 { + storedSerialNum = UInt32.random(in: 0 ... UInt32.max) + } + self.dummyDefinition = dummyDefinition + self.serialNum = storedSerialNum + if doConnect { + _ = self.connect() + } + } + + func getName() -> String { + "Dummy \(self.dummyDefinition.description.components(separatedBy: " ").first ?? self.dummyDefinition.description)" + } + + func connect() -> Bool { + if self.virtualDisplay != nil || self.isConnected { + self.disconnect() + } + let name: String = self.getName() + if let virtualDisplay = Dummy.createVirtualDisplay(self.dummyDefinition, name: name, serialNum: self.serialNum) { + self.virtualDisplay = virtualDisplay + self.displayIdentifier = virtualDisplay.displayID + self.isConnected = true + os_log("Display %{public}@ successfully connected", type: .info, "\(name)") + return true + } else { + os_log("Failed to connect display %{public}@", type: .info, "\(name)") + return false + } + } + + func disconnect() { + self.virtualDisplay = nil + self.isConnected = false + os_log("Disconnected virtual display: %{public}@", type: .info, "\(self.getName())") + } + + private static func waitForDisplayRegistration(_ displayId: CGDirectDisplayID) -> Bool { + for _ in 0..<20 { + var count: UInt32 = 0, displays = [CGDirectDisplayID](repeating: 0, count: 32) + if CGGetActiveDisplayList(32, &displays, &count) == .success && displays[0..<Int(count)].contains(displayId) { + return true + } + usleep(100000) + } + return false + } + + static func createVirtualDisplay(_ definition: DummyDefinition, name: String, serialNum: UInt32, hiDPI: Bool = false) -> CGVirtualDisplay? { + if let descriptor = CGVirtualDisplayDescriptor() { + descriptor.queue = DispatchQueue.global(qos: .userInteractive) + descriptor.name = name + descriptor.whitePoint = CGPoint(x: 0.950, y: 1.000) + descriptor.redPrimary = CGPoint(x: 0.454, y: 0.242) + descriptor.greenPrimary = CGPoint(x: 0.353, y: 0.674) + descriptor.bluePrimary = CGPoint(x: 0.157, y: 0.084) + descriptor.maxPixelsWide = UInt32(definition.aspectWidth * definition.multiplierStep * definition.maxMultiplier) + descriptor.maxPixelsHigh = UInt32(definition.aspectHeight * definition.multiplierStep * definition.maxMultiplier) + let diagonalSizeRatio: Double = (24 * 25.4) / sqrt(Double(definition.aspectWidth * definition.aspectWidth + definition.aspectHeight * definition.aspectHeight)) + descriptor.sizeInMillimeters = CGSize(width: Double(definition.aspectWidth) * diagonalSizeRatio, height: Double(definition.aspectHeight) * diagonalSizeRatio) + descriptor.serialNum = serialNum + descriptor.productID = UInt32(min(definition.aspectWidth - 1, 255) * 256 + min(definition.aspectHeight - 1, 255)) + descriptor.vendorID = UInt32(0xF0F0) + if let display = CGVirtualDisplay(descriptor: descriptor) { + var modes = [CGVirtualDisplayMode?](repeating: nil, count: definition.maxMultiplier - definition.minMultiplier + 1) + for multiplier in definition.minMultiplier ... definition.maxMultiplier { + for refreshRate in definition.refreshRates { + let width = UInt32(definition.aspectWidth * multiplier * definition.multiplierStep) + let height = UInt32(definition.aspectHeight * multiplier * definition.multiplierStep) + modes[multiplier - definition.minMultiplier] = CGVirtualDisplayMode(width: width, height: height, refreshRate: refreshRate)! + } + } + if let settings = CGVirtualDisplaySettings() { + settings.hiDPI = hiDPI ? 1 : 0 + settings.modes = modes as [Any] + if display.applySettings(settings) { + return waitForDisplayRegistration(display.displayID) ? display : nil + } + } + } + } + return nil + } +} \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift index 1c14c7c3b9686..1c4e57952cf89 100644 --- a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift +++ b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift @@ -3,157 +3,52 @@ import Cocoa import os.log @objc public class VirtualDisplay: NSObject { - @objc public static func addDisplay(width: Int, height: Int) -> Int { + @objc public static func create(width: Int, height: Int, x: Int, y: Int) -> Int { let refreshRates: [Double] = [60.0] // Always 60Hz default let description = "\(width)x\(height) Display" let definition = DummyDefinition(width, height, 1, refreshRates, description, false) - return DummyManager.createDummy(definition) ?? 0 + let displayId = DummyManager.createDummy(definition) ?? 0 + positionDisplay(displayId: displayId, x: x, y: y) + + return displayId } - @objc public static func removeDisplay(id: Int) -> Bool { + @objc public static func destroy(id: Int) -> Bool { DummyManager.discardDummyByNumber(id) return true } -} - -class DummyManager { - struct DefinedDummy { - var dummy: Dummy - } - - static var definedDummies: [Int: DefinedDummy] = [:] - static var dummyCounter: Int = 0 - static func createDummy(_ dummyDefinition: DummyDefinition, isPortrait _: Bool = false, serialNum: UInt32 = 0, doConnect: Bool = true) -> Int? { - let dummy = Dummy(dummyDefinition: dummyDefinition, serialNum: serialNum, doConnect: doConnect) - self.dummyCounter += 1 - self.definedDummies[self.dummyCounter] = DefinedDummy(dummy: dummy) - return self.dummyCounter - } - - static func discardDummyByNumber(_ number: Int) { - if let definedDummy = self.definedDummies[number] { - if definedDummy.dummy.isConnected { - definedDummy.dummy.disconnect() - } + private static func positionDisplay(displayId: Int, x: Int, y: Int) { + guard let definedDummy = DummyManager.definedDummies[displayId], + definedDummy.dummy.isConnected else { + os_log("VirtualDisplay: Cannot position display %{public}@: display not found or not connected", type: .error, "\(displayId)") + return } - self.definedDummies[number] = nil - } -} - -struct DummyDefinition { - let aspectWidth, aspectHeight, multiplierStep, minMultiplier, maxMultiplier: Int - let refreshRates: [Double] - let description: String - let addSeparatorAfter: Bool - - init(_ aspectWidth: Int, _ aspectHeight: Int, _ step: Int, _ refreshRates: [Double], _ description: String, _ addSeparatorAfter: Bool = false) { - let minX: Int = 720 - let minY: Int = 720 - let maxX: Int = 8192 - let maxY: Int = 8192 - let minMultiplier = max(Int(ceil(Float(minX) / (Float(aspectWidth) * Float(step)))), Int(ceil(Float(minY) / (Float(aspectHeight) * Float(step))))) - let maxMultiplier = min(Int(floor(Float(maxX) / (Float(aspectWidth) * Float(step)))), Int(floor(Float(maxY) / (Float(aspectHeight) * Float(step))))) - self.aspectWidth = aspectWidth - self.aspectHeight = aspectHeight - self.minMultiplier = minMultiplier - self.maxMultiplier = maxMultiplier - self.multiplierStep = step - self.refreshRates = refreshRates - self.description = description - self.addSeparatorAfter = addSeparatorAfter - } -} - -class Dummy: Equatable { - var virtualDisplay: CGVirtualDisplay? - var dummyDefinition: DummyDefinition - let serialNum: UInt32 - var isConnected: Bool = false - var displayIdentifier: CGDirectDisplayID = 0 - - static func == (lhs: Dummy, rhs: Dummy) -> Bool { - lhs.serialNum == rhs.serialNum - } + let cgDisplayId = definedDummy.dummy.displayIdentifier - init(dummyDefinition: DummyDefinition, serialNum: UInt32 = 0, doConnect: Bool = true) { - var storedSerialNum: UInt32 = serialNum - if storedSerialNum == 0 { - storedSerialNum = UInt32.random(in: 0 ... UInt32.max) - } - self.dummyDefinition = dummyDefinition - self.serialNum = storedSerialNum - if doConnect { - _ = self.connect() + var config: CGDisplayConfigRef? = nil + let beginResult = CGBeginDisplayConfiguration(&config) + + if beginResult != .success { + os_log("VirtualDisplay: Cannot position display, failed to begin display configuration via CGBeginDisplayConfiguration: error %{public}@", type: .error, "\(beginResult.rawValue)") + return } - } - func getName() -> String { - "Dummy \(self.dummyDefinition.description.components(separatedBy: " ").first ?? self.dummyDefinition.description)" - } - - func connect() -> Bool { - if self.virtualDisplay != nil || self.isConnected { - self.disconnect() - } - let name: String = self.getName() - if let virtualDisplay = Dummy.createVirtualDisplay(self.dummyDefinition, name: name, serialNum: self.serialNum) { - self.virtualDisplay = virtualDisplay - self.displayIdentifier = virtualDisplay.displayID - self.isConnected = true - os_log("Display %{public}@ successfully connected", type: .info, "\(name)") - return true - } else { - os_log("Failed to connect display %{public}@", type: .info, "\(name)") - return false + let configResult = CGConfigureDisplayOrigin(config, cgDisplayId, Int32(x), Int32(y)) + + if configResult != .success { + os_log("VirtualDisplay: Cannot position display, failed to configure display origin via CGConfigureDisplayOrigin: error %{public}@", type: .error, "\(configResult.rawValue)") + CGCancelDisplayConfiguration(config) + return } - } - - func disconnect() { - self.virtualDisplay = nil - self.isConnected = false - os_log("Disconnected virtual display: %{public}@", type: .info, "\(self.getName())") - } - static func createVirtualDisplay(_ definition: DummyDefinition, name: String, serialNum: UInt32, hiDPI: Bool = false) -> CGVirtualDisplay? { - os_log("Creating virtual display: %{public}@", type: .info, "\(name)") - if let descriptor = CGVirtualDisplayDescriptor() { - os_log("- Preparing descriptor...", type: .info) - descriptor.queue = DispatchQueue.global(qos: .userInteractive) - descriptor.name = name - descriptor.whitePoint = CGPoint(x: 0.950, y: 1.000) - descriptor.redPrimary = CGPoint(x: 0.454, y: 0.242) - descriptor.greenPrimary = CGPoint(x: 0.353, y: 0.674) - descriptor.bluePrimary = CGPoint(x: 0.157, y: 0.084) - descriptor.maxPixelsWide = UInt32(definition.aspectWidth * definition.multiplierStep * definition.maxMultiplier) - descriptor.maxPixelsHigh = UInt32(definition.aspectHeight * definition.multiplierStep * definition.maxMultiplier) - let diagonalSizeRatio: Double = (24 * 25.4) / sqrt(Double(definition.aspectWidth * definition.aspectWidth + definition.aspectHeight * definition.aspectHeight)) - descriptor.sizeInMillimeters = CGSize(width: Double(definition.aspectWidth) * diagonalSizeRatio, height: Double(definition.aspectHeight) * diagonalSizeRatio) - descriptor.serialNum = serialNum - descriptor.productID = UInt32(min(definition.aspectWidth - 1, 255) * 256 + min(definition.aspectHeight - 1, 255)) - descriptor.vendorID = UInt32(0xF0F0) - if let display = CGVirtualDisplay(descriptor: descriptor) { - os_log("- Creating display, preparing modes...", type: .info) - var modes = [CGVirtualDisplayMode?](repeating: nil, count: definition.maxMultiplier - definition.minMultiplier + 1) - for multiplier in definition.minMultiplier ... definition.maxMultiplier { - for refreshRate in definition.refreshRates { - let width = UInt32(definition.aspectWidth * multiplier * definition.multiplierStep) - let height = UInt32(definition.aspectHeight * multiplier * definition.multiplierStep) - modes[multiplier - definition.minMultiplier] = CGVirtualDisplayMode(width: width, height: height, refreshRate: refreshRate)! - } - } - if let settings = CGVirtualDisplaySettings() { - os_log("- Preparing settings for display...", type: .info) - settings.hiDPI = hiDPI ? 1 : 0 - settings.modes = modes as [Any] - if display.applySettings(settings) { - os_log("- Settings are successfully applied. Dummy Display ID is %{public}@", type: .info, String(display.displayID)) - return display - } - } - } + let completeResult = CGCompleteDisplayConfiguration(config, .permanently) + + if completeResult == .success { + os_log("VirtualDisplay: Successfully positioned display %{public}@ at (%{public}@, %{public}@)", type: .info, "\(displayId)", "\(x)", "\(y)") + } else { + os_log("VirtualDisplay: Cannot position display, failed to complete display configuration via CGCompleteDisplayConfiguration: error %{public}@", type: .error, "\(completeResult.rawValue)") } - return nil } } \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m index a488385a90ffb..b18ccbe97757d 100644 --- a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m +++ b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m @@ -3,12 +3,12 @@ @implementation VirtualDisplayBridge -+ (NSInteger)addDisplay:(int)width height:(int)height { - return [VirtualDisplay addDisplayWithWidth:width height:height]; ++ (NSInteger)create:(int)width height:(int)height x:(int)x y:(int)y { + return [VirtualDisplay createWithWidth:width height:height x:x y:y]; } -+ (BOOL)removeDisplay:(NSInteger)displayId { - return [VirtualDisplay removeDisplayWithId:(int)displayId]; ++ (BOOL)destroy:(NSInteger)displayId { + return [VirtualDisplay destroyWithId:(int)displayId]; } @end \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/src/addon.mm b/spec/fixtures/native-addon/virtual-display/src/addon.mm index 8f9537d06601d..e15d59a532e8e 100644 --- a/spec/fixtures/native-addon/virtual-display/src/addon.mm +++ b/spec/fixtures/native-addon/virtual-display/src/addon.mm @@ -4,7 +4,13 @@ namespace { -// Helper function to extract integer property from object +typedef struct { + const char* name; + int default_val; + int* ptr; +} PropertySpec; + +// Helper function to get an integer property from an object bool GetIntProperty(napi_env env, napi_value object, const char* prop_name, @@ -15,7 +21,7 @@ bool GetIntProperty(napi_env env, bool has_prop; if (napi_has_named_property(env, object, prop_name, &has_prop) != napi_ok || !has_prop) { - return true; // Use default + return true; } napi_value prop_value; @@ -30,7 +36,54 @@ bool GetIntProperty(napi_env env, return true; } -napi_value AddDisplay(napi_env env, napi_callback_info info) { +// Helper function to validate and parse object properties +bool ParseObjectProperties(napi_env env, + napi_value object, + PropertySpec props[], + size_t prop_count) { + // Process all properties + for (size_t i = 0; i < prop_count; i++) { + if (!GetIntProperty(env, object, props[i].name, props[i].ptr, + props[i].default_val)) { + char error_msg[50]; + snprintf(error_msg, sizeof(error_msg), "%s must be a number", + props[i].name); + napi_throw_error(env, NULL, error_msg); + return false; + } + } + + // Check for unknown properties + napi_value prop_names; + uint32_t count; + napi_get_property_names(env, object, &prop_names); + napi_get_array_length(env, prop_names, &count); + + for (uint32_t i = 0; i < count; i++) { + napi_value prop_name; + napi_get_element(env, prop_names, i, &prop_name); + size_t len; + char name[20]; + napi_get_value_string_utf8(env, prop_name, name, sizeof(name), &len); + + bool found = false; + for (size_t j = 0; j < prop_count; j++) { + if (strcmp(name, props[j].name) == 0) { + found = true; + break; + } + } + if (!found) { + napi_throw_error(env, NULL, "Object contains unknown properties"); + return false; + } + } + + return true; +} + +// virtualDisplay.create() +napi_value create(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; @@ -38,11 +91,13 @@ napi_value AddDisplay(napi_env env, napi_callback_info info) { return NULL; } - // Default values - int width = 1920; - int height = 1080; + int width = 1920, height = 1080, x = 0, y = 0; + + PropertySpec props[] = {{"width", 1920, &width}, + {"height", 1080, &height}, + {"x", 0, &x}, + {"y", 0, &y}}; - // If object argument provided, extract properties if (argc >= 1) { napi_valuetype valuetype; if (napi_typeof(env, args[0], &valuetype) != napi_ok) { @@ -51,23 +106,25 @@ napi_value AddDisplay(napi_env env, napi_callback_info info) { } if (valuetype == napi_object) { - if (!GetIntProperty(env, args[0], "width", &width, 1920)) { - napi_throw_error(env, NULL, "Width must be a number"); - return NULL; - } - - if (!GetIntProperty(env, args[0], "height", &height, 1080)) { - napi_throw_error(env, NULL, "Height must be a number"); + if (!ParseObjectProperties(env, args[0], props, + sizeof(props) / sizeof(props[0]))) { return NULL; } } else { - napi_throw_error(env, NULL, - "Expected object with width/height properties"); + napi_throw_error(env, NULL, "Expected an object as the argument"); return NULL; } } - NSInteger displayId = [VirtualDisplayBridge addDisplay:width height:height]; + NSInteger displayId = [VirtualDisplayBridge create:width + height:height + x:x + y:y]; + + if (displayId == 0) { + napi_throw_error(env, NULL, "Failed to create virtual display"); + return NULL; + } napi_value result; if (napi_create_int64(env, displayId, &result) != napi_ok) { @@ -77,7 +134,8 @@ napi_value AddDisplay(napi_env env, napi_callback_info info) { return result; } -napi_value RemoveDisplay(napi_env env, napi_callback_info info) { +// virtualDisplay.destroy() +napi_value destroy(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; @@ -96,7 +154,7 @@ napi_value RemoveDisplay(napi_env env, napi_callback_info info) { return NULL; } - BOOL result = [VirtualDisplayBridge removeDisplay:(NSInteger)displayId]; + BOOL result = [VirtualDisplayBridge destroy:(NSInteger)displayId]; napi_value js_result; if (napi_get_boolean(env, result, &js_result) != napi_ok) { @@ -108,9 +166,8 @@ napi_value RemoveDisplay(napi_env env, napi_callback_info info) { napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor descriptors[] = { - {"addDisplay", NULL, AddDisplay, NULL, NULL, NULL, napi_default, NULL}, - {"removeDisplay", NULL, RemoveDisplay, NULL, NULL, NULL, napi_default, - NULL}}; + {"create", NULL, create, NULL, NULL, NULL, napi_default, NULL}, + {"destroy", NULL, destroy, NULL, NULL, NULL, napi_default, NULL}}; if (napi_define_properties(env, exports, sizeof(descriptors) / sizeof(*descriptors), From f7e2ade62c5460d48a646a970e2a4083dc0c15f0 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Sun, 3 Aug 2025 20:34:37 +0530 Subject: [PATCH 025/268] docs: multi-monitor tests --- docs/development/multi-monitor-testing.md | 79 +++++++++++++++++++++++ docs/development/testing.md | 8 +++ 2 files changed, 87 insertions(+) create mode 100644 docs/development/multi-monitor-testing.md diff --git a/docs/development/multi-monitor-testing.md b/docs/development/multi-monitor-testing.md new file mode 100644 index 0000000000000..5a1d7e772b662 --- /dev/null +++ b/docs/development/multi-monitor-testing.md @@ -0,0 +1,79 @@ +# Multi-Monitor Testing + +The `virtualDisplay` addon leverages macOS CoreGraphics APIs to create virtual displays, allowing you to write and run multi-monitor tests without the need for physical monitors. + +## Methods + +#### `virtualDisplay.create([options])` + +Creates a virtual display and returns a display ID. + +```js @ts-nocheck +const virtualDisplay = require('@electron-ci/virtual-display') +// Default: 1920×1080 at origin (0, 0) +const displayId = virtualDisplay.create() +``` + +```js @ts-nocheck +const virtualDisplay = require('@electron-ci/virtual-display') +// Custom options (all parameters optional and have default values) +const displayId = virtualDisplay.create({ + width: 2560, // Display width in pixels + height: 1440, // Display height in pixels + x: 1920, // X position (top-left corner) + y: 0 // Y position (top-left corner) +}) +``` + +**Returns:** `number` - Unique display ID used to identify the display. Returns `0` on failure to create display. + +#### `virtualDisplay.destroy(displayId)` + +Removes the virtual display. + +```js @ts-nocheck +const success = virtualDisplay.destroy(displayId) +``` + +**Returns:** `boolean` - Success status + +## Display Constraints + +### Size Limits + +Virtual displays are constrained to 720×720 pixels minimum and 8192×8192 pixels maximum. Actual limits may vary depending on your Mac's graphics capabilities, so sizes outside this range (like 9000×6000) may fail on some systems. + +```js @ts-nocheck +// Safe sizes for testing +virtualDisplay.create({ width: 1920, height: 1080 }) // Full HD +virtualDisplay.create({ width: 3840, height: 2160 }) // 4K +``` + +### Positioning Behavior + +macOS maintains a contiguous desktop space by automatically adjusting display positions if there are any overlaps or gaps. In case of either, the placement of the new origin is as close as possible to the requested location, without overlapping or leaving a gap between displays. + +**Overlap:** + +```js @ts-nocheck +// Requested positions +const display1 = virtualDisplay.create({ x: 0, y: 0, width: 1920, height: 1080 }) +const display2 = virtualDisplay.create({ x: 500, y: 0, width: 1920, height: 1080 }) + +// macOS automatically repositions display2 to x: 1920 to prevent overlap +const actualBounds = screen.getAllDisplays().map(d => d.bounds) +// Result: [{ x: 0, y: 0, width: 1920, height: 1080 }, +// { x: 1920, y: 0, width: 1920, height: 1080 }] +``` + +**Gap:** + +```js @ts-nocheck +// Requested: gap between displays +const display1 = virtualDisplay.create({ width: 1920, height: 1080, x: 0, y: 0 }) +const display2 = virtualDisplay.create({ width: 1920, height: 1080, x: 2000, y: 0 }) +// macOS snaps display2 to x: 1920 (eliminates 80px gap) +``` + +> [!NOTE] +> Always verify actual positions with `screen.getAllDisplays()` after creation, as macOS may adjust coordinates from the set values. diff --git a/docs/development/testing.md b/docs/development/testing.md index cce8ea5eab463..2de3b2e2e8c27 100644 --- a/docs/development/testing.md +++ b/docs/development/testing.md @@ -95,3 +95,11 @@ To configure display scaling: 1. Push the Windows key and search for _Display settings_. 2. Under _Scale and layout_, make sure that the device is set to 100%. + +## Multi-Monitor Tests + +Some Electron APIs require testing across multiple displays, such as screen detection, window positioning, and display-related events. For contributors working on these features, the `virtualDisplay` native addon enables you to create and position virtual displays programmatically, making it possible to test multi-monitor scenarios without any physical hardware. + +For detailed information on using virtual displays in your tests, see [Multi-Monitor Testing](multi-monitor-testing.md). + +**Platform support:** macOS only From e0ba68fdb587dde23e45d0f984ef20a98d509ca2 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Sun, 3 Aug 2025 22:56:20 +0530 Subject: [PATCH 026/268] test: remove dummy test --- spec/api-browser-window-spec.ts | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 56e546c05b058..6cc21f5ac9ab9 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -7884,24 +7884,4 @@ describe('BrowserWindow module', () => { }); }); }); - - describe('virtual-display', async () => { - it('should load the addon and add a display', async () => { - const virtualDisplay = require('@electron-ci/virtual-display'); - const displayId = virtualDisplay.create({ - height: 1080, // height of the display - width: 1920, // width of the display - x: 0, // origin x of the display - y: 0 // origin y of the display - }); - expect(displayId).to.not.be.null(); - - screen.getAllDisplays().forEach(display => { - console.log(display.bounds); - }); - - const result = virtualDisplay.destroy(displayId); - expect(result).to.equal(true); - }); - }); }); From 578fb0e77a0d3d86ddf0a23a4d52f55b2c4f75fc Mon Sep 17 00:00:00 2001 From: Nilay Arya <84241885+nilayarya@users.noreply.github.com> Date: Thu, 10 Jul 2025 21:36:36 +0530 Subject: [PATCH 027/268] feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> --- docs/api/structures/base-window-options.md | 4 +- .../structures/window-state-persistence.md | 4 + filenames.auto.gni | 1 + shell/browser/api/electron_api_base_window.cc | 4 +- shell/browser/browser_process_impl.cc | 5 +- shell/browser/native_window.cc | 95 ++++- shell/browser/native_window.h | 28 ++ shell/common/electron_constants.h | 17 + shell/common/options_switches.h | 13 + spec/api-browser-window-spec.ts | 340 ++++++++++++++++++ .../api/window-state-save/close-save/index.js | 27 ++ .../fullscreen-save/index.js | 28 ++ .../api/window-state-save/kiosk-save/index.js | 28 ++ .../window-state-save/maximize-save/index.js | 28 ++ .../window-state-save/minimize-save/index.js | 28 ++ .../api/window-state-save/move-save/index.js | 23 ++ .../window-state-save/resize-save/index.js | 23 ++ .../window-state-save/schema-check/index.js | 23 ++ .../work-area-primary/index.js | 41 +++ 19 files changed, 755 insertions(+), 5 deletions(-) create mode 100644 docs/api/structures/window-state-persistence.md create mode 100644 spec/fixtures/api/window-state-save/close-save/index.js create mode 100644 spec/fixtures/api/window-state-save/fullscreen-save/index.js create mode 100644 spec/fixtures/api/window-state-save/kiosk-save/index.js create mode 100644 spec/fixtures/api/window-state-save/maximize-save/index.js create mode 100644 spec/fixtures/api/window-state-save/minimize-save/index.js create mode 100644 spec/fixtures/api/window-state-save/move-save/index.js create mode 100644 spec/fixtures/api/window-state-save/resize-save/index.js create mode 100644 spec/fixtures/api/window-state-save/schema-check/index.js create mode 100644 spec/fixtures/api/window-state-save/work-area-primary/index.js diff --git a/docs/api/structures/base-window-options.md b/docs/api/structures/base-window-options.md index 375c6adc3b59b..5a2b73efb505d 100644 --- a/docs/api/structures/base-window-options.md +++ b/docs/api/structures/base-window-options.md @@ -42,6 +42,8 @@ Default is `false`. * `hiddenInMissionControl` boolean (optional) _macOS_ - Whether window should be hidden when the user toggles into mission control. * `kiosk` boolean (optional) - Whether the window is in kiosk mode. Default is `false`. +* `name` string (optional) - An identifier for the window that enables features such as state persistence. +* `windowStatePersistence` ([WindowStatePersistence](window-state-persistence.md) | boolean) (optional) - Configures or enables the persistence of window state (position, size, maximized state, etc.) across application restarts. Has no effect if window `name` is not provided. _Experimental_ * `title` string (optional) - Default window title. Default is `"Electron"`. If the HTML tag `<title>` is defined in the HTML file loaded by `loadURL()`, this property will be ignored. * `icon` ([NativeImage](../native-image.md) | string) (optional) - The window icon. On Windows it is recommended to use `ICO` icons to get best visual effects, you can also @@ -91,7 +93,7 @@ title bar and a full size content window, the traffic light buttons will display when being hovered over in the top left of the window. **Note:** This option is currently experimental. -* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`. +* `titleBarOverlay` Object | boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`. * `color` String (optional) _Windows_ _Linux_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color. * `symbolColor` String (optional) _Windows_ _Linux_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color. * `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. Default is system height. diff --git a/docs/api/structures/window-state-persistence.md b/docs/api/structures/window-state-persistence.md new file mode 100644 index 0000000000000..efb02bb56d09f --- /dev/null +++ b/docs/api/structures/window-state-persistence.md @@ -0,0 +1,4 @@ +# WindowStatePersistence Object + +* `bounds` boolean (optional) - Whether to persist window position and size across application restarts. Defaults to `true` if not specified. +* `displayMode` boolean (optional) - Whether to persist display modes (fullscreen, kiosk, maximized, etc.) across application restarts. Defaults to `true` if not specified. diff --git a/filenames.auto.gni b/filenames.auto.gni index 6152603405e63..27b5d8f983abe 100644 --- a/filenames.auto.gni +++ b/filenames.auto.gni @@ -163,6 +163,7 @@ auto_filenames = { "docs/api/structures/web-source.md", "docs/api/structures/window-open-handler-response.md", "docs/api/structures/window-session-end-event.md", + "docs/api/structures/window-state-persistence.md", ] sandbox_bundle_deps = [ diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index a6ebfb156b98c..26ed781818a7a 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -178,7 +178,7 @@ void BaseWindow::OnWindowClosed() { // We can not call Destroy here because we need to call Emit first, but we // also do not want any method to be used, so just mark as destroyed here. MarkDestroyed(); - + window_->FlushWindowState(); Emit("closed"); RemoveFromParentChildWindows(); @@ -267,6 +267,7 @@ void BaseWindow::OnWindowWillResize(const gfx::Rect& new_bounds, } void BaseWindow::OnWindowResize() { + window_->DebouncedSaveWindowState(); Emit("resize"); } @@ -282,6 +283,7 @@ void BaseWindow::OnWindowWillMove(const gfx::Rect& new_bounds, } void BaseWindow::OnWindowMove() { + window_->DebouncedSaveWindowState(); Emit("move"); } diff --git a/shell/browser/browser_process_impl.cc b/shell/browser/browser_process_impl.cc index 7c6cc917ed9a8..013f317993758 100644 --- a/shell/browser/browser_process_impl.cc +++ b/shell/browser/browser_process_impl.cc @@ -38,6 +38,7 @@ #include "services/device/public/cpp/geolocation/geolocation_system_permission_manager.h" #include "services/network/public/cpp/network_switches.h" #include "shell/browser/net/resolve_proxy_helper.h" +#include "shell/common/electron_constants.h" #include "shell/common/electron_paths.h" #include "shell/common/thread_restrictions.h" @@ -106,12 +107,12 @@ void BrowserProcessImpl::PostEarlyInitialization() { OSCrypt::RegisterLocalPrefs(pref_registry.get()); #endif + pref_registry->RegisterDictionaryPref(electron::kWindowStates); + in_memory_pref_store_ = base::MakeRefCounted<ValueMapPrefStore>(); ApplyProxyModeFromCommandLine(in_memory_pref_store()); prefs_factory.set_command_line_prefs(in_memory_pref_store()); - // Only use a persistent prefs store when cookie encryption is enabled as that - // is the only key that needs it base::FilePath prefs_path; CHECK(base::PathService::Get(electron::DIR_SESSION_DATA, &prefs_path)); prefs_path = prefs_path.Append(FILE_PATH_LITERAL("Local State")); diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index f69be2feb6051..502a0086602a9 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -10,22 +10,30 @@ #include "base/containers/contains.h" #include "base/memory/ptr_util.h" +#include "base/memory/raw_ptr.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" +#include "components/prefs/pref_service.h" +#include "components/prefs/scoped_user_pref_update.h" #include "content/public/browser/web_contents_user_data.h" #include "include/core/SkColor.h" #include "shell/browser/background_throttling_source.h" #include "shell/browser/browser.h" +#include "shell/browser/browser_process_impl.h" #include "shell/browser/draggable_region_provider.h" +#include "shell/browser/electron_browser_main_parts.h" #include "shell/browser/native_window_features.h" #include "shell/browser/ui/drag_util.h" #include "shell/browser/window_list.h" #include "shell/common/color_util.h" +#include "shell/common/electron_constants.h" #include "shell/common/gin_helper/dictionary.h" #include "shell/common/gin_helper/persistent_dictionary.h" #include "shell/common/options_switches.h" #include "ui/base/hit_test.h" #include "ui/compositor/compositor.h" +#include "ui/display/display.h" +#include "ui/display/screen.h" #include "ui/views/widget/widget.h" #if !BUILDFLAG(IS_MAC) @@ -114,6 +122,29 @@ NativeWindow::NativeWindow(const gin_helper::Dictionary& options, options.Get(options::kVibrancyType, &vibrancy_); #endif + options.Get(options::kName, &window_name_); + + if (gin_helper::Dictionary persistence_options; + options.Get(options::kWindowStatePersistence, &persistence_options)) { + // Other options will be parsed here in the future. + window_state_persistence_enabled_ = true; + } else if (bool flag; options.Get(options::kWindowStatePersistence, &flag)) { + window_state_persistence_enabled_ = flag; + } + + // Initialize prefs_ to save/restore window bounds if we have a valid window + // name and window state persistence is enabled. + if (window_state_persistence_enabled_ && !window_name_.empty()) { + if (auto* browser_process = + electron::ElectronBrowserMainParts::Get()->browser_process()) { + DCHECK(browser_process); + prefs_ = browser_process->local_state(); + } + } else if (window_state_persistence_enabled_ && window_name_.empty()) { + LOG(WARNING) << "Window state persistence enabled but no window name " + "provided. Window state will not be persisted."; + } + if (gin_helper::Dictionary dict; options.Get(options::ktitleBarOverlay, &dict)) { titlebar_overlay_ = true; @@ -242,7 +273,9 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) { SetBackgroundColor(background_color); SetTitle(options.ValueOrDefault(options::kTitle, Browser::Get()->GetName())); - + // TODO(nilayarya): Save window state after restoration logic is implemented + // here. + SaveWindowState(); // Then show it. if (options.ValueOrDefault(options::kShow, true)) Show(); @@ -793,6 +826,66 @@ bool NativeWindow::IsTranslucent() const { return false; } +void NativeWindow::DebouncedSaveWindowState() { + save_window_state_timer_.Start( + FROM_HERE, base::Milliseconds(200), + base::BindOnce(&NativeWindow::SaveWindowState, base::Unretained(this))); +} + +void NativeWindow::SaveWindowState() { + if (!prefs_ || window_name_.empty()) + return; + + ScopedDictPrefUpdate update(prefs_, electron::kWindowStates); + const base::Value::Dict* existing_prefs = update->FindDict(window_name_); + + gfx::Rect bounds = GetBounds(); + // When the window is in a special display mode (fullscreen, kiosk, or + // maximized), save the previously stored window bounds instead of + // the current bounds. This ensures that when the window is restored, it can + // be restored to its original position and size if display mode is not + // preserved via windowStatePersistence. + if (!IsNormal() && existing_prefs) { + std::optional<int> left = existing_prefs->FindInt(electron::kLeft); + std::optional<int> top = existing_prefs->FindInt(electron::kTop); + std::optional<int> right = existing_prefs->FindInt(electron::kRight); + std::optional<int> bottom = existing_prefs->FindInt(electron::kBottom); + + if (left && top && right && bottom) { + bounds = gfx::Rect(*left, *top, *right - *left, *bottom - *top); + } + } + + base::Value::Dict window_preferences; + window_preferences.Set(electron::kLeft, bounds.x()); + window_preferences.Set(electron::kTop, bounds.y()); + window_preferences.Set(electron::kRight, bounds.right()); + window_preferences.Set(electron::kBottom, bounds.bottom()); + + window_preferences.Set(electron::kMaximized, IsMaximized()); + window_preferences.Set(electron::kFullscreen, IsFullscreen()); + window_preferences.Set(electron::kKiosk, IsKiosk()); + + const display::Screen* screen = display::Screen::GetScreen(); + const display::Display display = screen->GetDisplayMatching(bounds); + gfx::Rect work_area = display.work_area(); + + window_preferences.Set(electron::kWorkAreaLeft, work_area.x()); + window_preferences.Set(electron::kWorkAreaTop, work_area.y()); + window_preferences.Set(electron::kWorkAreaRight, work_area.right()); + window_preferences.Set(electron::kWorkAreaBottom, work_area.bottom()); + + update->Set(window_name_, std::move(window_preferences)); +} + +void NativeWindow::FlushWindowState() { + if (save_window_state_timer_.IsRunning()) { + save_window_state_timer_.FireNow(); + } else { + SaveWindowState(); + } +} + // static bool NativeWindow::PlatformHasClientFrame() { #if defined(USE_OZONE) diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index 2c25fa547ab78..01e6e5ef90907 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -18,6 +18,7 @@ #include "base/observer_list.h" #include "base/strings/cstring_view.h" #include "base/supports_user_data.h" +#include "base/timer/timer.h" #include "content/public/browser/desktop_media_id.h" #include "content/public/browser/web_contents_user_data.h" #include "extensions/browser/app_window/size_constraints.h" @@ -27,6 +28,7 @@ class SkRegion; class DraggableRegionProvider; +class PrefService; namespace input { struct NativeWebKeyboardEvent; @@ -433,6 +435,17 @@ class NativeWindow : public base::SupportsUserData, // throttling, then throttling in the `ui::Compositor` will be disabled. void UpdateBackgroundThrottlingState(); + // Saves current window state to the Local State JSON file in + // app.getPath('userData') via PrefService. + // This does NOT immediately write to disk - it updates the in-memory + // preference store and queues an asynchronous write operation. The actual + // disk write is batched and flushed later. + void SaveWindowState(); + void DebouncedSaveWindowState(); + // Flushes save_window_state_timer_ that was queued by + // DebouncedSaveWindowState. This does NOT flush the actual disk write. + void FlushWindowState(); + protected: friend class api::BrowserView; @@ -494,6 +507,10 @@ class NativeWindow : public base::SupportsUserData, static inline int32_t next_id_ = 0; const int32_t window_id_ = ++next_id_; + // Identifier for the window provided by the application. + // Used by Electron internally for features such as state persistence. + std::string window_name_; + // The "titleBarStyle" option. const TitleBarStyle title_bar_style_; @@ -552,6 +569,17 @@ class NativeWindow : public base::SupportsUserData, gfx::Rect overlay_rect_; + // The boolean parsing of the "windowStatePersistence" option + bool window_state_persistence_enabled_ = false; + + // PrefService is used to persist window bounds and state. + // Only populated when windowStatePersistence is enabled and window has a + // valid name. + raw_ptr<PrefService> prefs_ = nullptr; + + // Timer to debounce window state saving operations. + base::OneShotTimer save_window_state_timer_; + base::WeakPtrFactory<NativeWindow> weak_factory_{this}; }; diff --git a/shell/common/electron_constants.h b/shell/common/electron_constants.h index 2ddf98d25acf4..d8313e906a94d 100644 --- a/shell/common/electron_constants.h +++ b/shell/common/electron_constants.h @@ -21,6 +21,23 @@ inline constexpr std::string_view kDeviceVendorIdKey = "vendorId"; inline constexpr std::string_view kDeviceProductIdKey = "productId"; inline constexpr std::string_view kDeviceSerialNumberKey = "serialNumber"; +// Window state preference keys +inline constexpr std::string_view kLeft = "left"; +inline constexpr std::string_view kTop = "top"; +inline constexpr std::string_view kRight = "right"; +inline constexpr std::string_view kBottom = "bottom"; + +inline constexpr std::string_view kMaximized = "maximized"; +inline constexpr std::string_view kFullscreen = "fullscreen"; +inline constexpr std::string_view kKiosk = "kiosk"; + +inline constexpr std::string_view kWorkAreaLeft = "workAreaLeft"; +inline constexpr std::string_view kWorkAreaTop = "workAreaTop"; +inline constexpr std::string_view kWorkAreaRight = "workAreaRight"; +inline constexpr std::string_view kWorkAreaBottom = "workAreaBottom"; + +inline constexpr std::string_view kWindowStates = "windowStates"; + inline constexpr base::cstring_view kRunAsNode = "ELECTRON_RUN_AS_NODE"; // Per-profile UUID to distinguish global shortcut sessions for diff --git a/shell/common/options_switches.h b/shell/common/options_switches.h index b07313f033ec1..e6a7ca4ceb44b 100644 --- a/shell/common/options_switches.h +++ b/shell/common/options_switches.h @@ -107,6 +107,19 @@ inline constexpr std::string_view kFocusable = "focusable"; // The WebPreferences. inline constexpr std::string_view kWebPreferences = "webPreferences"; +// Window state persistence for BaseWindow +inline constexpr std::string_view kWindowStatePersistence = + "windowStatePersistence"; + +// Identifier for the window provided by the application +inline constexpr std::string_view kName = "name"; + +// Whether to save the window bounds +inline constexpr std::string_view kBounds = "bounds"; + +// Whether to save the window display mode +inline constexpr std::string_view kDisplayMode = "displayMode"; + // Add a vibrancy effect to the browser window inline constexpr std::string_view kVibrancyType = "vibrancy"; diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 58529ac1f8379..757a9f2015889 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -7070,4 +7070,344 @@ describe('BrowserWindow module', () => { expect(startPos).to.not.deep.equal(endPos); }); }); + + describe('windowStatePersistence', () => { + describe('save window state', () => { + const fixturesPath = path.resolve(__dirname, 'fixtures', 'api', 'window-state-save'); + const sharedUserDataPath = path.join(os.tmpdir(), 'electron-window-state-test'); + const sharedPreferencesPath = path.join(sharedUserDataPath, 'Local State'); + + const getWindowStateFromDisk = (windowName: string, preferencesPath: string) => { + if (!fs.existsSync(preferencesPath)) { + throw new Error(`Preferences file does not exist at path: ${preferencesPath}. Window state was not saved to disk.`); + } + const prefsContent = fs.readFileSync(preferencesPath, 'utf8'); + const prefs = JSON.parse(prefsContent); + return prefs?.windowStates?.[windowName] || null; + }; + + // Clean up before each test + beforeEach(() => { + if (fs.existsSync(sharedUserDataPath)) { + fs.rmSync(sharedUserDataPath, { recursive: true, force: true }); + } + }); + + describe('state saving after window operations', () => { + it('should save window state with required properties', async () => { + const appPath = path.join(fixturesPath, 'schema-check'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-window-state-schema', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-window-state-schema" does not exist'); + expect(savedState).to.have.property('left'); + expect(savedState).to.have.property('top'); + expect(savedState).to.have.property('right'); + expect(savedState).to.have.property('bottom'); + expect(savedState).to.have.property('maximized'); + expect(savedState).to.have.property('fullscreen'); + expect(savedState).to.have.property('kiosk'); + expect(savedState).to.have.property('workAreaLeft'); + expect(savedState).to.have.property('workAreaTop'); + expect(savedState).to.have.property('workAreaRight'); + expect(savedState).to.have.property('workAreaBottom'); + }); + + ifit(hasCapturableScreen())('should save window state after window is closed and app exit', async () => { + const appPath = path.join(fixturesPath, 'close-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-close-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-close-save" does not exist'); + expect(savedState.right - savedState.left).to.equal(400); + expect(savedState.bottom - savedState.top).to.equal(300); + expect(savedState.maximized).to.equal(false); + expect(savedState.fullscreen).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state after window is resized and app exit', async () => { + const appPath = path.join(fixturesPath, 'resize-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-resize-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-resize-save" does not exist'); + expect(savedState.right - savedState.left).to.equal(500); + expect(savedState.bottom - savedState.top).to.equal(400); + expect(savedState.maximized).to.equal(false); + expect(savedState.fullscreen).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state after window is moved and app exit', async () => { + const appPath = path.join(fixturesPath, 'move-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-move-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-move-save" does not exist'); + expect(savedState.left).to.equal(100); + expect(savedState.top).to.equal(150); + expect(savedState.maximized).to.equal(false); + expect(savedState.fullscreen).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state after window is fullscreened and app exit', async () => { + const appPath = path.join(fixturesPath, 'fullscreen-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-fullscreen-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-fullscreen-save" does not exist'); + expect(savedState.fullscreen).to.equal(true); + expect(savedState.maximized).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state after window is maximized and app exit', async () => { + const appPath = path.join(fixturesPath, 'maximize-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-maximize-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-maximize-save" does not exist'); + expect(savedState.maximized).to.equal(true); + expect(savedState.fullscreen).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state if in a minimized state and app exit', async () => { + const appPath = path.join(fixturesPath, 'minimize-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-minimize-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-minimize-save" does not exist'); + // Should save the bounds from before minimizing + expect(savedState.right - savedState.left).to.equal(400); + expect(savedState.bottom - savedState.top).to.equal(300); + expect(savedState.maximized).to.equal(false); + expect(savedState.fullscreen).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state after window is kiosked and app exit', async () => { + const appPath = path.join(fixturesPath, 'kiosk-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-kiosk-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-kiosk-save" does not exist'); + expect(savedState.kiosk).to.equal(true); + expect(savedState.fullscreen).to.equal(true); + expect(savedState.maximized).to.equal(false); + }); + }); + + describe('work area tests', () => { + ifit(hasCapturableScreen())('should save valid work area bounds', async () => { + const appPath = path.join(fixturesPath, 'schema-check'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-window-state-schema', sharedPreferencesPath); + + expect(savedState).to.not.be.null('window state with window name "test-window-state-schema" does not exist'); + expect(savedState.workAreaLeft).to.be.a('number'); + expect(savedState.workAreaTop).to.be.a('number'); + expect(savedState.workAreaRight).to.be.a('number'); + expect(savedState.workAreaBottom).to.be.a('number'); + + expect(savedState.workAreaLeft).to.be.lessThan(savedState.workAreaRight); + expect(savedState.workAreaTop).to.be.lessThan(savedState.workAreaBottom); + }); + + ifit(hasCapturableScreen())('should save work area bounds that contain the window bounds on primary display', async () => { + // Fixture will center the window on the primary display + const appPath = path.join(fixturesPath, 'work-area-primary'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-work-area-primary', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-work-area-primary" does not exist'); + + expect(savedState.left).to.be.greaterThanOrEqual(savedState.workAreaLeft); + expect(savedState.top).to.be.greaterThanOrEqual(savedState.workAreaTop); + expect(savedState.right).to.be.lessThanOrEqual(savedState.workAreaRight); + expect(savedState.bottom).to.be.lessThanOrEqual(savedState.workAreaBottom); + }); + }); + + describe('asynchronous batching behavior', () => { + let w: BrowserWindow; + const windowName = 'test-batching-behavior'; + const preferencesPath = path.join(app.getPath('userData'), 'Local State'); + + // Helper to get preferences file modification time + const getPrefsModTime = (): Date => { + try { + return fs.statSync(preferencesPath).mtime; + } catch { + throw new Error(`Test requires preferences file to exist at path: ${preferencesPath}.`); + } + }; + + // Helper to wait for file modification with 20 second default timeout + const waitForPrefsUpdate = async (initialModTime: Date, timeoutMs: number = 20000): Promise<void> => { + const startTime = Date.now(); + + while (true) { + const currentModTime = getPrefsModTime(); + + if (currentModTime > initialModTime) { + return; + } + + if (Date.now() - startTime > timeoutMs) { + throw new Error(`Window state was not flushed to disk within ${timeoutMs}ms`); + } + // Wait for 1 second before checking again + await setTimeout(1000); + } + }; + + const waitForPrefsFileCreation = async (preferencesPath: string) => { + while (!fs.existsSync(preferencesPath)) { + await setTimeout(1000); + } + }; + + beforeEach(async () => { + await setTimeout(2000); + w = new BrowserWindow({ + show: false, + width: 400, + height: 300, + name: windowName, + windowStatePersistence: true + }); + }); + + afterEach(closeAllWindows); + + it('should not immediately save window state to disk when window is moved/resized', async () => { + // Wait for preferences file to be created if its the first time we're running the test + await waitForPrefsFileCreation(preferencesPath); + + const initialModTime = getPrefsModTime(); + + const moved = once(w, 'move'); + w.setPosition(150, 200); + await moved; + // Wait for any potential save to occur from the move operation + await setTimeout(1000); + + const resized = once(w, 'resize'); + w.setSize(500, 400); + await resized; + // Wait for any potential save to occur from the resize operation + await setTimeout(1000); + + const afterMoveModTime = getPrefsModTime(); + + expect(afterMoveModTime.getTime()).to.equal(initialModTime.getTime()); + }); + + it('should eventually flush window state to disk after batching period', async () => { + // Wait for preferences file to be created if its the first time we're running the test + await waitForPrefsFileCreation(preferencesPath); + + const initialModTime = getPrefsModTime(); + + const resized = once(w, 'resize'); + w.setSize(500, 400); + await resized; + + await waitForPrefsUpdate(initialModTime); + + const savedState = getWindowStateFromDisk(windowName, preferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-batching-behavior" does not exist'); + expect(savedState.right - savedState.left).to.equal(500); + expect(savedState.bottom - savedState.top).to.equal(400); + }); + + it('should batch multiple window operations and save final state', async () => { + // Wait for preferences file to be created if its the first time we're running the test + await waitForPrefsFileCreation(preferencesPath); + + const initialModTime = getPrefsModTime(); + + const resize1 = once(w, 'resize'); + w.setSize(500, 400); + await resize1; + // Wait for any potential save to occur + await setTimeout(1000); + + const afterFirstResize = getPrefsModTime(); + + const resize2 = once(w, 'resize'); + w.setSize(600, 500); + await resize2; + // Wait for any potential save to occur + await setTimeout(1000); + + const afterSecondResize = getPrefsModTime(); + + const resize3 = once(w, 'resize'); + w.setSize(700, 600); + await resize3; + // Wait for any potential save to occur + await setTimeout(1000); + + const afterThirdResize = getPrefsModTime(); + + await waitForPrefsUpdate(initialModTime); + + const savedState = getWindowStateFromDisk(windowName, preferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-batching-behavior" does not exist'); + + [afterFirstResize, afterSecondResize, afterThirdResize].forEach(time => { + expect(time.getTime()).to.equal(initialModTime.getTime()); + }); + + expect(savedState.right - savedState.left).to.equal(700); + expect(savedState.bottom - savedState.top).to.equal(600); + }); + + it('should not save window bounds when main thread is busy', async () => { + // Wait for preferences file to be created if its the first time we're running the test + await waitForPrefsFileCreation(preferencesPath); + + const initialModTime = getPrefsModTime(); + + const moved = once(w, 'move'); + w.setPosition(100, 100); + await moved; + + const startTime = Date.now(); + + // Keep main thread busy for 25 seconds + while (Date.now() - startTime < 25000); + + const finalModTime = getPrefsModTime(); + + expect(finalModTime.getTime()).to.equal(initialModTime.getTime()); + }); + }); + }); + }); }); diff --git a/spec/fixtures/api/window-state-save/close-save/index.js b/spec/fixtures/api/window-state-save/close-save/index.js new file mode 100644 index 0000000000000..6dcd5e935f1cf --- /dev/null +++ b/spec/fixtures/api/window-state-save/close-save/index.js @@ -0,0 +1,27 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-close-save', + windowStatePersistence: true, + show: false + }); + + w.on('close', () => { + app.quit(); + }); + + w.close(); + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); diff --git a/spec/fixtures/api/window-state-save/fullscreen-save/index.js b/spec/fixtures/api/window-state-save/fullscreen-save/index.js new file mode 100644 index 0000000000000..bd2f2cbabb659 --- /dev/null +++ b/spec/fixtures/api/window-state-save/fullscreen-save/index.js @@ -0,0 +1,28 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-fullscreen-save', + windowStatePersistence: true + }); + + w.on('enter-full-screen', () => { + setTimeout(() => { + app.quit(); + }, 1000); + }); + + w.setFullScreen(true); + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); diff --git a/spec/fixtures/api/window-state-save/kiosk-save/index.js b/spec/fixtures/api/window-state-save/kiosk-save/index.js new file mode 100644 index 0000000000000..29f3b5f1675b4 --- /dev/null +++ b/spec/fixtures/api/window-state-save/kiosk-save/index.js @@ -0,0 +1,28 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-kiosk-save', + windowStatePersistence: true + }); + + w.on('enter-full-screen', () => { + setTimeout(() => { + app.quit(); + }, 1000); + }); + + w.setKiosk(true); + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); diff --git a/spec/fixtures/api/window-state-save/maximize-save/index.js b/spec/fixtures/api/window-state-save/maximize-save/index.js new file mode 100644 index 0000000000000..3e0dcd8915f52 --- /dev/null +++ b/spec/fixtures/api/window-state-save/maximize-save/index.js @@ -0,0 +1,28 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-maximize-save', + windowStatePersistence: true + }); + + w.on('maximize', () => { + setTimeout(() => { + app.quit(); + }, 1000); + }); + + w.maximize(); + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); diff --git a/spec/fixtures/api/window-state-save/minimize-save/index.js b/spec/fixtures/api/window-state-save/minimize-save/index.js new file mode 100644 index 0000000000000..36c7018abb464 --- /dev/null +++ b/spec/fixtures/api/window-state-save/minimize-save/index.js @@ -0,0 +1,28 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-minimize-save', + windowStatePersistence: true + }); + + w.on('minimize', () => { + setTimeout(() => { + app.quit(); + }, 1000); + }); + + w.minimize(); + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); diff --git a/spec/fixtures/api/window-state-save/move-save/index.js b/spec/fixtures/api/window-state-save/move-save/index.js new file mode 100644 index 0000000000000..56fb079b32741 --- /dev/null +++ b/spec/fixtures/api/window-state-save/move-save/index.js @@ -0,0 +1,23 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-move-save', + windowStatePersistence: true, + show: false + }); + + w.setPosition(100, 150); + + setTimeout(() => { + app.quit(); + }, 1000); +}); diff --git a/spec/fixtures/api/window-state-save/resize-save/index.js b/spec/fixtures/api/window-state-save/resize-save/index.js new file mode 100644 index 0000000000000..a25d399f657e7 --- /dev/null +++ b/spec/fixtures/api/window-state-save/resize-save/index.js @@ -0,0 +1,23 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(async () => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-resize-save', + windowStatePersistence: true, + show: false + }); + + w.setSize(500, 400); + + setTimeout(() => { + app.quit(); + }, 1000); +}); diff --git a/spec/fixtures/api/window-state-save/schema-check/index.js b/spec/fixtures/api/window-state-save/schema-check/index.js new file mode 100644 index 0000000000000..cad32f1e82636 --- /dev/null +++ b/spec/fixtures/api/window-state-save/schema-check/index.js @@ -0,0 +1,23 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-window-state-schema', + windowStatePersistence: true, + show: false + }); + + w.close(); + + setTimeout(() => { + app.quit(); + }, 1000); +}); diff --git a/spec/fixtures/api/window-state-save/work-area-primary/index.js b/spec/fixtures/api/window-state-save/work-area-primary/index.js new file mode 100644 index 0000000000000..4f7b0f86b7a6f --- /dev/null +++ b/spec/fixtures/api/window-state-save/work-area-primary/index.js @@ -0,0 +1,41 @@ +const { app, BrowserWindow, screen } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(async () => { + const primaryDisplay = screen.getPrimaryDisplay(); + const workArea = primaryDisplay.workArea; + + const maxWidth = Math.max(200, Math.floor(workArea.width * 0.8)); + const maxHeight = Math.max(150, Math.floor(workArea.height * 0.8)); + const windowWidth = Math.min(400, maxWidth); + const windowHeight = Math.min(300, maxHeight); + + const w = new BrowserWindow({ + width: windowWidth, + height: windowHeight, + name: 'test-work-area-primary', + windowStatePersistence: true + }); + + // Center the window on the primary display to prevent overflow + const centerX = workArea.x + Math.floor((workArea.width - windowWidth) / 2); + const centerY = workArea.y + Math.floor((workArea.height - windowHeight) / 2); + + w.setPosition(centerX, centerY); + + w.on('close', () => { + app.quit(); + }); + + w.close(); + + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); From c47e9ce469322e044245822b6f96dc9f92ab9f2b Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 6 Aug 2025 10:17:59 -0400 Subject: [PATCH 028/268] test: clear sharedUserPath before and test --- spec/api-browser-window-spec.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 6cc21f5ac9ab9..adb6f2d1d162e 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -85,18 +85,24 @@ describe('BrowserWindow module', () => { }); ifit(!hasCapturableScreen())('should not save window state when there is no valid display (fake display)', async () => { + const sharedUserDataPath = path.join(os.tmpdir(), 'electron-window-state-test'); + if (fs.existsSync(sharedUserDataPath)) { + fs.rmSync(sharedUserDataPath, { recursive: true, force: true }); + } + const appPath = path.resolve(__dirname, 'fixtures', 'api', 'window-state-save', 'schema-check'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); expect(code).to.equal(0); - const sharedPreferencesPath = path.join(os.tmpdir(), 'electron-window-state-test', 'Local State'); - if (!fs.existsSync(sharedPreferencesPath)) { - throw new Error(`Preferences file does not exist at path: ${sharedPreferencesPath}. Window state was not saved to disk.`); + const sharedPreferencesPath = path.join(sharedUserDataPath, 'Local State'); + + let savedState = null; + if (fs.existsSync(sharedPreferencesPath)) { + const prefsContent = fs.readFileSync(sharedPreferencesPath, 'utf8'); + const prefs = JSON.parse(prefsContent); + savedState = prefs?.windowStates?.['test-window-state-schema'] || null; } - const prefsContent = fs.readFileSync(sharedPreferencesPath, 'utf8'); - const prefs = JSON.parse(prefsContent); - const savedState = prefs?.windowStates?.['test-window-state-schema'] || null; expect(savedState).to.be.null('window state with window name "test-window-state-schema" should not exist'); }); From be14f84f9c7a2ca1ab5ce3c6ea095b9bdff9aabe Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 6 Aug 2025 10:19:43 -0400 Subject: [PATCH 029/268] refactor: hasInvalidDisplay function --- shell/browser/native_window.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 43322437f96c4..42e1d07460cdd 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -104,6 +104,12 @@ gfx::Size GetExpandedWindowSize(const NativeWindow* window, } #endif +// Check if display is fake (default display ID) or has invalid dimensions +bool hasInvalidDisplay(const display::Display& display) { + return display.id() == display::kDefaultDisplayId || + display.size().width() == 0 || display.size().height() == 0; +} + } // namespace NativeWindow::NativeWindow(const gin_helper::Dictionary& options, @@ -866,8 +872,7 @@ void NativeWindow::SaveWindowState() { // is fake (ID 0xFF). Invalid displays could cause incorrect window bounds to // be saved, leading to positioning issues during restoration. // https://source.chromium.org/chromium/chromium/src/+/main:ui/display/types/display_constants.h;l=28;drc=e4f1aef5f3ec30a28950d766612cc2c04c822c71 - if (display.id() == display::kDefaultDisplayId || - display.size().width() == 0 || display.size().height() == 0) { + if (hasInvalidDisplay(display)) { LOG(WARNING) << "Window state not saved - no physical display attached or current " "display has invalid bounds"; @@ -970,8 +975,7 @@ void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { // is fake. Restoring from invalid displays (0x0) or fake displays (ID 0xFF) // could cause incorrect window positioning when later moved to real displays. // https://source.chromium.org/chromium/chromium/src/+/main:ui/display/types/display_constants.h;l=28;drc=e4f1aef5f3ec30a28950d766612cc2c04c822c71 - if (display.id() == display::kDefaultDisplayId || - display.size().width() == 0 || display.size().height() == 0) { + if (hasInvalidDisplay(display)) { LOG(WARNING) << "Window state not restored - no physical display attached " "or current display has invalid bounds"; return; From 10be3ff909346cc9fa90e7368e6fa31aa442cfc7 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 6 Aug 2025 10:21:22 -0400 Subject: [PATCH 030/268] debug: add display info logging for CI --- shell/browser/native_window.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 42e1d07460cdd..7648e7ddde319 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -877,6 +877,13 @@ void NativeWindow::SaveWindowState() { << "Window state not saved - no physical display attached or current " "display has invalid bounds"; return; + } else { + LOG(WARNING) << "Saving window state for display: " << display.id(); + LOG(WARNING) << "Display height: " << display.size().height(); + LOG(WARNING) << "Display width: " << display.size().width(); + LOG(WARNING) << "Display work area height: " + << display.work_area().height(); + LOG(WARNING) << "Display work area width: " << display.work_area().width(); } ScopedDictPrefUpdate update(prefs_, electron::kWindowStates); @@ -979,6 +986,13 @@ void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { LOG(WARNING) << "Window state not restored - no physical display attached " "or current display has invalid bounds"; return; + } else { + LOG(WARNING) << "Restoring window state for display: " << display.id(); + LOG(WARNING) << "Display height: " << display.size().height(); + LOG(WARNING) << "Display width: " << display.size().width(); + LOG(WARNING) << "Display work area height: " + << display.work_area().height(); + LOG(WARNING) << "Display work area width: " << display.work_area().width(); } gfx::Rect saved_work_area = gfx::Rect(*work_area_left, *work_area_top, From 60e09969dcb2bd2e7b0b462eb52f23969608018b Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Fri, 8 Aug 2025 04:13:54 -0400 Subject: [PATCH 031/268] fix: do not save/restore when window is 0x0 --- shell/browser/native_window.cc | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 7648e7ddde319..091e60796e30f 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -861,6 +861,12 @@ void NativeWindow::SaveWindowState() { return; gfx::Rect bounds = GetBounds(); + + if (bounds.width() == 0 || bounds.height() == 0) { + LOG(WARNING) << "Window state not saved - window bounds are invalid"; + return; + } + const display::Screen* screen = display::Screen::GetScreen(); DCHECK(screen); // GetDisplayMatching returns a fake display with 1920x1080 resolution at @@ -877,13 +883,6 @@ void NativeWindow::SaveWindowState() { << "Window state not saved - no physical display attached or current " "display has invalid bounds"; return; - } else { - LOG(WARNING) << "Saving window state for display: " << display.id(); - LOG(WARNING) << "Display height: " << display.size().height(); - LOG(WARNING) << "Display width: " << display.size().width(); - LOG(WARNING) << "Display work area height: " - << display.work_area().height(); - LOG(WARNING) << "Display work area width: " << display.work_area().width(); } ScopedDictPrefUpdate update(prefs_, electron::kWindowStates); @@ -986,13 +985,6 @@ void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { LOG(WARNING) << "Window state not restored - no physical display attached " "or current display has invalid bounds"; return; - } else { - LOG(WARNING) << "Restoring window state for display: " << display.id(); - LOG(WARNING) << "Display height: " << display.size().height(); - LOG(WARNING) << "Display width: " << display.size().width(); - LOG(WARNING) << "Display work area height: " - << display.work_area().height(); - LOG(WARNING) << "Display work area width: " << display.work_area().width(); } gfx::Rect saved_work_area = gfx::Rect(*work_area_left, *work_area_top, @@ -1037,6 +1029,11 @@ void NativeWindow::FlushPendingDisplayMode() { void NativeWindow::RestoreBounds(const display::Display& display, const gfx::Rect& saved_work_area, gfx::Rect& saved_bounds) { + if (saved_bounds.width() == 0 || saved_bounds.height() == 0) { + LOG(WARNING) << "Window bounds not restored - values are invalid"; + return; + } + // Ensure that the window is at least kMinVisibleHeight * kMinVisibleWidth. saved_bounds.set_height(std::max(kMinVisibleHeight, saved_bounds.height())); saved_bounds.set_width(std::max(kMinVisibleWidth, saved_bounds.width())); From 88531c4ac716968e3bbe7269b639680bcecd6ec7 Mon Sep 17 00:00:00 2001 From: Nilay Arya <84241885+nilayarya@users.noreply.github.com> Date: Mon, 11 Aug 2025 03:43:16 -0400 Subject: [PATCH 032/268] test: support for multimonitor tests (#47911) * test: support for multimonitor tests * fix: update yarn.lock file * test: support any resolution for new displays * test: support display positioning * docs: multi-monitor tests * test: remove dummy test --- docs/development/multi-monitor-testing.md | 79 ++++++++ docs/development/testing.md | 8 + .../native-addon/virtual-display/binding.gyp | 90 +++++++++ .../include/VirtualDisplayBridge.h | 120 ++++++++++++ .../virtual-display/lib/virtual-display.js | 6 + .../native-addon/virtual-display/package.json | 20 ++ .../virtual-display/src/Dummy.swift | 151 +++++++++++++++ .../virtual-display/src/VirtualDisplay.swift | 54 ++++++ .../src/VirtualDisplayBridge.m | 14 ++ .../native-addon/virtual-display/src/addon.mm | 183 ++++++++++++++++++ spec/package.json | 1 + spec/yarn.lock | 13 +- 12 files changed, 738 insertions(+), 1 deletion(-) create mode 100644 docs/development/multi-monitor-testing.md create mode 100644 spec/fixtures/native-addon/virtual-display/binding.gyp create mode 100644 spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h create mode 100644 spec/fixtures/native-addon/virtual-display/lib/virtual-display.js create mode 100644 spec/fixtures/native-addon/virtual-display/package.json create mode 100644 spec/fixtures/native-addon/virtual-display/src/Dummy.swift create mode 100644 spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift create mode 100644 spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m create mode 100644 spec/fixtures/native-addon/virtual-display/src/addon.mm diff --git a/docs/development/multi-monitor-testing.md b/docs/development/multi-monitor-testing.md new file mode 100644 index 0000000000000..5a1d7e772b662 --- /dev/null +++ b/docs/development/multi-monitor-testing.md @@ -0,0 +1,79 @@ +# Multi-Monitor Testing + +The `virtualDisplay` addon leverages macOS CoreGraphics APIs to create virtual displays, allowing you to write and run multi-monitor tests without the need for physical monitors. + +## Methods + +#### `virtualDisplay.create([options])` + +Creates a virtual display and returns a display ID. + +```js @ts-nocheck +const virtualDisplay = require('@electron-ci/virtual-display') +// Default: 1920×1080 at origin (0, 0) +const displayId = virtualDisplay.create() +``` + +```js @ts-nocheck +const virtualDisplay = require('@electron-ci/virtual-display') +// Custom options (all parameters optional and have default values) +const displayId = virtualDisplay.create({ + width: 2560, // Display width in pixels + height: 1440, // Display height in pixels + x: 1920, // X position (top-left corner) + y: 0 // Y position (top-left corner) +}) +``` + +**Returns:** `number` - Unique display ID used to identify the display. Returns `0` on failure to create display. + +#### `virtualDisplay.destroy(displayId)` + +Removes the virtual display. + +```js @ts-nocheck +const success = virtualDisplay.destroy(displayId) +``` + +**Returns:** `boolean` - Success status + +## Display Constraints + +### Size Limits + +Virtual displays are constrained to 720×720 pixels minimum and 8192×8192 pixels maximum. Actual limits may vary depending on your Mac's graphics capabilities, so sizes outside this range (like 9000×6000) may fail on some systems. + +```js @ts-nocheck +// Safe sizes for testing +virtualDisplay.create({ width: 1920, height: 1080 }) // Full HD +virtualDisplay.create({ width: 3840, height: 2160 }) // 4K +``` + +### Positioning Behavior + +macOS maintains a contiguous desktop space by automatically adjusting display positions if there are any overlaps or gaps. In case of either, the placement of the new origin is as close as possible to the requested location, without overlapping or leaving a gap between displays. + +**Overlap:** + +```js @ts-nocheck +// Requested positions +const display1 = virtualDisplay.create({ x: 0, y: 0, width: 1920, height: 1080 }) +const display2 = virtualDisplay.create({ x: 500, y: 0, width: 1920, height: 1080 }) + +// macOS automatically repositions display2 to x: 1920 to prevent overlap +const actualBounds = screen.getAllDisplays().map(d => d.bounds) +// Result: [{ x: 0, y: 0, width: 1920, height: 1080 }, +// { x: 1920, y: 0, width: 1920, height: 1080 }] +``` + +**Gap:** + +```js @ts-nocheck +// Requested: gap between displays +const display1 = virtualDisplay.create({ width: 1920, height: 1080, x: 0, y: 0 }) +const display2 = virtualDisplay.create({ width: 1920, height: 1080, x: 2000, y: 0 }) +// macOS snaps display2 to x: 1920 (eliminates 80px gap) +``` + +> [!NOTE] +> Always verify actual positions with `screen.getAllDisplays()` after creation, as macOS may adjust coordinates from the set values. diff --git a/docs/development/testing.md b/docs/development/testing.md index cce8ea5eab463..2de3b2e2e8c27 100644 --- a/docs/development/testing.md +++ b/docs/development/testing.md @@ -95,3 +95,11 @@ To configure display scaling: 1. Push the Windows key and search for _Display settings_. 2. Under _Scale and layout_, make sure that the device is set to 100%. + +## Multi-Monitor Tests + +Some Electron APIs require testing across multiple displays, such as screen detection, window positioning, and display-related events. For contributors working on these features, the `virtualDisplay` native addon enables you to create and position virtual displays programmatically, making it possible to test multi-monitor scenarios without any physical hardware. + +For detailed information on using virtual displays in your tests, see [Multi-Monitor Testing](multi-monitor-testing.md). + +**Platform support:** macOS only diff --git a/spec/fixtures/native-addon/virtual-display/binding.gyp b/spec/fixtures/native-addon/virtual-display/binding.gyp new file mode 100644 index 0000000000000..f8ef0b280660f --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/binding.gyp @@ -0,0 +1,90 @@ +{ + "targets": [{ + "target_name": "virtual_display", + "conditions": [ + ['OS=="mac"', { + "sources": [ + "src/addon.mm", + "src/VirtualDisplayBridge.m" + ], + "include_dirs": [ + "<!@(node -p \"require('node-addon-api').include\")", + "include", + "build_swift" + ], + "dependencies": [ + "<!(node -p \"require('node-addon-api').gyp\")" + ], + "libraries": [ + "<(PRODUCT_DIR)/libVirtualDisplay.dylib" + ], + "defines": [ + "NODE_ADDON_API_CPP_EXCEPTIONS" + ], + "cflags!": [ "-fno-exceptions" ], + "cflags_cc!": [ "-fno-exceptions" ], + "xcode_settings": { + "GCC_ENABLE_CPP_EXCEPTIONS": "YES", + "CLANG_ENABLE_OBJC_ARC": "YES", + "CLANG_CXX_LIBRARY": "libc++", + "SWIFT_OBJC_BRIDGING_HEADER": "include/VirtualDisplayBridge.h", + "SWIFT_VERSION": "5.0", + "SWIFT_OBJC_INTERFACE_HEADER_NAME": "virtual_display-Swift.h", + "MACOSX_DEPLOYMENT_TARGET": "11.0", + "OTHER_CFLAGS": [ + "-ObjC++", + "-fobjc-arc" + ], + "OTHER_LDFLAGS": [ + "-lswiftCore", + "-lswiftFoundation", + "-lswiftObjectiveC", + "-lswiftDarwin", + "-lswiftDispatch", + "-L/usr/lib/swift", + "-Wl,-rpath,/usr/lib/swift", + "-Wl,-rpath,@loader_path" + ] + }, + "actions": [ + { + "action_name": "build_swift", + "inputs": [ + "src/VirtualDisplay.swift", + "src/Dummy.swift", + "include/VirtualDisplayBridge.h" + ], + "outputs": [ + "build_swift/libVirtualDisplay.dylib", + "build_swift/virtual_display-Swift.h" + ], + "action": [ + "swiftc", + "src/VirtualDisplay.swift", + "src/Dummy.swift", + "-import-objc-header", "include/VirtualDisplayBridge.h", + "-emit-objc-header-path", "./build_swift/virtual_display-Swift.h", + "-emit-library", "-o", "./build_swift/libVirtualDisplay.dylib", + "-emit-module", "-module-name", "virtual_display", + "-module-link-name", "VirtualDisplay" + ] + }, + { + "action_name": "copy_swift_lib", + "inputs": [ + "<(module_root_dir)/build_swift/libVirtualDisplay.dylib" + ], + "outputs": [ + "<(PRODUCT_DIR)/libVirtualDisplay.dylib" + ], + "action": [ + "sh", + "-c", + "cp -f <(module_root_dir)/build_swift/libVirtualDisplay.dylib <(PRODUCT_DIR)/libVirtualDisplay.dylib && install_name_tool -id @rpath/libVirtualDisplay.dylib <(PRODUCT_DIR)/libVirtualDisplay.dylib" + ] + } + ] + }] + ] + }] +} \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h b/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h new file mode 100644 index 0000000000000..6ac5cbacb8f9a --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h @@ -0,0 +1,120 @@ +#ifndef VirtualDisplayBridge_h +#define VirtualDisplayBridge_h + +#import <CoreGraphics/CoreGraphics.h> +#import <Foundation/Foundation.h> + +@interface VirtualDisplayBridge : NSObject + ++ (NSInteger)create:(int)width height:(int)height x:(int)x y:(int)y; ++ (BOOL)destroy:(NSInteger)displayId; + +@end + +@interface CGVirtualDisplay : NSObject { + unsigned int _vendorID; + unsigned int _productID; + unsigned int _serialNum; + NSString* _name; + struct CGSize _sizeInMillimeters; + unsigned int _maxPixelsWide; + unsigned int _maxPixelsHigh; + struct CGPoint _redPrimary; + struct CGPoint _greenPrimary; + struct CGPoint _bluePrimary; + struct CGPoint _whitePoint; + id _queue; + id _terminationHandler; + void* _client; + unsigned int _displayID; + unsigned int _hiDPI; + NSArray* _modes; + unsigned int _serverRPC_port; + unsigned int _proxyRPC_port; + unsigned int _clientHandler_port; +} + +@property(readonly, nonatomic) NSArray* modes; +@property(readonly, nonatomic) unsigned int hiDPI; +@property(readonly, nonatomic) unsigned int displayID; +@property(readonly, nonatomic) id terminationHandler; +@property(readonly, nonatomic) id queue; +@property(readonly, nonatomic) struct CGPoint whitePoint; +@property(readonly, nonatomic) struct CGPoint bluePrimary; +@property(readonly, nonatomic) struct CGPoint greenPrimary; +@property(readonly, nonatomic) struct CGPoint redPrimary; +@property(readonly, nonatomic) unsigned int maxPixelsHigh; +@property(readonly, nonatomic) unsigned int maxPixelsWide; +@property(readonly, nonatomic) struct CGSize sizeInMillimeters; +@property(readonly, nonatomic) NSString* name; +@property(readonly, nonatomic) unsigned int serialNum; +@property(readonly, nonatomic) unsigned int productID; +@property(readonly, nonatomic) unsigned int vendorID; +- (BOOL)applySettings:(id)arg1; +- (void)dealloc; +- (id)initWithDescriptor:(id)arg1; + +@end + +@interface CGVirtualDisplayDescriptor : NSObject { + unsigned int _vendorID; + unsigned int _productID; + unsigned int _serialNum; + NSString* _name; + struct CGSize _sizeInMillimeters; + unsigned int _maxPixelsWide; + unsigned int _maxPixelsHigh; + struct CGPoint _redPrimary; + struct CGPoint _greenPrimary; + struct CGPoint _bluePrimary; + struct CGPoint _whitePoint; + id _queue; + id _terminationHandler; +} + +@property(retain, nonatomic) id queue; +@property(retain, nonatomic) NSString* name; +@property(nonatomic) struct CGPoint whitePoint; +@property(nonatomic) struct CGPoint bluePrimary; +@property(nonatomic) struct CGPoint greenPrimary; +@property(nonatomic) struct CGPoint redPrimary; +@property(nonatomic) unsigned int maxPixelsHigh; +@property(nonatomic) unsigned int maxPixelsWide; +@property(nonatomic) struct CGSize sizeInMillimeters; +@property(nonatomic) unsigned int serialNum; +@property(nonatomic) unsigned int productID; +@property(nonatomic) unsigned int vendorID; +- (void)dealloc; +- (id)init; +@property(copy, nonatomic) id terminationHandler; + +@end + +@interface CGVirtualDisplayMode : NSObject { + unsigned int _width; + unsigned int _height; + double _refreshRate; +} + +@property(readonly, nonatomic) double refreshRate; +@property(readonly, nonatomic) unsigned int height; +@property(readonly, nonatomic) unsigned int width; +- (id)initWithWidth:(unsigned int)arg1 + height:(unsigned int)arg2 + refreshRate:(double)arg3; + +@end + +@interface CGVirtualDisplaySettings : NSObject { + NSArray* _modes; + unsigned int _hiDPI; +} + +@property(nonatomic) unsigned int hiDPI; +- (void)dealloc; +- (id)init; +@property(retain, nonatomic) NSArray* modes; + +@end + +#endif \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js b/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js new file mode 100644 index 0000000000000..f43c420599df0 --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js @@ -0,0 +1,6 @@ +module.exports = process.platform === 'darwin' + ? require('../build/Release/virtual_display.node') + : { + create: () => { throw new Error('Virtual displays only supported on macOS'); }, + destroy: () => { throw new Error('Virtual displays only supported on macOS'); } + }; diff --git a/spec/fixtures/native-addon/virtual-display/package.json b/spec/fixtures/native-addon/virtual-display/package.json new file mode 100644 index 0000000000000..16fd059920b2c --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/package.json @@ -0,0 +1,20 @@ +{ + "name": "@electron-ci/virtual-display", + "version": "1.0.0", + "description": "Virtual display for multi-monitor testing", + "main": "./lib/virtual-display.js", + "scripts": { + "clean": "rm -rf build", + "build-electron": "electron-rebuild", + "build": "node-gyp configure && node-gyp build" + }, + "license": "MIT", + "dependencies": { + "bindings": "^1.5.0", + "node-addon-api": "^8.3.0" + }, + "devDependencies": { + "@types/jest": "^30.0.0", + "node-gyp": "^11.1.0" + } +} diff --git a/spec/fixtures/native-addon/virtual-display/src/Dummy.swift b/spec/fixtures/native-addon/virtual-display/src/Dummy.swift new file mode 100644 index 0000000000000..ef0195f3039fe --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/src/Dummy.swift @@ -0,0 +1,151 @@ +import Foundation +import Cocoa +import os.log + +class DummyManager { + struct DefinedDummy { + var dummy: Dummy + } + + static var definedDummies: [Int: DefinedDummy] = [:] + static var dummyCounter: Int = 0 + + static func createDummy(_ dummyDefinition: DummyDefinition, isPortrait _: Bool = false, serialNum: UInt32 = 0, doConnect: Bool = true) -> Int? { + let dummy = Dummy(dummyDefinition: dummyDefinition, serialNum: serialNum, doConnect: doConnect) + self.dummyCounter += 1 + self.definedDummies[self.dummyCounter] = DefinedDummy(dummy: dummy) + return self.dummyCounter + } + + static func discardDummyByNumber(_ number: Int) { + if let definedDummy = self.definedDummies[number] { + if definedDummy.dummy.isConnected { + definedDummy.dummy.disconnect() + } + } + self.definedDummies[number] = nil + } +} + +struct DummyDefinition { + let aspectWidth, aspectHeight, multiplierStep, minMultiplier, maxMultiplier: Int + let refreshRates: [Double] + let description: String + let addSeparatorAfter: Bool + + init(_ aspectWidth: Int, _ aspectHeight: Int, _ step: Int, _ refreshRates: [Double], _ description: String, _ addSeparatorAfter: Bool = false) { + let minX: Int = 720 + let minY: Int = 720 + let maxX: Int = 8192 + let maxY: Int = 8192 + let minMultiplier = max(Int(ceil(Float(minX) / (Float(aspectWidth) * Float(step)))), Int(ceil(Float(minY) / (Float(aspectHeight) * Float(step))))) + let maxMultiplier = min(Int(floor(Float(maxX) / (Float(aspectWidth) * Float(step)))), Int(floor(Float(maxY) / (Float(aspectHeight) * Float(step))))) + + self.aspectWidth = aspectWidth + self.aspectHeight = aspectHeight + self.minMultiplier = minMultiplier + self.maxMultiplier = maxMultiplier + self.multiplierStep = step + self.refreshRates = refreshRates + self.description = description + self.addSeparatorAfter = addSeparatorAfter + } +} + +class Dummy: Equatable { + var virtualDisplay: CGVirtualDisplay? + var dummyDefinition: DummyDefinition + let serialNum: UInt32 + var isConnected: Bool = false + var displayIdentifier: CGDirectDisplayID = 0 + + static func == (lhs: Dummy, rhs: Dummy) -> Bool { + lhs.serialNum == rhs.serialNum + } + + init(dummyDefinition: DummyDefinition, serialNum: UInt32 = 0, doConnect: Bool = true) { + var storedSerialNum: UInt32 = serialNum + if storedSerialNum == 0 { + storedSerialNum = UInt32.random(in: 0 ... UInt32.max) + } + self.dummyDefinition = dummyDefinition + self.serialNum = storedSerialNum + if doConnect { + _ = self.connect() + } + } + + func getName() -> String { + "Dummy \(self.dummyDefinition.description.components(separatedBy: " ").first ?? self.dummyDefinition.description)" + } + + func connect() -> Bool { + if self.virtualDisplay != nil || self.isConnected { + self.disconnect() + } + let name: String = self.getName() + if let virtualDisplay = Dummy.createVirtualDisplay(self.dummyDefinition, name: name, serialNum: self.serialNum) { + self.virtualDisplay = virtualDisplay + self.displayIdentifier = virtualDisplay.displayID + self.isConnected = true + os_log("Display %{public}@ successfully connected", type: .info, "\(name)") + return true + } else { + os_log("Failed to connect display %{public}@", type: .info, "\(name)") + return false + } + } + + func disconnect() { + self.virtualDisplay = nil + self.isConnected = false + os_log("Disconnected virtual display: %{public}@", type: .info, "\(self.getName())") + } + + private static func waitForDisplayRegistration(_ displayId: CGDirectDisplayID) -> Bool { + for _ in 0..<20 { + var count: UInt32 = 0, displays = [CGDirectDisplayID](repeating: 0, count: 32) + if CGGetActiveDisplayList(32, &displays, &count) == .success && displays[0..<Int(count)].contains(displayId) { + return true + } + usleep(100000) + } + return false + } + + static func createVirtualDisplay(_ definition: DummyDefinition, name: String, serialNum: UInt32, hiDPI: Bool = false) -> CGVirtualDisplay? { + if let descriptor = CGVirtualDisplayDescriptor() { + descriptor.queue = DispatchQueue.global(qos: .userInteractive) + descriptor.name = name + descriptor.whitePoint = CGPoint(x: 0.950, y: 1.000) + descriptor.redPrimary = CGPoint(x: 0.454, y: 0.242) + descriptor.greenPrimary = CGPoint(x: 0.353, y: 0.674) + descriptor.bluePrimary = CGPoint(x: 0.157, y: 0.084) + descriptor.maxPixelsWide = UInt32(definition.aspectWidth * definition.multiplierStep * definition.maxMultiplier) + descriptor.maxPixelsHigh = UInt32(definition.aspectHeight * definition.multiplierStep * definition.maxMultiplier) + let diagonalSizeRatio: Double = (24 * 25.4) / sqrt(Double(definition.aspectWidth * definition.aspectWidth + definition.aspectHeight * definition.aspectHeight)) + descriptor.sizeInMillimeters = CGSize(width: Double(definition.aspectWidth) * diagonalSizeRatio, height: Double(definition.aspectHeight) * diagonalSizeRatio) + descriptor.serialNum = serialNum + descriptor.productID = UInt32(min(definition.aspectWidth - 1, 255) * 256 + min(definition.aspectHeight - 1, 255)) + descriptor.vendorID = UInt32(0xF0F0) + if let display = CGVirtualDisplay(descriptor: descriptor) { + var modes = [CGVirtualDisplayMode?](repeating: nil, count: definition.maxMultiplier - definition.minMultiplier + 1) + for multiplier in definition.minMultiplier ... definition.maxMultiplier { + for refreshRate in definition.refreshRates { + let width = UInt32(definition.aspectWidth * multiplier * definition.multiplierStep) + let height = UInt32(definition.aspectHeight * multiplier * definition.multiplierStep) + modes[multiplier - definition.minMultiplier] = CGVirtualDisplayMode(width: width, height: height, refreshRate: refreshRate)! + } + } + if let settings = CGVirtualDisplaySettings() { + settings.hiDPI = hiDPI ? 1 : 0 + settings.modes = modes as [Any] + if display.applySettings(settings) { + return waitForDisplayRegistration(display.displayID) ? display : nil + } + } + } + } + return nil + } +} \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift new file mode 100644 index 0000000000000..1c4e57952cf89 --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift @@ -0,0 +1,54 @@ +import Foundation +import Cocoa +import os.log + +@objc public class VirtualDisplay: NSObject { + @objc public static func create(width: Int, height: Int, x: Int, y: Int) -> Int { + let refreshRates: [Double] = [60.0] // Always 60Hz default + let description = "\(width)x\(height) Display" + let definition = DummyDefinition(width, height, 1, refreshRates, description, false) + let displayId = DummyManager.createDummy(definition) ?? 0 + positionDisplay(displayId: displayId, x: x, y: y) + + return displayId + } + + @objc public static func destroy(id: Int) -> Bool { + DummyManager.discardDummyByNumber(id) + return true + } + + private static func positionDisplay(displayId: Int, x: Int, y: Int) { + guard let definedDummy = DummyManager.definedDummies[displayId], + definedDummy.dummy.isConnected else { + os_log("VirtualDisplay: Cannot position display %{public}@: display not found or not connected", type: .error, "\(displayId)") + return + } + + let cgDisplayId = definedDummy.dummy.displayIdentifier + + var config: CGDisplayConfigRef? = nil + let beginResult = CGBeginDisplayConfiguration(&config) + + if beginResult != .success { + os_log("VirtualDisplay: Cannot position display, failed to begin display configuration via CGBeginDisplayConfiguration: error %{public}@", type: .error, "\(beginResult.rawValue)") + return + } + + let configResult = CGConfigureDisplayOrigin(config, cgDisplayId, Int32(x), Int32(y)) + + if configResult != .success { + os_log("VirtualDisplay: Cannot position display, failed to configure display origin via CGConfigureDisplayOrigin: error %{public}@", type: .error, "\(configResult.rawValue)") + CGCancelDisplayConfiguration(config) + return + } + + let completeResult = CGCompleteDisplayConfiguration(config, .permanently) + + if completeResult == .success { + os_log("VirtualDisplay: Successfully positioned display %{public}@ at (%{public}@, %{public}@)", type: .info, "\(displayId)", "\(x)", "\(y)") + } else { + os_log("VirtualDisplay: Cannot position display, failed to complete display configuration via CGCompleteDisplayConfiguration: error %{public}@", type: .error, "\(completeResult.rawValue)") + } + } +} \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m new file mode 100644 index 0000000000000..b18ccbe97757d --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m @@ -0,0 +1,14 @@ +#import "VirtualDisplayBridge.h" +#import "../build_swift/virtual_display-Swift.h" + +@implementation VirtualDisplayBridge + ++ (NSInteger)create:(int)width height:(int)height x:(int)x y:(int)y { + return [VirtualDisplay createWithWidth:width height:height x:x y:y]; +} + ++ (BOOL)destroy:(NSInteger)displayId { + return [VirtualDisplay destroyWithId:(int)displayId]; +} + +@end \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/src/addon.mm b/spec/fixtures/native-addon/virtual-display/src/addon.mm new file mode 100644 index 0000000000000..e15d59a532e8e --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/src/addon.mm @@ -0,0 +1,183 @@ +#include <js_native_api.h> +#include <node_api.h> +#include "VirtualDisplayBridge.h" + +namespace { + +typedef struct { + const char* name; + int default_val; + int* ptr; +} PropertySpec; + +// Helper function to get an integer property from an object +bool GetIntProperty(napi_env env, + napi_value object, + const char* prop_name, + int* result, + int default_value) { + *result = default_value; + + bool has_prop; + if (napi_has_named_property(env, object, prop_name, &has_prop) != napi_ok || + !has_prop) { + return true; + } + + napi_value prop_value; + if (napi_get_named_property(env, object, prop_name, &prop_value) != napi_ok) { + return false; + } + + if (napi_get_value_int32(env, prop_value, result) != napi_ok) { + return false; + } + + return true; +} + +// Helper function to validate and parse object properties +bool ParseObjectProperties(napi_env env, + napi_value object, + PropertySpec props[], + size_t prop_count) { + // Process all properties + for (size_t i = 0; i < prop_count; i++) { + if (!GetIntProperty(env, object, props[i].name, props[i].ptr, + props[i].default_val)) { + char error_msg[50]; + snprintf(error_msg, sizeof(error_msg), "%s must be a number", + props[i].name); + napi_throw_error(env, NULL, error_msg); + return false; + } + } + + // Check for unknown properties + napi_value prop_names; + uint32_t count; + napi_get_property_names(env, object, &prop_names); + napi_get_array_length(env, prop_names, &count); + + for (uint32_t i = 0; i < count; i++) { + napi_value prop_name; + napi_get_element(env, prop_names, i, &prop_name); + size_t len; + char name[20]; + napi_get_value_string_utf8(env, prop_name, name, sizeof(name), &len); + + bool found = false; + for (size_t j = 0; j < prop_count; j++) { + if (strcmp(name, props[j].name) == 0) { + found = true; + break; + } + } + if (!found) { + napi_throw_error(env, NULL, "Object contains unknown properties"); + return false; + } + } + + return true; +} + +// virtualDisplay.create() +napi_value create(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + + if (napi_get_cb_info(env, info, &argc, args, NULL, NULL) != napi_ok) { + return NULL; + } + + int width = 1920, height = 1080, x = 0, y = 0; + + PropertySpec props[] = {{"width", 1920, &width}, + {"height", 1080, &height}, + {"x", 0, &x}, + {"y", 0, &y}}; + + if (argc >= 1) { + napi_valuetype valuetype; + if (napi_typeof(env, args[0], &valuetype) != napi_ok) { + napi_throw_error(env, NULL, "Failed to get argument type"); + return NULL; + } + + if (valuetype == napi_object) { + if (!ParseObjectProperties(env, args[0], props, + sizeof(props) / sizeof(props[0]))) { + return NULL; + } + } else { + napi_throw_error(env, NULL, "Expected an object as the argument"); + return NULL; + } + } + + NSInteger displayId = [VirtualDisplayBridge create:width + height:height + x:x + y:y]; + + if (displayId == 0) { + napi_throw_error(env, NULL, "Failed to create virtual display"); + return NULL; + } + + napi_value result; + if (napi_create_int64(env, displayId, &result) != napi_ok) { + return NULL; + } + + return result; +} + +// virtualDisplay.destroy() +napi_value destroy(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + + if (napi_get_cb_info(env, info, &argc, args, NULL, NULL) != napi_ok) { + return NULL; + } + + if (argc < 1) { + napi_throw_error(env, NULL, "Expected number argument"); + return NULL; + } + + int64_t displayId; + if (napi_get_value_int64(env, args[0], &displayId) != napi_ok) { + napi_throw_error(env, NULL, "Expected number argument"); + return NULL; + } + + BOOL result = [VirtualDisplayBridge destroy:(NSInteger)displayId]; + + napi_value js_result; + if (napi_get_boolean(env, result, &js_result) != napi_ok) { + return NULL; + } + + return js_result; +} + +napi_value Init(napi_env env, napi_value exports) { + napi_property_descriptor descriptors[] = { + {"create", NULL, create, NULL, NULL, NULL, napi_default, NULL}, + {"destroy", NULL, destroy, NULL, NULL, NULL, napi_default, NULL}}; + + if (napi_define_properties(env, exports, + sizeof(descriptors) / sizeof(*descriptors), + descriptors) != napi_ok) { + return NULL; + } + + return exports; +} + +} // namespace + +NAPI_MODULE(NODE_GYP_MODULE_NAME, Init) \ No newline at end of file diff --git a/spec/package.json b/spec/package.json index 797b4d8bc5e46..4bc6ace3937f2 100644 --- a/spec/package.json +++ b/spec/package.json @@ -24,6 +24,7 @@ "@electron-ci/uv-dlopen": "file:./fixtures/native-addon/uv-dlopen/", "@electron-ci/osr-gpu": "file:./fixtures/native-addon/osr-gpu/", "@electron-ci/external-ab": "file:./fixtures/native-addon/external-ab/", + "@electron-ci/virtual-display": "file:./fixtures/native-addon/virtual-display/", "@electron/fuses": "^1.8.0", "@electron/packager": "^18.3.2", "@types/sinon": "^9.0.4", diff --git a/spec/yarn.lock b/spec/yarn.lock index b37a017d30807..2ab549ff5162b 100644 --- a/spec/yarn.lock +++ b/spec/yarn.lock @@ -19,6 +19,12 @@ "@electron-ci/uv-dlopen@file:./fixtures/native-addon/uv-dlopen": version "0.0.1" +"@electron-ci/virtual-display@file:./fixtures/native-addon/virtual-display": + version "1.0.0" + dependencies: + bindings "^1.5.0" + node-addon-api "^8.3.0" + "@electron/asar@^3.2.1", "@electron/asar@^3.2.7": version "3.2.10" resolved "https://registry.yarnpkg.com/@electron/asar/-/asar-3.2.10.tgz#615cf346b734b23cafa4e0603551010bd0e50aa8" @@ -517,7 +523,7 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== -bindings@^1.2.1: +bindings@^1.2.1, bindings@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== @@ -1892,6 +1898,11 @@ node-addon-api@8.0.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-8.0.0.tgz#5453b7ad59dd040d12e0f1a97a6fa1c765c5c9d2" integrity sha512-ipO7rsHEBqa9STO5C5T10fj732ml+5kLN1cAG8/jdHd56ldQeGj3Q7+scUS+VHK/qy1zLEwC4wMK5+yM0btPvw== +node-addon-api@^8.3.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-8.5.0.tgz#c91b2d7682fa457d2e1c388150f0dff9aafb8f3f" + integrity sha512-/bRZty2mXUIFY/xU5HLvveNHlswNJej+RnxBjOMkidWfwZzgTbPG1E3K5TOxRLOR+5hX7bSofy8yf1hZevMS8A== + node-fetch@^2.6.7: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" From 319a710a9847cef1d59393f021f6dde5d81f0fd7 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Mon, 11 Aug 2025 10:46:24 -0400 Subject: [PATCH 033/268] fix: native-addon forceCleanup --- .../include/VirtualDisplayBridge.h | 1 + .../virtual-display/src/Dummy.swift | 36 +++++++++++++++++-- .../virtual-display/src/VirtualDisplay.swift | 5 +++ .../src/VirtualDisplayBridge.m | 4 +++ .../native-addon/virtual-display/src/addon.mm | 16 ++++++++- 5 files changed, 58 insertions(+), 4 deletions(-) diff --git a/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h b/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h index 6ac5cbacb8f9a..dfb3096cf1df7 100644 --- a/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h +++ b/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h @@ -8,6 +8,7 @@ + (NSInteger)create:(int)width height:(int)height x:(int)x y:(int)y; + (BOOL)destroy:(NSInteger)displayId; ++ (BOOL)forceCleanup; @end diff --git a/spec/fixtures/native-addon/virtual-display/src/Dummy.swift b/spec/fixtures/native-addon/virtual-display/src/Dummy.swift index ef0195f3039fe..9695b1a0b433e 100644 --- a/spec/fixtures/native-addon/virtual-display/src/Dummy.swift +++ b/spec/fixtures/native-addon/virtual-display/src/Dummy.swift @@ -12,6 +12,11 @@ class DummyManager { static func createDummy(_ dummyDefinition: DummyDefinition, isPortrait _: Bool = false, serialNum: UInt32 = 0, doConnect: Bool = true) -> Int? { let dummy = Dummy(dummyDefinition: dummyDefinition, serialNum: serialNum, doConnect: doConnect) + + if !dummy.isConnected { + print("[DummyManager.createDummy:\(#line)] Failed to create virtual display - not connected") + return nil + } self.dummyCounter += 1 self.definedDummies[self.dummyCounter] = DefinedDummy(dummy: dummy) return self.dummyCounter @@ -25,6 +30,30 @@ class DummyManager { } self.definedDummies[number] = nil } + + static func forceCleanup() { + for (_, definedDummy) in self.definedDummies { + if definedDummy.dummy.isConnected { + definedDummy.dummy.virtualDisplay = nil + definedDummy.dummy.displayIdentifier = 0 + definedDummy.dummy.isConnected = false + } + } + + self.definedDummies.removeAll() + self.dummyCounter = 0 + + var config: CGDisplayConfigRef? = nil + if CGBeginDisplayConfiguration(&config) == .success { + CGCompleteDisplayConfiguration(config, .permanently) + } + + usleep(2000000) + + if CGBeginDisplayConfiguration(&config) == .success { + CGCompleteDisplayConfiguration(config, .forSession) + } + } } struct DummyDefinition { @@ -88,10 +117,10 @@ class Dummy: Equatable { self.virtualDisplay = virtualDisplay self.displayIdentifier = virtualDisplay.displayID self.isConnected = true - os_log("Display %{public}@ successfully connected", type: .info, "\(name)") + print("[Dummy.connect:\(#line)] Successfully connected virtual display: \(name)") return true } else { - os_log("Failed to connect display %{public}@", type: .info, "\(name)") + print("[Dummy.connect:\(#line)] Failed to connect virtual display: \(name)") return false } } @@ -99,7 +128,7 @@ class Dummy: Equatable { func disconnect() { self.virtualDisplay = nil self.isConnected = false - os_log("Disconnected virtual display: %{public}@", type: .info, "\(self.getName())") + print("[Dummy.disconnect:\(#line)] Disconnected virtual display: \(self.getName())") } private static func waitForDisplayRegistration(_ displayId: CGDirectDisplayID) -> Bool { @@ -110,6 +139,7 @@ class Dummy: Equatable { } usleep(100000) } + print("[Dummy.waitForDisplayRegistration:\(#line)] Failed to register virtual display: \(displayId)") return false } diff --git a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift index 1c4e57952cf89..265bfc5af2c77 100644 --- a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift +++ b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift @@ -18,6 +18,11 @@ import os.log return true } + @objc public static func forceCleanup() -> Bool { + DummyManager.forceCleanup() + return true + } + private static func positionDisplay(displayId: Int, x: Int, y: Int) { guard let definedDummy = DummyManager.definedDummies[displayId], definedDummy.dummy.isConnected else { diff --git a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m index b18ccbe97757d..7d31526748d4d 100644 --- a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m +++ b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m @@ -11,4 +11,8 @@ + (BOOL)destroy:(NSInteger)displayId { return [VirtualDisplay destroyWithId:(int)displayId]; } ++ (BOOL)forceCleanup { + return [VirtualDisplay forceCleanup]; +} + @end \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/src/addon.mm b/spec/fixtures/native-addon/virtual-display/src/addon.mm index e15d59a532e8e..60285d1fd8332 100644 --- a/spec/fixtures/native-addon/virtual-display/src/addon.mm +++ b/spec/fixtures/native-addon/virtual-display/src/addon.mm @@ -134,6 +134,18 @@ napi_value create(napi_env env, napi_callback_info info) { return result; } +// virtualDisplay.forceCleanup() +napi_value forceCleanup(napi_env env, napi_callback_info info) { + BOOL result = [VirtualDisplayBridge forceCleanup]; + + napi_value js_result; + if (napi_get_boolean(env, result, &js_result) != napi_ok) { + return NULL; + } + + return js_result; +} + // virtualDisplay.destroy() napi_value destroy(napi_env env, napi_callback_info info) { size_t argc = 1; @@ -167,7 +179,9 @@ napi_value destroy(napi_env env, napi_callback_info info) { napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor descriptors[] = { {"create", NULL, create, NULL, NULL, NULL, napi_default, NULL}, - {"destroy", NULL, destroy, NULL, NULL, NULL, napi_default, NULL}}; + {"destroy", NULL, destroy, NULL, NULL, NULL, napi_default, NULL}, + {"forceCleanup", NULL, forceCleanup, NULL, NULL, NULL, napi_default, + NULL}}; if (napi_define_properties(env, exports, sizeof(descriptors) / sizeof(*descriptors), From 06b51645a8c8a12ccfb1b89922eb8c669840b219 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Mon, 11 Aug 2025 10:47:11 -0400 Subject: [PATCH 034/268] docs: add forceCleanup description --- docs/development/multi-monitor-testing.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/development/multi-monitor-testing.md b/docs/development/multi-monitor-testing.md index 5a1d7e772b662..7a8e62bc9732a 100644 --- a/docs/development/multi-monitor-testing.md +++ b/docs/development/multi-monitor-testing.md @@ -37,6 +37,21 @@ const success = virtualDisplay.destroy(displayId) **Returns:** `boolean` - Success status +#### `virtualDisplay.forceCleanup()` + +Performs a complete cleanup of all virtual displays and resets the macOS CoreGraphics display system. + +It is recommended to call this before every test to prevent test failures. macOS CoreGraphics maintains an internal display ID allocation pool that can become corrupted when virtual displays are created and destroyed rapidly during testing. Without proper cleanup, subsequent display creation may fail with inconsistent display IDs, resulting in test flakiness. + +```js @ts-nocheck +// Recommended test pattern +beforeEach(() => { + virtualDisplay.forceCleanup() +}) +``` + +**Returns:** `boolean` - Success status + ## Display Constraints ### Size Limits From 1401bcc7f997a065420930cd7d83007fa2309693 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Mon, 11 Aug 2025 10:48:11 -0400 Subject: [PATCH 035/268] test: add two basic multi-monitor tests --- spec/api-browser-window-spec.ts | 103 ++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 515367099f8c9..9d4e7ddbc9f83 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -7965,6 +7965,109 @@ describe('BrowserWindow module', () => { if (!w.isFullScreen()) await enterFullScreen; expect(w.isFullScreen()).to.equal(true); + w.destroy(); + }); + }); + ifdescribe(process.platform === 'darwin')('multi-monitor tests', () => { + const virtualDisplay = require('@electron-ci/virtual-display'); + const primaryDisplay = screen.getPrimaryDisplay(); + + beforeEach(async () => { + virtualDisplay.forceCleanup(); + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + }); + + it('should restore window bounds correctly on a secondary display', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + // Create a new virtual target display to the right of the primary display + const targetDisplayId = virtualDisplay.create({ + width: 1920, + height: 1080, + x: targetDisplayX, + y: targetDisplayY + }); + + // Verify the virtual display is created correctly + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + expect(targetDisplay.bounds.width).to.equal(1920); + expect(targetDisplay.bounds.height).to.equal(1080); + + // Bounds for the test window on the virtual target display + const boundsOnTargetDisplay = { + width: 400, + height: 300, + x: targetDisplay.workArea.x + 100, + y: targetDisplay.workArea.y + 100 + }; + + await createAndSaveWindowState(boundsOnTargetDisplay); + + // Restore the window state by creating a new window with the same name + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const restoredBounds = w.getBounds(); + expectBoundsEqual(restoredBounds, boundsOnTargetDisplay); + + w.destroy(); + virtualDisplay.destroy(targetDisplayId); + }); + + it('should restore window to a visible location when saved display no longer exists', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + // Create a new virtual target display to the right of the primary display + const targetDisplayId = virtualDisplay.create({ + width: 1920, + height: 1080, + x: targetDisplayX, + y: targetDisplayY + }); + + // Verify the virtual display is created correctly + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + expect(targetDisplay.bounds.width).to.equal(1920); + expect(targetDisplay.bounds.height).to.equal(1080); + + // Bounds for the test window on the virtual target display + const boundsOnTargetDisplay = { + width: 400, + height: 300, + x: targetDisplay.workArea.x + 100, + y: targetDisplay.workArea.y + 100 + }; + + // Save window state on the virtual display + await createAndSaveWindowState(boundsOnTargetDisplay); + + virtualDisplay.destroy(targetDisplayId); + // Wait for the target virtual display to be destroyed + while (screen.getAllDisplays().length > 1) await setTimeout(1000); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const restoredBounds = w.getBounds(); + const primaryWorkArea = primaryDisplay.workArea; + + // Window should be fully visible on the primary display + expect(restoredBounds.x).to.be.at.least(primaryWorkArea.x); + expect(restoredBounds.y).to.be.at.least(primaryWorkArea.y); + expect(restoredBounds.x + restoredBounds.width).to.be.at.most(primaryWorkArea.x + primaryWorkArea.width); + expect(restoredBounds.y + restoredBounds.height).to.be.at.most(primaryWorkArea.y + primaryWorkArea.height); + + // Window should maintain its original size + expect(restoredBounds.width).to.equal(boundsOnTargetDisplay.width); + expect(restoredBounds.height).to.equal(boundsOnTargetDisplay.height); + w.destroy(); }); }); From cc1783f97eafca295d025802caa434d0a1dc9c79 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Mon, 11 Aug 2025 15:18:27 -0400 Subject: [PATCH 036/268] fix: find the closest display for non-overlapping saved bounds --- shell/browser/native_window.cc | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 43322437f96c4..1274a8cab1799 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -961,10 +961,25 @@ void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { display::Screen* screen = display::Screen::GetScreen(); DCHECK(screen); - // GetDisplayMatching returns a fake display with 1920x1080 resolution at - // (0,0) when no physical displays are attached. - // https://source.chromium.org/chromium/chromium/src/+/main:ui/display/display.cc;l=184;drc=e4f1aef5f3ec30a28950d766612cc2c04c822c71 - const display::Display display = screen->GetDisplayMatching(saved_bounds); + + // Set the primary display as the target display for restoration. + display::Display display = screen->GetPrimaryDisplay(); + + // We identify the display with the minimal Manhattan distance to the saved + // bounds and set it as the target display for restoration. + int min_displacement = std::numeric_limits<int>::max(); + + for (const auto& candidate : screen->GetAllDisplays()) { + gfx::Rect test_bounds = saved_bounds; + test_bounds.AdjustToFit(candidate.work_area()); + int displacement = std::abs(test_bounds.x() - saved_bounds.x()) + + std::abs(test_bounds.y() - saved_bounds.y()); + + if (displacement < min_displacement) { + min_displacement = displacement; + display = candidate; + } + } // Skip window state restoration if current display has invalid dimensions or // is fake. Restoring from invalid displays (0x0) or fake displays (ID 0xFF) From 777f5356e1f667a55c7e21757791a479de96857e Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Mon, 11 Aug 2025 21:02:44 -0400 Subject: [PATCH 037/268] test: windowStatePersistence multi-monitor tests --- spec/api-browser-window-spec.ts | 433 +++++++++++++++++++++++++++++++- 1 file changed, 430 insertions(+), 3 deletions(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 9d4e7ddbc9f83..4845fcbca7233 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -7991,6 +7991,8 @@ describe('BrowserWindow module', () => { // Verify the virtual display is created correctly const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + expect(targetDisplay.bounds.x).to.equal(targetDisplayX); + expect(targetDisplay.bounds.y).to.equal(targetDisplayY); expect(targetDisplay.bounds.width).to.equal(1920); expect(targetDisplay.bounds.height).to.equal(1080); @@ -8029,10 +8031,9 @@ describe('BrowserWindow module', () => { y: targetDisplayY }); - // Verify the virtual display is created correctly + // Verify the virtual display is created correctly - single check for targetDisplay.bounds.x const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); - expect(targetDisplay.bounds.width).to.equal(1920); - expect(targetDisplay.bounds.height).to.equal(1080); + expect(targetDisplay.bounds.x).to.equal(targetDisplayX); // Bounds for the test window on the virtual target display const boundsOnTargetDisplay = { @@ -8070,6 +8071,432 @@ describe('BrowserWindow module', () => { w.destroy(); }); + + it('should fallback to nearest display when saved display no longer exists', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + + // Create first virtual display to the right of primary + const middleDisplayId = virtualDisplay.create({ + width: 1920, + height: 1080, + x: targetDisplayX, + y: targetDisplayY + }); + + // Create second virtual display to the right of the first (rightmost) + const rightmostDisplayX = targetDisplayX + 1920; + const rightmostDisplayId = virtualDisplay.create({ + width: 1920, + height: 1080, + x: rightmostDisplayX, + y: targetDisplayY + }); + + // Verify the virtual displays are created correctly - single check for origin x values + const middleDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + expect(middleDisplay.bounds.x).to.equal(targetDisplayX); + + const rightmostDisplay = screen.getDisplayNearestPoint({ x: rightmostDisplayX, y: targetDisplayY }); + expect(rightmostDisplay.bounds.x).to.equal(rightmostDisplayX); + + // Bounds for the test window on the rightmost display + const boundsOnRightmostDisplay = { + width: 400, + height: 300, + x: rightmostDisplay.workArea.x + 100, + y: rightmostDisplay.workArea.y + 100 + }; + + // Save window state on the rightmost display + await createAndSaveWindowState(boundsOnRightmostDisplay); + + // Destroy the rightmost display (where window was saved) + virtualDisplay.destroy(rightmostDisplayId); + // Wait for the rightmost display to be destroyed + while (screen.getAllDisplays().length > 2) await setTimeout(1000); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const restoredBounds = w.getBounds(); + + // Window should be restored on the middle display (nearest remaining display) + expect(restoredBounds.x).to.be.at.least(middleDisplay.workArea.x); + expect(restoredBounds.y).to.be.at.least(middleDisplay.workArea.y); + expect(restoredBounds.x + restoredBounds.width).to.be.at.most(middleDisplay.workArea.x + middleDisplay.workArea.width); + expect(restoredBounds.y + restoredBounds.height).to.be.at.most(middleDisplay.workArea.y + middleDisplay.workArea.height); + + // Window should maintain its original size + expect(restoredBounds.width).to.equal(boundsOnRightmostDisplay.width); + expect(restoredBounds.height).to.equal(boundsOnRightmostDisplay.height); + + w.destroy(); + virtualDisplay.destroy(middleDisplayId); + }); + + it('should restore multiple named windows independently across displays', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + + // Create a first virtual display to the right of the primary display + const targetDisplayId1 = virtualDisplay.create({ + width: 1920, + height: 1080, + x: targetDisplayX, + y: targetDisplayY + }); + // Create a second virtual display to the right of the first + const targetDisplayId2 = virtualDisplay.create({ + width: 1600, + height: 900, + x: targetDisplayX + 1920, + y: targetDisplayY + }); + + // Verify the virtual displays are created correctly - single check for origin x values + const targetDisplay1 = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + expect(targetDisplay1.bounds.x).to.equal(targetDisplayX); + + const targetDisplay2 = screen.getDisplayNearestPoint({ x: targetDisplayX + 1920, y: targetDisplayY }); + expect(targetDisplay2.bounds.x).to.equal(targetDisplayX + 1920); + + // Window 1 on primary display + const window1Name = 'test-multi-window-1'; + const bounds1 = { + width: 300, + height: 200, + x: primaryDisplay.workArea.x + 50, + y: primaryDisplay.workArea.y + 50 + }; + + // Window 2 on second display (first virtual) + const window2Name = 'test-multi-window-2'; + const bounds2 = { + width: 400, + height: 300, + x: targetDisplay1.workArea.x + 100, + y: targetDisplay1.workArea.y + 100 + }; + + // Window 3 on third display (second virtual) + const window3Name = 'test-multi-window-3'; + const bounds3 = { + width: 350, + height: 250, + x: targetDisplay2.workArea.x + 150, + y: targetDisplay2.workArea.y + 150 + }; + + // Create and save state for all three windows + const w1 = new BrowserWindow({ + name: window1Name, + windowStatePersistence: true, + show: false, + ...bounds1 + }); + const w2 = new BrowserWindow({ + name: window2Name, + windowStatePersistence: true, + show: false, + ...bounds2 + }); + const w3 = new BrowserWindow({ + name: window3Name, + windowStatePersistence: true, + show: false, + ...bounds3 + }); + + w1.destroy(); + w2.destroy(); + w3.destroy(); + + await setTimeout(2000); + + // Restore all three windows + const restoredW1 = new BrowserWindow({ + name: window1Name, + windowStatePersistence: true, + show: false + }); + const restoredW2 = new BrowserWindow({ + name: window2Name, + windowStatePersistence: true, + show: false + }); + const restoredW3 = new BrowserWindow({ + name: window3Name, + windowStatePersistence: true, + show: false + }); + + // Check that each window restored to its correct display and position + expectBoundsEqual(restoredW1.getBounds(), bounds1); + expectBoundsEqual(restoredW2.getBounds(), bounds2); + expectBoundsEqual(restoredW3.getBounds(), bounds3); + + restoredW1.destroy(); + restoredW2.destroy(); + restoredW3.destroy(); + virtualDisplay.destroy(targetDisplayId1); + virtualDisplay.destroy(targetDisplayId2); + }); + + it('should restore fullscreen state on correct display', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + // Create a new virtual target display to the right of the primary display + const targetDisplayId = virtualDisplay.create({ + width: 1920, + height: 1080, + x: targetDisplayX, + y: targetDisplayY + }); + + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + expect(targetDisplay.bounds.x).to.equal(targetDisplayX); + + // Create window on target display and set fullscreen + const initialBounds = { + width: 400, + height: 300, + x: targetDisplay.workArea.x + 100, + y: targetDisplay.workArea.y + 100, + fullscreen: true + }; + + await createAndSaveWindowState(initialBounds); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true + }); + + const enterFullScreen = once(w, 'enter-full-screen'); + if (!w.isFullScreen()) await enterFullScreen; + + expect(w.isFullScreen()).to.equal(true); + + // Check that fullscreen window is on the correct display + const fsBounds = w.getBounds(); + expect(fsBounds.x).to.be.at.least(targetDisplay.bounds.x); + expect(fsBounds.y).to.be.at.least(targetDisplay.bounds.y); + expect(fsBounds.x + fsBounds.width).to.be.at.most(targetDisplay.bounds.x + targetDisplay.bounds.width); + expect(fsBounds.y + fsBounds.height).to.be.at.most(targetDisplay.bounds.y + targetDisplay.bounds.height); + + w.destroy(); + virtualDisplay.destroy(targetDisplayId); + }); + + it('should restore maximized state on correct display', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + // Create a new virtual target display to the right of the primary display + const targetDisplayId = virtualDisplay.create({ + width: 1920, + height: 1080, + x: targetDisplayX, + y: targetDisplayY + }); + + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + expect(targetDisplay.bounds.x).to.equal(targetDisplayX); + + // Create window on target display and maximize it + const w1 = new BrowserWindow({ + name: windowName, + windowStatePersistence: { + displayMode: false + }, + x: targetDisplay.workArea.x, + y: targetDisplay.workArea.y + }); + + const maximized = once(w1, 'maximize'); + w1.maximize(); + if (!w1.isMaximized()) await maximized; + + w1.destroy(); + await setTimeout(2000); + + const w2 = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: true + }); + + const maximized_ = once(w2, 'maximize'); + if (!w2.isMaximized()) await maximized_; + + expect(w2.isMaximized()).to.equal(true); + // Check that maximized window is on the correct display + const maximizedBounds = w2.getBounds(); + expect(maximizedBounds.x).to.be.at.least(targetDisplay.bounds.x); + expect(maximizedBounds.y).to.be.at.least(targetDisplay.bounds.y); + expect(maximizedBounds.x + maximizedBounds.width).to.be.at.most(targetDisplay.bounds.x + targetDisplay.bounds.width); + expect(maximizedBounds.y + maximizedBounds.height).to.be.at.most(targetDisplay.bounds.y + targetDisplay.bounds.height); + + w2.destroy(); + virtualDisplay.destroy(targetDisplayId); + }); + + it('should restore kiosk state on correct display', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + // Create a new virtual target display to the right of the primary display + const targetDisplayId = virtualDisplay.create({ + width: 1920, + height: 1080, + x: targetDisplayX, + y: targetDisplayY + }); + + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + + // Create window on target display and set kiosk: true + const initialBounds = { + width: 400, + height: 300, + x: targetDisplay.workArea.x + 100, + y: targetDisplay.workArea.y + 100, + kiosk: true + }; + + await createAndSaveWindowState(initialBounds); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true + }); + + const enterFullScreen = once(w, 'enter-full-screen'); + if (!w.isFullScreen()) await enterFullScreen; + + expect(w.isFullScreen()).to.equal(true); + expect(w.isKiosk()).to.equal(true); + + // Check that kiosk window is on the correct display + const kioskBounds = w.getBounds(); + expect(kioskBounds.x).to.be.at.least(targetDisplay.bounds.x); + expect(kioskBounds.y).to.be.at.least(targetDisplay.bounds.y); + expect(kioskBounds.x + kioskBounds.width).to.be.at.most(targetDisplay.bounds.x + targetDisplay.bounds.width); + expect(kioskBounds.y + kioskBounds.height).to.be.at.most(targetDisplay.bounds.y + targetDisplay.bounds.height); + + w.destroy(); + virtualDisplay.destroy(targetDisplayId); + }); + + it('should maintain same bounds when target display resolution increases', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + // Create initial virtual display + const targetDisplayId = virtualDisplay.create({ + width: 1920, + height: 1080, + x: targetDisplayX, + y: targetDisplayY + }); + + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + + // Create a new virtual display with double the resolution of the target display + const higherResDisplayId = virtualDisplay.create({ + width: targetDisplay.bounds.width * 2, + height: targetDisplay.bounds.height * 2, + x: targetDisplayX + targetDisplay.bounds.width, + y: targetDisplayY + }); + + // Bounds for the test window on the virtual target display + const initialBounds = { + width: 400, + height: 300, + x: targetDisplay.workArea.x + 100, + y: targetDisplay.workArea.y + 100 + }; + + await createAndSaveWindowState(initialBounds); + + // Destroy the target display and wait for the higher resolution display to take its place + virtualDisplay.destroy(targetDisplayId); + while (screen.getAllDisplays().length > 2) await setTimeout(1000); + + // Restore window + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const restoredBounds = w.getBounds(); + + // Window should maintain same x, y, width, height as the display got bigger + expectBoundsEqual(restoredBounds, initialBounds); + + w.destroy(); + virtualDisplay.destroy(higherResDisplayId); + }); + + it('should reposition and resize window when target display resolution decreases', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + // Create initial virtual display with high resolution + const targetDisplayId = virtualDisplay.create({ + width: 2560, + height: 1440, + x: targetDisplayX, + y: targetDisplayY + }); + + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + + // Create a new virtual display with half the resolution of the target display shifted down + const lowerResDisplayId = virtualDisplay.create({ + width: targetDisplay.bounds.width / 2, + height: targetDisplay.bounds.height / 2, + x: targetDisplayX + targetDisplay.bounds.width, + y: targetDisplay.bounds.height / 2 + }); + + // Bounds that would overflow on a smaller display + const initialBounds = { + x: targetDisplay.workArea.x, + y: targetDisplay.workArea.y, + width: targetDisplay.bounds.width, + height: targetDisplay.bounds.height + }; + + await createAndSaveWindowState(initialBounds); + + // Destroy and and wait for the lower resolution display to take its place + virtualDisplay.destroy(targetDisplayId); + while (screen.getAllDisplays().length > 2) await setTimeout(1000); + + // We expect the display to be shifted down as we set y: targetDisplay.bounds.height / 2 earlier + const smallerDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplay.bounds.height / 2 }); + + // Restore window + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const restoredBounds = w.getBounds(); + + // Window should be repositioned to be entirely visible on smaller display + expect(restoredBounds.x).to.be.at.least(smallerDisplay.workArea.x); + expect(restoredBounds.y).to.be.at.least(smallerDisplay.workArea.y); + expect(restoredBounds.x + restoredBounds.width).to.be.at.most(smallerDisplay.workArea.x + smallerDisplay.workArea.width); + expect(restoredBounds.y + restoredBounds.height).to.be.at.most(smallerDisplay.workArea.y + smallerDisplay.workArea.height); + + w.destroy(); + virtualDisplay.destroy(lowerResDisplayId); + }); }); }); }); From c7e2fb05e3dbdfe4370a9d42c0ec2015d7ce51db Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Mon, 11 Aug 2025 23:12:01 -0400 Subject: [PATCH 038/268] docs: add note on display APIs in CI --- spec/lib/screen-helpers.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/lib/screen-helpers.ts b/spec/lib/screen-helpers.ts index 2358e5a35cd51..075bed2ef973e 100644 --- a/spec/lib/screen-helpers.ts +++ b/spec/lib/screen-helpers.ts @@ -208,6 +208,9 @@ export class ScreenCapture { * - Win32 arm64 (WOA): virtual screen display is 0x0 * - Win32 ia32: skipped * - Win32 x64: virtual screen display is 0x0 + * + * Note: Display APIs return valid dimensions (e.g. 1280x1024) in CI environments, + * but actual window creation fails, resulting in windows with 0x0 bounds. */ export const hasCapturableScreen = () => { return process.env.CI ? process.platform === 'darwin' : true; From 8f327e71b99aa9a1cdb6ba3212201c84af06fd3b Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Mon, 11 Aug 2025 23:28:36 -0400 Subject: [PATCH 039/268] fix: remove duplicate destroy registration --- spec/fixtures/native-addon/virtual-display/src/Dummy.swift | 1 - spec/fixtures/native-addon/virtual-display/src/addon.mm | 1 - 2 files changed, 2 deletions(-) diff --git a/spec/fixtures/native-addon/virtual-display/src/Dummy.swift b/spec/fixtures/native-addon/virtual-display/src/Dummy.swift index 75d1c096d039c..9695b1a0b433e 100644 --- a/spec/fixtures/native-addon/virtual-display/src/Dummy.swift +++ b/spec/fixtures/native-addon/virtual-display/src/Dummy.swift @@ -17,7 +17,6 @@ class DummyManager { print("[DummyManager.createDummy:\(#line)] Failed to create virtual display - not connected") return nil } - self.dummyCounter += 1 self.definedDummies[self.dummyCounter] = DefinedDummy(dummy: dummy) return self.dummyCounter diff --git a/spec/fixtures/native-addon/virtual-display/src/addon.mm b/spec/fixtures/native-addon/virtual-display/src/addon.mm index eda8cbe7e93ac..60285d1fd8332 100644 --- a/spec/fixtures/native-addon/virtual-display/src/addon.mm +++ b/spec/fixtures/native-addon/virtual-display/src/addon.mm @@ -182,7 +182,6 @@ napi_value Init(napi_env env, napi_value exports) { {"destroy", NULL, destroy, NULL, NULL, NULL, napi_default, NULL}, {"forceCleanup", NULL, forceCleanup, NULL, NULL, NULL, napi_default, NULL}}; - {"destroy", NULL, destroy, NULL, NULL, NULL, napi_default, NULL}}; if (napi_define_properties(env, exports, sizeof(descriptors) / sizeof(*descriptors), From 65345eeccb8d107ad36e873ded94636a45254a50 Mon Sep 17 00:00:00 2001 From: Nilay Arya <84241885+nilayarya@users.noreply.github.com> Date: Mon, 11 Aug 2025 23:30:25 -0400 Subject: [PATCH 040/268] feat: enforce unique window names across BaseWindow and BrowserWindow (#47764) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: enforce unique window names across BaseWindow and BrowserWindow * docs: update docs for name property * fix: linter issue with symbol --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> --- docs/api/structures/base-window-options.md | 2 +- shell/browser/api/electron_api_base_window.cc | 30 ++++++++++++++++ shell/browser/api/electron_api_base_window.h | 3 ++ .../api/electron_api_browser_window.cc | 7 ++++ shell/browser/native_window.cc | 6 +++- shell/browser/native_window.h | 4 ++- spec/api-browser-window-spec.ts | 36 ++++++++++++++++++- 7 files changed, 84 insertions(+), 4 deletions(-) diff --git a/docs/api/structures/base-window-options.md b/docs/api/structures/base-window-options.md index 5a2b73efb505d..78d4c1bd6cd60 100644 --- a/docs/api/structures/base-window-options.md +++ b/docs/api/structures/base-window-options.md @@ -42,7 +42,7 @@ Default is `false`. * `hiddenInMissionControl` boolean (optional) _macOS_ - Whether window should be hidden when the user toggles into mission control. * `kiosk` boolean (optional) - Whether the window is in kiosk mode. Default is `false`. -* `name` string (optional) - An identifier for the window that enables features such as state persistence. +* `name` string (optional) - A unique identifier for the window, used to enable features such as state persistence. Each window must have a distinct name. It can only be reused after the corresponding window has been destroyed. * `windowStatePersistence` ([WindowStatePersistence](window-state-persistence.md) | boolean) (optional) - Configures or enables the persistence of window state (position, size, maximized state, etc.) across application restarts. Has no effect if window `name` is not provided. _Experimental_ * `title` string (optional) - Default window title. Default is `"Electron"`. If the HTML tag `<title>` is defined in the HTML file loaded by `loadURL()`, this property will be ignored. * `icon` ([NativeImage](../native-image.md) | string) (optional) - The window icon. On Windows it is diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index 26ed781818a7a..69b060be35c2a 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -18,6 +18,7 @@ #include "shell/browser/api/electron_api_web_contents.h" #include "shell/browser/javascript_environment.h" #include "shell/browser/native_window.h" +#include "shell/browser/window_list.h" #include "shell/common/color_util.h" #include "shell/common/gin_converters/callback_converter.h" #include "shell/common/gin_converters/file_path_converter.h" @@ -1148,9 +1149,38 @@ gin_helper::WrappableBase* BaseWindow::New(gin_helper::Arguments* args) { auto options = gin_helper::Dictionary::CreateEmpty(args->isolate()); args->GetNext(&options); + std::string error_message; + if (!IsWindowNameValid(options, &error_message)) { + // Window name is already in use throw an error and do not create the window + args->ThrowError(error_message); + return nullptr; + } + return new BaseWindow(args, options); } +// static +bool BaseWindow::IsWindowNameValid(const gin_helper::Dictionary& options, + std::string* error_message) { + std::string window_name; + if (options.Get(options::kName, &window_name) && !window_name.empty()) { + // Check if window name is already in use by another window + // Window names must be unique for state persistence to work correctly + const auto& windows = electron::WindowList::GetWindows(); + bool name_in_use = std::any_of(windows.begin(), windows.end(), + [&window_name](const auto* const window) { + return window->GetName() == window_name; + }); + + if (name_in_use) { + *error_message = "Window name '" + window_name + + "' is already in use. Window names must be unique."; + return false; + } + } + return true; +} + // static void BaseWindow::BuildPrototype(v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> prototype) { diff --git a/shell/browser/api/electron_api_base_window.h b/shell/browser/api/electron_api_base_window.h index 53ddd8cee191f..7b256fb4e7834 100644 --- a/shell/browser/api/electron_api_base_window.h +++ b/shell/browser/api/electron_api_base_window.h @@ -42,6 +42,9 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>, static void BuildPrototype(v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> prototype); + static bool IsWindowNameValid(const gin_helper::Dictionary& options, + std::string* error_message); + const NativeWindow* window() const { return window_.get(); } NativeWindow* window() { return window_.get(); } diff --git a/shell/browser/api/electron_api_browser_window.cc b/shell/browser/api/electron_api_browser_window.cc index 943530e697e41..9c24d981fb04c 100644 --- a/shell/browser/api/electron_api_browser_window.cc +++ b/shell/browser/api/electron_api_browser_window.cc @@ -307,6 +307,13 @@ gin_helper::WrappableBase* BrowserWindow::New(gin_helper::ErrorThrower thrower, options = gin::Dictionary::CreateEmpty(args->isolate()); } + std::string error_message; + if (!IsWindowNameValid(options, &error_message)) { + // Window name is already in use throw an error and do not create the window + thrower.ThrowError(error_message); + return nullptr; + } + return new BrowserWindow(args, options); } diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 502a0086602a9..f3c564bdb69c4 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -790,10 +790,14 @@ void NativeWindow::SetAccessibleTitle(const std::string& title) { WidgetDelegate::SetAccessibleTitle(base::UTF8ToUTF16(title)); } -std::string NativeWindow::GetAccessibleTitle() { +std::string NativeWindow::GetAccessibleTitle() const { return base::UTF16ToUTF8(GetAccessibleWindowTitle()); } +std::string NativeWindow::GetName() const { + return window_name_; +} + void NativeWindow::HandlePendingFullscreenTransitions() { if (pending_transitions_.empty()) { set_fullscreen_transition_type(FullScreenTransitionType::kNone); diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index 01e6e5ef90907..8085ba9cd3cd8 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -171,9 +171,11 @@ class NativeWindow : public base::SupportsUserData, void SetTitle(std::string_view title); [[nodiscard]] std::string GetTitle() const; + [[nodiscard]] std::string GetName() const; + // Ability to augment the window title for the screen readers. void SetAccessibleTitle(const std::string& title); - std::string GetAccessibleTitle(); + [[nodiscard]] std::string GetAccessibleTitle() const; virtual void FlashFrame(bool flash) = 0; virtual void SetSkipTaskbar(bool skip) = 0; diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 757a9f2015889..096eb9ba67cb5 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, net, protocol, screen, webContents, webFrameMain, session, WebContents, WebFrameMain } from 'electron/main'; +import { app, BrowserWindow, BaseWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, net, protocol, screen, webContents, webFrameMain, session, WebContents, WebFrameMain } from 'electron/main'; import { expect } from 'chai'; @@ -57,6 +57,8 @@ describe('BrowserWindow module', () => { }); describe('BrowserWindow constructor', () => { + afterEach(closeAllWindows); + it('allows passing void 0 as the webContents', async () => { expect(() => { const w = new BrowserWindow({ @@ -83,6 +85,38 @@ describe('BrowserWindow module', () => { w.destroy(); }).not.to.throw(); }); + + it('throws error when creating windows with duplicate names', () => { + const w1 = new BrowserWindow({ show: false, name: 'duplicate-name' }); + + expect(() => { + // eslint-disable-next-line no-new + new BrowserWindow({ show: false, name: 'duplicate-name' }); + }).to.throw("Window name 'duplicate-name' is already in use. Window names must be unique."); + + w1.destroy(); + }); + + it('prevents BaseWindow and BrowserWindow from using same name', () => { + const base = new BaseWindow({ show: false, name: 'shared-name' }); + + expect(() => { + // eslint-disable-next-line no-new + new BrowserWindow({ show: false, name: 'shared-name' }); + }).to.throw("Window name 'shared-name' is already in use. Window names must be unique."); + + base.destroy(); + }); + + it('allows reusing name after window is destroyed', () => { + const w1 = new BrowserWindow({ show: false, name: 'reusable-name' }); + w1.destroy(); + + expect(() => { + const w2 = new BrowserWindow({ show: false, name: 'reusable-name' }); + w2.destroy(); + }).not.to.throw(); + }); }); describe('garbage collection', () => { From 1115ee7e1a8e980b76d7a846862980894f8033be Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Tue, 12 Aug 2025 16:17:21 -0400 Subject: [PATCH 041/268] docs: remove inaccurate comment --- spec/lib/screen-helpers.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/spec/lib/screen-helpers.ts b/spec/lib/screen-helpers.ts index 075bed2ef973e..2358e5a35cd51 100644 --- a/spec/lib/screen-helpers.ts +++ b/spec/lib/screen-helpers.ts @@ -208,9 +208,6 @@ export class ScreenCapture { * - Win32 arm64 (WOA): virtual screen display is 0x0 * - Win32 ia32: skipped * - Win32 x64: virtual screen display is 0x0 - * - * Note: Display APIs return valid dimensions (e.g. 1280x1024) in CI environments, - * but actual window creation fails, resulting in windows with 0x0 bounds. */ export const hasCapturableScreen = () => { return process.env.CI ? process.platform === 'darwin' : true; From 2e2ac23d3d7a332a0b99240261351cd69d42cf79 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 13 Aug 2025 00:16:38 -0400 Subject: [PATCH 042/268] fix: move expect blocks outside beforeEach --- spec/api-browser-window-spec.ts | 34 ++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 76363d805c013..d947f547087f5 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -8006,15 +8006,16 @@ describe('BrowserWindow module', () => { const virtualDisplay = require('@electron-ci/virtual-display'); const primaryDisplay = screen.getPrimaryDisplay(); - beforeEach(async () => { + beforeEach(() => { virtualDisplay.forceCleanup(); - // We expect only the primary display to be present before the tests start - expect(screen.getAllDisplays().length).to.equal(1); }); it('should restore window bounds correctly on a secondary display', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + // Create a new virtual target display to the right of the primary display const targetDisplayId = virtualDisplay.create({ width: 1920, @@ -8057,6 +8058,9 @@ describe('BrowserWindow module', () => { it('should restore window to a visible location when saved display no longer exists', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + // Create a new virtual target display to the right of the primary display const targetDisplayId = virtualDisplay.create({ width: 1920, @@ -8109,6 +8113,8 @@ describe('BrowserWindow module', () => { it('should fallback to nearest display when saved display no longer exists', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); // Create first virtual display to the right of primary const middleDisplayId = virtualDisplay.create({ @@ -8175,6 +8181,8 @@ describe('BrowserWindow module', () => { it('should restore multiple named windows independently across displays', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); // Create a first virtual display to the right of the primary display const targetDisplayId1 = virtualDisplay.create({ @@ -8225,6 +8233,11 @@ describe('BrowserWindow module', () => { y: targetDisplay2.workArea.y + 150 }; + // Clear window state for all three windows from previous tests + BrowserWindow.clearWindowState(window1Name); + BrowserWindow.clearWindowState(window2Name); + BrowserWindow.clearWindowState(window3Name); + // Create and save state for all three windows const w1 = new BrowserWindow({ name: window1Name, @@ -8283,6 +8296,9 @@ describe('BrowserWindow module', () => { it('should restore fullscreen state on correct display', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + // Create a new virtual target display to the right of the primary display const targetDisplayId = virtualDisplay.create({ width: 1920, @@ -8329,6 +8345,9 @@ describe('BrowserWindow module', () => { it('should restore maximized state on correct display', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + // Create a new virtual target display to the right of the primary display const targetDisplayId = virtualDisplay.create({ width: 1920, @@ -8381,6 +8400,9 @@ describe('BrowserWindow module', () => { it('should restore kiosk state on correct display', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + // Create a new virtual target display to the right of the primary display const targetDisplayId = virtualDisplay.create({ width: 1920, @@ -8427,6 +8449,9 @@ describe('BrowserWindow module', () => { it('should maintain same bounds when target display resolution increases', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + // Create initial virtual display const targetDisplayId = virtualDisplay.create({ width: 1920, @@ -8478,6 +8503,9 @@ describe('BrowserWindow module', () => { it('should reposition and resize window when target display resolution decreases', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + // Create initial virtual display with high resolution const targetDisplayId = virtualDisplay.create({ width: 2560, From e2ebd1c3243026b861bab0577680f772aec69f2a Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 13 Aug 2025 00:54:30 -0400 Subject: [PATCH 043/268] test: set show to true --- spec/fixtures/api/window-state-save/schema-check/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/fixtures/api/window-state-save/schema-check/index.js b/spec/fixtures/api/window-state-save/schema-check/index.js index cad32f1e82636..c0a3dbf8f8932 100644 --- a/spec/fixtures/api/window-state-save/schema-check/index.js +++ b/spec/fixtures/api/window-state-save/schema-check/index.js @@ -12,7 +12,7 @@ app.whenReady().then(() => { height: 300, name: 'test-window-state-schema', windowStatePersistence: true, - show: false + show: true }); w.close(); From 1208af425e1361ec8173f4536c86a70a595b238e Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 13 Aug 2025 20:52:53 -0400 Subject: [PATCH 044/268] test: exclude macOS-x64 for now --- spec/api-browser-window-spec.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index d947f547087f5..c9fad8db06128 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -8002,7 +8002,10 @@ describe('BrowserWindow module', () => { w.destroy(); }); }); - ifdescribe(process.platform === 'darwin')('multi-monitor tests', () => { + + // FIXME(nilayarya): Figure out why these tests fail on macOS-x64 + // virtualDisplay.create() is creating double displays on macOS-x64 + ifdescribe(process.platform === 'darwin' && process.arch === 'arm64')('multi-monitor tests', () => { const virtualDisplay = require('@electron-ci/virtual-display'); const primaryDisplay = screen.getPrimaryDisplay(); From aeb04993c2e4722ae1ade429ad24a82ba6518ab2 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 13 Aug 2025 21:04:18 -0400 Subject: [PATCH 045/268] test: remove invalid display test --- spec/api-browser-window-spec.ts | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index c7418728549a6..ad528f7151337 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -86,29 +86,6 @@ describe('BrowserWindow module', () => { }).not.to.throw(); }); - ifit(!hasCapturableScreen())('should not save window state when there is no valid display (fake display)', async () => { - const sharedUserDataPath = path.join(os.tmpdir(), 'electron-window-state-test'); - if (fs.existsSync(sharedUserDataPath)) { - fs.rmSync(sharedUserDataPath, { recursive: true, force: true }); - } - - const appPath = path.resolve(__dirname, 'fixtures', 'api', 'window-state-save', 'schema-check'); - const appProcess = childProcess.spawn(process.execPath, [appPath]); - const [code] = await once(appProcess, 'exit'); - expect(code).to.equal(0); - - const sharedPreferencesPath = path.join(sharedUserDataPath, 'Local State'); - - let savedState = null; - if (fs.existsSync(sharedPreferencesPath)) { - const prefsContent = fs.readFileSync(sharedPreferencesPath, 'utf8'); - const prefs = JSON.parse(prefsContent); - savedState = prefs?.windowStates?.['test-window-state-schema'] || null; - } - - expect(savedState).to.be.null('window state with window name "test-window-state-schema" should not exist'); - }); - it('throws error when creating windows with duplicate names', () => { const w1 = new BrowserWindow({ show: false, name: 'duplicate-name' }); From 598967f992ad06b2202024b5a956fbab1f84271d Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 13 Aug 2025 21:14:22 -0400 Subject: [PATCH 046/268] test: remove invalid display test --- spec/api-browser-window-spec.ts | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index c9fad8db06128..0e525cb06049e 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -86,23 +86,6 @@ describe('BrowserWindow module', () => { }).not.to.throw(); }); - ifit(!hasCapturableScreen())('should not save window state when there is no valid display (fake display)', async () => { - const appPath = path.resolve(__dirname, 'fixtures', 'api', 'window-state-save', 'schema-check'); - const appProcess = childProcess.spawn(process.execPath, [appPath]); - const [code] = await once(appProcess, 'exit'); - expect(code).to.equal(0); - - const sharedPreferencesPath = path.join(os.tmpdir(), 'electron-window-state-test', 'Local State'); - if (!fs.existsSync(sharedPreferencesPath)) { - throw new Error(`Preferences file does not exist at path: ${sharedPreferencesPath}. Window state was not saved to disk.`); - } - const prefsContent = fs.readFileSync(sharedPreferencesPath, 'utf8'); - const prefs = JSON.parse(prefsContent); - const savedState = prefs?.windowStates?.['test-window-state-schema'] || null; - - expect(savedState).to.be.null('window state with window name "test-window-state-schema" should not exist'); - }); - it('throws error when creating windows with duplicate names', () => { const w1 = new BrowserWindow({ show: false, name: 'duplicate-name' }); From 8784211c5d7ea9499495bf8b612b0132a6771a0d Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Thu, 14 Aug 2025 00:36:41 -0400 Subject: [PATCH 047/268] docs: restored-window-state event --- docs/api/base-window.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/api/base-window.md b/docs/api/base-window.md index 6cfe7f7c90734..a94e6ac9a59db 100644 --- a/docs/api/base-window.md +++ b/docs/api/base-window.md @@ -369,6 +369,15 @@ Calling `event.preventDefault()` will prevent the menu from being displayed. To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows-linux). +#### Event: 'restored-window-state' + +Emitted after the window state has been restored. + +Window state includes the window bounds (x, y, height, width) and display mode (maximized, fullscreen, kiosk). + +> [!NOTE] +> This event is only emitted when [windowStatePersistence](structures/window-state-persistence.md) is enabled in [BaseWindowConstructorOptions](structures/base-window-options.md) or in [BrowserWindowConstructorOptions](structures/browser-window-options.md). + ### Static Methods The `BaseWindow` class has the following static methods: From 2c78fb3dd0dc01d220a4ce91a4ebf6b1f69716c3 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Thu, 14 Aug 2025 00:40:16 -0400 Subject: [PATCH 048/268] feat: add 'restored-window-state' event to BaseWindow --- shell/browser/api/electron_api_base_window.cc | 4 ++++ shell/browser/api/electron_api_base_window.h | 1 + shell/browser/native_window.cc | 6 ++++++ shell/browser/native_window.h | 1 + shell/browser/native_window_observer.h | 2 ++ 5 files changed, 14 insertions(+) diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index 749ca3f662a1e..2e4d0aa308c21 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -351,6 +351,10 @@ void BaseWindow::OnSystemContextMenu(int x, int y, bool* prevent_default) { } } +void BaseWindow::OnWindowStateRestored() { + EmitEventSoon("restored-window-state"); +} + #if BUILDFLAG(IS_WIN) void BaseWindow::OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) { if (IsWindowMessageHooked(message)) { diff --git a/shell/browser/api/electron_api_base_window.h b/shell/browser/api/electron_api_base_window.h index 1c4b85e161750..e4e2d2dd6c43b 100644 --- a/shell/browser/api/electron_api_base_window.h +++ b/shell/browser/api/electron_api_base_window.h @@ -100,6 +100,7 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>, const base::Value::Dict& details) override; void OnNewWindowForTab() override; void OnSystemContextMenu(int x, int y, bool* prevent_default) override; + void OnWindowStateRestored() override; #if BUILDFLAG(IS_WIN) void OnWindowMessage(UINT message, WPARAM w_param, LPARAM l_param) override; #endif diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 0d0e47b39f619..c2a852418397d 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -712,6 +712,10 @@ void NativeWindow::NotifyLayoutWindowControlsOverlay() { *bounds); } +void NativeWindow::NotifyWindowStateRestored() { + observers_.Notify(&NativeWindowObserver::OnWindowStateRestored); +} + #if BUILDFLAG(IS_WIN) void NativeWindow::NotifyWindowMessage(UINT message, WPARAM w_param, @@ -1020,6 +1024,8 @@ void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { } is_being_restored_ = false; + + NotifyWindowStateRestored(); } void NativeWindow::FlushPendingDisplayMode() { diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index 8f75ce520aedb..a3a3339e50b86 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -348,6 +348,7 @@ class NativeWindow : public base::SupportsUserData, void NotifyNewWindowForTab(); void NotifyWindowSystemContextMenu(int x, int y, bool* prevent_default); void NotifyLayoutWindowControlsOverlay(); + void NotifyWindowStateRestored(); #if BUILDFLAG(IS_WIN) void NotifyWindowMessage(UINT message, WPARAM w_param, LPARAM l_param); diff --git a/shell/browser/native_window_observer.h b/shell/browser/native_window_observer.h index 1adf24d474043..84925dd04f32f 100644 --- a/shell/browser/native_window_observer.h +++ b/shell/browser/native_window_observer.h @@ -110,6 +110,8 @@ class NativeWindowObserver : public base::CheckedObserver { virtual void OnExecuteAppCommand(std::string_view command_name) {} virtual void UpdateWindowControlsOverlay(const gfx::Rect& bounding_rect) {} + + virtual void OnWindowStateRestored() {} }; } // namespace electron From e5bc395cd23de46260e858b78bfb46e5dfd01dc2 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Thu, 14 Aug 2025 00:40:51 -0400 Subject: [PATCH 049/268] test: add tests for 'restored-window-state' event emission --- spec/api-browser-window-spec.ts | 159 ++++++++++++++++++++------------ 1 file changed, 102 insertions(+), 57 deletions(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index c7418728549a6..d2f5a41c88780 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -86,29 +86,6 @@ describe('BrowserWindow module', () => { }).not.to.throw(); }); - ifit(!hasCapturableScreen())('should not save window state when there is no valid display (fake display)', async () => { - const sharedUserDataPath = path.join(os.tmpdir(), 'electron-window-state-test'); - if (fs.existsSync(sharedUserDataPath)) { - fs.rmSync(sharedUserDataPath, { recursive: true, force: true }); - } - - const appPath = path.resolve(__dirname, 'fixtures', 'api', 'window-state-save', 'schema-check'); - const appProcess = childProcess.spawn(process.execPath, [appPath]); - const [code] = await once(appProcess, 'exit'); - expect(code).to.equal(0); - - const sharedPreferencesPath = path.join(sharedUserDataPath, 'Local State'); - - let savedState = null; - if (fs.existsSync(sharedPreferencesPath)) { - const prefsContent = fs.readFileSync(sharedPreferencesPath, 'utf8'); - const prefs = JSON.parse(prefsContent); - savedState = prefs?.windowStates?.['test-window-state-schema'] || null; - } - - expect(savedState).to.be.null('window state with window name "test-window-state-schema" should not exist'); - }); - it('throws error when creating windows with duplicate names', () => { const w1 = new BrowserWindow({ show: false, name: 'duplicate-name' }); @@ -7171,6 +7148,27 @@ describe('BrowserWindow module', () => { } }; + const createAndSaveWindowState = async (preferencesPath: string, windowName: string, options?: BrowserWindowConstructorOptions) => { + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: { + displayMode: false + }, + show: false, + ...options + }); + if (!fs.existsSync(preferencesPath)) { + // File doesn't exist, wait for creation + await waitForPrefsFileCreation(preferencesPath); + } else { + // File exists, wait for update + const initialModTime = getPrefsModTime(preferencesPath); + await waitForPrefsUpdate(initialModTime, preferencesPath); + } + // Ensure window is destroyed because we can't create another window with the same name otherwise + w.destroy(); + }; + describe('save window state', () => { const fixturesPath = path.resolve(__dirname, 'fixtures', 'api', 'window-state-save'); const sharedUserDataPath = path.join(os.tmpdir(), 'electron-window-state-test'); @@ -7589,27 +7587,6 @@ describe('BrowserWindow module', () => { const preferencesPath = path.join(app.getPath('userData'), 'Local State'); const windowName = 'test-restore-window'; - const createAndSaveWindowState = async (options?: BrowserWindowConstructorOptions) => { - const w = new BrowserWindow({ - name: windowName, - windowStatePersistence: { - displayMode: false - }, - show: false, - ...options - }); - if (!fs.existsSync(preferencesPath)) { - // File doesn't exist, wait for creation - await waitForPrefsFileCreation(preferencesPath); - } else { - // File exists, wait for update - const initialModTime = getPrefsModTime(preferencesPath); - await waitForPrefsUpdate(initialModTime, preferencesPath); - } - // Ensure window is destroyed because we can't create another window with the same name otherwise - w.destroy(); - }; - beforeEach(async () => { // Timeout here plays nice with CI await setTimeout(2000); @@ -7626,7 +7603,7 @@ describe('BrowserWindow module', () => { it('should restore bounds when windowStatePersistence is true', async () => { const workArea = screen.getPrimaryDisplay().workArea; const bounds = { width: 100, height: 100, x: workArea.x, y: workArea.y }; - await createAndSaveWindowState(bounds); + await createAndSaveWindowState(preferencesPath, windowName, bounds); // Should override default constructor bounds const w = new BrowserWindow({ name: windowName, @@ -7661,7 +7638,7 @@ describe('BrowserWindow module', () => { }); it('should restore fullscreen state when windowStatePersistence is true', async () => { - await createAndSaveWindowState({ fullscreen: true }); + await createAndSaveWindowState(preferencesPath, windowName, { fullscreen: true }); await setTimeout(2000); const w = new BrowserWindow({ name: windowName, @@ -7677,7 +7654,7 @@ describe('BrowserWindow module', () => { }); it('should restore kiosk state when windowStatePersistence is true', async () => { - await createAndSaveWindowState({ kiosk: true }); + await createAndSaveWindowState(preferencesPath, windowName, { kiosk: true }); await setTimeout(2000); const w = new BrowserWindow({ name: windowName, @@ -7696,7 +7673,7 @@ describe('BrowserWindow module', () => { it('should restore maximized state when windowStatePersistence is true', async () => { const width = screen.getPrimaryDisplay().workArea.width; const height = screen.getPrimaryDisplay().workArea.height; - await createAndSaveWindowState({ width, height }); + await createAndSaveWindowState(preferencesPath, windowName, { width, height }); const w = new BrowserWindow({ name: windowName, @@ -7714,7 +7691,7 @@ describe('BrowserWindow module', () => { it('should not restore state when windowStatePersistence is false', async () => { const bounds = { width: 400, height: 300, x: 100, y: 150 }; - await createAndSaveWindowState(bounds); + await createAndSaveWindowState(preferencesPath, windowName, bounds); const defaultBounds = { width: 500, height: 400, x: 200, y: 250 }; const w = new BrowserWindow({ @@ -7763,7 +7740,7 @@ describe('BrowserWindow module', () => { }); it('should restore display modes when bounds is disabled', async () => { - await createAndSaveWindowState({ fullscreen: true }); + await createAndSaveWindowState(preferencesPath, windowName, { fullscreen: true }); await setTimeout(2000); const w = new BrowserWindow({ name: windowName, @@ -7780,7 +7757,7 @@ describe('BrowserWindow module', () => { }); it('should respect fullscreenable property', async () => { - await createAndSaveWindowState({ fullscreen: true }); + await createAndSaveWindowState(preferencesPath, windowName, { fullscreen: true }); const w = new BrowserWindow({ name: windowName, @@ -7798,7 +7775,7 @@ describe('BrowserWindow module', () => { }); it('should respect minWidth and minHeight properly', async () => { - await createAndSaveWindowState({ width: 200, height: 200 }); + await createAndSaveWindowState(preferencesPath, windowName, { width: 200, height: 200 }); const w = new BrowserWindow({ name: windowName, @@ -7814,7 +7791,7 @@ describe('BrowserWindow module', () => { }); it('should respect maxWidth and maxHeight properly', async () => { - await createAndSaveWindowState({ width: 800, height: 800 }); + await createAndSaveWindowState(preferencesPath, windowName, { width: 800, height: 800 }); const w = new BrowserWindow({ name: windowName, @@ -7897,7 +7874,7 @@ describe('BrowserWindow module', () => { y: workArea.y + workArea.height + 10 }; - await createAndSaveWindowState(offscreenBounds); + await createAndSaveWindowState(preferencesPath, windowName, offscreenBounds); const w = new BrowserWindow({ name: windowName, @@ -7927,7 +7904,7 @@ describe('BrowserWindow module', () => { y: workArea.y + workArea.height - 20 }; - await createAndSaveWindowState(overflowBounds); + await createAndSaveWindowState(preferencesPath, windowName, overflowBounds); const w = new BrowserWindow({ name: windowName, @@ -7956,7 +7933,7 @@ describe('BrowserWindow module', () => { y: workArea.y + workArea.height - 50 }; - await createAndSaveWindowState(overflowBounds); + await createAndSaveWindowState(preferencesPath, windowName, overflowBounds); const w = new BrowserWindow({ name: windowName, @@ -7983,7 +7960,7 @@ describe('BrowserWindow module', () => { }); it('should respect show:false when restoring display modes', async () => { - await createAndSaveWindowState({ fullscreen: true }); + await createAndSaveWindowState(preferencesPath, windowName, { fullscreen: true }); const w = new BrowserWindow({ name: windowName, @@ -8009,5 +7986,73 @@ describe('BrowserWindow module', () => { }); }); }); + describe('event emitters', () => { + const preferencesPath = path.join(app.getPath('userData'), 'Local State'); + const windowName = 'test-restore-window'; + + it('should emit restored-window-state when windowStatePersistence is enabled and state exists', async () => { + await createAndSaveWindowState(preferencesPath, windowName, { width: 300, height: 200 }); + + const restoredPromise = new Promise<void>((resolve) => { + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + w.once('restored-window-state', () => { + resolve(); + w.destroy(); + }); + }); + + await restoredPromise; + }); + + it('should not emit restored-window-state when windowStatePersistence is disabled', async () => { + await createAndSaveWindowState(preferencesPath, windowName, { width: 300, height: 200 }); + + let eventEmitted = false; + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: false, + show: false + }); + + w.on('restored-window-state', () => { + eventEmitted = true; + }); + + // Wait for the event to be emitted for 5 seconds + await setTimeout(5000); + + expect(eventEmitted).to.equal(false); + w.destroy(); + }); + + it('should not emit restored-window-state when no window state exists on disk', async () => { + // Clear any existing state to ensure no state exists + BrowserWindow.clearWindowState(windowName); + + let eventEmitted = false; + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + w.on('restored-window-state', () => { + eventEmitted = true; + }); + + // Wait for the event to be emitted for 5 seconds + await setTimeout(5000); + + expect(eventEmitted).to.equal(false); + w.destroy(); + }); + }); }); }); From 7e0de05f79697f60609a746cb0a4ecb66204d337 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Thu, 14 Aug 2025 01:15:31 -0400 Subject: [PATCH 050/268] fix: remove header created during merge --- shell/browser/native_window.h | 1 - 1 file changed, 1 deletion(-) diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index 251c6d66cbac0..a3a3339e50b86 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -29,7 +29,6 @@ class SkRegion; class DraggableRegionProvider; class PrefService; -class PrefService; namespace input { struct NativeWebKeyboardEvent; From 018336dd27027ed37ff897ac05bdff353a93e6ad Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Thu, 14 Aug 2025 01:41:38 -0400 Subject: [PATCH 051/268] test: move createWindowAndSave --- spec/api-browser-window-spec.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 57cda0ad8a10c..db5fd2184b5ba 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -8025,7 +8025,7 @@ describe('BrowserWindow module', () => { y: targetDisplay.workArea.y + 100 }; - await createAndSaveWindowState(boundsOnTargetDisplay); + await createAndSaveWindowState(preferencesPath, windowName, boundsOnTargetDisplay); // Restore the window state by creating a new window with the same name const w = new BrowserWindow({ @@ -8068,7 +8068,7 @@ describe('BrowserWindow module', () => { }; // Save window state on the virtual display - await createAndSaveWindowState(boundsOnTargetDisplay); + await createAndSaveWindowState(preferencesPath, windowName, boundsOnTargetDisplay); virtualDisplay.destroy(targetDisplayId); // Wait for the target virtual display to be destroyed @@ -8135,7 +8135,7 @@ describe('BrowserWindow module', () => { }; // Save window state on the rightmost display - await createAndSaveWindowState(boundsOnRightmostDisplay); + await createAndSaveWindowState(preferencesPath, windowName, boundsOnRightmostDisplay); // Destroy the rightmost display (where window was saved) virtualDisplay.destroy(rightmostDisplayId); @@ -8305,7 +8305,7 @@ describe('BrowserWindow module', () => { fullscreen: true }; - await createAndSaveWindowState(initialBounds); + await createAndSaveWindowState(preferencesPath, windowName, initialBounds); const w = new BrowserWindow({ name: windowName, @@ -8408,7 +8408,7 @@ describe('BrowserWindow module', () => { kiosk: true }; - await createAndSaveWindowState(initialBounds); + await createAndSaveWindowState(preferencesPath, windowName, initialBounds); const w = new BrowserWindow({ name: windowName, @@ -8464,7 +8464,7 @@ describe('BrowserWindow module', () => { y: targetDisplay.workArea.y + 100 }; - await createAndSaveWindowState(initialBounds); + await createAndSaveWindowState(preferencesPath, windowName, initialBounds); // Destroy the target display and wait for the higher resolution display to take its place virtualDisplay.destroy(targetDisplayId); @@ -8518,7 +8518,7 @@ describe('BrowserWindow module', () => { height: targetDisplay.bounds.height }; - await createAndSaveWindowState(initialBounds); + await createAndSaveWindowState(preferencesPath, windowName, initialBounds); // Destroy and and wait for the lower resolution display to take its place virtualDisplay.destroy(targetDisplayId); From f22b48eea92f0288e81e433d4c05bac23d5ffe67 Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Wed, 20 Aug 2025 16:17:35 -0400 Subject: [PATCH 052/268] docs: differentiate between name and title --- docs/api/structures/base-window-options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/structures/base-window-options.md b/docs/api/structures/base-window-options.md index b4ad98d2f6a37..f5cdf3e09e7ad 100644 --- a/docs/api/structures/base-window-options.md +++ b/docs/api/structures/base-window-options.md @@ -42,7 +42,7 @@ Default is `false`. * `hiddenInMissionControl` boolean (optional) _macOS_ - Whether window should be hidden when the user toggles into mission control. * `kiosk` boolean (optional) - Whether the window is in kiosk mode. Default is `false`. -* `name` string (optional) - A unique identifier for the window, used to enable features such as state persistence. Each window must have a distinct name. It can only be reused after the corresponding window has been destroyed. +* `name` string (optional) - A unique identifier for the window, used internally by Electron to enable features such as state persistence. Each window must have a distinct name. It can only be reused after the corresponding window has been destroyed. This is not the visible title shown to users on the title bar. * `windowStatePersistence` ([WindowStatePersistence](window-state-persistence.md) | boolean) (optional) - Configures or enables the persistence of window state (position, size, maximized state, etc.) across application restarts. Has no effect if window `name` is not provided. Automatically disabled when there is no available display. _Experimental_ * `title` string (optional) - Default window title. Default is `"Electron"`. If the HTML tag `<title>` is defined in the HTML file loaded by `loadURL()`, this property will be ignored. * `icon` ([NativeImage](../native-image.md) | string) (optional) - The window icon. On Windows it is From 96c28c3325fd3f6beb510f1fd48d78674725ff6d Mon Sep 17 00:00:00 2001 From: Nilay Arya <84241885+nilayarya@users.noreply.github.com> Date: Thu, 10 Jul 2025 21:36:36 +0530 Subject: [PATCH 053/268] feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> --- docs/api/structures/base-window-options.md | 4 +- .../structures/window-state-persistence.md | 4 + filenames.auto.gni | 1 + shell/browser/api/electron_api_base_window.cc | 4 +- shell/browser/browser_process_impl.cc | 5 +- shell/browser/native_window.cc | 95 ++++- shell/browser/native_window.h | 28 ++ shell/common/electron_constants.h | 17 + shell/common/options_switches.h | 13 + spec/api-browser-window-spec.ts | 340 ++++++++++++++++++ .../api/window-state-save/close-save/index.js | 27 ++ .../fullscreen-save/index.js | 28 ++ .../api/window-state-save/kiosk-save/index.js | 28 ++ .../window-state-save/maximize-save/index.js | 28 ++ .../window-state-save/minimize-save/index.js | 28 ++ .../api/window-state-save/move-save/index.js | 23 ++ .../window-state-save/resize-save/index.js | 23 ++ .../window-state-save/schema-check/index.js | 23 ++ .../work-area-primary/index.js | 41 +++ 19 files changed, 755 insertions(+), 5 deletions(-) create mode 100644 docs/api/structures/window-state-persistence.md create mode 100644 spec/fixtures/api/window-state-save/close-save/index.js create mode 100644 spec/fixtures/api/window-state-save/fullscreen-save/index.js create mode 100644 spec/fixtures/api/window-state-save/kiosk-save/index.js create mode 100644 spec/fixtures/api/window-state-save/maximize-save/index.js create mode 100644 spec/fixtures/api/window-state-save/minimize-save/index.js create mode 100644 spec/fixtures/api/window-state-save/move-save/index.js create mode 100644 spec/fixtures/api/window-state-save/resize-save/index.js create mode 100644 spec/fixtures/api/window-state-save/schema-check/index.js create mode 100644 spec/fixtures/api/window-state-save/work-area-primary/index.js diff --git a/docs/api/structures/base-window-options.md b/docs/api/structures/base-window-options.md index 375c6adc3b59b..5a2b73efb505d 100644 --- a/docs/api/structures/base-window-options.md +++ b/docs/api/structures/base-window-options.md @@ -42,6 +42,8 @@ Default is `false`. * `hiddenInMissionControl` boolean (optional) _macOS_ - Whether window should be hidden when the user toggles into mission control. * `kiosk` boolean (optional) - Whether the window is in kiosk mode. Default is `false`. +* `name` string (optional) - An identifier for the window that enables features such as state persistence. +* `windowStatePersistence` ([WindowStatePersistence](window-state-persistence.md) | boolean) (optional) - Configures or enables the persistence of window state (position, size, maximized state, etc.) across application restarts. Has no effect if window `name` is not provided. _Experimental_ * `title` string (optional) - Default window title. Default is `"Electron"`. If the HTML tag `<title>` is defined in the HTML file loaded by `loadURL()`, this property will be ignored. * `icon` ([NativeImage](../native-image.md) | string) (optional) - The window icon. On Windows it is recommended to use `ICO` icons to get best visual effects, you can also @@ -91,7 +93,7 @@ title bar and a full size content window, the traffic light buttons will display when being hovered over in the top left of the window. **Note:** This option is currently experimental. -* `titleBarOverlay` Object | Boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`. +* `titleBarOverlay` Object | boolean (optional) - When using a frameless window in conjunction with `win.setWindowButtonVisibility(true)` on macOS or using a `titleBarStyle` so that the standard window controls ("traffic lights" on macOS) are visible, this property enables the Window Controls Overlay [JavaScript APIs][overlay-javascript-apis] and [CSS Environment Variables][overlay-css-env-vars]. Specifying `true` will result in an overlay with default system colors. Default is `false`. * `color` String (optional) _Windows_ _Linux_ - The CSS color of the Window Controls Overlay when enabled. Default is the system color. * `symbolColor` String (optional) _Windows_ _Linux_ - The CSS color of the symbols on the Window Controls Overlay when enabled. Default is the system color. * `height` Integer (optional) - The height of the title bar and Window Controls Overlay in pixels. Default is system height. diff --git a/docs/api/structures/window-state-persistence.md b/docs/api/structures/window-state-persistence.md new file mode 100644 index 0000000000000..efb02bb56d09f --- /dev/null +++ b/docs/api/structures/window-state-persistence.md @@ -0,0 +1,4 @@ +# WindowStatePersistence Object + +* `bounds` boolean (optional) - Whether to persist window position and size across application restarts. Defaults to `true` if not specified. +* `displayMode` boolean (optional) - Whether to persist display modes (fullscreen, kiosk, maximized, etc.) across application restarts. Defaults to `true` if not specified. diff --git a/filenames.auto.gni b/filenames.auto.gni index 9491b55b149ae..5fb1e51106042 100644 --- a/filenames.auto.gni +++ b/filenames.auto.gni @@ -164,6 +164,7 @@ auto_filenames = { "docs/api/structures/web-source.md", "docs/api/structures/window-open-handler-response.md", "docs/api/structures/window-session-end-event.md", + "docs/api/structures/window-state-persistence.md", ] sandbox_bundle_deps = [ diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index a6ebfb156b98c..26ed781818a7a 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -178,7 +178,7 @@ void BaseWindow::OnWindowClosed() { // We can not call Destroy here because we need to call Emit first, but we // also do not want any method to be used, so just mark as destroyed here. MarkDestroyed(); - + window_->FlushWindowState(); Emit("closed"); RemoveFromParentChildWindows(); @@ -267,6 +267,7 @@ void BaseWindow::OnWindowWillResize(const gfx::Rect& new_bounds, } void BaseWindow::OnWindowResize() { + window_->DebouncedSaveWindowState(); Emit("resize"); } @@ -282,6 +283,7 @@ void BaseWindow::OnWindowWillMove(const gfx::Rect& new_bounds, } void BaseWindow::OnWindowMove() { + window_->DebouncedSaveWindowState(); Emit("move"); } diff --git a/shell/browser/browser_process_impl.cc b/shell/browser/browser_process_impl.cc index 7c6cc917ed9a8..013f317993758 100644 --- a/shell/browser/browser_process_impl.cc +++ b/shell/browser/browser_process_impl.cc @@ -38,6 +38,7 @@ #include "services/device/public/cpp/geolocation/geolocation_system_permission_manager.h" #include "services/network/public/cpp/network_switches.h" #include "shell/browser/net/resolve_proxy_helper.h" +#include "shell/common/electron_constants.h" #include "shell/common/electron_paths.h" #include "shell/common/thread_restrictions.h" @@ -106,12 +107,12 @@ void BrowserProcessImpl::PostEarlyInitialization() { OSCrypt::RegisterLocalPrefs(pref_registry.get()); #endif + pref_registry->RegisterDictionaryPref(electron::kWindowStates); + in_memory_pref_store_ = base::MakeRefCounted<ValueMapPrefStore>(); ApplyProxyModeFromCommandLine(in_memory_pref_store()); prefs_factory.set_command_line_prefs(in_memory_pref_store()); - // Only use a persistent prefs store when cookie encryption is enabled as that - // is the only key that needs it base::FilePath prefs_path; CHECK(base::PathService::Get(electron::DIR_SESSION_DATA, &prefs_path)); prefs_path = prefs_path.Append(FILE_PATH_LITERAL("Local State")); diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index f69be2feb6051..502a0086602a9 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -10,22 +10,30 @@ #include "base/containers/contains.h" #include "base/memory/ptr_util.h" +#include "base/memory/raw_ptr.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" +#include "components/prefs/pref_service.h" +#include "components/prefs/scoped_user_pref_update.h" #include "content/public/browser/web_contents_user_data.h" #include "include/core/SkColor.h" #include "shell/browser/background_throttling_source.h" #include "shell/browser/browser.h" +#include "shell/browser/browser_process_impl.h" #include "shell/browser/draggable_region_provider.h" +#include "shell/browser/electron_browser_main_parts.h" #include "shell/browser/native_window_features.h" #include "shell/browser/ui/drag_util.h" #include "shell/browser/window_list.h" #include "shell/common/color_util.h" +#include "shell/common/electron_constants.h" #include "shell/common/gin_helper/dictionary.h" #include "shell/common/gin_helper/persistent_dictionary.h" #include "shell/common/options_switches.h" #include "ui/base/hit_test.h" #include "ui/compositor/compositor.h" +#include "ui/display/display.h" +#include "ui/display/screen.h" #include "ui/views/widget/widget.h" #if !BUILDFLAG(IS_MAC) @@ -114,6 +122,29 @@ NativeWindow::NativeWindow(const gin_helper::Dictionary& options, options.Get(options::kVibrancyType, &vibrancy_); #endif + options.Get(options::kName, &window_name_); + + if (gin_helper::Dictionary persistence_options; + options.Get(options::kWindowStatePersistence, &persistence_options)) { + // Other options will be parsed here in the future. + window_state_persistence_enabled_ = true; + } else if (bool flag; options.Get(options::kWindowStatePersistence, &flag)) { + window_state_persistence_enabled_ = flag; + } + + // Initialize prefs_ to save/restore window bounds if we have a valid window + // name and window state persistence is enabled. + if (window_state_persistence_enabled_ && !window_name_.empty()) { + if (auto* browser_process = + electron::ElectronBrowserMainParts::Get()->browser_process()) { + DCHECK(browser_process); + prefs_ = browser_process->local_state(); + } + } else if (window_state_persistence_enabled_ && window_name_.empty()) { + LOG(WARNING) << "Window state persistence enabled but no window name " + "provided. Window state will not be persisted."; + } + if (gin_helper::Dictionary dict; options.Get(options::ktitleBarOverlay, &dict)) { titlebar_overlay_ = true; @@ -242,7 +273,9 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) { SetBackgroundColor(background_color); SetTitle(options.ValueOrDefault(options::kTitle, Browser::Get()->GetName())); - + // TODO(nilayarya): Save window state after restoration logic is implemented + // here. + SaveWindowState(); // Then show it. if (options.ValueOrDefault(options::kShow, true)) Show(); @@ -793,6 +826,66 @@ bool NativeWindow::IsTranslucent() const { return false; } +void NativeWindow::DebouncedSaveWindowState() { + save_window_state_timer_.Start( + FROM_HERE, base::Milliseconds(200), + base::BindOnce(&NativeWindow::SaveWindowState, base::Unretained(this))); +} + +void NativeWindow::SaveWindowState() { + if (!prefs_ || window_name_.empty()) + return; + + ScopedDictPrefUpdate update(prefs_, electron::kWindowStates); + const base::Value::Dict* existing_prefs = update->FindDict(window_name_); + + gfx::Rect bounds = GetBounds(); + // When the window is in a special display mode (fullscreen, kiosk, or + // maximized), save the previously stored window bounds instead of + // the current bounds. This ensures that when the window is restored, it can + // be restored to its original position and size if display mode is not + // preserved via windowStatePersistence. + if (!IsNormal() && existing_prefs) { + std::optional<int> left = existing_prefs->FindInt(electron::kLeft); + std::optional<int> top = existing_prefs->FindInt(electron::kTop); + std::optional<int> right = existing_prefs->FindInt(electron::kRight); + std::optional<int> bottom = existing_prefs->FindInt(electron::kBottom); + + if (left && top && right && bottom) { + bounds = gfx::Rect(*left, *top, *right - *left, *bottom - *top); + } + } + + base::Value::Dict window_preferences; + window_preferences.Set(electron::kLeft, bounds.x()); + window_preferences.Set(electron::kTop, bounds.y()); + window_preferences.Set(electron::kRight, bounds.right()); + window_preferences.Set(electron::kBottom, bounds.bottom()); + + window_preferences.Set(electron::kMaximized, IsMaximized()); + window_preferences.Set(electron::kFullscreen, IsFullscreen()); + window_preferences.Set(electron::kKiosk, IsKiosk()); + + const display::Screen* screen = display::Screen::GetScreen(); + const display::Display display = screen->GetDisplayMatching(bounds); + gfx::Rect work_area = display.work_area(); + + window_preferences.Set(electron::kWorkAreaLeft, work_area.x()); + window_preferences.Set(electron::kWorkAreaTop, work_area.y()); + window_preferences.Set(electron::kWorkAreaRight, work_area.right()); + window_preferences.Set(electron::kWorkAreaBottom, work_area.bottom()); + + update->Set(window_name_, std::move(window_preferences)); +} + +void NativeWindow::FlushWindowState() { + if (save_window_state_timer_.IsRunning()) { + save_window_state_timer_.FireNow(); + } else { + SaveWindowState(); + } +} + // static bool NativeWindow::PlatformHasClientFrame() { #if defined(USE_OZONE) diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index 2c25fa547ab78..01e6e5ef90907 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -18,6 +18,7 @@ #include "base/observer_list.h" #include "base/strings/cstring_view.h" #include "base/supports_user_data.h" +#include "base/timer/timer.h" #include "content/public/browser/desktop_media_id.h" #include "content/public/browser/web_contents_user_data.h" #include "extensions/browser/app_window/size_constraints.h" @@ -27,6 +28,7 @@ class SkRegion; class DraggableRegionProvider; +class PrefService; namespace input { struct NativeWebKeyboardEvent; @@ -433,6 +435,17 @@ class NativeWindow : public base::SupportsUserData, // throttling, then throttling in the `ui::Compositor` will be disabled. void UpdateBackgroundThrottlingState(); + // Saves current window state to the Local State JSON file in + // app.getPath('userData') via PrefService. + // This does NOT immediately write to disk - it updates the in-memory + // preference store and queues an asynchronous write operation. The actual + // disk write is batched and flushed later. + void SaveWindowState(); + void DebouncedSaveWindowState(); + // Flushes save_window_state_timer_ that was queued by + // DebouncedSaveWindowState. This does NOT flush the actual disk write. + void FlushWindowState(); + protected: friend class api::BrowserView; @@ -494,6 +507,10 @@ class NativeWindow : public base::SupportsUserData, static inline int32_t next_id_ = 0; const int32_t window_id_ = ++next_id_; + // Identifier for the window provided by the application. + // Used by Electron internally for features such as state persistence. + std::string window_name_; + // The "titleBarStyle" option. const TitleBarStyle title_bar_style_; @@ -552,6 +569,17 @@ class NativeWindow : public base::SupportsUserData, gfx::Rect overlay_rect_; + // The boolean parsing of the "windowStatePersistence" option + bool window_state_persistence_enabled_ = false; + + // PrefService is used to persist window bounds and state. + // Only populated when windowStatePersistence is enabled and window has a + // valid name. + raw_ptr<PrefService> prefs_ = nullptr; + + // Timer to debounce window state saving operations. + base::OneShotTimer save_window_state_timer_; + base::WeakPtrFactory<NativeWindow> weak_factory_{this}; }; diff --git a/shell/common/electron_constants.h b/shell/common/electron_constants.h index 2ddf98d25acf4..d8313e906a94d 100644 --- a/shell/common/electron_constants.h +++ b/shell/common/electron_constants.h @@ -21,6 +21,23 @@ inline constexpr std::string_view kDeviceVendorIdKey = "vendorId"; inline constexpr std::string_view kDeviceProductIdKey = "productId"; inline constexpr std::string_view kDeviceSerialNumberKey = "serialNumber"; +// Window state preference keys +inline constexpr std::string_view kLeft = "left"; +inline constexpr std::string_view kTop = "top"; +inline constexpr std::string_view kRight = "right"; +inline constexpr std::string_view kBottom = "bottom"; + +inline constexpr std::string_view kMaximized = "maximized"; +inline constexpr std::string_view kFullscreen = "fullscreen"; +inline constexpr std::string_view kKiosk = "kiosk"; + +inline constexpr std::string_view kWorkAreaLeft = "workAreaLeft"; +inline constexpr std::string_view kWorkAreaTop = "workAreaTop"; +inline constexpr std::string_view kWorkAreaRight = "workAreaRight"; +inline constexpr std::string_view kWorkAreaBottom = "workAreaBottom"; + +inline constexpr std::string_view kWindowStates = "windowStates"; + inline constexpr base::cstring_view kRunAsNode = "ELECTRON_RUN_AS_NODE"; // Per-profile UUID to distinguish global shortcut sessions for diff --git a/shell/common/options_switches.h b/shell/common/options_switches.h index b07313f033ec1..e6a7ca4ceb44b 100644 --- a/shell/common/options_switches.h +++ b/shell/common/options_switches.h @@ -107,6 +107,19 @@ inline constexpr std::string_view kFocusable = "focusable"; // The WebPreferences. inline constexpr std::string_view kWebPreferences = "webPreferences"; +// Window state persistence for BaseWindow +inline constexpr std::string_view kWindowStatePersistence = + "windowStatePersistence"; + +// Identifier for the window provided by the application +inline constexpr std::string_view kName = "name"; + +// Whether to save the window bounds +inline constexpr std::string_view kBounds = "bounds"; + +// Whether to save the window display mode +inline constexpr std::string_view kDisplayMode = "displayMode"; + // Add a vibrancy effect to the browser window inline constexpr std::string_view kVibrancyType = "vibrancy"; diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 58529ac1f8379..757a9f2015889 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -7070,4 +7070,344 @@ describe('BrowserWindow module', () => { expect(startPos).to.not.deep.equal(endPos); }); }); + + describe('windowStatePersistence', () => { + describe('save window state', () => { + const fixturesPath = path.resolve(__dirname, 'fixtures', 'api', 'window-state-save'); + const sharedUserDataPath = path.join(os.tmpdir(), 'electron-window-state-test'); + const sharedPreferencesPath = path.join(sharedUserDataPath, 'Local State'); + + const getWindowStateFromDisk = (windowName: string, preferencesPath: string) => { + if (!fs.existsSync(preferencesPath)) { + throw new Error(`Preferences file does not exist at path: ${preferencesPath}. Window state was not saved to disk.`); + } + const prefsContent = fs.readFileSync(preferencesPath, 'utf8'); + const prefs = JSON.parse(prefsContent); + return prefs?.windowStates?.[windowName] || null; + }; + + // Clean up before each test + beforeEach(() => { + if (fs.existsSync(sharedUserDataPath)) { + fs.rmSync(sharedUserDataPath, { recursive: true, force: true }); + } + }); + + describe('state saving after window operations', () => { + it('should save window state with required properties', async () => { + const appPath = path.join(fixturesPath, 'schema-check'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-window-state-schema', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-window-state-schema" does not exist'); + expect(savedState).to.have.property('left'); + expect(savedState).to.have.property('top'); + expect(savedState).to.have.property('right'); + expect(savedState).to.have.property('bottom'); + expect(savedState).to.have.property('maximized'); + expect(savedState).to.have.property('fullscreen'); + expect(savedState).to.have.property('kiosk'); + expect(savedState).to.have.property('workAreaLeft'); + expect(savedState).to.have.property('workAreaTop'); + expect(savedState).to.have.property('workAreaRight'); + expect(savedState).to.have.property('workAreaBottom'); + }); + + ifit(hasCapturableScreen())('should save window state after window is closed and app exit', async () => { + const appPath = path.join(fixturesPath, 'close-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-close-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-close-save" does not exist'); + expect(savedState.right - savedState.left).to.equal(400); + expect(savedState.bottom - savedState.top).to.equal(300); + expect(savedState.maximized).to.equal(false); + expect(savedState.fullscreen).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state after window is resized and app exit', async () => { + const appPath = path.join(fixturesPath, 'resize-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-resize-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-resize-save" does not exist'); + expect(savedState.right - savedState.left).to.equal(500); + expect(savedState.bottom - savedState.top).to.equal(400); + expect(savedState.maximized).to.equal(false); + expect(savedState.fullscreen).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state after window is moved and app exit', async () => { + const appPath = path.join(fixturesPath, 'move-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-move-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-move-save" does not exist'); + expect(savedState.left).to.equal(100); + expect(savedState.top).to.equal(150); + expect(savedState.maximized).to.equal(false); + expect(savedState.fullscreen).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state after window is fullscreened and app exit', async () => { + const appPath = path.join(fixturesPath, 'fullscreen-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-fullscreen-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-fullscreen-save" does not exist'); + expect(savedState.fullscreen).to.equal(true); + expect(savedState.maximized).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state after window is maximized and app exit', async () => { + const appPath = path.join(fixturesPath, 'maximize-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-maximize-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-maximize-save" does not exist'); + expect(savedState.maximized).to.equal(true); + expect(savedState.fullscreen).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state if in a minimized state and app exit', async () => { + const appPath = path.join(fixturesPath, 'minimize-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-minimize-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-minimize-save" does not exist'); + // Should save the bounds from before minimizing + expect(savedState.right - savedState.left).to.equal(400); + expect(savedState.bottom - savedState.top).to.equal(300); + expect(savedState.maximized).to.equal(false); + expect(savedState.fullscreen).to.equal(false); + expect(savedState.kiosk).to.equal(false); + }); + + ifit(hasCapturableScreen())('should save window state after window is kiosked and app exit', async () => { + const appPath = path.join(fixturesPath, 'kiosk-save'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-kiosk-save', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-kiosk-save" does not exist'); + expect(savedState.kiosk).to.equal(true); + expect(savedState.fullscreen).to.equal(true); + expect(savedState.maximized).to.equal(false); + }); + }); + + describe('work area tests', () => { + ifit(hasCapturableScreen())('should save valid work area bounds', async () => { + const appPath = path.join(fixturesPath, 'schema-check'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-window-state-schema', sharedPreferencesPath); + + expect(savedState).to.not.be.null('window state with window name "test-window-state-schema" does not exist'); + expect(savedState.workAreaLeft).to.be.a('number'); + expect(savedState.workAreaTop).to.be.a('number'); + expect(savedState.workAreaRight).to.be.a('number'); + expect(savedState.workAreaBottom).to.be.a('number'); + + expect(savedState.workAreaLeft).to.be.lessThan(savedState.workAreaRight); + expect(savedState.workAreaTop).to.be.lessThan(savedState.workAreaBottom); + }); + + ifit(hasCapturableScreen())('should save work area bounds that contain the window bounds on primary display', async () => { + // Fixture will center the window on the primary display + const appPath = path.join(fixturesPath, 'work-area-primary'); + const appProcess = childProcess.spawn(process.execPath, [appPath]); + const [code] = await once(appProcess, 'exit'); + expect(code).to.equal(0); + + const savedState = getWindowStateFromDisk('test-work-area-primary', sharedPreferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-work-area-primary" does not exist'); + + expect(savedState.left).to.be.greaterThanOrEqual(savedState.workAreaLeft); + expect(savedState.top).to.be.greaterThanOrEqual(savedState.workAreaTop); + expect(savedState.right).to.be.lessThanOrEqual(savedState.workAreaRight); + expect(savedState.bottom).to.be.lessThanOrEqual(savedState.workAreaBottom); + }); + }); + + describe('asynchronous batching behavior', () => { + let w: BrowserWindow; + const windowName = 'test-batching-behavior'; + const preferencesPath = path.join(app.getPath('userData'), 'Local State'); + + // Helper to get preferences file modification time + const getPrefsModTime = (): Date => { + try { + return fs.statSync(preferencesPath).mtime; + } catch { + throw new Error(`Test requires preferences file to exist at path: ${preferencesPath}.`); + } + }; + + // Helper to wait for file modification with 20 second default timeout + const waitForPrefsUpdate = async (initialModTime: Date, timeoutMs: number = 20000): Promise<void> => { + const startTime = Date.now(); + + while (true) { + const currentModTime = getPrefsModTime(); + + if (currentModTime > initialModTime) { + return; + } + + if (Date.now() - startTime > timeoutMs) { + throw new Error(`Window state was not flushed to disk within ${timeoutMs}ms`); + } + // Wait for 1 second before checking again + await setTimeout(1000); + } + }; + + const waitForPrefsFileCreation = async (preferencesPath: string) => { + while (!fs.existsSync(preferencesPath)) { + await setTimeout(1000); + } + }; + + beforeEach(async () => { + await setTimeout(2000); + w = new BrowserWindow({ + show: false, + width: 400, + height: 300, + name: windowName, + windowStatePersistence: true + }); + }); + + afterEach(closeAllWindows); + + it('should not immediately save window state to disk when window is moved/resized', async () => { + // Wait for preferences file to be created if its the first time we're running the test + await waitForPrefsFileCreation(preferencesPath); + + const initialModTime = getPrefsModTime(); + + const moved = once(w, 'move'); + w.setPosition(150, 200); + await moved; + // Wait for any potential save to occur from the move operation + await setTimeout(1000); + + const resized = once(w, 'resize'); + w.setSize(500, 400); + await resized; + // Wait for any potential save to occur from the resize operation + await setTimeout(1000); + + const afterMoveModTime = getPrefsModTime(); + + expect(afterMoveModTime.getTime()).to.equal(initialModTime.getTime()); + }); + + it('should eventually flush window state to disk after batching period', async () => { + // Wait for preferences file to be created if its the first time we're running the test + await waitForPrefsFileCreation(preferencesPath); + + const initialModTime = getPrefsModTime(); + + const resized = once(w, 'resize'); + w.setSize(500, 400); + await resized; + + await waitForPrefsUpdate(initialModTime); + + const savedState = getWindowStateFromDisk(windowName, preferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-batching-behavior" does not exist'); + expect(savedState.right - savedState.left).to.equal(500); + expect(savedState.bottom - savedState.top).to.equal(400); + }); + + it('should batch multiple window operations and save final state', async () => { + // Wait for preferences file to be created if its the first time we're running the test + await waitForPrefsFileCreation(preferencesPath); + + const initialModTime = getPrefsModTime(); + + const resize1 = once(w, 'resize'); + w.setSize(500, 400); + await resize1; + // Wait for any potential save to occur + await setTimeout(1000); + + const afterFirstResize = getPrefsModTime(); + + const resize2 = once(w, 'resize'); + w.setSize(600, 500); + await resize2; + // Wait for any potential save to occur + await setTimeout(1000); + + const afterSecondResize = getPrefsModTime(); + + const resize3 = once(w, 'resize'); + w.setSize(700, 600); + await resize3; + // Wait for any potential save to occur + await setTimeout(1000); + + const afterThirdResize = getPrefsModTime(); + + await waitForPrefsUpdate(initialModTime); + + const savedState = getWindowStateFromDisk(windowName, preferencesPath); + expect(savedState).to.not.be.null('window state with window name "test-batching-behavior" does not exist'); + + [afterFirstResize, afterSecondResize, afterThirdResize].forEach(time => { + expect(time.getTime()).to.equal(initialModTime.getTime()); + }); + + expect(savedState.right - savedState.left).to.equal(700); + expect(savedState.bottom - savedState.top).to.equal(600); + }); + + it('should not save window bounds when main thread is busy', async () => { + // Wait for preferences file to be created if its the first time we're running the test + await waitForPrefsFileCreation(preferencesPath); + + const initialModTime = getPrefsModTime(); + + const moved = once(w, 'move'); + w.setPosition(100, 100); + await moved; + + const startTime = Date.now(); + + // Keep main thread busy for 25 seconds + while (Date.now() - startTime < 25000); + + const finalModTime = getPrefsModTime(); + + expect(finalModTime.getTime()).to.equal(initialModTime.getTime()); + }); + }); + }); + }); }); diff --git a/spec/fixtures/api/window-state-save/close-save/index.js b/spec/fixtures/api/window-state-save/close-save/index.js new file mode 100644 index 0000000000000..6dcd5e935f1cf --- /dev/null +++ b/spec/fixtures/api/window-state-save/close-save/index.js @@ -0,0 +1,27 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-close-save', + windowStatePersistence: true, + show: false + }); + + w.on('close', () => { + app.quit(); + }); + + w.close(); + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); diff --git a/spec/fixtures/api/window-state-save/fullscreen-save/index.js b/spec/fixtures/api/window-state-save/fullscreen-save/index.js new file mode 100644 index 0000000000000..bd2f2cbabb659 --- /dev/null +++ b/spec/fixtures/api/window-state-save/fullscreen-save/index.js @@ -0,0 +1,28 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-fullscreen-save', + windowStatePersistence: true + }); + + w.on('enter-full-screen', () => { + setTimeout(() => { + app.quit(); + }, 1000); + }); + + w.setFullScreen(true); + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); diff --git a/spec/fixtures/api/window-state-save/kiosk-save/index.js b/spec/fixtures/api/window-state-save/kiosk-save/index.js new file mode 100644 index 0000000000000..29f3b5f1675b4 --- /dev/null +++ b/spec/fixtures/api/window-state-save/kiosk-save/index.js @@ -0,0 +1,28 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-kiosk-save', + windowStatePersistence: true + }); + + w.on('enter-full-screen', () => { + setTimeout(() => { + app.quit(); + }, 1000); + }); + + w.setKiosk(true); + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); diff --git a/spec/fixtures/api/window-state-save/maximize-save/index.js b/spec/fixtures/api/window-state-save/maximize-save/index.js new file mode 100644 index 0000000000000..3e0dcd8915f52 --- /dev/null +++ b/spec/fixtures/api/window-state-save/maximize-save/index.js @@ -0,0 +1,28 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-maximize-save', + windowStatePersistence: true + }); + + w.on('maximize', () => { + setTimeout(() => { + app.quit(); + }, 1000); + }); + + w.maximize(); + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); diff --git a/spec/fixtures/api/window-state-save/minimize-save/index.js b/spec/fixtures/api/window-state-save/minimize-save/index.js new file mode 100644 index 0000000000000..36c7018abb464 --- /dev/null +++ b/spec/fixtures/api/window-state-save/minimize-save/index.js @@ -0,0 +1,28 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-minimize-save', + windowStatePersistence: true + }); + + w.on('minimize', () => { + setTimeout(() => { + app.quit(); + }, 1000); + }); + + w.minimize(); + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); diff --git a/spec/fixtures/api/window-state-save/move-save/index.js b/spec/fixtures/api/window-state-save/move-save/index.js new file mode 100644 index 0000000000000..56fb079b32741 --- /dev/null +++ b/spec/fixtures/api/window-state-save/move-save/index.js @@ -0,0 +1,23 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-move-save', + windowStatePersistence: true, + show: false + }); + + w.setPosition(100, 150); + + setTimeout(() => { + app.quit(); + }, 1000); +}); diff --git a/spec/fixtures/api/window-state-save/resize-save/index.js b/spec/fixtures/api/window-state-save/resize-save/index.js new file mode 100644 index 0000000000000..a25d399f657e7 --- /dev/null +++ b/spec/fixtures/api/window-state-save/resize-save/index.js @@ -0,0 +1,23 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(async () => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-resize-save', + windowStatePersistence: true, + show: false + }); + + w.setSize(500, 400); + + setTimeout(() => { + app.quit(); + }, 1000); +}); diff --git a/spec/fixtures/api/window-state-save/schema-check/index.js b/spec/fixtures/api/window-state-save/schema-check/index.js new file mode 100644 index 0000000000000..cad32f1e82636 --- /dev/null +++ b/spec/fixtures/api/window-state-save/schema-check/index.js @@ -0,0 +1,23 @@ +const { app, BrowserWindow } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(() => { + const w = new BrowserWindow({ + width: 400, + height: 300, + name: 'test-window-state-schema', + windowStatePersistence: true, + show: false + }); + + w.close(); + + setTimeout(() => { + app.quit(); + }, 1000); +}); diff --git a/spec/fixtures/api/window-state-save/work-area-primary/index.js b/spec/fixtures/api/window-state-save/work-area-primary/index.js new file mode 100644 index 0000000000000..4f7b0f86b7a6f --- /dev/null +++ b/spec/fixtures/api/window-state-save/work-area-primary/index.js @@ -0,0 +1,41 @@ +const { app, BrowserWindow, screen } = require('electron'); + +const os = require('node:os'); +const path = require('node:path'); + +const sharedUserData = path.join(os.tmpdir(), 'electron-window-state-test'); +app.setPath('userData', sharedUserData); + +app.whenReady().then(async () => { + const primaryDisplay = screen.getPrimaryDisplay(); + const workArea = primaryDisplay.workArea; + + const maxWidth = Math.max(200, Math.floor(workArea.width * 0.8)); + const maxHeight = Math.max(150, Math.floor(workArea.height * 0.8)); + const windowWidth = Math.min(400, maxWidth); + const windowHeight = Math.min(300, maxHeight); + + const w = new BrowserWindow({ + width: windowWidth, + height: windowHeight, + name: 'test-work-area-primary', + windowStatePersistence: true + }); + + // Center the window on the primary display to prevent overflow + const centerX = workArea.x + Math.floor((workArea.width - windowWidth) / 2); + const centerY = workArea.y + Math.floor((workArea.height - windowHeight) / 2); + + w.setPosition(centerX, centerY); + + w.on('close', () => { + app.quit(); + }); + + w.close(); + + // Timeout of 10s to ensure app exits + setTimeout(() => { + app.quit(); + }, 10000); +}); From a6093b157552b31abc352a8534f729ffc79ac563 Mon Sep 17 00:00:00 2001 From: Nilay Arya <84241885+nilayarya@users.noreply.github.com> Date: Mon, 11 Aug 2025 03:43:16 -0400 Subject: [PATCH 054/268] test: support for multimonitor tests (#47911) * test: support for multimonitor tests * fix: update yarn.lock file * test: support any resolution for new displays * test: support display positioning * docs: multi-monitor tests * test: remove dummy test --- docs/development/multi-monitor-testing.md | 79 ++++++++ docs/development/testing.md | 8 + .../native-addon/virtual-display/binding.gyp | 90 +++++++++ .../include/VirtualDisplayBridge.h | 120 ++++++++++++ .../virtual-display/lib/virtual-display.js | 6 + .../native-addon/virtual-display/package.json | 20 ++ .../virtual-display/src/Dummy.swift | 151 +++++++++++++++ .../virtual-display/src/VirtualDisplay.swift | 54 ++++++ .../src/VirtualDisplayBridge.m | 14 ++ .../native-addon/virtual-display/src/addon.mm | 183 ++++++++++++++++++ spec/package.json | 1 + spec/yarn.lock | 13 +- 12 files changed, 738 insertions(+), 1 deletion(-) create mode 100644 docs/development/multi-monitor-testing.md create mode 100644 spec/fixtures/native-addon/virtual-display/binding.gyp create mode 100644 spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h create mode 100644 spec/fixtures/native-addon/virtual-display/lib/virtual-display.js create mode 100644 spec/fixtures/native-addon/virtual-display/package.json create mode 100644 spec/fixtures/native-addon/virtual-display/src/Dummy.swift create mode 100644 spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift create mode 100644 spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m create mode 100644 spec/fixtures/native-addon/virtual-display/src/addon.mm diff --git a/docs/development/multi-monitor-testing.md b/docs/development/multi-monitor-testing.md new file mode 100644 index 0000000000000..5a1d7e772b662 --- /dev/null +++ b/docs/development/multi-monitor-testing.md @@ -0,0 +1,79 @@ +# Multi-Monitor Testing + +The `virtualDisplay` addon leverages macOS CoreGraphics APIs to create virtual displays, allowing you to write and run multi-monitor tests without the need for physical monitors. + +## Methods + +#### `virtualDisplay.create([options])` + +Creates a virtual display and returns a display ID. + +```js @ts-nocheck +const virtualDisplay = require('@electron-ci/virtual-display') +// Default: 1920×1080 at origin (0, 0) +const displayId = virtualDisplay.create() +``` + +```js @ts-nocheck +const virtualDisplay = require('@electron-ci/virtual-display') +// Custom options (all parameters optional and have default values) +const displayId = virtualDisplay.create({ + width: 2560, // Display width in pixels + height: 1440, // Display height in pixels + x: 1920, // X position (top-left corner) + y: 0 // Y position (top-left corner) +}) +``` + +**Returns:** `number` - Unique display ID used to identify the display. Returns `0` on failure to create display. + +#### `virtualDisplay.destroy(displayId)` + +Removes the virtual display. + +```js @ts-nocheck +const success = virtualDisplay.destroy(displayId) +``` + +**Returns:** `boolean` - Success status + +## Display Constraints + +### Size Limits + +Virtual displays are constrained to 720×720 pixels minimum and 8192×8192 pixels maximum. Actual limits may vary depending on your Mac's graphics capabilities, so sizes outside this range (like 9000×6000) may fail on some systems. + +```js @ts-nocheck +// Safe sizes for testing +virtualDisplay.create({ width: 1920, height: 1080 }) // Full HD +virtualDisplay.create({ width: 3840, height: 2160 }) // 4K +``` + +### Positioning Behavior + +macOS maintains a contiguous desktop space by automatically adjusting display positions if there are any overlaps or gaps. In case of either, the placement of the new origin is as close as possible to the requested location, without overlapping or leaving a gap between displays. + +**Overlap:** + +```js @ts-nocheck +// Requested positions +const display1 = virtualDisplay.create({ x: 0, y: 0, width: 1920, height: 1080 }) +const display2 = virtualDisplay.create({ x: 500, y: 0, width: 1920, height: 1080 }) + +// macOS automatically repositions display2 to x: 1920 to prevent overlap +const actualBounds = screen.getAllDisplays().map(d => d.bounds) +// Result: [{ x: 0, y: 0, width: 1920, height: 1080 }, +// { x: 1920, y: 0, width: 1920, height: 1080 }] +``` + +**Gap:** + +```js @ts-nocheck +// Requested: gap between displays +const display1 = virtualDisplay.create({ width: 1920, height: 1080, x: 0, y: 0 }) +const display2 = virtualDisplay.create({ width: 1920, height: 1080, x: 2000, y: 0 }) +// macOS snaps display2 to x: 1920 (eliminates 80px gap) +``` + +> [!NOTE] +> Always verify actual positions with `screen.getAllDisplays()` after creation, as macOS may adjust coordinates from the set values. diff --git a/docs/development/testing.md b/docs/development/testing.md index cce8ea5eab463..2de3b2e2e8c27 100644 --- a/docs/development/testing.md +++ b/docs/development/testing.md @@ -95,3 +95,11 @@ To configure display scaling: 1. Push the Windows key and search for _Display settings_. 2. Under _Scale and layout_, make sure that the device is set to 100%. + +## Multi-Monitor Tests + +Some Electron APIs require testing across multiple displays, such as screen detection, window positioning, and display-related events. For contributors working on these features, the `virtualDisplay` native addon enables you to create and position virtual displays programmatically, making it possible to test multi-monitor scenarios without any physical hardware. + +For detailed information on using virtual displays in your tests, see [Multi-Monitor Testing](multi-monitor-testing.md). + +**Platform support:** macOS only diff --git a/spec/fixtures/native-addon/virtual-display/binding.gyp b/spec/fixtures/native-addon/virtual-display/binding.gyp new file mode 100644 index 0000000000000..f8ef0b280660f --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/binding.gyp @@ -0,0 +1,90 @@ +{ + "targets": [{ + "target_name": "virtual_display", + "conditions": [ + ['OS=="mac"', { + "sources": [ + "src/addon.mm", + "src/VirtualDisplayBridge.m" + ], + "include_dirs": [ + "<!@(node -p \"require('node-addon-api').include\")", + "include", + "build_swift" + ], + "dependencies": [ + "<!(node -p \"require('node-addon-api').gyp\")" + ], + "libraries": [ + "<(PRODUCT_DIR)/libVirtualDisplay.dylib" + ], + "defines": [ + "NODE_ADDON_API_CPP_EXCEPTIONS" + ], + "cflags!": [ "-fno-exceptions" ], + "cflags_cc!": [ "-fno-exceptions" ], + "xcode_settings": { + "GCC_ENABLE_CPP_EXCEPTIONS": "YES", + "CLANG_ENABLE_OBJC_ARC": "YES", + "CLANG_CXX_LIBRARY": "libc++", + "SWIFT_OBJC_BRIDGING_HEADER": "include/VirtualDisplayBridge.h", + "SWIFT_VERSION": "5.0", + "SWIFT_OBJC_INTERFACE_HEADER_NAME": "virtual_display-Swift.h", + "MACOSX_DEPLOYMENT_TARGET": "11.0", + "OTHER_CFLAGS": [ + "-ObjC++", + "-fobjc-arc" + ], + "OTHER_LDFLAGS": [ + "-lswiftCore", + "-lswiftFoundation", + "-lswiftObjectiveC", + "-lswiftDarwin", + "-lswiftDispatch", + "-L/usr/lib/swift", + "-Wl,-rpath,/usr/lib/swift", + "-Wl,-rpath,@loader_path" + ] + }, + "actions": [ + { + "action_name": "build_swift", + "inputs": [ + "src/VirtualDisplay.swift", + "src/Dummy.swift", + "include/VirtualDisplayBridge.h" + ], + "outputs": [ + "build_swift/libVirtualDisplay.dylib", + "build_swift/virtual_display-Swift.h" + ], + "action": [ + "swiftc", + "src/VirtualDisplay.swift", + "src/Dummy.swift", + "-import-objc-header", "include/VirtualDisplayBridge.h", + "-emit-objc-header-path", "./build_swift/virtual_display-Swift.h", + "-emit-library", "-o", "./build_swift/libVirtualDisplay.dylib", + "-emit-module", "-module-name", "virtual_display", + "-module-link-name", "VirtualDisplay" + ] + }, + { + "action_name": "copy_swift_lib", + "inputs": [ + "<(module_root_dir)/build_swift/libVirtualDisplay.dylib" + ], + "outputs": [ + "<(PRODUCT_DIR)/libVirtualDisplay.dylib" + ], + "action": [ + "sh", + "-c", + "cp -f <(module_root_dir)/build_swift/libVirtualDisplay.dylib <(PRODUCT_DIR)/libVirtualDisplay.dylib && install_name_tool -id @rpath/libVirtualDisplay.dylib <(PRODUCT_DIR)/libVirtualDisplay.dylib" + ] + } + ] + }] + ] + }] +} \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h b/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h new file mode 100644 index 0000000000000..6ac5cbacb8f9a --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h @@ -0,0 +1,120 @@ +#ifndef VirtualDisplayBridge_h +#define VirtualDisplayBridge_h + +#import <CoreGraphics/CoreGraphics.h> +#import <Foundation/Foundation.h> + +@interface VirtualDisplayBridge : NSObject + ++ (NSInteger)create:(int)width height:(int)height x:(int)x y:(int)y; ++ (BOOL)destroy:(NSInteger)displayId; + +@end + +@interface CGVirtualDisplay : NSObject { + unsigned int _vendorID; + unsigned int _productID; + unsigned int _serialNum; + NSString* _name; + struct CGSize _sizeInMillimeters; + unsigned int _maxPixelsWide; + unsigned int _maxPixelsHigh; + struct CGPoint _redPrimary; + struct CGPoint _greenPrimary; + struct CGPoint _bluePrimary; + struct CGPoint _whitePoint; + id _queue; + id _terminationHandler; + void* _client; + unsigned int _displayID; + unsigned int _hiDPI; + NSArray* _modes; + unsigned int _serverRPC_port; + unsigned int _proxyRPC_port; + unsigned int _clientHandler_port; +} + +@property(readonly, nonatomic) NSArray* modes; +@property(readonly, nonatomic) unsigned int hiDPI; +@property(readonly, nonatomic) unsigned int displayID; +@property(readonly, nonatomic) id terminationHandler; +@property(readonly, nonatomic) id queue; +@property(readonly, nonatomic) struct CGPoint whitePoint; +@property(readonly, nonatomic) struct CGPoint bluePrimary; +@property(readonly, nonatomic) struct CGPoint greenPrimary; +@property(readonly, nonatomic) struct CGPoint redPrimary; +@property(readonly, nonatomic) unsigned int maxPixelsHigh; +@property(readonly, nonatomic) unsigned int maxPixelsWide; +@property(readonly, nonatomic) struct CGSize sizeInMillimeters; +@property(readonly, nonatomic) NSString* name; +@property(readonly, nonatomic) unsigned int serialNum; +@property(readonly, nonatomic) unsigned int productID; +@property(readonly, nonatomic) unsigned int vendorID; +- (BOOL)applySettings:(id)arg1; +- (void)dealloc; +- (id)initWithDescriptor:(id)arg1; + +@end + +@interface CGVirtualDisplayDescriptor : NSObject { + unsigned int _vendorID; + unsigned int _productID; + unsigned int _serialNum; + NSString* _name; + struct CGSize _sizeInMillimeters; + unsigned int _maxPixelsWide; + unsigned int _maxPixelsHigh; + struct CGPoint _redPrimary; + struct CGPoint _greenPrimary; + struct CGPoint _bluePrimary; + struct CGPoint _whitePoint; + id _queue; + id _terminationHandler; +} + +@property(retain, nonatomic) id queue; +@property(retain, nonatomic) NSString* name; +@property(nonatomic) struct CGPoint whitePoint; +@property(nonatomic) struct CGPoint bluePrimary; +@property(nonatomic) struct CGPoint greenPrimary; +@property(nonatomic) struct CGPoint redPrimary; +@property(nonatomic) unsigned int maxPixelsHigh; +@property(nonatomic) unsigned int maxPixelsWide; +@property(nonatomic) struct CGSize sizeInMillimeters; +@property(nonatomic) unsigned int serialNum; +@property(nonatomic) unsigned int productID; +@property(nonatomic) unsigned int vendorID; +- (void)dealloc; +- (id)init; +@property(copy, nonatomic) id terminationHandler; + +@end + +@interface CGVirtualDisplayMode : NSObject { + unsigned int _width; + unsigned int _height; + double _refreshRate; +} + +@property(readonly, nonatomic) double refreshRate; +@property(readonly, nonatomic) unsigned int height; +@property(readonly, nonatomic) unsigned int width; +- (id)initWithWidth:(unsigned int)arg1 + height:(unsigned int)arg2 + refreshRate:(double)arg3; + +@end + +@interface CGVirtualDisplaySettings : NSObject { + NSArray* _modes; + unsigned int _hiDPI; +} + +@property(nonatomic) unsigned int hiDPI; +- (void)dealloc; +- (id)init; +@property(retain, nonatomic) NSArray* modes; + +@end + +#endif \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js b/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js new file mode 100644 index 0000000000000..f43c420599df0 --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js @@ -0,0 +1,6 @@ +module.exports = process.platform === 'darwin' + ? require('../build/Release/virtual_display.node') + : { + create: () => { throw new Error('Virtual displays only supported on macOS'); }, + destroy: () => { throw new Error('Virtual displays only supported on macOS'); } + }; diff --git a/spec/fixtures/native-addon/virtual-display/package.json b/spec/fixtures/native-addon/virtual-display/package.json new file mode 100644 index 0000000000000..16fd059920b2c --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/package.json @@ -0,0 +1,20 @@ +{ + "name": "@electron-ci/virtual-display", + "version": "1.0.0", + "description": "Virtual display for multi-monitor testing", + "main": "./lib/virtual-display.js", + "scripts": { + "clean": "rm -rf build", + "build-electron": "electron-rebuild", + "build": "node-gyp configure && node-gyp build" + }, + "license": "MIT", + "dependencies": { + "bindings": "^1.5.0", + "node-addon-api": "^8.3.0" + }, + "devDependencies": { + "@types/jest": "^30.0.0", + "node-gyp": "^11.1.0" + } +} diff --git a/spec/fixtures/native-addon/virtual-display/src/Dummy.swift b/spec/fixtures/native-addon/virtual-display/src/Dummy.swift new file mode 100644 index 0000000000000..ef0195f3039fe --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/src/Dummy.swift @@ -0,0 +1,151 @@ +import Foundation +import Cocoa +import os.log + +class DummyManager { + struct DefinedDummy { + var dummy: Dummy + } + + static var definedDummies: [Int: DefinedDummy] = [:] + static var dummyCounter: Int = 0 + + static func createDummy(_ dummyDefinition: DummyDefinition, isPortrait _: Bool = false, serialNum: UInt32 = 0, doConnect: Bool = true) -> Int? { + let dummy = Dummy(dummyDefinition: dummyDefinition, serialNum: serialNum, doConnect: doConnect) + self.dummyCounter += 1 + self.definedDummies[self.dummyCounter] = DefinedDummy(dummy: dummy) + return self.dummyCounter + } + + static func discardDummyByNumber(_ number: Int) { + if let definedDummy = self.definedDummies[number] { + if definedDummy.dummy.isConnected { + definedDummy.dummy.disconnect() + } + } + self.definedDummies[number] = nil + } +} + +struct DummyDefinition { + let aspectWidth, aspectHeight, multiplierStep, minMultiplier, maxMultiplier: Int + let refreshRates: [Double] + let description: String + let addSeparatorAfter: Bool + + init(_ aspectWidth: Int, _ aspectHeight: Int, _ step: Int, _ refreshRates: [Double], _ description: String, _ addSeparatorAfter: Bool = false) { + let minX: Int = 720 + let minY: Int = 720 + let maxX: Int = 8192 + let maxY: Int = 8192 + let minMultiplier = max(Int(ceil(Float(minX) / (Float(aspectWidth) * Float(step)))), Int(ceil(Float(minY) / (Float(aspectHeight) * Float(step))))) + let maxMultiplier = min(Int(floor(Float(maxX) / (Float(aspectWidth) * Float(step)))), Int(floor(Float(maxY) / (Float(aspectHeight) * Float(step))))) + + self.aspectWidth = aspectWidth + self.aspectHeight = aspectHeight + self.minMultiplier = minMultiplier + self.maxMultiplier = maxMultiplier + self.multiplierStep = step + self.refreshRates = refreshRates + self.description = description + self.addSeparatorAfter = addSeparatorAfter + } +} + +class Dummy: Equatable { + var virtualDisplay: CGVirtualDisplay? + var dummyDefinition: DummyDefinition + let serialNum: UInt32 + var isConnected: Bool = false + var displayIdentifier: CGDirectDisplayID = 0 + + static func == (lhs: Dummy, rhs: Dummy) -> Bool { + lhs.serialNum == rhs.serialNum + } + + init(dummyDefinition: DummyDefinition, serialNum: UInt32 = 0, doConnect: Bool = true) { + var storedSerialNum: UInt32 = serialNum + if storedSerialNum == 0 { + storedSerialNum = UInt32.random(in: 0 ... UInt32.max) + } + self.dummyDefinition = dummyDefinition + self.serialNum = storedSerialNum + if doConnect { + _ = self.connect() + } + } + + func getName() -> String { + "Dummy \(self.dummyDefinition.description.components(separatedBy: " ").first ?? self.dummyDefinition.description)" + } + + func connect() -> Bool { + if self.virtualDisplay != nil || self.isConnected { + self.disconnect() + } + let name: String = self.getName() + if let virtualDisplay = Dummy.createVirtualDisplay(self.dummyDefinition, name: name, serialNum: self.serialNum) { + self.virtualDisplay = virtualDisplay + self.displayIdentifier = virtualDisplay.displayID + self.isConnected = true + os_log("Display %{public}@ successfully connected", type: .info, "\(name)") + return true + } else { + os_log("Failed to connect display %{public}@", type: .info, "\(name)") + return false + } + } + + func disconnect() { + self.virtualDisplay = nil + self.isConnected = false + os_log("Disconnected virtual display: %{public}@", type: .info, "\(self.getName())") + } + + private static func waitForDisplayRegistration(_ displayId: CGDirectDisplayID) -> Bool { + for _ in 0..<20 { + var count: UInt32 = 0, displays = [CGDirectDisplayID](repeating: 0, count: 32) + if CGGetActiveDisplayList(32, &displays, &count) == .success && displays[0..<Int(count)].contains(displayId) { + return true + } + usleep(100000) + } + return false + } + + static func createVirtualDisplay(_ definition: DummyDefinition, name: String, serialNum: UInt32, hiDPI: Bool = false) -> CGVirtualDisplay? { + if let descriptor = CGVirtualDisplayDescriptor() { + descriptor.queue = DispatchQueue.global(qos: .userInteractive) + descriptor.name = name + descriptor.whitePoint = CGPoint(x: 0.950, y: 1.000) + descriptor.redPrimary = CGPoint(x: 0.454, y: 0.242) + descriptor.greenPrimary = CGPoint(x: 0.353, y: 0.674) + descriptor.bluePrimary = CGPoint(x: 0.157, y: 0.084) + descriptor.maxPixelsWide = UInt32(definition.aspectWidth * definition.multiplierStep * definition.maxMultiplier) + descriptor.maxPixelsHigh = UInt32(definition.aspectHeight * definition.multiplierStep * definition.maxMultiplier) + let diagonalSizeRatio: Double = (24 * 25.4) / sqrt(Double(definition.aspectWidth * definition.aspectWidth + definition.aspectHeight * definition.aspectHeight)) + descriptor.sizeInMillimeters = CGSize(width: Double(definition.aspectWidth) * diagonalSizeRatio, height: Double(definition.aspectHeight) * diagonalSizeRatio) + descriptor.serialNum = serialNum + descriptor.productID = UInt32(min(definition.aspectWidth - 1, 255) * 256 + min(definition.aspectHeight - 1, 255)) + descriptor.vendorID = UInt32(0xF0F0) + if let display = CGVirtualDisplay(descriptor: descriptor) { + var modes = [CGVirtualDisplayMode?](repeating: nil, count: definition.maxMultiplier - definition.minMultiplier + 1) + for multiplier in definition.minMultiplier ... definition.maxMultiplier { + for refreshRate in definition.refreshRates { + let width = UInt32(definition.aspectWidth * multiplier * definition.multiplierStep) + let height = UInt32(definition.aspectHeight * multiplier * definition.multiplierStep) + modes[multiplier - definition.minMultiplier] = CGVirtualDisplayMode(width: width, height: height, refreshRate: refreshRate)! + } + } + if let settings = CGVirtualDisplaySettings() { + settings.hiDPI = hiDPI ? 1 : 0 + settings.modes = modes as [Any] + if display.applySettings(settings) { + return waitForDisplayRegistration(display.displayID) ? display : nil + } + } + } + } + return nil + } +} \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift new file mode 100644 index 0000000000000..1c4e57952cf89 --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift @@ -0,0 +1,54 @@ +import Foundation +import Cocoa +import os.log + +@objc public class VirtualDisplay: NSObject { + @objc public static func create(width: Int, height: Int, x: Int, y: Int) -> Int { + let refreshRates: [Double] = [60.0] // Always 60Hz default + let description = "\(width)x\(height) Display" + let definition = DummyDefinition(width, height, 1, refreshRates, description, false) + let displayId = DummyManager.createDummy(definition) ?? 0 + positionDisplay(displayId: displayId, x: x, y: y) + + return displayId + } + + @objc public static func destroy(id: Int) -> Bool { + DummyManager.discardDummyByNumber(id) + return true + } + + private static func positionDisplay(displayId: Int, x: Int, y: Int) { + guard let definedDummy = DummyManager.definedDummies[displayId], + definedDummy.dummy.isConnected else { + os_log("VirtualDisplay: Cannot position display %{public}@: display not found or not connected", type: .error, "\(displayId)") + return + } + + let cgDisplayId = definedDummy.dummy.displayIdentifier + + var config: CGDisplayConfigRef? = nil + let beginResult = CGBeginDisplayConfiguration(&config) + + if beginResult != .success { + os_log("VirtualDisplay: Cannot position display, failed to begin display configuration via CGBeginDisplayConfiguration: error %{public}@", type: .error, "\(beginResult.rawValue)") + return + } + + let configResult = CGConfigureDisplayOrigin(config, cgDisplayId, Int32(x), Int32(y)) + + if configResult != .success { + os_log("VirtualDisplay: Cannot position display, failed to configure display origin via CGConfigureDisplayOrigin: error %{public}@", type: .error, "\(configResult.rawValue)") + CGCancelDisplayConfiguration(config) + return + } + + let completeResult = CGCompleteDisplayConfiguration(config, .permanently) + + if completeResult == .success { + os_log("VirtualDisplay: Successfully positioned display %{public}@ at (%{public}@, %{public}@)", type: .info, "\(displayId)", "\(x)", "\(y)") + } else { + os_log("VirtualDisplay: Cannot position display, failed to complete display configuration via CGCompleteDisplayConfiguration: error %{public}@", type: .error, "\(completeResult.rawValue)") + } + } +} \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m new file mode 100644 index 0000000000000..b18ccbe97757d --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m @@ -0,0 +1,14 @@ +#import "VirtualDisplayBridge.h" +#import "../build_swift/virtual_display-Swift.h" + +@implementation VirtualDisplayBridge + ++ (NSInteger)create:(int)width height:(int)height x:(int)x y:(int)y { + return [VirtualDisplay createWithWidth:width height:height x:x y:y]; +} + ++ (BOOL)destroy:(NSInteger)displayId { + return [VirtualDisplay destroyWithId:(int)displayId]; +} + +@end \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/src/addon.mm b/spec/fixtures/native-addon/virtual-display/src/addon.mm new file mode 100644 index 0000000000000..e15d59a532e8e --- /dev/null +++ b/spec/fixtures/native-addon/virtual-display/src/addon.mm @@ -0,0 +1,183 @@ +#include <js_native_api.h> +#include <node_api.h> +#include "VirtualDisplayBridge.h" + +namespace { + +typedef struct { + const char* name; + int default_val; + int* ptr; +} PropertySpec; + +// Helper function to get an integer property from an object +bool GetIntProperty(napi_env env, + napi_value object, + const char* prop_name, + int* result, + int default_value) { + *result = default_value; + + bool has_prop; + if (napi_has_named_property(env, object, prop_name, &has_prop) != napi_ok || + !has_prop) { + return true; + } + + napi_value prop_value; + if (napi_get_named_property(env, object, prop_name, &prop_value) != napi_ok) { + return false; + } + + if (napi_get_value_int32(env, prop_value, result) != napi_ok) { + return false; + } + + return true; +} + +// Helper function to validate and parse object properties +bool ParseObjectProperties(napi_env env, + napi_value object, + PropertySpec props[], + size_t prop_count) { + // Process all properties + for (size_t i = 0; i < prop_count; i++) { + if (!GetIntProperty(env, object, props[i].name, props[i].ptr, + props[i].default_val)) { + char error_msg[50]; + snprintf(error_msg, sizeof(error_msg), "%s must be a number", + props[i].name); + napi_throw_error(env, NULL, error_msg); + return false; + } + } + + // Check for unknown properties + napi_value prop_names; + uint32_t count; + napi_get_property_names(env, object, &prop_names); + napi_get_array_length(env, prop_names, &count); + + for (uint32_t i = 0; i < count; i++) { + napi_value prop_name; + napi_get_element(env, prop_names, i, &prop_name); + size_t len; + char name[20]; + napi_get_value_string_utf8(env, prop_name, name, sizeof(name), &len); + + bool found = false; + for (size_t j = 0; j < prop_count; j++) { + if (strcmp(name, props[j].name) == 0) { + found = true; + break; + } + } + if (!found) { + napi_throw_error(env, NULL, "Object contains unknown properties"); + return false; + } + } + + return true; +} + +// virtualDisplay.create() +napi_value create(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + + if (napi_get_cb_info(env, info, &argc, args, NULL, NULL) != napi_ok) { + return NULL; + } + + int width = 1920, height = 1080, x = 0, y = 0; + + PropertySpec props[] = {{"width", 1920, &width}, + {"height", 1080, &height}, + {"x", 0, &x}, + {"y", 0, &y}}; + + if (argc >= 1) { + napi_valuetype valuetype; + if (napi_typeof(env, args[0], &valuetype) != napi_ok) { + napi_throw_error(env, NULL, "Failed to get argument type"); + return NULL; + } + + if (valuetype == napi_object) { + if (!ParseObjectProperties(env, args[0], props, + sizeof(props) / sizeof(props[0]))) { + return NULL; + } + } else { + napi_throw_error(env, NULL, "Expected an object as the argument"); + return NULL; + } + } + + NSInteger displayId = [VirtualDisplayBridge create:width + height:height + x:x + y:y]; + + if (displayId == 0) { + napi_throw_error(env, NULL, "Failed to create virtual display"); + return NULL; + } + + napi_value result; + if (napi_create_int64(env, displayId, &result) != napi_ok) { + return NULL; + } + + return result; +} + +// virtualDisplay.destroy() +napi_value destroy(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + + if (napi_get_cb_info(env, info, &argc, args, NULL, NULL) != napi_ok) { + return NULL; + } + + if (argc < 1) { + napi_throw_error(env, NULL, "Expected number argument"); + return NULL; + } + + int64_t displayId; + if (napi_get_value_int64(env, args[0], &displayId) != napi_ok) { + napi_throw_error(env, NULL, "Expected number argument"); + return NULL; + } + + BOOL result = [VirtualDisplayBridge destroy:(NSInteger)displayId]; + + napi_value js_result; + if (napi_get_boolean(env, result, &js_result) != napi_ok) { + return NULL; + } + + return js_result; +} + +napi_value Init(napi_env env, napi_value exports) { + napi_property_descriptor descriptors[] = { + {"create", NULL, create, NULL, NULL, NULL, napi_default, NULL}, + {"destroy", NULL, destroy, NULL, NULL, NULL, napi_default, NULL}}; + + if (napi_define_properties(env, exports, + sizeof(descriptors) / sizeof(*descriptors), + descriptors) != napi_ok) { + return NULL; + } + + return exports; +} + +} // namespace + +NAPI_MODULE(NODE_GYP_MODULE_NAME, Init) \ No newline at end of file diff --git a/spec/package.json b/spec/package.json index 797b4d8bc5e46..4bc6ace3937f2 100644 --- a/spec/package.json +++ b/spec/package.json @@ -24,6 +24,7 @@ "@electron-ci/uv-dlopen": "file:./fixtures/native-addon/uv-dlopen/", "@electron-ci/osr-gpu": "file:./fixtures/native-addon/osr-gpu/", "@electron-ci/external-ab": "file:./fixtures/native-addon/external-ab/", + "@electron-ci/virtual-display": "file:./fixtures/native-addon/virtual-display/", "@electron/fuses": "^1.8.0", "@electron/packager": "^18.3.2", "@types/sinon": "^9.0.4", diff --git a/spec/yarn.lock b/spec/yarn.lock index b37a017d30807..2ab549ff5162b 100644 --- a/spec/yarn.lock +++ b/spec/yarn.lock @@ -19,6 +19,12 @@ "@electron-ci/uv-dlopen@file:./fixtures/native-addon/uv-dlopen": version "0.0.1" +"@electron-ci/virtual-display@file:./fixtures/native-addon/virtual-display": + version "1.0.0" + dependencies: + bindings "^1.5.0" + node-addon-api "^8.3.0" + "@electron/asar@^3.2.1", "@electron/asar@^3.2.7": version "3.2.10" resolved "https://registry.yarnpkg.com/@electron/asar/-/asar-3.2.10.tgz#615cf346b734b23cafa4e0603551010bd0e50aa8" @@ -517,7 +523,7 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== -bindings@^1.2.1: +bindings@^1.2.1, bindings@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== @@ -1892,6 +1898,11 @@ node-addon-api@8.0.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-8.0.0.tgz#5453b7ad59dd040d12e0f1a97a6fa1c765c5c9d2" integrity sha512-ipO7rsHEBqa9STO5C5T10fj732ml+5kLN1cAG8/jdHd56ldQeGj3Q7+scUS+VHK/qy1zLEwC4wMK5+yM0btPvw== +node-addon-api@^8.3.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-8.5.0.tgz#c91b2d7682fa457d2e1c388150f0dff9aafb8f3f" + integrity sha512-/bRZty2mXUIFY/xU5HLvveNHlswNJej+RnxBjOMkidWfwZzgTbPG1E3K5TOxRLOR+5hX7bSofy8yf1hZevMS8A== + node-fetch@^2.6.7: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" From aaf813a0f6455daf405384ee0f461d971f5d1e5e Mon Sep 17 00:00:00 2001 From: Nilay Arya <84241885+nilayarya@users.noreply.github.com> Date: Mon, 11 Aug 2025 23:30:25 -0400 Subject: [PATCH 055/268] feat: enforce unique window names across BaseWindow and BrowserWindow (#47764) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: enforce unique window names across BaseWindow and BrowserWindow * docs: update docs for name property * fix: linter issue with symbol --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> --- docs/api/structures/base-window-options.md | 2 +- shell/browser/api/electron_api_base_window.cc | 30 ++++++++++++++++ shell/browser/api/electron_api_base_window.h | 3 ++ .../api/electron_api_browser_window.cc | 7 ++++ shell/browser/native_window.cc | 6 +++- shell/browser/native_window.h | 4 ++- spec/api-browser-window-spec.ts | 36 ++++++++++++++++++- 7 files changed, 84 insertions(+), 4 deletions(-) diff --git a/docs/api/structures/base-window-options.md b/docs/api/structures/base-window-options.md index 5a2b73efb505d..78d4c1bd6cd60 100644 --- a/docs/api/structures/base-window-options.md +++ b/docs/api/structures/base-window-options.md @@ -42,7 +42,7 @@ Default is `false`. * `hiddenInMissionControl` boolean (optional) _macOS_ - Whether window should be hidden when the user toggles into mission control. * `kiosk` boolean (optional) - Whether the window is in kiosk mode. Default is `false`. -* `name` string (optional) - An identifier for the window that enables features such as state persistence. +* `name` string (optional) - A unique identifier for the window, used to enable features such as state persistence. Each window must have a distinct name. It can only be reused after the corresponding window has been destroyed. * `windowStatePersistence` ([WindowStatePersistence](window-state-persistence.md) | boolean) (optional) - Configures or enables the persistence of window state (position, size, maximized state, etc.) across application restarts. Has no effect if window `name` is not provided. _Experimental_ * `title` string (optional) - Default window title. Default is `"Electron"`. If the HTML tag `<title>` is defined in the HTML file loaded by `loadURL()`, this property will be ignored. * `icon` ([NativeImage](../native-image.md) | string) (optional) - The window icon. On Windows it is diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index 26ed781818a7a..69b060be35c2a 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -18,6 +18,7 @@ #include "shell/browser/api/electron_api_web_contents.h" #include "shell/browser/javascript_environment.h" #include "shell/browser/native_window.h" +#include "shell/browser/window_list.h" #include "shell/common/color_util.h" #include "shell/common/gin_converters/callback_converter.h" #include "shell/common/gin_converters/file_path_converter.h" @@ -1148,9 +1149,38 @@ gin_helper::WrappableBase* BaseWindow::New(gin_helper::Arguments* args) { auto options = gin_helper::Dictionary::CreateEmpty(args->isolate()); args->GetNext(&options); + std::string error_message; + if (!IsWindowNameValid(options, &error_message)) { + // Window name is already in use throw an error and do not create the window + args->ThrowError(error_message); + return nullptr; + } + return new BaseWindow(args, options); } +// static +bool BaseWindow::IsWindowNameValid(const gin_helper::Dictionary& options, + std::string* error_message) { + std::string window_name; + if (options.Get(options::kName, &window_name) && !window_name.empty()) { + // Check if window name is already in use by another window + // Window names must be unique for state persistence to work correctly + const auto& windows = electron::WindowList::GetWindows(); + bool name_in_use = std::any_of(windows.begin(), windows.end(), + [&window_name](const auto* const window) { + return window->GetName() == window_name; + }); + + if (name_in_use) { + *error_message = "Window name '" + window_name + + "' is already in use. Window names must be unique."; + return false; + } + } + return true; +} + // static void BaseWindow::BuildPrototype(v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> prototype) { diff --git a/shell/browser/api/electron_api_base_window.h b/shell/browser/api/electron_api_base_window.h index 53ddd8cee191f..7b256fb4e7834 100644 --- a/shell/browser/api/electron_api_base_window.h +++ b/shell/browser/api/electron_api_base_window.h @@ -42,6 +42,9 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>, static void BuildPrototype(v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> prototype); + static bool IsWindowNameValid(const gin_helper::Dictionary& options, + std::string* error_message); + const NativeWindow* window() const { return window_.get(); } NativeWindow* window() { return window_.get(); } diff --git a/shell/browser/api/electron_api_browser_window.cc b/shell/browser/api/electron_api_browser_window.cc index 943530e697e41..9c24d981fb04c 100644 --- a/shell/browser/api/electron_api_browser_window.cc +++ b/shell/browser/api/electron_api_browser_window.cc @@ -307,6 +307,13 @@ gin_helper::WrappableBase* BrowserWindow::New(gin_helper::ErrorThrower thrower, options = gin::Dictionary::CreateEmpty(args->isolate()); } + std::string error_message; + if (!IsWindowNameValid(options, &error_message)) { + // Window name is already in use throw an error and do not create the window + thrower.ThrowError(error_message); + return nullptr; + } + return new BrowserWindow(args, options); } diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 502a0086602a9..f3c564bdb69c4 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -790,10 +790,14 @@ void NativeWindow::SetAccessibleTitle(const std::string& title) { WidgetDelegate::SetAccessibleTitle(base::UTF8ToUTF16(title)); } -std::string NativeWindow::GetAccessibleTitle() { +std::string NativeWindow::GetAccessibleTitle() const { return base::UTF16ToUTF8(GetAccessibleWindowTitle()); } +std::string NativeWindow::GetName() const { + return window_name_; +} + void NativeWindow::HandlePendingFullscreenTransitions() { if (pending_transitions_.empty()) { set_fullscreen_transition_type(FullScreenTransitionType::kNone); diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index 01e6e5ef90907..8085ba9cd3cd8 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -171,9 +171,11 @@ class NativeWindow : public base::SupportsUserData, void SetTitle(std::string_view title); [[nodiscard]] std::string GetTitle() const; + [[nodiscard]] std::string GetName() const; + // Ability to augment the window title for the screen readers. void SetAccessibleTitle(const std::string& title); - std::string GetAccessibleTitle(); + [[nodiscard]] std::string GetAccessibleTitle() const; virtual void FlashFrame(bool flash) = 0; virtual void SetSkipTaskbar(bool skip) = 0; diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 757a9f2015889..096eb9ba67cb5 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, net, protocol, screen, webContents, webFrameMain, session, WebContents, WebFrameMain } from 'electron/main'; +import { app, BrowserWindow, BaseWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, net, protocol, screen, webContents, webFrameMain, session, WebContents, WebFrameMain } from 'electron/main'; import { expect } from 'chai'; @@ -57,6 +57,8 @@ describe('BrowserWindow module', () => { }); describe('BrowserWindow constructor', () => { + afterEach(closeAllWindows); + it('allows passing void 0 as the webContents', async () => { expect(() => { const w = new BrowserWindow({ @@ -83,6 +85,38 @@ describe('BrowserWindow module', () => { w.destroy(); }).not.to.throw(); }); + + it('throws error when creating windows with duplicate names', () => { + const w1 = new BrowserWindow({ show: false, name: 'duplicate-name' }); + + expect(() => { + // eslint-disable-next-line no-new + new BrowserWindow({ show: false, name: 'duplicate-name' }); + }).to.throw("Window name 'duplicate-name' is already in use. Window names must be unique."); + + w1.destroy(); + }); + + it('prevents BaseWindow and BrowserWindow from using same name', () => { + const base = new BaseWindow({ show: false, name: 'shared-name' }); + + expect(() => { + // eslint-disable-next-line no-new + new BrowserWindow({ show: false, name: 'shared-name' }); + }).to.throw("Window name 'shared-name' is already in use. Window names must be unique."); + + base.destroy(); + }); + + it('allows reusing name after window is destroyed', () => { + const w1 = new BrowserWindow({ show: false, name: 'reusable-name' }); + w1.destroy(); + + expect(() => { + const w2 = new BrowserWindow({ show: false, name: 'reusable-name' }); + w2.destroy(); + }).not.to.throw(); + }); }); describe('garbage collection', () => { From 04d450500460a67d94c41d1890d4b9b9813ffd0c Mon Sep 17 00:00:00 2001 From: Nilay Arya <84241885+nilayarya@users.noreply.github.com> Date: Wed, 20 Aug 2025 12:03:30 -0400 Subject: [PATCH 056/268] feat: clear and restore window state (#47781) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: restore window state * feat: flush display modes on show * refactor: move utility functions to common area * feat: clear window state * fix: wait for the prefs to update * test: clearWindowState extra test * test: refine clear window state tests * test: single monitor restore window tests chore: rebase on gsoc-2025 * refactor: refine clearWindowState test * fix: revert default_app back to original * docs: add comment linking AdjustBoundsToBeVisibleOnDisplay to Chromium code * fix: add correct permalink * refactor: ci friendly * fix: disable windowStatePersistence when no display * refactor: use reference instead pointer * fix: skip window state persistence for invalid/fake displays * refactor: better flag placement * test: add test to verify window state is not saved when no display * fix: restore display mode inside show() * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * test: clear sharedUserPath before and test * refactor: hasInvalidDisplay function * debug: add display info logging for CI * fix: do not save/restore when window is 0x0 * test: support for multimonitor tests (#47911) * test: support for multimonitor tests * fix: update yarn.lock file * test: support any resolution for new displays * test: support display positioning * docs: multi-monitor tests * test: remove dummy test * feat: enforce unique window names across BaseWindow and BrowserWindow (#47764) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: enforce unique window names across BaseWindow and BrowserWindow * docs: update docs for name property * fix: linter issue with symbol --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * test: remove invalid display test --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> --- docs/api/base-window.md | 8 + docs/api/structures/base-window-options.md | 2 +- lib/browser/api/browser-window.ts | 2 + shell/browser/api/electron_api_base_window.cc | 26 + shell/browser/api/electron_api_base_window.h | 4 + shell/browser/native_window.cc | 211 +++++- shell/browser/native_window.h | 26 + shell/browser/native_window_mac.mm | 2 + shell/browser/native_window_views.cc | 2 + spec/api-browser-window-spec.ts | 673 ++++++++++++++++-- 10 files changed, 881 insertions(+), 75 deletions(-) diff --git a/docs/api/base-window.md b/docs/api/base-window.md index a4520c1c57482..6cfe7f7c90734 100644 --- a/docs/api/base-window.md +++ b/docs/api/base-window.md @@ -387,6 +387,14 @@ Returns `BaseWindow | null` - The window that is focused in this application, ot Returns `BaseWindow | null` - The window with the given `id`. +#### `BaseWindow.clearWindowState(windowName)` + +* `windowName` string - The window `name` to clear state for (see [BaseWindowConstructorOptions](structures/base-window-options.md)). + +Clears the saved state for a window with the given name. This removes all persisted window bounds, display mode, and work area information that was previously saved when `windowStatePersistence` was enabled. + +If the window name is empty or the window state doesn't exist, the method will log a warning. + ### Instance Properties Objects created with `new BaseWindow` have the following properties: diff --git a/docs/api/structures/base-window-options.md b/docs/api/structures/base-window-options.md index 78d4c1bd6cd60..b4ad98d2f6a37 100644 --- a/docs/api/structures/base-window-options.md +++ b/docs/api/structures/base-window-options.md @@ -43,7 +43,7 @@ * `hiddenInMissionControl` boolean (optional) _macOS_ - Whether window should be hidden when the user toggles into mission control. * `kiosk` boolean (optional) - Whether the window is in kiosk mode. Default is `false`. * `name` string (optional) - A unique identifier for the window, used to enable features such as state persistence. Each window must have a distinct name. It can only be reused after the corresponding window has been destroyed. -* `windowStatePersistence` ([WindowStatePersistence](window-state-persistence.md) | boolean) (optional) - Configures or enables the persistence of window state (position, size, maximized state, etc.) across application restarts. Has no effect if window `name` is not provided. _Experimental_ +* `windowStatePersistence` ([WindowStatePersistence](window-state-persistence.md) | boolean) (optional) - Configures or enables the persistence of window state (position, size, maximized state, etc.) across application restarts. Has no effect if window `name` is not provided. Automatically disabled when there is no available display. _Experimental_ * `title` string (optional) - Default window title. Default is `"Electron"`. If the HTML tag `<title>` is defined in the HTML file loaded by `loadURL()`, this property will be ignored. * `icon` ([NativeImage](../native-image.md) | string) (optional) - The window icon. On Windows it is recommended to use `ICO` icons to get best visual effects, you can also diff --git a/lib/browser/api/browser-window.ts b/lib/browser/api/browser-window.ts index 909b442c3d27c..0b9b7c7abe512 100644 --- a/lib/browser/api/browser-window.ts +++ b/lib/browser/api/browser-window.ts @@ -111,6 +111,8 @@ BrowserWindow.getAllWindows = () => { return BaseWindow.getAllWindows().filter(isBrowserWindow) as any[] as BWT[]; }; +BrowserWindow.clearWindowState = BaseWindow.clearWindowState; + BrowserWindow.getFocusedWindow = () => { for (const window of BrowserWindow.getAllWindows()) { if (!window.isDestroyed() && window.webContents && !window.webContents.isDestroyed()) { diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index 69b060be35c2a..749ca3f662a1e 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -10,16 +10,20 @@ #include <vector> #include "base/task/single_thread_task_runner.h" +#include "components/prefs/scoped_user_pref_update.h" #include "content/public/common/color_parser.h" #include "electron/buildflags/buildflags.h" #include "gin/dictionary.h" #include "shell/browser/api/electron_api_menu.h" #include "shell/browser/api/electron_api_view.h" #include "shell/browser/api/electron_api_web_contents.h" +#include "shell/browser/browser_process_impl.h" +#include "shell/browser/electron_browser_main_parts.h" #include "shell/browser/javascript_environment.h" #include "shell/browser/native_window.h" #include "shell/browser/window_list.h" #include "shell/common/color_util.h" +#include "shell/common/electron_constants.h" #include "shell/common/gin_converters/callback_converter.h" #include "shell/common/gin_converters/file_path_converter.h" #include "shell/common/gin_converters/gfx_converter.h" @@ -1144,6 +1148,27 @@ void BaseWindow::RemoveFromParentChildWindows() { parent->child_windows_.Remove(weak_map_id()); } +// static +void BaseWindow::ClearWindowState(const std::string& window_name) { + if (window_name.empty()) { + LOG(WARNING) << "Cannot clear window state: window name is empty"; + return; + } + + if (auto* browser_process = + electron::ElectronBrowserMainParts::Get()->browser_process()) { + DCHECK(browser_process); + if (auto* prefs = browser_process->local_state()) { + ScopedDictPrefUpdate update(prefs, electron::kWindowStates); + + if (!update->Remove(window_name)) { + LOG(WARNING) << "Window state '" << window_name + << "' not found, nothing to clear"; + } + } + } +} + // static gin_helper::WrappableBase* BaseWindow::New(gin_helper::Arguments* args) { auto options = gin_helper::Dictionary::CreateEmpty(args->isolate()); @@ -1372,6 +1397,7 @@ void Initialize(v8::Local<v8::Object> exports, .ToLocalChecked()); constructor.SetMethod("fromId", &BaseWindow::FromWeakMapID); constructor.SetMethod("getAllWindows", &BaseWindow::GetAll); + constructor.SetMethod("clearWindowState", &BaseWindow::ClearWindowState); gin_helper::Dictionary dict(isolate, exports); dict.Set("BaseWindow", constructor); diff --git a/shell/browser/api/electron_api_base_window.h b/shell/browser/api/electron_api_base_window.h index 7b256fb4e7834..1c4b85e161750 100644 --- a/shell/browser/api/electron_api_base_window.h +++ b/shell/browser/api/electron_api_base_window.h @@ -42,6 +42,10 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>, static void BuildPrototype(v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> prototype); + // Clears window state from the Local State JSON file in + // app.getPath('userData') via PrefService. + static void ClearWindowState(const std::string& window_name); + static bool IsWindowNameValid(const gin_helper::Dictionary& options, std::string* error_message); diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index f3c564bdb69c4..0d0e47b39f619 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -34,6 +34,7 @@ #include "ui/compositor/compositor.h" #include "ui/display/display.h" #include "ui/display/screen.h" +#include "ui/display/types/display_constants.h" #include "ui/views/widget/widget.h" #if !BUILDFLAG(IS_MAC) @@ -103,6 +104,12 @@ gfx::Size GetExpandedWindowSize(const NativeWindow* window, } #endif +// Check if display is fake (default display ID) or has invalid dimensions +bool hasInvalidDisplay(const display::Display& display) { + return display.id() == display::kDefaultDisplayId || + display.size().width() == 0 || display.size().height() == 0; +} + } // namespace NativeWindow::NativeWindow(const gin_helper::Dictionary& options, @@ -126,21 +133,30 @@ NativeWindow::NativeWindow(const gin_helper::Dictionary& options, if (gin_helper::Dictionary persistence_options; options.Get(options::kWindowStatePersistence, &persistence_options)) { - // Other options will be parsed here in the future. + // Restore bounds by default + restore_bounds_ = true; + persistence_options.Get(options::kBounds, &restore_bounds_); + // Restore display mode by default + restore_display_mode_ = true; + persistence_options.Get(options::kDisplayMode, &restore_display_mode_); window_state_persistence_enabled_ = true; } else if (bool flag; options.Get(options::kWindowStatePersistence, &flag)) { + restore_bounds_ = flag; + restore_display_mode_ = flag; window_state_persistence_enabled_ = flag; } // Initialize prefs_ to save/restore window bounds if we have a valid window // name and window state persistence is enabled. if (window_state_persistence_enabled_ && !window_name_.empty()) { + // Move this out if there's a need to initialize prefs_ for other features if (auto* browser_process = electron::ElectronBrowserMainParts::Get()->browser_process()) { DCHECK(browser_process); prefs_ = browser_process->local_state(); } } else if (window_state_persistence_enabled_ && window_name_.empty()) { + window_state_persistence_enabled_ = false; LOG(WARNING) << "Window state persistence enabled but no window name " "provided. Window state will not be persisted."; } @@ -244,7 +260,14 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) { options.Get(options::kFullScreenable, &fullscreenable); SetFullScreenable(fullscreenable); - if (fullscreen) + // Restore window state (bounds and display mode) at this point in + // initialization. We deliberately restore bounds before display modes + // (fullscreen/kiosk) since the target display for these states depends on the + // window's initial bounds. Also, restoring here ensures we respect min/max + // width/height and fullscreenable constraints. + RestoreWindowState(options); + + if (fullscreen && !restore_display_mode_) SetFullScreen(true); if (bool val; options.Get(options::kResizable, &val)) @@ -253,7 +276,8 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) { if (bool val; options.Get(options::kSkipTaskbar, &val)) SetSkipTaskbar(val); - if (bool val; options.Get(options::kKiosk, &val) && val) + if (bool val; + options.Get(options::kKiosk, &val) && val && !restore_display_mode_) SetKiosk(val); #if BUILDFLAG(IS_MAC) @@ -273,8 +297,8 @@ void NativeWindow::InitFromOptions(const gin_helper::Dictionary& options) { SetBackgroundColor(background_color); SetTitle(options.ValueOrDefault(options::kTitle, Browser::Get()->GetName())); - // TODO(nilayarya): Save window state after restoration logic is implemented - // here. + // Save updated window state after restoration adjustments are complete if + // any. SaveWindowState(); // Then show it. if (options.ValueOrDefault(options::kShow, true)) @@ -837,13 +861,37 @@ void NativeWindow::DebouncedSaveWindowState() { } void NativeWindow::SaveWindowState() { - if (!prefs_ || window_name_.empty()) + if (!window_state_persistence_enabled_ || is_being_restored_) + return; + + gfx::Rect bounds = GetBounds(); + + if (bounds.width() == 0 || bounds.height() == 0) { + LOG(WARNING) << "Window state not saved - window bounds are invalid"; return; + } + + const display::Screen* screen = display::Screen::GetScreen(); + DCHECK(screen); + // GetDisplayMatching returns a fake display with 1920x1080 resolution at + // (0,0) when no physical displays are attached. + // https://source.chromium.org/chromium/chromium/src/+/main:ui/display/display.cc;l=184;drc=e4f1aef5f3ec30a28950d766612cc2c04c822c71 + const display::Display display = screen->GetDisplayMatching(bounds); + + // Skip window state persistence when display has invalid dimensions (0x0) or + // is fake (ID 0xFF). Invalid displays could cause incorrect window bounds to + // be saved, leading to positioning issues during restoration. + // https://source.chromium.org/chromium/chromium/src/+/main:ui/display/types/display_constants.h;l=28;drc=e4f1aef5f3ec30a28950d766612cc2c04c822c71 + if (hasInvalidDisplay(display)) { + LOG(WARNING) + << "Window state not saved - no physical display attached or current " + "display has invalid bounds"; + return; + } ScopedDictPrefUpdate update(prefs_, electron::kWindowStates); const base::Value::Dict* existing_prefs = update->FindDict(window_name_); - gfx::Rect bounds = GetBounds(); // When the window is in a special display mode (fullscreen, kiosk, or // maximized), save the previously stored window bounds instead of // the current bounds. This ensures that when the window is restored, it can @@ -870,8 +918,6 @@ void NativeWindow::SaveWindowState() { window_preferences.Set(electron::kFullscreen, IsFullscreen()); window_preferences.Set(electron::kKiosk, IsKiosk()); - const display::Screen* screen = display::Screen::GetScreen(); - const display::Display display = screen->GetDisplayMatching(bounds); gfx::Rect work_area = display.work_area(); window_preferences.Set(electron::kWorkAreaLeft, work_area.x()); @@ -890,6 +936,153 @@ void NativeWindow::FlushWindowState() { } } +void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { + if (!window_state_persistence_enabled_) + return; + + const base::Value& value = prefs_->GetValue(electron::kWindowStates); + const base::Value::Dict* window_preferences = + value.is_dict() ? value.GetDict().FindDict(window_name_) : nullptr; + + if (!window_preferences) + return; + + std::optional<int> saved_left = window_preferences->FindInt(electron::kLeft); + std::optional<int> saved_top = window_preferences->FindInt(electron::kTop); + std::optional<int> saved_right = + window_preferences->FindInt(electron::kRight); + std::optional<int> saved_bottom = + window_preferences->FindInt(electron::kBottom); + + std::optional<int> work_area_left = + window_preferences->FindInt(electron::kWorkAreaLeft); + std::optional<int> work_area_top = + window_preferences->FindInt(electron::kWorkAreaTop); + std::optional<int> work_area_right = + window_preferences->FindInt(electron::kWorkAreaRight); + std::optional<int> work_area_bottom = + window_preferences->FindInt(electron::kWorkAreaBottom); + + if (!saved_left || !saved_top || !saved_right || !saved_bottom || + !work_area_left || !work_area_top || !work_area_right || + !work_area_bottom) { + LOG(WARNING) << "Window state not restored - corrupted values found"; + return; + } + + gfx::Rect saved_bounds = + gfx::Rect(*saved_left, *saved_top, *saved_right - *saved_left, + *saved_bottom - *saved_top); + + display::Screen* screen = display::Screen::GetScreen(); + DCHECK(screen); + // GetDisplayMatching returns a fake display with 1920x1080 resolution at + // (0,0) when no physical displays are attached. + // https://source.chromium.org/chromium/chromium/src/+/main:ui/display/display.cc;l=184;drc=e4f1aef5f3ec30a28950d766612cc2c04c822c71 + const display::Display display = screen->GetDisplayMatching(saved_bounds); + + // Skip window state restoration if current display has invalid dimensions or + // is fake. Restoring from invalid displays (0x0) or fake displays (ID 0xFF) + // could cause incorrect window positioning when later moved to real displays. + // https://source.chromium.org/chromium/chromium/src/+/main:ui/display/types/display_constants.h;l=28;drc=e4f1aef5f3ec30a28950d766612cc2c04c822c71 + if (hasInvalidDisplay(display)) { + LOG(WARNING) << "Window state not restored - no physical display attached " + "or current display has invalid bounds"; + return; + } + + gfx::Rect saved_work_area = gfx::Rect(*work_area_left, *work_area_top, + *work_area_right - *work_area_left, + *work_area_bottom - *work_area_top); + + // Set this to true before RestoreBounds to prevent SaveWindowState from being + // inadvertently triggered during the restoration process. + is_being_restored_ = true; + + if (restore_bounds_) { + RestoreBounds(display, saved_work_area, saved_bounds); + } + + if (restore_display_mode_) { + restore_display_mode_callback_ = base::BindOnce( + [](NativeWindow* window, base::Value::Dict prefs) { + if (auto kiosk = prefs.FindBool(electron::kKiosk); kiosk && *kiosk) { + window->SetKiosk(true); + } else if (auto fs = prefs.FindBool(electron::kFullscreen); + fs && *fs) { + window->SetFullScreen(true); + } else if (auto max = prefs.FindBool(electron::kMaximized); + max && *max) { + window->Maximize(); + } + }, + base::Unretained(this), window_preferences->Clone()); + } + + is_being_restored_ = false; +} + +void NativeWindow::FlushPendingDisplayMode() { + if (restore_display_mode_callback_) { + std::move(restore_display_mode_callback_).Run(); + } +} + +// This function is similar to Chromium's window bounds adjustment logic +// https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/window_sizer/window_sizer.cc;l=350;drc=0ec56065ba588552f21633aa47280ba02c3cd160 +void NativeWindow::RestoreBounds(const display::Display& display, + const gfx::Rect& saved_work_area, + gfx::Rect& saved_bounds) { + if (saved_bounds.width() == 0 || saved_bounds.height() == 0) { + LOG(WARNING) << "Window bounds not restored - values are invalid"; + return; + } + + // Ensure that the window is at least kMinVisibleHeight * kMinVisibleWidth. + saved_bounds.set_height(std::max(kMinVisibleHeight, saved_bounds.height())); + saved_bounds.set_width(std::max(kMinVisibleWidth, saved_bounds.width())); + + const gfx::Rect work_area = display.work_area(); + // Ensure that the title bar is not above the work area. + if (saved_bounds.y() < work_area.y()) { + saved_bounds.set_y(work_area.y()); + } + + // Reposition and resize the bounds if the saved_work_area is different from + // the current work area and the current work area doesn't completely contain + // the bounds. + if (!saved_work_area.IsEmpty() && saved_work_area != work_area && + !work_area.Contains(saved_bounds)) { + saved_bounds.AdjustToFit(work_area); + } + +#if BUILDFLAG(IS_MAC) + // On mac, we want to be aggressive about repositioning windows that are + // partially offscreen. If the window is partially offscreen horizontally, + // snap to the nearest edge of the work area. This call also adjusts the + // height, width if needed to make the window fully visible. + saved_bounds.AdjustToFit(work_area); +#else + // On non-Mac platforms, we are less aggressive about repositioning. Simply + // ensure that at least kMinVisibleWidth * kMinVisibleHeight is visible + + const int min_y = work_area.y() + kMinVisibleHeight - saved_bounds.height(); + const int min_x = work_area.x() + kMinVisibleWidth - saved_bounds.width(); + const int max_y = work_area.bottom() - kMinVisibleHeight; + const int max_x = work_area.right() - kMinVisibleWidth; + // Reposition and resize the bounds to make it fully visible inside the work + // area. `min_x >= max_x` happens when work area and bounds are both small. + if (min_x >= max_x || min_y >= max_y) { + saved_bounds.AdjustToFit(work_area); + } else { + saved_bounds.set_y(std::clamp(saved_bounds.y(), min_y, max_y)); + saved_bounds.set_x(std::clamp(saved_bounds.x(), min_x, max_x)); + } +#endif // BUILDFLAG(IS_MAC) + + SetBounds(saved_bounds); +} + // static bool NativeWindow::PlatformHasClientFrame() { #if defined(USE_OZONE) diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index 8085ba9cd3cd8..8f75ce520aedb 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -448,6 +448,17 @@ class NativeWindow : public base::SupportsUserData, // DebouncedSaveWindowState. This does NOT flush the actual disk write. void FlushWindowState(); + // Restores window state - bounds first and then display mode. + void RestoreWindowState(const gin_helper::Dictionary& options); + // Applies saved bounds to the window. + void RestoreBounds(const display::Display& display, + const gfx::Rect& saved_work_area, + gfx::Rect& saved_bounds); + // Flushes pending display mode restoration (fullscreen, maximized, kiosk) + // that was deferred during initialization to respect show=false. This + // consumes and clears the restore_display_mode_callback_. + void FlushPendingDisplayMode(); + protected: friend class api::BrowserView; @@ -571,6 +582,9 @@ class NativeWindow : public base::SupportsUserData, gfx::Rect overlay_rect_; + // Flag to prevent SaveWindowState calls during window restoration. + bool is_being_restored_ = false; + // The boolean parsing of the "windowStatePersistence" option bool window_state_persistence_enabled_ = false; @@ -579,9 +593,21 @@ class NativeWindow : public base::SupportsUserData, // valid name. raw_ptr<PrefService> prefs_ = nullptr; + // Whether to restore bounds. + bool restore_bounds_ = false; + // Whether to restore display mode. + bool restore_display_mode_ = false; + // Callback to restore display mode. + base::OnceCallback<void()> restore_display_mode_callback_; + // Timer to debounce window state saving operations. base::OneShotTimer save_window_state_timer_; + // Minimum height of the visible part of a window. + const int kMinVisibleHeight = 100; + // Minimum width of the visible part of a window. + const int kMinVisibleWidth = 100; + base::WeakPtrFactory<NativeWindow> weak_factory_{this}; }; diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index fbb9ee8946c3f..e48bf10cebdc5 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -416,6 +416,8 @@ static bool FromV8(v8::Isolate* isolate, return; } + FlushPendingDisplayMode(); + set_wants_to_be_visible(true); // Reattach the window to the parent to actually show it. diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index ceee28bfc7689..80fdce3346f14 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -558,6 +558,8 @@ void NativeWindowViews::Show() { if (is_modal() && NativeWindow::parent() && !widget()->IsVisible()) static_cast<NativeWindowViews*>(parent())->IncrementChildModals(); + FlushPendingDisplayMode(); + widget()->native_widget_private()->Show(GetRestoredState(), gfx::Rect()); // explicitly focus the window diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 096eb9ba67cb5..ad528f7151337 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, BaseWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, net, protocol, screen, webContents, webFrameMain, session, WebContents, WebFrameMain } from 'electron/main'; +import { app, BrowserWindow, BaseWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, net, protocol, screen, webContents, webFrameMain, session, WebContents, WebFrameMain, BrowserWindowConstructorOptions } from 'electron/main'; import { expect } from 'chai'; @@ -7105,21 +7105,54 @@ describe('BrowserWindow module', () => { }); }); - describe('windowStatePersistence', () => { + ifdescribe(hasCapturableScreen())('windowStatePersistence', () => { + const getWindowStateFromDisk = (windowName: string, preferencesPath: string) => { + if (!fs.existsSync(preferencesPath)) { + throw new Error(`Preferences file does not exist at path: ${preferencesPath}. Window state was not saved to disk.`); + } + const prefsContent = fs.readFileSync(preferencesPath, 'utf8'); + const prefs = JSON.parse(prefsContent); + return prefs?.windowStates?.[windowName] || null; + }; + + // Helper to get preferences file modification time + const getPrefsModTime = (preferencesPath: string): Date => { + try { + return fs.statSync(preferencesPath).mtime; + } catch { + throw new Error(`Test requires preferences file to exist at path: ${preferencesPath}.`); + } + }; + + const waitForPrefsUpdate = async (initialModTime: Date, preferencesPath: string): Promise<void> => { + const startTime = Date.now(); + const timeoutMs = 20000; + while (true) { + const currentModTime = getPrefsModTime(preferencesPath); + + if (currentModTime > initialModTime) { + return; + } + + if (Date.now() - startTime > timeoutMs) { + throw new Error(`Window state was not flushed to disk within ${timeoutMs}ms`); + } + // Wait for 1 second before checking again + await setTimeout(1000); + } + }; + + const waitForPrefsFileCreation = async (preferencesPath: string) => { + while (!fs.existsSync(preferencesPath)) { + await setTimeout(1000); + } + }; + describe('save window state', () => { const fixturesPath = path.resolve(__dirname, 'fixtures', 'api', 'window-state-save'); const sharedUserDataPath = path.join(os.tmpdir(), 'electron-window-state-test'); const sharedPreferencesPath = path.join(sharedUserDataPath, 'Local State'); - const getWindowStateFromDisk = (windowName: string, preferencesPath: string) => { - if (!fs.existsSync(preferencesPath)) { - throw new Error(`Preferences file does not exist at path: ${preferencesPath}. Window state was not saved to disk.`); - } - const prefsContent = fs.readFileSync(preferencesPath, 'utf8'); - const prefs = JSON.parse(prefsContent); - return prefs?.windowStates?.[windowName] || null; - }; - // Clean up before each test beforeEach(() => { if (fs.existsSync(sharedUserDataPath)) { @@ -7149,7 +7182,7 @@ describe('BrowserWindow module', () => { expect(savedState).to.have.property('workAreaBottom'); }); - ifit(hasCapturableScreen())('should save window state after window is closed and app exit', async () => { + it('should save window state after window is closed and app exit', async () => { const appPath = path.join(fixturesPath, 'close-save'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); @@ -7164,7 +7197,7 @@ describe('BrowserWindow module', () => { expect(savedState.kiosk).to.equal(false); }); - ifit(hasCapturableScreen())('should save window state after window is resized and app exit', async () => { + it('should save window state after window is resized and app exit', async () => { const appPath = path.join(fixturesPath, 'resize-save'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); @@ -7179,7 +7212,7 @@ describe('BrowserWindow module', () => { expect(savedState.kiosk).to.equal(false); }); - ifit(hasCapturableScreen())('should save window state after window is moved and app exit', async () => { + it('should save window state after window is moved and app exit', async () => { const appPath = path.join(fixturesPath, 'move-save'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); @@ -7194,7 +7227,7 @@ describe('BrowserWindow module', () => { expect(savedState.kiosk).to.equal(false); }); - ifit(hasCapturableScreen())('should save window state after window is fullscreened and app exit', async () => { + it('should save window state after window is fullscreened and app exit', async () => { const appPath = path.join(fixturesPath, 'fullscreen-save'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); @@ -7207,7 +7240,7 @@ describe('BrowserWindow module', () => { expect(savedState.kiosk).to.equal(false); }); - ifit(hasCapturableScreen())('should save window state after window is maximized and app exit', async () => { + it('should save window state after window is maximized and app exit', async () => { const appPath = path.join(fixturesPath, 'maximize-save'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); @@ -7220,7 +7253,7 @@ describe('BrowserWindow module', () => { expect(savedState.kiosk).to.equal(false); }); - ifit(hasCapturableScreen())('should save window state if in a minimized state and app exit', async () => { + it('should save window state if in a minimized state and app exit', async () => { const appPath = path.join(fixturesPath, 'minimize-save'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); @@ -7236,7 +7269,7 @@ describe('BrowserWindow module', () => { expect(savedState.kiosk).to.equal(false); }); - ifit(hasCapturableScreen())('should save window state after window is kiosked and app exit', async () => { + it('should save window state after window is kiosked and app exit', async () => { const appPath = path.join(fixturesPath, 'kiosk-save'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); @@ -7251,7 +7284,7 @@ describe('BrowserWindow module', () => { }); describe('work area tests', () => { - ifit(hasCapturableScreen())('should save valid work area bounds', async () => { + it('should save valid work area bounds', async () => { const appPath = path.join(fixturesPath, 'schema-check'); const appProcess = childProcess.spawn(process.execPath, [appPath]); const [code] = await once(appProcess, 'exit'); @@ -7269,7 +7302,7 @@ describe('BrowserWindow module', () => { expect(savedState.workAreaTop).to.be.lessThan(savedState.workAreaBottom); }); - ifit(hasCapturableScreen())('should save work area bounds that contain the window bounds on primary display', async () => { + it('should save work area bounds that contain the window bounds on primary display', async () => { // Fixture will center the window on the primary display const appPath = path.join(fixturesPath, 'work-area-primary'); const appProcess = childProcess.spawn(process.execPath, [appPath]); @@ -7291,42 +7324,9 @@ describe('BrowserWindow module', () => { const windowName = 'test-batching-behavior'; const preferencesPath = path.join(app.getPath('userData'), 'Local State'); - // Helper to get preferences file modification time - const getPrefsModTime = (): Date => { - try { - return fs.statSync(preferencesPath).mtime; - } catch { - throw new Error(`Test requires preferences file to exist at path: ${preferencesPath}.`); - } - }; - - // Helper to wait for file modification with 20 second default timeout - const waitForPrefsUpdate = async (initialModTime: Date, timeoutMs: number = 20000): Promise<void> => { - const startTime = Date.now(); - - while (true) { - const currentModTime = getPrefsModTime(); - - if (currentModTime > initialModTime) { - return; - } - - if (Date.now() - startTime > timeoutMs) { - throw new Error(`Window state was not flushed to disk within ${timeoutMs}ms`); - } - // Wait for 1 second before checking again - await setTimeout(1000); - } - }; - - const waitForPrefsFileCreation = async (preferencesPath: string) => { - while (!fs.existsSync(preferencesPath)) { - await setTimeout(1000); - } - }; - beforeEach(async () => { await setTimeout(2000); + BrowserWindow.clearWindowState(windowName); w = new BrowserWindow({ show: false, width: 400, @@ -7342,7 +7342,7 @@ describe('BrowserWindow module', () => { // Wait for preferences file to be created if its the first time we're running the test await waitForPrefsFileCreation(preferencesPath); - const initialModTime = getPrefsModTime(); + const initialModTime = getPrefsModTime(preferencesPath); const moved = once(w, 'move'); w.setPosition(150, 200); @@ -7356,7 +7356,7 @@ describe('BrowserWindow module', () => { // Wait for any potential save to occur from the resize operation await setTimeout(1000); - const afterMoveModTime = getPrefsModTime(); + const afterMoveModTime = getPrefsModTime(preferencesPath); expect(afterMoveModTime.getTime()).to.equal(initialModTime.getTime()); }); @@ -7365,13 +7365,13 @@ describe('BrowserWindow module', () => { // Wait for preferences file to be created if its the first time we're running the test await waitForPrefsFileCreation(preferencesPath); - const initialModTime = getPrefsModTime(); + const initialModTime = getPrefsModTime(preferencesPath); const resized = once(w, 'resize'); w.setSize(500, 400); await resized; - await waitForPrefsUpdate(initialModTime); + await waitForPrefsUpdate(initialModTime, preferencesPath); const savedState = getWindowStateFromDisk(windowName, preferencesPath); expect(savedState).to.not.be.null('window state with window name "test-batching-behavior" does not exist'); @@ -7383,7 +7383,7 @@ describe('BrowserWindow module', () => { // Wait for preferences file to be created if its the first time we're running the test await waitForPrefsFileCreation(preferencesPath); - const initialModTime = getPrefsModTime(); + const initialModTime = getPrefsModTime(preferencesPath); const resize1 = once(w, 'resize'); w.setSize(500, 400); @@ -7391,7 +7391,7 @@ describe('BrowserWindow module', () => { // Wait for any potential save to occur await setTimeout(1000); - const afterFirstResize = getPrefsModTime(); + const afterFirstResize = getPrefsModTime(preferencesPath); const resize2 = once(w, 'resize'); w.setSize(600, 500); @@ -7399,7 +7399,7 @@ describe('BrowserWindow module', () => { // Wait for any potential save to occur await setTimeout(1000); - const afterSecondResize = getPrefsModTime(); + const afterSecondResize = getPrefsModTime(preferencesPath); const resize3 = once(w, 'resize'); w.setSize(700, 600); @@ -7407,9 +7407,9 @@ describe('BrowserWindow module', () => { // Wait for any potential save to occur await setTimeout(1000); - const afterThirdResize = getPrefsModTime(); + const afterThirdResize = getPrefsModTime(preferencesPath); - await waitForPrefsUpdate(initialModTime); + await waitForPrefsUpdate(initialModTime, preferencesPath); const savedState = getWindowStateFromDisk(windowName, preferencesPath); expect(savedState).to.not.be.null('window state with window name "test-batching-behavior" does not exist'); @@ -7426,7 +7426,7 @@ describe('BrowserWindow module', () => { // Wait for preferences file to be created if its the first time we're running the test await waitForPrefsFileCreation(preferencesPath); - const initialModTime = getPrefsModTime(); + const initialModTime = getPrefsModTime(preferencesPath); const moved = once(w, 'move'); w.setPosition(100, 100); @@ -7437,11 +7437,554 @@ describe('BrowserWindow module', () => { // Keep main thread busy for 25 seconds while (Date.now() - startTime < 25000); - const finalModTime = getPrefsModTime(); + const finalModTime = getPrefsModTime(preferencesPath); expect(finalModTime.getTime()).to.equal(initialModTime.getTime()); }); }); }); + + describe('clear window state', () => { + const windowName = 'test-window-clear'; + const preferencesPath = path.join(app.getPath('userData'), 'Local State'); + + beforeEach(async () => { + // Timeout here plays nice with CI + await setTimeout(2000); + // Let's start with a clean slate everytime + BrowserWindow.clearWindowState(windowName); + }); + + afterEach(closeAllWindows); + + it('should clear existing window state', async () => { + const initialModTime = getPrefsModTime(preferencesPath); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + w.destroy(); + + await waitForPrefsUpdate(initialModTime, preferencesPath); + + const stateBefore = getWindowStateFromDisk(windowName, preferencesPath); + expect(stateBefore).to.not.be.null('window state with window name "test-window-clear" should exist but does not'); + + BrowserWindow.clearWindowState(windowName); + + await waitForPrefsUpdate(getPrefsModTime(preferencesPath), preferencesPath); + + const stateAfter = getWindowStateFromDisk(windowName, preferencesPath); + expect(stateAfter).to.be.null('window state with window name "test-window-clear" should be cleared'); + }); + + it('should clear existing window state from memory immediately', async () => { + const w = new BrowserWindow({ + height: 100, + width: 100, + name: windowName, + windowStatePersistence: true, + show: false + }); + + w.destroy(); + + const w1 = new BrowserWindow({ + height: 200, + width: 200, + name: windowName, + windowStatePersistence: true, + show: false + }); + + // This proves that the window state exists in memory + expect(w1.getBounds().width).to.equal(100); + expect(w1.getBounds().height).to.equal(100); + + w1.destroy(); + + BrowserWindow.clearWindowState(windowName); + + const w2 = new BrowserWindow({ + height: 200, + width: 200, + name: windowName, + windowStatePersistence: true, + show: false + }); + // windowStatePersistence: true should override the constructor bounds if not cleared + // If the window has dimensions 200x200, it indicates that the state was indeed cleared + expect(w2.getBounds().width).to.equal(200); + expect(w2.getBounds().height).to.equal(200); + + w2.destroy(); + }); + + it('should not throw when clearing non-existent window state', () => { + expect(() => { + BrowserWindow.clearWindowState('non-existent-window'); + }).to.not.throw(); + }); + + it('should not affect other window states when clearing specific window', async () => { + const windowName1 = 'test-window-1'; + const windowName2 = 'test-window-2'; + const initialModTime = getPrefsModTime(preferencesPath); + + const w1 = new BrowserWindow({ + name: windowName1, + windowStatePersistence: true, + show: false + }); + w1.destroy(); + + const w2 = new BrowserWindow({ + name: windowName2, + windowStatePersistence: true, + show: false + }); + w2.destroy(); + + await waitForPrefsUpdate(initialModTime, preferencesPath); + + expect(getWindowStateFromDisk(windowName1, preferencesPath)).to.not.be.null('window state with window name "test-window-1" should exist but does not'); + expect(getWindowStateFromDisk(windowName2, preferencesPath)).to.not.be.null('window state with window name "test-window-2" should exist but does not'); + + BrowserWindow.clearWindowState(windowName1); + + await waitForPrefsUpdate(getPrefsModTime(preferencesPath), preferencesPath); + + // Verify if only window1 was cleared + expect(getWindowStateFromDisk(windowName1, preferencesPath)).to.be.null('window state with window name "test-window-1" should be cleared'); + expect(getWindowStateFromDisk(windowName2, preferencesPath)).to.not.be.null('window state with window name "test-window-2" should not be cleared'); + }); + }); + + describe('restore window state', () => { + const preferencesPath = path.join(app.getPath('userData'), 'Local State'); + const windowName = 'test-restore-window'; + + const createAndSaveWindowState = async (options?: BrowserWindowConstructorOptions) => { + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: { + displayMode: false + }, + show: false, + ...options + }); + if (!fs.existsSync(preferencesPath)) { + // File doesn't exist, wait for creation + await waitForPrefsFileCreation(preferencesPath); + } else { + // File exists, wait for update + const initialModTime = getPrefsModTime(preferencesPath); + await waitForPrefsUpdate(initialModTime, preferencesPath); + } + // Ensure window is destroyed because we can't create another window with the same name otherwise + w.destroy(); + }; + + beforeEach(async () => { + // Timeout here plays nice with CI + await setTimeout(2000); + // Let's start with a clean slate everytime + BrowserWindow.clearWindowState(windowName); + }); + + afterEach(closeAllWindows); + + describe('single monitor tests', () => { + // Window state restoration takes into account current work area bounds to readjust height/width + // height and width will be readjusted to kMinimumVisibleWidth*kMinimumVisibleHeight (100x100) + // if there is no capturable screen + it('should restore bounds when windowStatePersistence is true', async () => { + const workArea = screen.getPrimaryDisplay().workArea; + const bounds = { width: 100, height: 100, x: workArea.x, y: workArea.y }; + await createAndSaveWindowState(bounds); + // Should override default constructor bounds + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + width: 500, + height: 400, + x: 200, + y: 250, + show: false + }); + + expectBoundsEqual(w.getBounds(), bounds); + + w.destroy(); + }); + + it('should use default window options when no saved state exists', async () => { + const defaultBounds = { width: 500, height: 400, x: 200, y: 250 }; + // BrowserWindow.clearWindowState(windowName) is called in beforeEach + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + ...defaultBounds, + show: false + }); + // Should take the default bounds from the constructor as there is no saved state + expectBoundsEqual(w.getBounds(), defaultBounds); + expect(w.isFullScreen()).to.equal(false); + expect(w.isMaximized()).to.equal(false); + + w.destroy(); + }); + + it('should restore fullscreen state when windowStatePersistence is true', async () => { + await createAndSaveWindowState({ fullscreen: true }); + await setTimeout(2000); + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true + }); + + const enterFullScreen = once(w, 'enter-full-screen'); + if (!w.isFullScreen()) await enterFullScreen; + + expect(w.isFullScreen()).to.equal(true); + + w.destroy(); + }); + + it('should restore kiosk state when windowStatePersistence is true', async () => { + await createAndSaveWindowState({ kiosk: true }); + await setTimeout(2000); + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true + }); + + const enterFullScreen = once(w, 'enter-full-screen'); + if (!w.isFullScreen()) await enterFullScreen; + + expect(w.isFullScreen()).to.equal(true); + expect(w.isKiosk()).to.equal(true); + + w.destroy(); + }); + + it('should restore maximized state when windowStatePersistence is true', async () => { + const width = screen.getPrimaryDisplay().workArea.width; + const height = screen.getPrimaryDisplay().workArea.height; + await createAndSaveWindowState({ width, height }); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const maximized = once(w, 'maximize'); + if (!w.isMaximized()) await maximized; + + expect(w.isMaximized()).to.equal(true); + + w.destroy(); + }); + + it('should not restore state when windowStatePersistence is false', async () => { + const bounds = { width: 400, height: 300, x: 100, y: 150 }; + await createAndSaveWindowState(bounds); + + const defaultBounds = { width: 500, height: 400, x: 200, y: 250 }; + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: false, + ...defaultBounds, + show: false + }); + + expectBoundsEqual(w.getBounds(), defaultBounds); + + w.destroy(); + }); + + it('should restore bounds only when displayMode is disabled', async () => { + // We don't use the utility createAndSaveWindowState here because the default bounds + // passed through the constructor get affected by setting fullscreen: true alongside it. + // It particularly affects this test because we want to ensure initial bounds stay the same + // on restore. + const workArea = screen.getPrimaryDisplay().workArea; + const defaultBounds = { width: 100, height: 100, x: workArea.x, y: workArea.y }; + const initialWindow = new BrowserWindow({ + ...defaultBounds, + show: false, + name: windowName, + windowStatePersistence: true + }); + const enterFullScreen = once(initialWindow, 'enter-full-screen'); + initialWindow.setFullScreen(true); + if (!initialWindow.isFullScreen()) await enterFullScreen; + + initialWindow.destroy(); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: { + displayMode: false + }, + show: false + }); + // We expect the bounds to restore to the values same as before the fullscreen state was set + expectBoundsEqual(w.getBounds(), defaultBounds); + expect(w.isFullScreen()).to.equal(false); + + w.destroy(); + }); + + it('should restore display modes when bounds is disabled', async () => { + await createAndSaveWindowState({ fullscreen: true }); + await setTimeout(2000); + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: { + bounds: false + } + }); + + const enterFullScreen = once(w, 'enter-full-screen'); + if (!w.isFullScreen()) await enterFullScreen; + expect(w.isFullScreen()).to.equal(true); + + w.destroy(); + }); + + it('should respect fullscreenable property', async () => { + await createAndSaveWindowState({ fullscreen: true }); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + fullscreenable: false, + show: false + }); + // Wait for the window to potentially enter fullscreen + await setTimeout(2000); + + expect(w.isFullScreen()).to.equal(false); + expect(w.isFullScreenable()).to.equal(false); + + w.destroy(); + }); + + it('should respect minWidth and minHeight properly', async () => { + await createAndSaveWindowState({ width: 200, height: 200 }); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + minWidth: 400, + minHeight: 400, + show: false + }); + + const bounds = w.getBounds(); + expect(bounds.width).to.be.at.least(400); + expect(bounds.height).to.be.at.least(400); + }); + + it('should respect maxWidth and maxHeight properly', async () => { + await createAndSaveWindowState({ width: 800, height: 800 }); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + maxWidth: 400, + maxHeight: 400, + show: false + }); + + const bounds = w.getBounds(); + expect(bounds.width).to.be.at.most(400); + expect(bounds.height).to.be.at.most(400); + }); + + it('should restore correct state for each named window independently - multi window check', async () => { + const window1Name = 'test-window-1'; + const window2Name = 'test-window-2'; + + // Clear any existing state + BrowserWindow.clearWindowState(window1Name); + BrowserWindow.clearWindowState(window2Name); + + const workArea = screen.getPrimaryDisplay().workArea; + + const bounds1 = { width: 100, height: 100, x: workArea.x, y: workArea.y }; + const w1 = new BrowserWindow({ + name: window1Name, + windowStatePersistence: true, + ...bounds1, + show: false + }); + + w1.destroy(); + + const bounds2 = { width: 120, height: 100, x: workArea.x, y: workArea.y }; + const w2 = new BrowserWindow({ + name: window2Name, + windowStatePersistence: true, + ...bounds2, + show: false + }); + + w2.destroy(); + + if (!fs.existsSync(preferencesPath)) { + // File doesn't exist, wait for creation + await waitForPrefsFileCreation(preferencesPath); + } else { + // File exists, wait for update + const initialModTime = getPrefsModTime(preferencesPath); + await waitForPrefsUpdate(initialModTime, preferencesPath); + } + + const restored1 = new BrowserWindow({ + name: window1Name, + windowStatePersistence: true, + show: false + }); + + const restored2 = new BrowserWindow({ + name: window2Name, + windowStatePersistence: true, + show: false + }); + + expectBoundsEqual(restored1.getBounds(), bounds1); + expectBoundsEqual(restored2.getBounds(), bounds2); + + restored1.destroy(); + restored2.destroy(); + }); + + it('should adjust restored bounds if they overflow current work area entirely', async () => { + const workArea = screen.getPrimaryDisplay().workArea; + // Completely off-screen to the right + const offscreenBounds = { + width: 100, + height: 100, + x: workArea.x + workArea.width + 10, + y: workArea.y + workArea.height + 10 + }; + + await createAndSaveWindowState(offscreenBounds); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const bounds = w.getBounds(); + + // Window should be moved to be entirely visible + expect(bounds.x + bounds.width).to.be.at.most(workArea.x + workArea.width); + expect(bounds.y + bounds.height).to.be.at.most(workArea.y + workArea.height); + expect(bounds.x).to.be.at.least(workArea.x); + expect(bounds.y).to.be.at.least(workArea.y); + expect(bounds.width).to.equal(100); + expect(bounds.height).to.equal(100); + + w.destroy(); + }); + + ifit(process.platform === 'darwin')('should adjust bounds if window overflows work area such that the window is entirely visible', async () => { + const workArea = screen.getPrimaryDisplay().workArea; + const overflowBounds = { + width: 100, + height: 100, + x: workArea.x + workArea.width - 20, + y: workArea.y + workArea.height - 20 + }; + + await createAndSaveWindowState(overflowBounds); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const bounds = w.getBounds(); + + // On macOS, window should be adjusted to be entirely visible + expect(bounds.x + bounds.width).to.be.at.most(workArea.x + workArea.width); + expect(bounds.y + bounds.height).to.be.at.most(workArea.y + workArea.height); + expect(bounds.width).to.equal(100); + expect(bounds.height).to.equal(100); + + w.destroy(); + }); + + ifit(process.platform !== 'darwin')('should adjust bounds if window overflows work area such that the window has minimum visible height/width 100x100', async () => { + const workArea = screen.getPrimaryDisplay().workArea; + // Initialize with 50x50 of the window visible + const overflowBounds = { + width: 120, + height: 120, + x: workArea.x + workArea.width - 50, + y: workArea.y + workArea.height - 50 + }; + + await createAndSaveWindowState(overflowBounds); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const bounds = w.getBounds(); + // Calculate the boundaries of the visible intersection rectangle + const leftMost = Math.max(bounds.x, workArea.x); + const rightMost = Math.min(bounds.x + bounds.width, workArea.x + workArea.width); + const topMost = Math.max(bounds.y, workArea.y); + const bottomMost = Math.min(bounds.y + bounds.height, workArea.y + workArea.height); + // On non-macOS platforms, at least 100x100 should be visible + const visibleWidth = rightMost - leftMost; + const visibleHeight = bottomMost - topMost; + + expect(visibleWidth).to.be.at.least(100); + expect(visibleHeight).to.be.at.least(100); + expect(bounds.width).to.equal(120); + expect(bounds.height).to.equal(120); + + w.destroy(); + }); + + it('should respect show:false when restoring display modes', async () => { + await createAndSaveWindowState({ fullscreen: true }); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const shown = once(w, 'show'); + const enterFullScreen = once(w, 'enter-full-screen'); + + await setTimeout(2000); + expect(w.isVisible()).to.equal(false); + + w.show(); + await shown; + expect(w.isVisible()).to.equal(true); + + // Fullscreen state should still be restored correctly + if (!w.isFullScreen()) await enterFullScreen; + expect(w.isFullScreen()).to.equal(true); + + w.destroy(); + }); + }); + }); }); }); From 444448507d06382a58372e8c69712eb7e9cbe6dd Mon Sep 17 00:00:00 2001 From: Nilay Arya <84241885+nilayarya@users.noreply.github.com> Date: Tue, 26 Aug 2025 21:30:35 -0400 Subject: [PATCH 057/268] test: multi monitor tests for save/restore window state (#48048) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: restore window state * feat: flush display modes on show * refactor: move utility functions to common area * feat: clear window state * fix: wait for the prefs to update * test: clearWindowState extra test * test: refine clear window state tests * test: single monitor restore window tests chore: rebase on gsoc-2025 * refactor: refine clearWindowState test * fix: revert default_app back to original * docs: add comment linking AdjustBoundsToBeVisibleOnDisplay to Chromium code * fix: add correct permalink * refactor: ci friendly * fix: disable windowStatePersistence when no display * refactor: use reference instead pointer * fix: skip window state persistence for invalid/fake displays * refactor: better flag placement * test: add test to verify window state is not saved when no display * fix: restore display mode inside show() * feat: support for multimonitor tests * fix: update yarn.lock file * feat: support any resolution for new displays * feat: support display positioning * docs: multi-monitor tests * test: remove dummy test * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * test: clear sharedUserPath before and test * refactor: hasInvalidDisplay function * debug: add display info logging for CI * fix: do not save/restore when window is 0x0 * test: support for multimonitor tests (#47911) * test: support for multimonitor tests * fix: update yarn.lock file * test: support any resolution for new displays * test: support display positioning * docs: multi-monitor tests * test: remove dummy test * fix: native-addon forceCleanup * docs: add forceCleanup description * test: add two basic multi-monitor tests * fix: find the closest display for non-overlapping saved bounds * test: windowStatePersistence multi-monitor tests * docs: add note on display APIs in CI * fix: remove duplicate destroy registration * feat: enforce unique window names across BaseWindow and BrowserWindow (#47764) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: enforce unique window names across BaseWindow and BrowserWindow * docs: update docs for name property * fix: linter issue with symbol --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * docs: remove inaccurate comment * fix: move expect blocks outside beforeEach * test: exclude macOS-x64 for now * test: remove invalid display test * test: remove invalid display test * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * test: support for multimonitor tests (#47911) * test: support for multimonitor tests * fix: update yarn.lock file * test: support any resolution for new displays * test: support display positioning * docs: multi-monitor tests * test: remove dummy test * feat: enforce unique window names across BaseWindow and BrowserWindow (#47764) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: enforce unique window names across BaseWindow and BrowserWindow * docs: update docs for name property * fix: linter issue with symbol --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: clear and restore window state (#47781) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: restore window state * feat: flush display modes on show * refactor: move utility functions to common area * feat: clear window state * fix: wait for the prefs to update * test: clearWindowState extra test * test: refine clear window state tests * test: single monitor restore window tests chore: rebase on gsoc-2025 * refactor: refine clearWindowState test * fix: revert default_app back to original * docs: add comment linking AdjustBoundsToBeVisibleOnDisplay to Chromium code * fix: add correct permalink * refactor: ci friendly * fix: disable windowStatePersistence when no display * refactor: use reference instead pointer * fix: skip window state persistence for invalid/fake displays * refactor: better flag placement * test: add test to verify window state is not saved when no display * fix: restore display mode inside show() * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * test: clear sharedUserPath before and test * refactor: hasInvalidDisplay function * debug: add display info logging for CI * fix: do not save/restore when window is 0x0 * test: support for multimonitor tests (#47911) * test: support for multimonitor tests * fix: update yarn.lock file * test: support any resolution for new displays * test: support display positioning * docs: multi-monitor tests * test: remove dummy test * feat: enforce unique window names across BaseWindow and BrowserWindow (#47764) * feat: save window state (#47425) * feat: save/restore window state * cleanup * remove constructor option * refactor: apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: forward declare prefservice * refactor: remove constructor option * refactor: save window state on move/resize instead of moved/resized * feat: resave window state after construction * test: add basic window save tests * test: add work area tests * test: asynchronous batching behavior * docs: add windowStateRestoreOptions to BaseWindowConstructorOptions * chore: move includes to main block * Update spec/api-browser-window-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * docs: update docs/api/structures/base-window-options.md Co-authored-by: Erick Zhao <erick@hotmail.ca> * fix: preserve original bounds during window state save in special modes * feat: save kiosk state in window preferences * chore: remove ts-expect-error * test: check hasCapturableScreen before running tests * test: remove multimonitor tests * test: add missing hasCapturableScreen checks before tests * docs: add blurb on saving mechanism * feat: add debounce window of 200ms to saveWindowState * docs: remove blurb until finalized * style: convert constants from snake_case to camelCase * refactor: initialize prefs_ only if window state is configured to be saved/restored * refactor: rename window states key * refactor: store in application-level Local State instead of browser context * refactor: switch to more accurate function names * fix: add dcheck for browser_process * fix: flush window state to avoid race condition * refactor: change stateId to name * refactor: change windowStateRestoreOptions to windowStatePersistence * Update docs/api/structures/base-window-options.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * fix: add warning when window state persistence enabled without window name * docs: lowercase capital B for consistency --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * feat: enforce unique window names across BaseWindow and BrowserWindow * docs: update docs for name property * fix: linter issue with symbol --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> * test: remove invalid display test --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Erick Zhao <erick@hotmail.ca> Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> --- docs/development/multi-monitor-testing.md | 15 + shell/browser/native_window.cc | 23 +- spec/api-browser-window-spec.ts | 561 ++++++++++++++++++ .../include/VirtualDisplayBridge.h | 1 + .../virtual-display/src/Dummy.swift | 36 +- .../virtual-display/src/VirtualDisplay.swift | 5 + .../src/VirtualDisplayBridge.m | 4 + .../native-addon/virtual-display/src/addon.mm | 16 +- 8 files changed, 653 insertions(+), 8 deletions(-) diff --git a/docs/development/multi-monitor-testing.md b/docs/development/multi-monitor-testing.md index 5a1d7e772b662..7a8e62bc9732a 100644 --- a/docs/development/multi-monitor-testing.md +++ b/docs/development/multi-monitor-testing.md @@ -37,6 +37,21 @@ const success = virtualDisplay.destroy(displayId) **Returns:** `boolean` - Success status +#### `virtualDisplay.forceCleanup()` + +Performs a complete cleanup of all virtual displays and resets the macOS CoreGraphics display system. + +It is recommended to call this before every test to prevent test failures. macOS CoreGraphics maintains an internal display ID allocation pool that can become corrupted when virtual displays are created and destroyed rapidly during testing. Without proper cleanup, subsequent display creation may fail with inconsistent display IDs, resulting in test flakiness. + +```js @ts-nocheck +// Recommended test pattern +beforeEach(() => { + virtualDisplay.forceCleanup() +}) +``` + +**Returns:** `boolean` - Success status + ## Display Constraints ### Size Limits diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 0d0e47b39f619..f607e83d1b3be 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -976,10 +976,25 @@ void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { display::Screen* screen = display::Screen::GetScreen(); DCHECK(screen); - // GetDisplayMatching returns a fake display with 1920x1080 resolution at - // (0,0) when no physical displays are attached. - // https://source.chromium.org/chromium/chromium/src/+/main:ui/display/display.cc;l=184;drc=e4f1aef5f3ec30a28950d766612cc2c04c822c71 - const display::Display display = screen->GetDisplayMatching(saved_bounds); + + // Set the primary display as the target display for restoration. + display::Display display = screen->GetPrimaryDisplay(); + + // We identify the display with the minimal Manhattan distance to the saved + // bounds and set it as the target display for restoration. + int min_displacement = std::numeric_limits<int>::max(); + + for (const auto& candidate : screen->GetAllDisplays()) { + gfx::Rect test_bounds = saved_bounds; + test_bounds.AdjustToFit(candidate.work_area()); + int displacement = std::abs(test_bounds.x() - saved_bounds.x()) + + std::abs(test_bounds.y() - saved_bounds.y()); + + if (displacement < min_displacement) { + min_displacement = displacement; + display = candidate; + } + } // Skip window state restoration if current display has invalid dimensions or // is fake. Restoring from invalid displays (0x0) or fake displays (ID 0xFF) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index ad528f7151337..0e525cb06049e 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -7985,6 +7985,567 @@ describe('BrowserWindow module', () => { w.destroy(); }); }); + + // FIXME(nilayarya): Figure out why these tests fail on macOS-x64 + // virtualDisplay.create() is creating double displays on macOS-x64 + ifdescribe(process.platform === 'darwin' && process.arch === 'arm64')('multi-monitor tests', () => { + const virtualDisplay = require('@electron-ci/virtual-display'); + const primaryDisplay = screen.getPrimaryDisplay(); + + beforeEach(() => { + virtualDisplay.forceCleanup(); + }); + + it('should restore window bounds correctly on a secondary display', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + + // Create a new virtual target display to the right of the primary display + const targetDisplayId = virtualDisplay.create({ + width: 1920, + height: 1080, + x: targetDisplayX, + y: targetDisplayY + }); + + // Verify the virtual display is created correctly + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + expect(targetDisplay.bounds.x).to.equal(targetDisplayX); + expect(targetDisplay.bounds.y).to.equal(targetDisplayY); + expect(targetDisplay.bounds.width).to.equal(1920); + expect(targetDisplay.bounds.height).to.equal(1080); + + // Bounds for the test window on the virtual target display + const boundsOnTargetDisplay = { + width: 400, + height: 300, + x: targetDisplay.workArea.x + 100, + y: targetDisplay.workArea.y + 100 + }; + + await createAndSaveWindowState(boundsOnTargetDisplay); + + // Restore the window state by creating a new window with the same name + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const restoredBounds = w.getBounds(); + expectBoundsEqual(restoredBounds, boundsOnTargetDisplay); + + w.destroy(); + virtualDisplay.destroy(targetDisplayId); + }); + + it('should restore window to a visible location when saved display no longer exists', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + + // Create a new virtual target display to the right of the primary display + const targetDisplayId = virtualDisplay.create({ + width: 1920, + height: 1080, + x: targetDisplayX, + y: targetDisplayY + }); + + // Verify the virtual display is created correctly - single check for targetDisplay.bounds.x + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + expect(targetDisplay.bounds.x).to.equal(targetDisplayX); + + // Bounds for the test window on the virtual target display + const boundsOnTargetDisplay = { + width: 400, + height: 300, + x: targetDisplay.workArea.x + 100, + y: targetDisplay.workArea.y + 100 + }; + + // Save window state on the virtual display + await createAndSaveWindowState(boundsOnTargetDisplay); + + virtualDisplay.destroy(targetDisplayId); + // Wait for the target virtual display to be destroyed + while (screen.getAllDisplays().length > 1) await setTimeout(1000); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const restoredBounds = w.getBounds(); + const primaryWorkArea = primaryDisplay.workArea; + + // Window should be fully visible on the primary display + expect(restoredBounds.x).to.be.at.least(primaryWorkArea.x); + expect(restoredBounds.y).to.be.at.least(primaryWorkArea.y); + expect(restoredBounds.x + restoredBounds.width).to.be.at.most(primaryWorkArea.x + primaryWorkArea.width); + expect(restoredBounds.y + restoredBounds.height).to.be.at.most(primaryWorkArea.y + primaryWorkArea.height); + + // Window should maintain its original size + expect(restoredBounds.width).to.equal(boundsOnTargetDisplay.width); + expect(restoredBounds.height).to.equal(boundsOnTargetDisplay.height); + + w.destroy(); + }); + + it('should fallback to nearest display when saved display no longer exists', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + + // Create first virtual display to the right of primary + const middleDisplayId = virtualDisplay.create({ + width: 1920, + height: 1080, + x: targetDisplayX, + y: targetDisplayY + }); + + // Create second virtual display to the right of the first (rightmost) + const rightmostDisplayX = targetDisplayX + 1920; + const rightmostDisplayId = virtualDisplay.create({ + width: 1920, + height: 1080, + x: rightmostDisplayX, + y: targetDisplayY + }); + + // Verify the virtual displays are created correctly - single check for origin x values + const middleDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + expect(middleDisplay.bounds.x).to.equal(targetDisplayX); + + const rightmostDisplay = screen.getDisplayNearestPoint({ x: rightmostDisplayX, y: targetDisplayY }); + expect(rightmostDisplay.bounds.x).to.equal(rightmostDisplayX); + + // Bounds for the test window on the rightmost display + const boundsOnRightmostDisplay = { + width: 400, + height: 300, + x: rightmostDisplay.workArea.x + 100, + y: rightmostDisplay.workArea.y + 100 + }; + + // Save window state on the rightmost display + await createAndSaveWindowState(boundsOnRightmostDisplay); + + // Destroy the rightmost display (where window was saved) + virtualDisplay.destroy(rightmostDisplayId); + // Wait for the rightmost display to be destroyed + while (screen.getAllDisplays().length > 2) await setTimeout(1000); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const restoredBounds = w.getBounds(); + + // Window should be restored on the middle display (nearest remaining display) + expect(restoredBounds.x).to.be.at.least(middleDisplay.workArea.x); + expect(restoredBounds.y).to.be.at.least(middleDisplay.workArea.y); + expect(restoredBounds.x + restoredBounds.width).to.be.at.most(middleDisplay.workArea.x + middleDisplay.workArea.width); + expect(restoredBounds.y + restoredBounds.height).to.be.at.most(middleDisplay.workArea.y + middleDisplay.workArea.height); + + // Window should maintain its original size + expect(restoredBounds.width).to.equal(boundsOnRightmostDisplay.width); + expect(restoredBounds.height).to.equal(boundsOnRightmostDisplay.height); + + w.destroy(); + virtualDisplay.destroy(middleDisplayId); + }); + + it('should restore multiple named windows independently across displays', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + + // Create a first virtual display to the right of the primary display + const targetDisplayId1 = virtualDisplay.create({ + width: 1920, + height: 1080, + x: targetDisplayX, + y: targetDisplayY + }); + // Create a second virtual display to the right of the first + const targetDisplayId2 = virtualDisplay.create({ + width: 1600, + height: 900, + x: targetDisplayX + 1920, + y: targetDisplayY + }); + + // Verify the virtual displays are created correctly - single check for origin x values + const targetDisplay1 = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + expect(targetDisplay1.bounds.x).to.equal(targetDisplayX); + + const targetDisplay2 = screen.getDisplayNearestPoint({ x: targetDisplayX + 1920, y: targetDisplayY }); + expect(targetDisplay2.bounds.x).to.equal(targetDisplayX + 1920); + + // Window 1 on primary display + const window1Name = 'test-multi-window-1'; + const bounds1 = { + width: 300, + height: 200, + x: primaryDisplay.workArea.x + 50, + y: primaryDisplay.workArea.y + 50 + }; + + // Window 2 on second display (first virtual) + const window2Name = 'test-multi-window-2'; + const bounds2 = { + width: 400, + height: 300, + x: targetDisplay1.workArea.x + 100, + y: targetDisplay1.workArea.y + 100 + }; + + // Window 3 on third display (second virtual) + const window3Name = 'test-multi-window-3'; + const bounds3 = { + width: 350, + height: 250, + x: targetDisplay2.workArea.x + 150, + y: targetDisplay2.workArea.y + 150 + }; + + // Clear window state for all three windows from previous tests + BrowserWindow.clearWindowState(window1Name); + BrowserWindow.clearWindowState(window2Name); + BrowserWindow.clearWindowState(window3Name); + + // Create and save state for all three windows + const w1 = new BrowserWindow({ + name: window1Name, + windowStatePersistence: true, + show: false, + ...bounds1 + }); + const w2 = new BrowserWindow({ + name: window2Name, + windowStatePersistence: true, + show: false, + ...bounds2 + }); + const w3 = new BrowserWindow({ + name: window3Name, + windowStatePersistence: true, + show: false, + ...bounds3 + }); + + w1.destroy(); + w2.destroy(); + w3.destroy(); + + await setTimeout(2000); + + // Restore all three windows + const restoredW1 = new BrowserWindow({ + name: window1Name, + windowStatePersistence: true, + show: false + }); + const restoredW2 = new BrowserWindow({ + name: window2Name, + windowStatePersistence: true, + show: false + }); + const restoredW3 = new BrowserWindow({ + name: window3Name, + windowStatePersistence: true, + show: false + }); + + // Check that each window restored to its correct display and position + expectBoundsEqual(restoredW1.getBounds(), bounds1); + expectBoundsEqual(restoredW2.getBounds(), bounds2); + expectBoundsEqual(restoredW3.getBounds(), bounds3); + + restoredW1.destroy(); + restoredW2.destroy(); + restoredW3.destroy(); + virtualDisplay.destroy(targetDisplayId1); + virtualDisplay.destroy(targetDisplayId2); + }); + + it('should restore fullscreen state on correct display', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + + // Create a new virtual target display to the right of the primary display + const targetDisplayId = virtualDisplay.create({ + width: 1920, + height: 1080, + x: targetDisplayX, + y: targetDisplayY + }); + + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + expect(targetDisplay.bounds.x).to.equal(targetDisplayX); + + // Create window on target display and set fullscreen + const initialBounds = { + width: 400, + height: 300, + x: targetDisplay.workArea.x + 100, + y: targetDisplay.workArea.y + 100, + fullscreen: true + }; + + await createAndSaveWindowState(initialBounds); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true + }); + + const enterFullScreen = once(w, 'enter-full-screen'); + if (!w.isFullScreen()) await enterFullScreen; + + expect(w.isFullScreen()).to.equal(true); + + // Check that fullscreen window is on the correct display + const fsBounds = w.getBounds(); + expect(fsBounds.x).to.be.at.least(targetDisplay.bounds.x); + expect(fsBounds.y).to.be.at.least(targetDisplay.bounds.y); + expect(fsBounds.x + fsBounds.width).to.be.at.most(targetDisplay.bounds.x + targetDisplay.bounds.width); + expect(fsBounds.y + fsBounds.height).to.be.at.most(targetDisplay.bounds.y + targetDisplay.bounds.height); + + w.destroy(); + virtualDisplay.destroy(targetDisplayId); + }); + + it('should restore maximized state on correct display', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + + // Create a new virtual target display to the right of the primary display + const targetDisplayId = virtualDisplay.create({ + width: 1920, + height: 1080, + x: targetDisplayX, + y: targetDisplayY + }); + + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + expect(targetDisplay.bounds.x).to.equal(targetDisplayX); + + // Create window on target display and maximize it + const w1 = new BrowserWindow({ + name: windowName, + windowStatePersistence: { + displayMode: false + }, + x: targetDisplay.workArea.x, + y: targetDisplay.workArea.y + }); + + const maximized = once(w1, 'maximize'); + w1.maximize(); + if (!w1.isMaximized()) await maximized; + + w1.destroy(); + await setTimeout(2000); + + const w2 = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: true + }); + + const maximized_ = once(w2, 'maximize'); + if (!w2.isMaximized()) await maximized_; + + expect(w2.isMaximized()).to.equal(true); + // Check that maximized window is on the correct display + const maximizedBounds = w2.getBounds(); + expect(maximizedBounds.x).to.be.at.least(targetDisplay.bounds.x); + expect(maximizedBounds.y).to.be.at.least(targetDisplay.bounds.y); + expect(maximizedBounds.x + maximizedBounds.width).to.be.at.most(targetDisplay.bounds.x + targetDisplay.bounds.width); + expect(maximizedBounds.y + maximizedBounds.height).to.be.at.most(targetDisplay.bounds.y + targetDisplay.bounds.height); + + w2.destroy(); + virtualDisplay.destroy(targetDisplayId); + }); + + it('should restore kiosk state on correct display', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + + // Create a new virtual target display to the right of the primary display + const targetDisplayId = virtualDisplay.create({ + width: 1920, + height: 1080, + x: targetDisplayX, + y: targetDisplayY + }); + + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + + // Create window on target display and set kiosk: true + const initialBounds = { + width: 400, + height: 300, + x: targetDisplay.workArea.x + 100, + y: targetDisplay.workArea.y + 100, + kiosk: true + }; + + await createAndSaveWindowState(initialBounds); + + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true + }); + + const enterFullScreen = once(w, 'enter-full-screen'); + if (!w.isFullScreen()) await enterFullScreen; + + expect(w.isFullScreen()).to.equal(true); + expect(w.isKiosk()).to.equal(true); + + // Check that kiosk window is on the correct display + const kioskBounds = w.getBounds(); + expect(kioskBounds.x).to.be.at.least(targetDisplay.bounds.x); + expect(kioskBounds.y).to.be.at.least(targetDisplay.bounds.y); + expect(kioskBounds.x + kioskBounds.width).to.be.at.most(targetDisplay.bounds.x + targetDisplay.bounds.width); + expect(kioskBounds.y + kioskBounds.height).to.be.at.most(targetDisplay.bounds.y + targetDisplay.bounds.height); + + w.destroy(); + virtualDisplay.destroy(targetDisplayId); + }); + + it('should maintain same bounds when target display resolution increases', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + + // Create initial virtual display + const targetDisplayId = virtualDisplay.create({ + width: 1920, + height: 1080, + x: targetDisplayX, + y: targetDisplayY + }); + + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + + // Create a new virtual display with double the resolution of the target display + const higherResDisplayId = virtualDisplay.create({ + width: targetDisplay.bounds.width * 2, + height: targetDisplay.bounds.height * 2, + x: targetDisplayX + targetDisplay.bounds.width, + y: targetDisplayY + }); + + // Bounds for the test window on the virtual target display + const initialBounds = { + width: 400, + height: 300, + x: targetDisplay.workArea.x + 100, + y: targetDisplay.workArea.y + 100 + }; + + await createAndSaveWindowState(initialBounds); + + // Destroy the target display and wait for the higher resolution display to take its place + virtualDisplay.destroy(targetDisplayId); + while (screen.getAllDisplays().length > 2) await setTimeout(1000); + + // Restore window + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const restoredBounds = w.getBounds(); + + // Window should maintain same x, y, width, height as the display got bigger + expectBoundsEqual(restoredBounds, initialBounds); + + w.destroy(); + virtualDisplay.destroy(higherResDisplayId); + }); + + it('should reposition and resize window when target display resolution decreases', async () => { + const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; + const targetDisplayY = primaryDisplay.bounds.y; + // We expect only the primary display to be present before the tests start + expect(screen.getAllDisplays().length).to.equal(1); + + // Create initial virtual display with high resolution + const targetDisplayId = virtualDisplay.create({ + width: 2560, + height: 1440, + x: targetDisplayX, + y: targetDisplayY + }); + + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); + + // Create a new virtual display with half the resolution of the target display shifted down + const lowerResDisplayId = virtualDisplay.create({ + width: targetDisplay.bounds.width / 2, + height: targetDisplay.bounds.height / 2, + x: targetDisplayX + targetDisplay.bounds.width, + y: targetDisplay.bounds.height / 2 + }); + + // Bounds that would overflow on a smaller display + const initialBounds = { + x: targetDisplay.workArea.x, + y: targetDisplay.workArea.y, + width: targetDisplay.bounds.width, + height: targetDisplay.bounds.height + }; + + await createAndSaveWindowState(initialBounds); + + // Destroy and and wait for the lower resolution display to take its place + virtualDisplay.destroy(targetDisplayId); + while (screen.getAllDisplays().length > 2) await setTimeout(1000); + + // We expect the display to be shifted down as we set y: targetDisplay.bounds.height / 2 earlier + const smallerDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplay.bounds.height / 2 }); + + // Restore window + const w = new BrowserWindow({ + name: windowName, + windowStatePersistence: true, + show: false + }); + + const restoredBounds = w.getBounds(); + + // Window should be repositioned to be entirely visible on smaller display + expect(restoredBounds.x).to.be.at.least(smallerDisplay.workArea.x); + expect(restoredBounds.y).to.be.at.least(smallerDisplay.workArea.y); + expect(restoredBounds.x + restoredBounds.width).to.be.at.most(smallerDisplay.workArea.x + smallerDisplay.workArea.width); + expect(restoredBounds.y + restoredBounds.height).to.be.at.most(smallerDisplay.workArea.y + smallerDisplay.workArea.height); + + w.destroy(); + virtualDisplay.destroy(lowerResDisplayId); + }); + }); }); }); }); diff --git a/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h b/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h index 6ac5cbacb8f9a..dfb3096cf1df7 100644 --- a/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h +++ b/spec/fixtures/native-addon/virtual-display/include/VirtualDisplayBridge.h @@ -8,6 +8,7 @@ + (NSInteger)create:(int)width height:(int)height x:(int)x y:(int)y; + (BOOL)destroy:(NSInteger)displayId; ++ (BOOL)forceCleanup; @end diff --git a/spec/fixtures/native-addon/virtual-display/src/Dummy.swift b/spec/fixtures/native-addon/virtual-display/src/Dummy.swift index ef0195f3039fe..9695b1a0b433e 100644 --- a/spec/fixtures/native-addon/virtual-display/src/Dummy.swift +++ b/spec/fixtures/native-addon/virtual-display/src/Dummy.swift @@ -12,6 +12,11 @@ class DummyManager { static func createDummy(_ dummyDefinition: DummyDefinition, isPortrait _: Bool = false, serialNum: UInt32 = 0, doConnect: Bool = true) -> Int? { let dummy = Dummy(dummyDefinition: dummyDefinition, serialNum: serialNum, doConnect: doConnect) + + if !dummy.isConnected { + print("[DummyManager.createDummy:\(#line)] Failed to create virtual display - not connected") + return nil + } self.dummyCounter += 1 self.definedDummies[self.dummyCounter] = DefinedDummy(dummy: dummy) return self.dummyCounter @@ -25,6 +30,30 @@ class DummyManager { } self.definedDummies[number] = nil } + + static func forceCleanup() { + for (_, definedDummy) in self.definedDummies { + if definedDummy.dummy.isConnected { + definedDummy.dummy.virtualDisplay = nil + definedDummy.dummy.displayIdentifier = 0 + definedDummy.dummy.isConnected = false + } + } + + self.definedDummies.removeAll() + self.dummyCounter = 0 + + var config: CGDisplayConfigRef? = nil + if CGBeginDisplayConfiguration(&config) == .success { + CGCompleteDisplayConfiguration(config, .permanently) + } + + usleep(2000000) + + if CGBeginDisplayConfiguration(&config) == .success { + CGCompleteDisplayConfiguration(config, .forSession) + } + } } struct DummyDefinition { @@ -88,10 +117,10 @@ class Dummy: Equatable { self.virtualDisplay = virtualDisplay self.displayIdentifier = virtualDisplay.displayID self.isConnected = true - os_log("Display %{public}@ successfully connected", type: .info, "\(name)") + print("[Dummy.connect:\(#line)] Successfully connected virtual display: \(name)") return true } else { - os_log("Failed to connect display %{public}@", type: .info, "\(name)") + print("[Dummy.connect:\(#line)] Failed to connect virtual display: \(name)") return false } } @@ -99,7 +128,7 @@ class Dummy: Equatable { func disconnect() { self.virtualDisplay = nil self.isConnected = false - os_log("Disconnected virtual display: %{public}@", type: .info, "\(self.getName())") + print("[Dummy.disconnect:\(#line)] Disconnected virtual display: \(self.getName())") } private static func waitForDisplayRegistration(_ displayId: CGDirectDisplayID) -> Bool { @@ -110,6 +139,7 @@ class Dummy: Equatable { } usleep(100000) } + print("[Dummy.waitForDisplayRegistration:\(#line)] Failed to register virtual display: \(displayId)") return false } diff --git a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift index 1c4e57952cf89..265bfc5af2c77 100644 --- a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift +++ b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplay.swift @@ -18,6 +18,11 @@ import os.log return true } + @objc public static func forceCleanup() -> Bool { + DummyManager.forceCleanup() + return true + } + private static func positionDisplay(displayId: Int, x: Int, y: Int) { guard let definedDummy = DummyManager.definedDummies[displayId], definedDummy.dummy.isConnected else { diff --git a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m index b18ccbe97757d..7d31526748d4d 100644 --- a/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m +++ b/spec/fixtures/native-addon/virtual-display/src/VirtualDisplayBridge.m @@ -11,4 +11,8 @@ + (BOOL)destroy:(NSInteger)displayId { return [VirtualDisplay destroyWithId:(int)displayId]; } ++ (BOOL)forceCleanup { + return [VirtualDisplay forceCleanup]; +} + @end \ No newline at end of file diff --git a/spec/fixtures/native-addon/virtual-display/src/addon.mm b/spec/fixtures/native-addon/virtual-display/src/addon.mm index e15d59a532e8e..60285d1fd8332 100644 --- a/spec/fixtures/native-addon/virtual-display/src/addon.mm +++ b/spec/fixtures/native-addon/virtual-display/src/addon.mm @@ -134,6 +134,18 @@ napi_value create(napi_env env, napi_callback_info info) { return result; } +// virtualDisplay.forceCleanup() +napi_value forceCleanup(napi_env env, napi_callback_info info) { + BOOL result = [VirtualDisplayBridge forceCleanup]; + + napi_value js_result; + if (napi_get_boolean(env, result, &js_result) != napi_ok) { + return NULL; + } + + return js_result; +} + // virtualDisplay.destroy() napi_value destroy(napi_env env, napi_callback_info info) { size_t argc = 1; @@ -167,7 +179,9 @@ napi_value destroy(napi_env env, napi_callback_info info) { napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor descriptors[] = { {"create", NULL, create, NULL, NULL, NULL, napi_default, NULL}, - {"destroy", NULL, destroy, NULL, NULL, NULL, napi_default, NULL}}; + {"destroy", NULL, destroy, NULL, NULL, NULL, napi_default, NULL}, + {"forceCleanup", NULL, forceCleanup, NULL, NULL, NULL, napi_default, + NULL}}; if (napi_define_properties(env, exports, sizeof(descriptors) / sizeof(*descriptors), From ca19aa6cb0ddc92151fdf076aa6e0fe8f09a0ade Mon Sep 17 00:00:00 2001 From: Nilay Arya <nilay2014@gmail.com> Date: Thu, 28 Aug 2025 14:44:36 -0400 Subject: [PATCH 058/268] docs: improve docs for name property and fix typos --- docs/api/base-window.md | 6 +++--- docs/api/structures/base-window-options.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/api/base-window.md b/docs/api/base-window.md index a94e6ac9a59db..e08d8d55aecae 100644 --- a/docs/api/base-window.md +++ b/docs/api/base-window.md @@ -396,13 +396,13 @@ Returns `BaseWindow | null` - The window that is focused in this application, ot Returns `BaseWindow | null` - The window with the given `id`. -#### `BaseWindow.clearWindowState(windowName)` +#### `BaseWindow.clearWindowState(name)` -* `windowName` string - The window `name` to clear state for (see [BaseWindowConstructorOptions](structures/base-window-options.md)). +* `name` string - The window `name` to clear state for (see [BaseWindowConstructorOptions](structures/base-window-options.md)). Clears the saved state for a window with the given name. This removes all persisted window bounds, display mode, and work area information that was previously saved when `windowStatePersistence` was enabled. -If the window name is empty or the window state doesn't exist, the method will log a warning. +If the window `name` is empty or the window state doesn't exist, the method will log a warning. ### Instance Properties diff --git a/docs/api/structures/base-window-options.md b/docs/api/structures/base-window-options.md index f5cdf3e09e7ad..2e60af99c38b2 100644 --- a/docs/api/structures/base-window-options.md +++ b/docs/api/structures/base-window-options.md @@ -42,7 +42,7 @@ Default is `false`. * `hiddenInMissionControl` boolean (optional) _macOS_ - Whether window should be hidden when the user toggles into mission control. * `kiosk` boolean (optional) - Whether the window is in kiosk mode. Default is `false`. -* `name` string (optional) - A unique identifier for the window, used internally by Electron to enable features such as state persistence. Each window must have a distinct name. It can only be reused after the corresponding window has been destroyed. This is not the visible title shown to users on the title bar. +* `name` string (optional) - A unique identifier for the window, used internally by Electron to enable features such as state persistence. Each window must have a distinct name. It can only be reused after the corresponding window has been destroyed. An error is thrown if the name is already in use. This is not the visible title shown to users on the title bar. * `windowStatePersistence` ([WindowStatePersistence](window-state-persistence.md) | boolean) (optional) - Configures or enables the persistence of window state (position, size, maximized state, etc.) across application restarts. Has no effect if window `name` is not provided. Automatically disabled when there is no available display. _Experimental_ * `title` string (optional) - Default window title. Default is `"Electron"`. If the HTML tag `<title>` is defined in the HTML file loaded by `loadURL()`, this property will be ignored. * `icon` ([NativeImage](../native-image.md) | string) (optional) - The window icon. On Windows it is From 549107f83ce3a306432aa773d7369c7a2ae53786 Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Fri, 29 Aug 2025 09:56:51 +0200 Subject: [PATCH 059/268] fix: showMessageDialog should center dialog to parent (#48181) --- shell/browser/ui/message_box_win.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/shell/browser/ui/message_box_win.cc b/shell/browser/ui/message_box_win.cc index e8658938e584c..9ba64cb3f9a23 100644 --- a/shell/browser/ui/message_box_win.cc +++ b/shell/browser/ui/message_box_win.cc @@ -160,6 +160,7 @@ DialogResult ShowTaskDialogWstr(gfx::AcceleratedWidget parent, if (parent) { config.hwndParent = parent; + config.dwFlags |= TDF_POSITION_RELATIVE_TO_WINDOW; } if (default_id > 0) From 5f60d8a65b27b60ed3f1bb32cc7cb2d6cdac06ab Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Fri, 29 Aug 2025 16:37:37 +0200 Subject: [PATCH 060/268] fix: ensure dragging works again after emitting contextmenu event (#48199) --- shell/browser/native_window_views_win.cc | 5 ----- .../browser/ui/win/electron_desktop_window_tree_host_win.cc | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/shell/browser/native_window_views_win.cc b/shell/browser/native_window_views_win.cc index f4c8c119494e4..2a7f74f013b57 100644 --- a/shell/browser/native_window_views_win.cc +++ b/shell/browser/native_window_views_win.cc @@ -324,11 +324,6 @@ bool NativeWindowViews::PreHandleMSG(UINT message, return false; } - case WM_RBUTTONUP: { - if (!has_frame()) - electron::api::WebContents::SetDisableDraggableRegions(false); - return false; - } case WM_GETMINMAXINFO: { WINDOWPLACEMENT wp; wp.length = sizeof(WINDOWPLACEMENT); diff --git a/shell/browser/ui/win/electron_desktop_window_tree_host_win.cc b/shell/browser/ui/win/electron_desktop_window_tree_host_win.cc index 40a3d6b66d23a..42039cd92f4d5 100644 --- a/shell/browser/ui/win/electron_desktop_window_tree_host_win.cc +++ b/shell/browser/ui/win/electron_desktop_window_tree_host_win.cc @@ -142,6 +142,7 @@ bool ElectronDesktopWindowTreeHostWin::HandleMouseEvent(ui::MouseEvent* event) { if (prevent_default) { electron::api::WebContents::SetDisableDraggableRegions(true); views::DesktopWindowTreeHostWin::HandleMouseEvent(event); + electron::api::WebContents::SetDisableDraggableRegions(false); } return prevent_default; } From 0375772460fd3606c930d7e788f676f3450e1c63 Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Fri, 29 Aug 2025 19:14:45 +0200 Subject: [PATCH 061/268] fix: file-only picker incorrectly allowing some directories (#48198) --- patches/chromium/.patches | 1 + ...ith_using_deprecated_nsopenpanel_api.patch | 108 ++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 patches/chromium/band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index cc097efab4644..3bc84f21cc308 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -138,3 +138,4 @@ fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch feat_add_support_for_embedder_snapshot_validation.patch chore_restore_some_deprecated_wrapper_utility_in_gin.patch chore_add_electron_objects_to_wrappablepointertag.patch +band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch diff --git a/patches/chromium/band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch b/patches/chromium/band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch new file mode 100644 index 0000000000000..557c3b3b4a5b5 --- /dev/null +++ b/patches/chromium/band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch @@ -0,0 +1,108 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Avi Drissman <avi@chromium.org> +Date: Thu, 21 Aug 2025 07:33:53 -0700 +Subject: Band-aid over an issue with using deprecated NSOpenPanel API + +Because deprecated and broken NSOpenPanel API is used, the open panel +will sometimes incorrectly misunderstand a folder to be a package and +return it as a user selection when folders are disallowed from +selection. In that case, skip it. + +Bug: 40861123 +Bug: 41275486 +Bug: 440106155 +Change-Id: Ia0459a2bb76a30f4e126bd83069d7e13894d62f6 +Fixed: 438779953 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6867298 +Commit-Queue: Avi Drissman <avi@chromium.org> +Reviewed-by: Christine Hollingsworth <christinesm@chromium.org> +Cr-Commit-Position: refs/heads/main@{#1504534} + +diff --git a/components/remote_cocoa/app_shim/select_file_dialog_bridge.mm b/components/remote_cocoa/app_shim/select_file_dialog_bridge.mm +index f0b8108a7f8a63f66664c6c5ad3ada0bf60805b3..67380a76c699d1c2db0d3a96671bb92657c4a6d3 100644 +--- a/components/remote_cocoa/app_shim/select_file_dialog_bridge.mm ++++ b/components/remote_cocoa/app_shim/select_file_dialog_bridge.mm +@@ -225,7 +225,7 @@ - (void)popupAction:(id)sender { + // Unfortunately, there's no great way to do strict type matching with + // NSOpenPanel. Setting explicit extensions via -allowedFileTypes is + // deprecated, and there's no way to specify that strict type equality should +- // be used for -allowedContentTypes (FB13721802). ++ // be used for -allowedContentTypes (https://crbug.com/41275486, FB13721802). + // + // -[NSOpenSavePanelDelegate panel:shouldEnableURL:] could be used to enforce + // strict type matching, however its presence on the delegate means that all +@@ -235,6 +235,10 @@ - (void)popupAction:(id)sender { + // + // Therefore, use the deprecated API, because it's the only way to remain + // performant while achieving strict type matching. ++ // ++ // TODO(https://crbug.com/440106155): Possibly reconsider using ++ // -panel:shouldEnableURL: if the speed impact is judged to be acceptable ++ // nowadays. + + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" +@@ -479,8 +483,8 @@ - (void)popupAction:(id)sender { + + // See -[ExtensionDropdownHandler popupAction:] as to why file extensions + // are collected here rather than being converted to UTTypes. +- // TODO(FB13721802): Use UTTypes when strict type matching can be +- // specified. ++ // TODO(https://crbug.com/440106155, FB13721802): Use UTTypes when strict ++ // type matching can be specified. + NSString* ext_ns = base::SysUTF8ToNSString(ext); + if (![file_extensions_array containsObject:ext_ns]) { + [file_extensions_array addObject:ext_ns]; +@@ -571,18 +575,46 @@ - (void)popupAction:(id)sender { + } + NSString* path = url.path; + +- // There is a bug in macOS where, despite a request to disallow file +- // selection, files/packages are able to be selected. If indeed file +- // selection was disallowed, drop any files selected. +- // https://crbug.com/40861123, FB11405008 +- if (!open_panel.canChooseFiles) { ++ if (base::mac::MacOSMajorVersion() < 14) { ++ // There is a bug in macOS (https://crbug.com/40861123, FB11405008) ++ // where, despite a request to disallow file selection, files/packages ++ // are able to be selected. If indeed file selection was disallowed, ++ // drop any files selected. This issue is fixed in macOS 14, so only ++ // do the workaround on previous releases. ++ if (!open_panel.canChooseFiles) { ++ BOOL is_directory; ++ BOOL exists = ++ [NSFileManager.defaultManager fileExistsAtPath:path ++ isDirectory:&is_directory]; ++ BOOL is_package = ++ [NSWorkspace.sharedWorkspace isFilePackageAtPath:path]; ++ if (!exists || !is_directory || is_package) { ++ continue; ++ } ++ } ++ } ++ ++ // As long as FB13721802 remains unfixed, this class uses extensions to ++ // filter what files are available rather than UTTypes. This deprecated ++ // API has a problem, however. If you specify an extension to be shown ++ // as available, then the NSOpenPanel will assume that any directory ++ // that has that extension is a package, and will offer it to the user ++ // for selection even if directory selection isn't otherwise allowed. ++ // Therefore, if directories are disallowed, filter out any that find ++ // their way in if they're not actually packages. ++ // ++ // TODO(https://crbug.com/440106155, FB13721802): Possibly reconsider ++ // using -panel:shouldEnableURL: if the speed impact is judged to be ++ // acceptable nowadays, and drop this band-aid. ++ if (!open_panel.canChooseDirectories) { + BOOL is_directory; + BOOL exists = + [NSFileManager.defaultManager fileExistsAtPath:path + isDirectory:&is_directory]; + BOOL is_package = + [NSWorkspace.sharedWorkspace isFilePackageAtPath:path]; +- if (!exists || !is_directory || is_package) { ++ if (!exists || (is_directory && !is_package)) { ++ NSLog(@"dropping %@", path); + continue; + } + } From 468971266df45127d1fd326f6a565cf282b7c466 Mon Sep 17 00:00:00 2001 From: Calvin <nilay2014@gmail.com> Date: Mon, 1 Sep 2025 15:55:11 -0600 Subject: [PATCH 062/268] docs: move some planned breaking changes to 39 (#48236) --- docs/breaking-changes.md | 46 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/breaking-changes.md b/docs/breaking-changes.md index 689519c62b0bb..5a7148198effe 100644 --- a/docs/breaking-changes.md +++ b/docs/breaking-changes.md @@ -20,6 +20,29 @@ Chromium is deprecating the `--host-rules` switch. You should use `--host-resolver-rules` instead. +### Behavior Changed: window.open popups are always resizable + +Per current [WHATWG spec](https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-open-dev), the `window.open` API will now always create a resizable popup window. + +To restore previous behavior: + +```js +webContents.setWindowOpenHandler((details) => { + return { + action: 'allow', + overrideBrowserWindowOptions: { + resizable: details.features.includes('resizable=yes') + } + } +}) +``` + +### Behavior Changed: shared texture OSR `paint` event data structure + +When using shared texture offscreen rendering feature, the `paint` event now emits a more structured object. +It moves the `sharedTextureHandle`, `planes`, `modifier` into a unified `handle` property. +See [here](https://www.electronjs.org/docs/latest/api/structures/offscreen-shared-texture) for more details. + ## Planned Breaking API Changes (38.0) ### Removed: `ELECTRON_OZONE_PLATFORM_HINT` environment variable @@ -51,29 +74,6 @@ The `webFrame.findFrameByRoutingId(routingId)` function will be removed. You should use `webFrame.findFrameByToken(frameToken)` instead. -### Behavior Changed: window.open popups are always resizable - -Per current [WHATWG spec](https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-open-dev), the `window.open` API will now always create a resizable popup window. - -To restore previous behavior: - -```js -webContents.setWindowOpenHandler((details) => { - return { - action: 'allow', - overrideBrowserWindowOptions: { - resizable: details.features.includes('resizable=yes') - } - } -}) -``` - -### Behavior Changed: shared texture OSR `paint` event data structure - -When using shared texture offscreen rendering feature, the `paint` event now emits a more structured object. -It moves the `sharedTextureHandle`, `planes`, `modifier` into a unified `handle` property. -See [here](https://www.electronjs.org/docs/latest/api/structures/offscreen-shared-texture) for more details. - ## Planned Breaking API Changes (37.0) ### Utility Process unhandled rejection behavior change From dca970a9623a99903ef3a172ea2d491a8263729d Mon Sep 17 00:00:00 2001 From: Samuel Attard <nilay2014@gmail.com> Date: Wed, 3 Sep 2025 12:05:49 -0700 Subject: [PATCH 063/268] build: update spec deps for clean audit (#48238) --- spec/yarn.lock | 220 +++++++++++++++++++++++-------------------------- 1 file changed, 104 insertions(+), 116 deletions(-) diff --git a/spec/yarn.lock b/spec/yarn.lock index b37a017d30807..07c336fab35f8 100644 --- a/spec/yarn.lock +++ b/spec/yarn.lock @@ -427,10 +427,10 @@ agent-base@6: dependencies: debug "4" -ansi-colors@4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" - integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== +ansi-colors@^4.1.3: + version "4.1.3" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" + integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== ansi-regex@^3.0.0: version "3.0.1" @@ -574,7 +574,7 @@ braces@~3.0.2: dependencies: fill-range "^7.1.1" -browser-stdout@1.3.1: +browser-stdout@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== @@ -679,10 +679,10 @@ check-error@^1.0.2, check-error@^1.0.3: dependencies: get-func-name "^2.0.2" -chokidar@3.5.3: - version "3.5.3" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" - integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== +chokidar@^3.5.3: + version "3.6.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" + integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== dependencies: anymatch "~3.1.2" braces "~3.0.2" @@ -779,10 +779,10 @@ cookie-signature@1.0.6: resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== -cookie@0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051" - integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw== +cookie@0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.7.1.tgz#2f73c42142d5d5cf71310a74fc4ae61670e5dbc9" + integrity sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w== cross-dirname@^0.1.0: version "0.1.0" @@ -831,12 +831,12 @@ debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.4: dependencies: ms "2.1.2" -debug@4.3.4: - version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== +debug@^4.3.5: + version "4.4.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.1.tgz#e5a8bc6cbc4c6cd3e64308b0693a3d4fa550189b" + integrity sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ== dependencies: - ms "2.1.2" + ms "^2.1.3" decamelize@^4.0.0: version "4.0.0" @@ -912,16 +912,16 @@ detect-node@^2.0.4: resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1" integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g== -diff@5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" - integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== - diff@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== +diff@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531" + integrity sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A== + dir-compare@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/dir-compare/-/dir-compare-4.2.0.tgz#d1d4999c14fbf55281071fdae4293b3b9ce86f19" @@ -1011,16 +1011,16 @@ escape-html@~1.0.3: resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== -escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" - integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== - escape-string-regexp@^1.0.2: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + etag@~1.8.1: version "1.8.1" resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" @@ -1040,16 +1040,16 @@ event-stream@^4.0.0: through "^2.3.8" express@^4.20.0: - version "4.21.0" - resolved "https://registry.yarnpkg.com/express/-/express-4.21.0.tgz#d57cb706d49623d4ac27833f1cbc466b668eb915" - integrity sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng== + version "4.21.2" + resolved "https://registry.yarnpkg.com/express/-/express-4.21.2.tgz#cf250e48362174ead6cea4a566abef0162c1ec32" + integrity sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA== dependencies: accepts "~1.3.8" array-flatten "1.1.1" body-parser "1.20.3" content-disposition "0.5.4" content-type "~1.0.4" - cookie "0.6.0" + cookie "0.7.1" cookie-signature "1.0.6" debug "2.6.9" depd "2.0.0" @@ -1063,7 +1063,7 @@ express@^4.20.0: methods "~1.1.2" on-finished "2.4.1" parseurl "~1.3.3" - path-to-regexp "0.1.10" + path-to-regexp "0.1.12" proxy-addr "~2.0.7" qs "6.13.0" range-parser "~1.2.1" @@ -1133,14 +1133,6 @@ finalhandler@1.3.1: statuses "2.0.1" unpipe "~1.0.0" -find-up@5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" - integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== - dependencies: - locate-path "^6.0.0" - path-exists "^4.0.0" - find-up@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" @@ -1148,6 +1140,14 @@ find-up@^2.0.0: dependencies: locate-path "^2.0.0" +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + flat@^5.0.2: version "5.0.2" resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" @@ -1304,17 +1304,6 @@ glob-parent@~5.1.2: dependencies: is-glob "^4.0.1" -glob@8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" - integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^5.0.1" - once "^1.3.0" - glob@^7.1.3, glob@^7.1.6: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" @@ -1327,6 +1316,17 @@ glob@^7.1.3, glob@^7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" + integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^5.0.1" + once "^1.3.0" + global-agent@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/global-agent/-/global-agent-3.0.0.tgz#ae7cd31bd3583b93c5a16437a1afe27cc33a1ab6" @@ -1410,7 +1410,7 @@ hasown@^2.0.0: dependencies: function-bind "^1.1.2" -he@1.2.0: +he@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== @@ -1553,7 +1553,7 @@ isexe@^2.0.0: resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== -js-yaml@4.1.0: +js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== @@ -1638,7 +1638,7 @@ lodash@^4.17.15: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -log-symbols@4.1.0: +log-symbols@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== @@ -1738,13 +1738,6 @@ mimic-response@^3.1.0: resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== -minimatch@5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.0.1.tgz#fb9022f7528125187c92bd9e9b6366be1cf3415b" - integrity sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g== - dependencies: - brace-expansion "^2.0.1" - minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" @@ -1752,7 +1745,7 @@ minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1: dependencies: brace-expansion "^1.1.7" -minimatch@^5.0.1: +minimatch@^5.0.1, minimatch@^5.1.6: version "5.1.6" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== @@ -1828,30 +1821,30 @@ mocha-multi-reporters@^1.1.7: lodash "^4.17.15" mocha@^10.0.0: - version "10.4.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.4.0.tgz#ed03db96ee9cfc6d20c56f8e2af07b961dbae261" - integrity sha512-eqhGB8JKapEYcC4ytX/xrzKforgEc3j1pGlAXVy3eRwrtAy5/nIfT1SvgGzfN0XZZxeLq0aQWkOUAmqIJiv+bA== - dependencies: - ansi-colors "4.1.1" - browser-stdout "1.3.1" - chokidar "3.5.3" - debug "4.3.4" - diff "5.0.0" - escape-string-regexp "4.0.0" - find-up "5.0.0" - glob "8.1.0" - he "1.2.0" - js-yaml "4.1.0" - log-symbols "4.1.0" - minimatch "5.0.1" - ms "2.1.3" - serialize-javascript "6.0.0" - strip-json-comments "3.1.1" - supports-color "8.1.1" - workerpool "6.2.1" - yargs "16.2.0" - yargs-parser "20.2.4" - yargs-unparser "2.0.0" + version "10.8.2" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.8.2.tgz#8d8342d016ed411b12a429eb731b825f961afb96" + integrity sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg== + dependencies: + ansi-colors "^4.1.3" + browser-stdout "^1.3.1" + chokidar "^3.5.3" + debug "^4.3.5" + diff "^5.2.0" + escape-string-regexp "^4.0.0" + find-up "^5.0.0" + glob "^8.1.0" + he "^1.2.0" + js-yaml "^4.1.0" + log-symbols "^4.1.0" + minimatch "^5.1.6" + ms "^2.1.3" + serialize-javascript "^6.0.2" + strip-json-comments "^3.1.1" + supports-color "^8.1.1" + workerpool "^6.5.1" + yargs "^16.2.0" + yargs-parser "^20.2.9" + yargs-unparser "^2.0.0" ms@2.0.0: version "2.0.0" @@ -1863,7 +1856,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@2.1.3: +ms@2.1.3, ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -2055,10 +2048,10 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== -path-to-regexp@0.1.10: - version "0.1.10" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.10.tgz#67e9108c5c0551b9e5326064387de4763c4d5f8b" - integrity sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w== +path-to-regexp@0.1.12: + version "0.1.12" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.12.tgz#d5e1a12e478a976d432ef3c58d534b9923164bb7" + integrity sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ== path-to-regexp@^1.7.0: version "1.9.0" @@ -2369,10 +2362,10 @@ serialize-error@^7.0.1: dependencies: type-fest "^0.13.1" -serialize-javascript@6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" - integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== +serialize-javascript@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2" + integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g== dependencies: randombytes "^2.1.0" @@ -2552,7 +2545,7 @@ strip-bom@^3.0.0: resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA== -strip-json-comments@3.1.1: +strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -2571,13 +2564,6 @@ sumchecker@^3.0.1: dependencies: debug "^4.1.0" -supports-color@8.1.1: - version "8.1.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" - integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== - dependencies: - has-flag "^4.0.0" - supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" @@ -2585,6 +2571,13 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" +supports-color@^8.1.1: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" @@ -2734,10 +2727,10 @@ wordwrap@~0.0.2: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" integrity sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw== -workerpool@6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" - integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== +workerpool@^6.5.1: + version "6.5.1" + resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544" + integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA== wrap-ansi@^7.0.0: version "7.0.0" @@ -2791,12 +2784,7 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yargs-parser@20.2.4: - version "20.2.4" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" - integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== - -yargs-parser@^20.2.2: +yargs-parser@^20.2.2, yargs-parser@^20.2.9: version "20.2.9" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== @@ -2806,7 +2794,7 @@ yargs-parser@^21.1.1: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yargs-unparser@2.0.0: +yargs-unparser@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== @@ -2816,7 +2804,7 @@ yargs-unparser@2.0.0: flat "^5.0.2" is-plain-obj "^2.1.0" -yargs@16.2.0, yargs@^16.0.3: +yargs@^16.0.3, yargs@^16.2.0: version "16.2.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== From 474ef4fdf0ae4aed7e4af7f8d36846d8a0d34554 Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Fri, 5 Sep 2025 17:16:45 -0400 Subject: [PATCH 064/268] chore: bump node to v22.19.0 (main) (#48222) * chore: bump node in DEPS to v22.19.0 * chore: fixup patch indices * crypto: add tls.setDefaultCACertificates() https://github.com/nodejs/node/pull/58822 * esm: js-string Wasm builtins in ESM Integration https://github.com/nodejs/node/pull/59179 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> --- DEPS | 2 +- patches/node/.patches | 2 +- patches/node/build_add_gn_build_files.patch | 51 +++++-------------- .../build_compile_with_c_20_support.patch | 2 +- patches/node/build_enable_perfetto.patch | 2 +- ...compilation_fails_if_not_using_a_new.patch | 2 +- ...f_original-fs_and_custom_embedder_js.patch | 2 +- ...e_clang_as_default_compiler_on_macos.patch | 2 +- ...de_entrypoint_to_be_a_builtin_module.patch | 2 +- ...cli_move_--trace-atomics-wait_to_eol.patch | 14 ++--- .../node/cli_remove_deprecated_v8_flag.patch | 6 +-- ..._values_for_variables_in_common_gypi.patch | 2 +- ...g_fileexists_fn_to_legacymainresolve.patch | 10 ++-- ...ssert_module_in_the_renderer_process.patch | 4 +- .../node/fix_cppgc_initializing_twice.patch | 4 +- .../fix_crypto_tests_to_run_with_bssl.patch | 10 ++-- ..._do_not_resolve_electron_entrypoints.patch | 2 +- ...se_readfilesync_override_for_modules.patch | 4 +- ...n_electron_module_via_the_esm_loader.patch | 6 +-- ...ingssl_and_openssl_incompatibilities.patch | 12 ++--- ...in_esm_loaders_to_apply_asar_patches.patch | 2 +- .../fix_remove_fastapitypedarray_usage.patch | 8 +-- ...rmony-import-assertions_from_node_cc.patch | 25 --------- ...emove_outdated_v8_flags_from_node_cc.patch | 36 +++++++++++++ .../pass_all_globals_through_require.patch | 6 +-- ...dder_overriding_of_internal_fs_calls.patch | 2 +- ...ch_cppgc_heap_on_v8_isolate_creation.patch | 12 ++--- ...st_formally_mark_some_tests_as_flaky.patch | 2 +- ...e_static_method_names_in_call_stacks.patch | 4 +- script/node-disabled-tests.json | 1 + 30 files changed, 112 insertions(+), 127 deletions(-) delete mode 100644 patches/node/fix_remove_harmony-import-assertions_from_node_cc.patch create mode 100644 patches/node/fix_remove_outdated_v8_flags_from_node_cc.patch diff --git a/DEPS b/DEPS index dc72d1a147352..494d98dd4f525 100644 --- a/DEPS +++ b/DEPS @@ -4,7 +4,7 @@ vars = { 'chromium_version': '141.0.7361.0', 'node_version': - 'v22.18.0', + 'v22.19.0', 'nan_version': 'e14bdcd1f72d62bca1d541b66da43130384ec213', 'squirrel.mac_version': diff --git a/patches/node/.patches b/patches/node/.patches index 1f05d709754ec..bd0290aa2f09d 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -30,7 +30,7 @@ build_compile_with_c_20_support.patch add_v8_taskpirority_to_foreground_task_runner_signature.patch cli_remove_deprecated_v8_flag.patch build_restore_clang_as_default_compiler_on_macos.patch -fix_remove_harmony-import-assertions_from_node_cc.patch +fix_remove_outdated_v8_flags_from_node_cc.patch chore_disable_deprecation_ftbfs_in_simdjson_header.patch build_allow_unbundling_of_node_js_dependencies.patch test_use_static_method_names_in_call_stacks.patch diff --git a/patches/node/build_add_gn_build_files.patch b/patches/node/build_add_gn_build_files.patch index 5e0111ef8ca4d..ed758f53ab541 100644 --- a/patches/node/build_add_gn_build_files.patch +++ b/patches/node/build_add_gn_build_files.patch @@ -24,7 +24,7 @@ index 2415940835036226799a7ea14c6687cc0d56c523..0feb07afbccad97a92cee00954443407 o['variables']['v8_enable_external_code_space'] = 1 if options.enable_pointer_compression else 0 o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0 diff --git a/node.gni b/node.gni -index b049f0692980c3e26771c3209c3bdd2e9a4d637b..e2407027ab05e59b2f0f1c213b98ea469db7a91b 100644 +index d4438f7fd61598afac2c1e3184721a759d22b10c..e2407027ab05e59b2f0f1c213b98ea469db7a91b 100644 --- a/node.gni +++ b/node.gni @@ -5,10 +5,10 @@ @@ -40,15 +40,7 @@ index b049f0692980c3e26771c3209c3bdd2e9a4d637b..e2407027ab05e59b2f0f1c213b98ea46 # The location of OpenSSL - use the one from node's deps by default. node_openssl_path = "$node_path/deps/openssl" -@@ -42,12 +42,15 @@ declare_args() { - # The variable is called "openssl" for parity with node's GYP build. - node_use_openssl = true - -+ # Build node with SQLite support. -+ node_use_sqlite = true -+ - # Use the specified path to system CA (PEM format) in addition to - # the BoringSSL supplied CA store or compiled-in Mozilla CA copy. +@@ -50,7 +50,7 @@ declare_args() { node_openssl_system_ca_path = "" # Initialize v8 platform during node.js startup. @@ -57,7 +49,7 @@ index b049f0692980c3e26771c3209c3bdd2e9a4d637b..e2407027ab05e59b2f0f1c213b98ea46 # Custom build tag. node_tag = "" -@@ -67,10 +70,16 @@ declare_args() { +@@ -70,10 +70,16 @@ declare_args() { # TODO(zcbenz): There are few broken things for now: # 1. cross-os compilation is not supported. # 2. node_mksnapshot crashes when cross-compiling for x64 from arm64. @@ -76,7 +68,7 @@ index b049f0692980c3e26771c3209c3bdd2e9a4d637b..e2407027ab05e59b2f0f1c213b98ea46 assert(!node_enable_inspector || node_use_openssl, diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index abf1583cdac9f139056cf4809f14e28e62f6d24c..8b104e175ccf8de90c138337f83f8f6ce1348ac7 100644 +index b4acc40618e372b09d0cb5e3755034f08711a282..efeaaef7e4dc64a0adb5e6bdbbe18945890de62c 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -789,6 +789,7 @@ void BuiltinLoader::RegisterExternalReferences( @@ -279,22 +271,10 @@ index 856878c33681a73d41016729dabe48b0a6a80589..91a11852d206b65485fe90fd037a0bd1 if sys.platform == 'win32': files = [ x.replace('\\', '/') for x in files ] diff --git a/unofficial.gni b/unofficial.gni -index da565473f1ae96b4d009935f7733e6ab15ea9de2..26ebc811272ef2990f8d090c54e7f5294aab9d37 100644 +index 865a0d5ce9c6792e57f4216bcaa594ca6fc7b1c8..26ebc811272ef2990f8d090c54e7f5294aab9d37 100644 --- a/unofficial.gni +++ b/unofficial.gni -@@ -22,6 +22,11 @@ template("node_gn_build") { - } else { - defines += [ "HAVE_OPENSSL=0" ] - } -+ if (node_use_sqlite) { -+ defines += [ "HAVE_SQLITE=1" ] -+ } else { -+ defines += [ "HAVE_SQLITE=0" ] -+ } - if (node_use_amaro) { - defines += [ "HAVE_AMARO=1" ] - } else { -@@ -142,32 +147,41 @@ template("node_gn_build") { +@@ -147,31 +147,41 @@ template("node_gn_build") { public_configs = [ ":node_external_config", "deps/googletest:googletest_config", @@ -317,7 +297,6 @@ index da565473f1ae96b4d009935f7733e6ab15ea9de2..26ebc811272ef2990f8d090c54e7f529 "deps/nghttp2", - "deps/ngtcp2", "deps/postject", -- "deps/sqlite", "deps/uvwasi", - "deps/zstd", "//third_party/zlib", @@ -340,7 +319,7 @@ index da565473f1ae96b4d009935f7733e6ab15ea9de2..26ebc811272ef2990f8d090c54e7f529 "$target_gen_dir/node_javascript.cc", ] + gypi_values.node_sources -@@ -190,9 +204,13 @@ template("node_gn_build") { +@@ -194,7 +204,7 @@ template("node_gn_build") { } if (node_use_openssl) { deps += [ "deps/ncrypto" ] @@ -348,14 +327,8 @@ index da565473f1ae96b4d009935f7733e6ab15ea9de2..26ebc811272ef2990f8d090c54e7f529 + public_deps += [ "//third_party/boringssl" ] sources += gypi_values.node_crypto_sources } -+ if (node_use_sqlite) { -+ deps += [ "deps/sqlite" ] -+ sources += gypi_values.node_sqlite_sources -+ } - if (node_enable_inspector) { - deps += [ - "$node_inspector_protocol_path:crdtp", -@@ -215,6 +233,10 @@ template("node_gn_build") { + if (node_use_sqlite) { +@@ -223,6 +233,10 @@ template("node_gn_build") { } } @@ -366,7 +339,7 @@ index da565473f1ae96b4d009935f7733e6ab15ea9de2..26ebc811272ef2990f8d090c54e7f529 executable(target_name) { forward_variables_from(invoker, "*") -@@ -289,6 +311,7 @@ template("node_gn_build") { +@@ -297,6 +311,7 @@ template("node_gn_build") { } executable("node_js2c") { @@ -374,7 +347,7 @@ index da565473f1ae96b4d009935f7733e6ab15ea9de2..26ebc811272ef2990f8d090c54e7f529 deps = [ "deps/uv", "$node_simdutf_path", -@@ -299,26 +322,75 @@ template("node_gn_build") { +@@ -307,26 +322,75 @@ template("node_gn_build") { "src/embedded_data.cc", "src/embedded_data.h", ] @@ -460,7 +433,7 @@ index da565473f1ae96b4d009935f7733e6ab15ea9de2..26ebc811272ef2990f8d090c54e7f529 outputs = [ "$target_gen_dir/node_javascript.cc" ] # Get the path to node_js2c executable of the host toolchain. -@@ -332,11 +404,11 @@ template("node_gn_build") { +@@ -340,11 +404,11 @@ template("node_gn_build") { get_label_info(":node_js2c($host_toolchain)", "name") + host_executable_suffix diff --git a/patches/node/build_compile_with_c_20_support.patch b/patches/node/build_compile_with_c_20_support.patch index 52a25cc54cd5c..4ea916a3b1342 100644 --- a/patches/node/build_compile_with_c_20_support.patch +++ b/patches/node/build_compile_with_c_20_support.patch @@ -10,7 +10,7 @@ V8 requires C++20 support as of https://chromium-review.googlesource.com/c/v8/v8 This can be removed when Electron upgrades to a version of Node.js containing the required V8 version. diff --git a/common.gypi b/common.gypi -index 679633dc6b4ce2a1f5f88e93d1a1c1feb4bbadb4..2caa183213d5632be81b763e894e37c09384391f 100644 +index 3a1d2fc9d147a8c89f7b5231d63d37f29979965d..6425ee9e8dba993f3e899362ce9bd7b097f08883 100644 --- a/common.gypi +++ b/common.gypi @@ -539,7 +539,7 @@ diff --git a/patches/node/build_enable_perfetto.patch b/patches/node/build_enable_perfetto.patch index 1bb292dd46878..a4aff646cb114 100644 --- a/patches/node/build_enable_perfetto.patch +++ b/patches/node/build_enable_perfetto.patch @@ -64,7 +64,7 @@ index 251f51ec454f9cba4023b8b6729241ee753aac13..1de8cac6e3953ce9cab9db03530da327 module.exports = { diff --git a/node.gyp b/node.gyp -index 442c1e7a6ddafbb7a7ec7a42a97ec04b28ea4d93..3a66c11d39dd2fd129c8f54098a9607e080ecca0 100644 +index d604e0ddd973174aa7be6f2d250af7b9c2b0fcfd..8e97aa3f44087213425927113fe72bca9ddef45b 100644 --- a/node.gyp +++ b/node.gyp @@ -176,7 +176,6 @@ diff --git a/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch b/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch index 3f5e9b39ae14b..c698eb1826006 100644 --- a/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch +++ b/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch @@ -7,7 +7,7 @@ Subject: build: ensure native module compilation fails if not using a new This should not be upstreamed, it is a quality-of-life patch for downstream module builders. diff --git a/common.gypi b/common.gypi -index 33af43cd768c24b26d523f3db66eb8b9eb26859a..679633dc6b4ce2a1f5f88e93d1a1c1feb4bbadb4 100644 +index e56ba31ed068b81f5c6fbd432cd82bb6916e9a85..3a1d2fc9d147a8c89f7b5231d63d37f29979965d 100644 --- a/common.gypi +++ b/common.gypi @@ -89,6 +89,8 @@ diff --git a/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch b/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch index 8b7051b7f036c..270f96dc50c2b 100644 --- a/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch +++ b/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch @@ -34,7 +34,7 @@ index 0244a214b187e67e0cb89f26cd019855963ec93a..b65a3be6bcb0e28f7f43367d0fa9da53 let kResistStopPropagation; diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index 8b104e175ccf8de90c138337f83f8f6ce1348ac7..35cf42a5e533cb799bf129df0c8370bfe8310233 100644 +index efeaaef7e4dc64a0adb5e6bdbbe18945890de62c..557972987abeaa56918362638a17a9b6e0763238 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -35,6 +35,7 @@ using v8::Value; diff --git a/patches/node/build_restore_clang_as_default_compiler_on_macos.patch b/patches/node/build_restore_clang_as_default_compiler_on_macos.patch index 88f7586d58c69..e03a0c3932020 100644 --- a/patches/node/build_restore_clang_as_default_compiler_on_macos.patch +++ b/patches/node/build_restore_clang_as_default_compiler_on_macos.patch @@ -11,7 +11,7 @@ node-gyp will use the result of `process.config` that reflects the environment in which the binary got built. diff --git a/common.gypi b/common.gypi -index 2caa183213d5632be81b763e894e37c09384391f..2cce436c4a9e3d942f957f6c94a4ef9e3db391ce 100644 +index 6425ee9e8dba993f3e899362ce9bd7b097f08883..95d66f75b582b3fd3b833109dfe110ae5b196f83 100644 --- a/common.gypi +++ b/common.gypi @@ -128,6 +128,7 @@ diff --git a/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch b/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch index a2901455347a2..ca0d26b834e9c 100644 --- a/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch +++ b/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch @@ -8,7 +8,7 @@ they use themselves as the entry point. We should try to upstream some form of this. diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js -index 0cda54fd85e1e0bff13d4718a269eb3e7c60312a..6b165062a5eaa40f6e5614bca50bc33ccbdb85cc 100644 +index 98ed40e3076f6628b1771dade63ac51600e8e447..1eba13caf1e00a8b41b2cf8afc4168c8f98be69f 100644 --- a/lib/internal/process/pre_execution.js +++ b/lib/internal/process/pre_execution.js @@ -245,12 +245,14 @@ function patchProcessObject(expandArgv1) { diff --git a/patches/node/cli_move_--trace-atomics-wait_to_eol.patch b/patches/node/cli_move_--trace-atomics-wait_to_eol.patch index dae7ed917b98d..b2451d795d6ad 100644 --- a/patches/node/cli_move_--trace-atomics-wait_to_eol.patch +++ b/patches/node/cli_move_--trace-atomics-wait_to_eol.patch @@ -15,10 +15,10 @@ Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> diff --git a/doc/api/cli.md b/doc/api/cli.md -index 404e87e6d1237b5ee79cafd8a959c1b6d9d23fe5..7deda572c940f7b2e8c6813f1826796a13e4db38 100644 +index 8cabb58e621a9951acd5551afb85c192f2b1c690..b69bacebef3e5e5e5b191c61aa5fe0f71c1edfb3 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md -@@ -2709,39 +2709,6 @@ added: v12.0.0 +@@ -2712,39 +2712,6 @@ added: v12.0.0 Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.3'. Use to disable support for TLSv1.2, which is not as secure as TLSv1.3. @@ -58,7 +58,7 @@ index 404e87e6d1237b5ee79cafd8a959c1b6d9d23fe5..7deda572c940f7b2e8c6813f1826796a ### `--trace-deprecation` <!-- YAML -@@ -3423,7 +3390,6 @@ one is included in the list below. +@@ -3429,7 +3396,6 @@ one is included in the list below. * `--tls-min-v1.1` * `--tls-min-v1.2` * `--tls-min-v1.3` @@ -67,7 +67,7 @@ index 404e87e6d1237b5ee79cafd8a959c1b6d9d23fe5..7deda572c940f7b2e8c6813f1826796a * `--trace-env-js-stack` * `--trace-env-native-stack` diff --git a/doc/node.1 b/doc/node.1 -index f41323c799ad34c8e17a36d81e4cc2b16e50e9ee..a9ff54edfad1d053ec1ac544f28e14a1898ac177 100644 +index 6913992a5476d2317a34fb69d3c6af63b686f9a6..1faef5ba1d4206a5cc4c71cb71f7a08f613fbf17 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -539,11 +539,6 @@ but the option is supported for compatibility with older Node.js versions. @@ -83,7 +83,7 @@ index f41323c799ad34c8e17a36d81e4cc2b16e50e9ee..a9ff54edfad1d053ec1ac544f28e14a1 Print stack traces for deprecations. . diff --git a/src/node.cc b/src/node.cc -index 0c2a4d344c991c2ca0d9d90934cf7921abf2a629..19d9fb77f1aaf003e43b7d7016f45e6c35df06b3 100644 +index 0d383dcdb80fe30e3c2d6880b44f626f065bb1f3..9d9992dacbc595c987827f55eb12ea8af0480df6 100644 --- a/src/node.cc +++ b/src/node.cc @@ -232,44 +232,6 @@ void Environment::WaitForInspectorFrontendByOptions() { @@ -150,7 +150,7 @@ index 0c2a4d344c991c2ca0d9d90934cf7921abf2a629..19d9fb77f1aaf003e43b7d7016f45e6c isolate_->SetPromiseHook(TracePromises); } diff --git a/src/node_options.cc b/src/node_options.cc -index d6988a5a8c068022d10607c32e57ac667f821337..4deaa52a8a4688bca32d41b74124604b6e33c80b 100644 +index cfb95f65ccb0c6d150be8a4039caf26faf7cd06d..cb0ecd81b33abd7743e66e225a6cb96b4094f935 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -773,10 +773,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { @@ -165,7 +165,7 @@ index d6988a5a8c068022d10607c32e57ac667f821337..4deaa52a8a4688bca32d41b74124604b "show stack traces on deprecations", &EnvironmentOptions::trace_deprecation, diff --git a/src/node_options.h b/src/node_options.h -index 2b7df46312b8be58d6062b6a2f6084247e075c37..2d52cde518926577834f77424fa5b2231ca3374e 100644 +index 3ff1f4b4baa64b8ee2a4587e150ea14cb2fdfdf4..26ac54c4b18dd00b2c1f915dc1ba0e90ca70b48f 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -204,7 +204,6 @@ class EnvironmentOptions : public Options { diff --git a/patches/node/cli_remove_deprecated_v8_flag.patch b/patches/node/cli_remove_deprecated_v8_flag.patch index f1d7fb80b0b5a..0e2555325e123 100644 --- a/patches/node/cli_remove_deprecated_v8_flag.patch +++ b/patches/node/cli_remove_deprecated_v8_flag.patch @@ -18,10 +18,10 @@ Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> diff --git a/doc/api/cli.md b/doc/api/cli.md -index 78c0794a57fd4fdcdd8a64fe98a6b13f9ef3f23a..404e87e6d1237b5ee79cafd8a959c1b6d9d23fe5 100644 +index 1a1e0ec1d89a4d0ecf1c9ae37c23b8f660c051d6..8cabb58e621a9951acd5551afb85c192f2b1c690 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md -@@ -3461,7 +3461,6 @@ V8 options that are allowed are: +@@ -3467,7 +3467,6 @@ V8 options that are allowed are: * `--disallow-code-generation-from-strings` * `--enable-etw-stack-walking` * `--expose-gc` @@ -30,7 +30,7 @@ index 78c0794a57fd4fdcdd8a64fe98a6b13f9ef3f23a..404e87e6d1237b5ee79cafd8a959c1b6 * `--jitless` * `--max-old-space-size` diff --git a/src/node_options.cc b/src/node_options.cc -index 367f7d9b1450e4d9e6d8fef36a2234e7d1344804..d6988a5a8c068022d10607c32e57ac667f821337 100644 +index 415d4e34f29bc303674dccbfdc231b251401961b..cfb95f65ccb0c6d150be8a4039caf26faf7cd06d 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -1001,11 +1001,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser( diff --git a/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch b/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch index 54cd7b6f5c2bb..3f5ec3af50551 100644 --- a/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch +++ b/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch @@ -7,7 +7,7 @@ common.gypi is a file that's included in the node header bundle, despite the fact that we do not build node with gyp. diff --git a/common.gypi b/common.gypi -index 20135003dd040ebfb3661c81c89fde93ce00fbfb..33af43cd768c24b26d523f3db66eb8b9eb26859a 100644 +index 7780ae106b479ca620a4065f08d6e4acc200628c..e56ba31ed068b81f5c6fbd432cd82bb6916e9a85 100644 --- a/common.gypi +++ b/common.gypi @@ -91,6 +91,23 @@ diff --git a/patches/node/fix_allow_passing_fileexists_fn_to_legacymainresolve.patch b/patches/node/fix_allow_passing_fileexists_fn_to_legacymainresolve.patch index 47b72be018a34..3565a108e1957 100644 --- a/patches/node/fix_allow_passing_fileexists_fn_to_legacymainresolve.patch +++ b/patches/node/fix_allow_passing_fileexists_fn_to_legacymainresolve.patch @@ -53,10 +53,10 @@ index e3afd30ba1f591d0298793bc42fd7166a4219bce..408dc96307d7f52f92db41004b358051 const maybeMain = resolvedOption <= legacyMainResolveExtensionsIndexes.kResolvedByMainIndexNode ? packageConfig.main || './' : ''; diff --git a/src/node_file.cc b/src/node_file.cc -index 7d174113a22cb26e767f8756ce0f0cdedd68d7d7..f3142dab526064114771af154c3389961771b5dc 100644 +index c8e7e341b1d9f5a1142afdc265704455c252a0c3..7221708a2296ff44c19ed01dc52d78653ecc4e58 100644 --- a/src/node_file.cc +++ b/src/node_file.cc -@@ -3482,13 +3482,25 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) { +@@ -3504,13 +3504,25 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) { } BindingData::FilePathIsFileReturnType BindingData::FilePathIsFile( @@ -83,7 +83,7 @@ index 7d174113a22cb26e767f8756ce0f0cdedd68d7d7..f3142dab526064114771af154c338996 uv_fs_t req; int rc = uv_fs_stat(env->event_loop(), &req, file_path.c_str(), nullptr); -@@ -3546,6 +3558,11 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { +@@ -3568,6 +3580,11 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { std::optional<std::string> initial_file_path; std::string file_path; @@ -95,7 +95,7 @@ index 7d174113a22cb26e767f8756ce0f0cdedd68d7d7..f3142dab526064114771af154c338996 if (args.Length() >= 2 && args[1]->IsString()) { auto package_config_main = Utf8Value(isolate, args[1]).ToString(); -@@ -3566,7 +3583,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { +@@ -3588,7 +3605,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { BufferValue buff_file_path(isolate, local_file_path); ToNamespacedPath(env, &buff_file_path); @@ -104,7 +104,7 @@ index 7d174113a22cb26e767f8756ce0f0cdedd68d7d7..f3142dab526064114771af154c338996 case BindingData::FilePathIsFileReturnType::kIsFile: return args.GetReturnValue().Set(i); case BindingData::FilePathIsFileReturnType::kIsNotFile: -@@ -3603,7 +3620,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { +@@ -3625,7 +3642,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { BufferValue buff_file_path(isolate, local_file_path); ToNamespacedPath(env, &buff_file_path); diff --git a/patches/node/fix_assert_module_in_the_renderer_process.patch b/patches/node/fix_assert_module_in_the_renderer_process.patch index 6b733d340fea7..6c41fe86663c4 100644 --- a/patches/node/fix_assert_module_in_the_renderer_process.patch +++ b/patches/node/fix_assert_module_in_the_renderer_process.patch @@ -13,7 +13,7 @@ if the override has been disabled. This will be upstreamed. diff --git a/lib/internal/assert/utils.js b/lib/internal/assert/utils.js -index d059fa89baf7d4f7d921d00871a97494be4a166a..a0f7fd2e4512e9b4196bbf5fe4390b00e5e2d9a8 100644 +index 13e41d67c635c27bd5e69eb4960eace34beaef0d..9a99c9ca93907630f9f3ba7ba24577a11465661c 100644 --- a/lib/internal/assert/utils.js +++ b/lib/internal/assert/utils.js @@ -24,6 +24,7 @@ const AssertionError = require('internal/assert/assertion_error'); @@ -44,7 +44,7 @@ index d059fa89baf7d4f7d921d00871a97494be4a166a..a0f7fd2e4512e9b4196bbf5fe4390b00 let filename = call.getFileName(); const line = call.getLineNumber() - 1; diff --git a/src/node_options.cc b/src/node_options.cc -index 9cf107b1048208ffcb69ff91e0d36ffacc741805..367f7d9b1450e4d9e6d8fef36a2234e7d1344804 100644 +index 653112fbaea59fe8b446236085dcae8be671c6e5..415d4e34f29bc303674dccbfdc231b251401961b 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -1566,14 +1566,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) { diff --git a/patches/node/fix_cppgc_initializing_twice.patch b/patches/node/fix_cppgc_initializing_twice.patch index 475bd2830be6a..d4a2189b9a3e1 100644 --- a/patches/node/fix_cppgc_initializing_twice.patch +++ b/patches/node/fix_cppgc_initializing_twice.patch @@ -12,10 +12,10 @@ This can be removed/refactored once Node.js upgrades to a version of V8 containing the above CL. diff --git a/src/node.cc b/src/node.cc -index 19d9fb77f1aaf003e43b7d7016f45e6c35df06b3..9fad3198757ce639eb491eb628c6264a17002bf2 100644 +index 9d9992dacbc595c987827f55eb12ea8af0480df6..d43a88b8780f04d186485a2dc58ad07083e699ac 100644 --- a/src/node.cc +++ b/src/node.cc -@@ -1208,7 +1208,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, +@@ -1222,7 +1222,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, result->platform_ = per_process::v8_platform.Platform(); } diff --git a/patches/node/fix_crypto_tests_to_run_with_bssl.patch b/patches/node/fix_crypto_tests_to_run_with_bssl.patch index 40564e4046eb7..72c38d7c08705 100644 --- a/patches/node/fix_crypto_tests_to_run_with_bssl.patch +++ b/patches/node/fix_crypto_tests_to_run_with_bssl.patch @@ -11,7 +11,7 @@ before it's acceptable to upstream, as this patch comments out a couple of tests that upstream probably cares about. diff --git a/test/parallel/test-crypto-async-sign-verify.js b/test/parallel/test-crypto-async-sign-verify.js -index b35dd08e6c49796418cd9d10eb5cc9d02b39961e..97bcd79b331db140d157e6b1faf92625597edc98 100644 +index 7a5e72b1e8e498fdfa8de12aa9b9672dc047248c..f326c52894f86ef9c82c685a8685245138f01ed5 100644 --- a/test/parallel/test-crypto-async-sign-verify.js +++ b/test/parallel/test-crypto-async-sign-verify.js @@ -89,6 +89,7 @@ test('rsa_public.pem', 'rsa_private.pem', 'sha256', false, @@ -268,7 +268,7 @@ index 48cd1ed4df61aaddeee8785cb90f83bdd9628187..d09e01712c617597833bb1320a32a967 // No-pad encrypted string should return the same: diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js -index dcd5045daaf58c60e27c1e2f7941033302241339..b52ec0e2cd5d6b1c9a0fee3064f2f8ff3b6e4308 100644 +index 119bc3c2d20ea7d681f0b579f9d91ad46cdc3634..8d13b105fa426015a873c411ad1d7f64b3d9580e 100644 --- a/test/parallel/test-crypto-rsa-dsa.js +++ b/test/parallel/test-crypto-rsa-dsa.js @@ -29,12 +29,11 @@ const dsaPkcs8KeyPem = fixtures.readKey('dsa_private_pkcs8.pem'); @@ -296,9 +296,9 @@ index dcd5045daaf58c60e27c1e2f7941033302241339..b52ec0e2cd5d6b1c9a0fee3064f2f8ff - if (padding === constants.RSA_PKCS1_PADDING) { + if (!process.features.openssl_is_boringssl) { if (!process.config.variables.node_shared_openssl) { - assert.throws(() => { - crypto.privateDecrypt({ -@@ -471,7 +470,7 @@ assert.throws(() => { + // TODO(richardlau) remove check and else branch after deps/openssl + // is upgraded. +@@ -489,7 +488,7 @@ assert.throws(() => { // // Test DSA signing and verification // diff --git a/patches/node/fix_do_not_resolve_electron_entrypoints.patch b/patches/node/fix_do_not_resolve_electron_entrypoints.patch index e481b7a973137..c9357d2e059e1 100644 --- a/patches/node/fix_do_not_resolve_electron_entrypoints.patch +++ b/patches/node/fix_do_not_resolve_electron_entrypoints.patch @@ -6,7 +6,7 @@ Subject: fix: do not resolve electron entrypoints This wastes fs cycles and can result in strange behavior if this path actually exists on disk diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index 8b55082d2bb0ce743b190a601aff0651095049cd..eb71a78c91b277157980aa1359578390c9fd1ae3 100644 +index 8e099e0961b624c6143f5a60f050855b3366f177..dfed827fd3fc794f52bad39ccf7b5c14b1caebc3 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -293,6 +293,9 @@ function cjsPreparseModuleExports(filename, source, isMain, format) { diff --git a/patches/node/fix_expose_readfilesync_override_for_modules.patch b/patches/node/fix_expose_readfilesync_override_for_modules.patch index 3feb62a0ed205..2b87a86ef43fb 100644 --- a/patches/node/fix_expose_readfilesync_override_for_modules.patch +++ b/patches/node/fix_expose_readfilesync_override_for_modules.patch @@ -8,10 +8,10 @@ an API override to replace the native `ReadFileSync` in the `modules` binding. diff --git a/src/env_properties.h b/src/env_properties.h -index d4961ac90fbc7fffe44f7d494bfae37ba0fa07e0..7b414e6733adff5740bd8e661846824962048c3e 100644 +index 5cb8dd86fe712755fe09556d227702aec905fbc9..f1768da6ef82fa85700fecbdf9321653345e92c5 100644 --- a/src/env_properties.h +++ b/src/env_properties.h -@@ -505,6 +505,7 @@ +@@ -506,6 +506,7 @@ V(maybe_cache_generated_source_map, v8::Function) \ V(messaging_deserialize_create_object, v8::Function) \ V(message_port, v8::Object) \ diff --git a/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch b/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch index e6cbd4f2f6d9f..1ed3bfda1b5cd 100644 --- a/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch +++ b/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch @@ -64,10 +64,10 @@ index e718d7b3e7c11addc78cf7af33c93f63a9cb247b..3334818153068468967baa5adc1ed238 } } diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js -index 8d98d50395cf7fbbaf9ae30387727bff5c6cd550..ed3b3c02bbdac78c163d589557651618814685a5 100644 +index 87c14d1f84def72c1326e09154b38c417840634e..4491499e6da1724a7fd66b028a78ba145d6114aa 100644 --- a/lib/internal/modules/esm/loader.js +++ b/lib/internal/modules/esm/loader.js -@@ -494,7 +494,7 @@ class ModuleLoader { +@@ -498,7 +498,7 @@ class ModuleLoader { } const cjsModule = wrap[imported_cjs_symbol]; @@ -103,7 +103,7 @@ index 859b6bfedac4bbee2df054f9ebca7cbaaed45f18..5aa946f66c71beff0b7a43c30638ab28 const packageConfig = packageJsonReader.read(packageJSONPath, { __proto__: null, specifier, base, isESM: true }); diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index 3a69558d7a3dba5bfcb7d3c13299f698fe6c18a1..de1539cebeb1874cbafbe76a4f03217693db2aa1 100644 +index d595ccbab8ce3042e83054e875eef612914115d8..7ea645b92a015b04cc121ff62aa1fc64b2961241 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -188,7 +188,7 @@ function createCJSModuleWrap(url, source, isMain, format, loadCJS = loadCJSModul diff --git a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch index 689fe6d14fb64..f1d0d94ef1bfc 100644 --- a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch +++ b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch @@ -228,10 +228,10 @@ index d94f6e1c82c4a62547b3b395f375c86ce4deb5de..b81b9005365272217c77e2b9289bd9f8 X509View ca(sk_X509_value(peer_certs.get(), i)); if (!cert->view().isIssuedBy(ca)) continue; diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc -index 64b850089ec837915910a243b1d5e4ed68655f63..508f7c1a49a0812583363c9e35244c3f5fbf5f89 100644 +index 5e368e3fd93b560c629aef720acd576f118cb1d6..ea5179ad5155cb599891d7421cd61df719ac4cae 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc -@@ -121,7 +121,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx, +@@ -141,7 +141,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx, // the CA certificates. SSL_CTX_clear_extra_chain_certs(ctx); @@ -240,7 +240,7 @@ index 64b850089ec837915910a243b1d5e4ed68655f63..508f7c1a49a0812583363c9e35244c3f X509* ca = sk_X509_value(extra_certs, i); // NOTE: Increments reference count on `ca` -@@ -1584,11 +1584,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) { +@@ -1752,11 +1752,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) { // If the user specified "auto" for dhparams, the JavaScript layer will pass // true to this function instead of the original string. Any other string // value will be interpreted as custom DH parameters below. @@ -254,7 +254,7 @@ index 64b850089ec837915910a243b1d5e4ed68655f63..508f7c1a49a0812583363c9e35244c3f DHPointer dh; { BIOPointer bio(LoadBIO(env, args[0])); -@@ -1814,7 +1815,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) { +@@ -1982,7 +1983,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) { } // Add CA certs too @@ -555,7 +555,7 @@ index 7b2072ad39c3f1a7c73101b25b69beb781141e26..d23536d88d21255d348175425a59e242 #if NODE_OPENSSL_HAS_QUIC #include <openssl/quic.h> diff --git a/src/node_options.cc b/src/node_options.cc -index 228fbe645587ab2d36574b46f1a4f6668bd56177..9cf107b1048208ffcb69ff91e0d36ffacc741805 100644 +index 249361e351946c16452124029c60fca52782adf9..653112fbaea59fe8b446236085dcae8be671c6e5 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -7,7 +7,7 @@ @@ -568,7 +568,7 @@ index 228fbe645587ab2d36574b46f1a4f6668bd56177..9cf107b1048208ffcb69ff91e0d36ffa #endif diff --git a/src/node_options.h b/src/node_options.h -index 0b75516eb426929dc95b7531a00bdb01d1c39185..2b7df46312b8be58d6062b6a2f6084247e075c37 100644 +index 2a1a6aaf9f2d358ffffb0a8171df470686b9450e..3ff1f4b4baa64b8ee2a4587e150ea14cb2fdfdf4 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -11,7 +11,7 @@ diff --git a/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch b/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch index 046340baebd65..ff8f0ae81c00a 100644 --- a/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch +++ b/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch @@ -50,7 +50,7 @@ index 5aa946f66c71beff0b7a43c30638ab28a1a5dfc0..e3afd30ba1f591d0298793bc42fd7166 }); const { search, hash } = resolved; diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index de1539cebeb1874cbafbe76a4f03217693db2aa1..8b55082d2bb0ce743b190a601aff0651095049cd 100644 +index 7ea645b92a015b04cc121ff62aa1fc64b2961241..8e099e0961b624c6143f5a60f050855b3366f177 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -25,7 +25,7 @@ const { diff --git a/patches/node/fix_remove_fastapitypedarray_usage.patch b/patches/node/fix_remove_fastapitypedarray_usage.patch index dd7b160fd3556..13e446df08857 100644 --- a/patches/node/fix_remove_fastapitypedarray_usage.patch +++ b/patches/node/fix_remove_fastapitypedarray_usage.patch @@ -48,7 +48,7 @@ index fe669d40c31a29334b047b9cfee3067f64ef0a7b..9e5de7bbe574add017cd12ee091304d0 static CFunction fast_timing_safe_equal(CFunction::Make(FastTimingSafeEqual)); diff --git a/src/node_buffer.cc b/src/node_buffer.cc -index d0338b8a2d9cd3fd9f6db1f0f16f83b198ce0e7e..c4a87539dab49ff40e0951616777b132d4059e01 100644 +index e39852c8e0392e0a9ae5d4ea58be115416e19233..c94b14741c827a81d69a6f036426a344e563ad72 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -44,6 +44,14 @@ @@ -135,7 +135,7 @@ index d0338b8a2d9cd3fd9f6db1f0f16f83b198ce0e7e..c4a87539dab49ff40e0951616777b132 } static v8::CFunction fast_compare(v8::CFunction::Make(FastCompare)); -@@ -1148,14 +1158,13 @@ void SlowIndexOfNumber(const FunctionCallbackInfo<Value>& args) { +@@ -1149,14 +1159,13 @@ void SlowIndexOfNumber(const FunctionCallbackInfo<Value>& args) { } int32_t FastIndexOfNumber(v8::Local<v8::Value>, @@ -153,7 +153,7 @@ index d0338b8a2d9cd3fd9f6db1f0f16f83b198ce0e7e..c4a87539dab49ff40e0951616777b132 } static v8::CFunction fast_index_of_number( -@@ -1495,21 +1504,31 @@ void SlowWriteString(const FunctionCallbackInfo<Value>& args) { +@@ -1496,21 +1505,31 @@ void SlowWriteString(const FunctionCallbackInfo<Value>& args) { template <encoding encoding> uint32_t FastWriteString(Local<Value> receiver, @@ -194,7 +194,7 @@ index d0338b8a2d9cd3fd9f6db1f0f16f83b198ce0e7e..c4a87539dab49ff40e0951616777b132 static const v8::CFunction fast_write_string_ascii( diff --git a/src/util.h b/src/util.h -index 6376cf4f81113cdb2e3c179b800f1c79b51ab762..cc7ad99f981f564fba0395159d9d8b39901050ff 100644 +index dbec66247852df91c57c2a4e9664d2fea7d3dcef..efeb12d837db7b88093e4a6a2e20df562180ca1e 100644 --- a/src/util.h +++ b/src/util.h @@ -60,6 +60,7 @@ diff --git a/patches/node/fix_remove_harmony-import-assertions_from_node_cc.patch b/patches/node/fix_remove_harmony-import-assertions_from_node_cc.patch deleted file mode 100644 index eb48a5a18140f..0000000000000 --- a/patches/node/fix_remove_harmony-import-assertions_from_node_cc.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr <shelley.vohr@gmail.com> -Date: Fri, 18 Oct 2024 17:01:06 +0200 -Subject: fix: remove harmony-import-assertions from node.cc - -harmony-import-assertions has been removed from V8 as of -https://chromium-review.googlesource.com/c/v8/v8/+/5507047, -so we should remove it from node.cc as well. - -This patch can be removed when we upgrade to a V8 version that -contains the above CL. - -diff --git a/src/node.cc b/src/node.cc -index c0d0b734edfa729c91a8112189c480e3f2382988..a43d36c731693b9d2ed1ba13f6b4bb33bf6c4ca4 100644 ---- a/src/node.cc -+++ b/src/node.cc -@@ -816,7 +816,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args, - } - // TODO(nicolo-ribaudo): remove this once V8 doesn't enable it by default - // anymore. -- v8_args.emplace_back("--no-harmony-import-assertions"); -+ // v8_args.emplace_back("--no-harmony-import-assertions"); - - auto env_opts = per_process::cli_options->per_isolate->per_env; - if (std::find(v8_args.begin(), v8_args.end(), diff --git a/patches/node/fix_remove_outdated_v8_flags_from_node_cc.patch b/patches/node/fix_remove_outdated_v8_flags_from_node_cc.patch new file mode 100644 index 0000000000000..5b14b177b5a54 --- /dev/null +++ b/patches/node/fix_remove_outdated_v8_flags_from_node_cc.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr <shelley.vohr@gmail.com> +Date: Fri, 18 Oct 2024 17:01:06 +0200 +Subject: fix: remove outdated V8 flags from node.cc + +Refs https://chromium-review.googlesource.com/c/v8/v8/+/5507047 +Refs https://chromium-review.googlesource.com/c/v8/v8/+/6249026 + +The above CL removes the `--harmony-import-assertions` and +--experimental-wasm-memory64 flags from V8. + +This patch can be removed when we upgrade to a V8 version that +contains the above CLs. + +diff --git a/src/node.cc b/src/node.cc +index 1b5e989e5456a9bf77475e06250702029568c08d..61d65094aebd7f3016d51a8e7c9c761fc69cecba 100644 +--- a/src/node.cc ++++ b/src/node.cc +@@ -816,7 +816,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args, + } + // TODO(nicolo-ribaudo): remove this once V8 doesn't enable it by default + // anymore. +- v8_args.emplace_back("--no-harmony-import-assertions"); ++ // v8_args.emplace_back("--no-harmony-import-assertions"); + + auto env_opts = per_process::cli_options->per_isolate->per_env; + if (std::find(v8_args.begin(), v8_args.end(), +@@ -828,7 +828,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args, + + // Support stable Phase 5 WebAssembly proposals + v8_args.emplace_back("--experimental-wasm-imported-strings"); +- v8_args.emplace_back("--experimental-wasm-memory64"); ++ // v8_args.emplace_back("--experimental-wasm-memory64"); + v8_args.emplace_back("--experimental-wasm-exnref"); + + #ifdef __POSIX__ diff --git a/patches/node/pass_all_globals_through_require.patch b/patches/node/pass_all_globals_through_require.patch index 1f02e81bce378..cc4c2dbac1cac 100644 --- a/patches/node/pass_all_globals_through_require.patch +++ b/patches/node/pass_all_globals_through_require.patch @@ -6,10 +6,10 @@ Subject: Pass all globals through "require" (cherry picked from commit 7d015419cb7a0ecfe6728431a4ed2056cd411d62) diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index 9b51e5bf4cdfbc8127efc7d5882581daa1cbd81f..aca7c36e9b566847228bd4f13f2c8237509207db 100644 +index a7d8fa1139c82054ac37a4e11cfb68605dc21f31..589c239aa544e118b7d9b7fff86d7deefe903896 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -200,6 +200,13 @@ const { +@@ -202,6 +202,13 @@ const { CHAR_FORWARD_SLASH, } = require('internal/constants'); @@ -23,7 +23,7 @@ index 9b51e5bf4cdfbc8127efc7d5882581daa1cbd81f..aca7c36e9b566847228bd4f13f2c8237 const { isProxy, } = require('internal/util/types'); -@@ -1683,10 +1690,12 @@ Module.prototype._compile = function(content, filename, format) { +@@ -1701,10 +1708,12 @@ Module.prototype._compile = function(content, filename, format) { if (this[kIsMainSymbol] && getOptionValue('--inspect-brk')) { const { callAndPauseOnStart } = internalBinding('inspector'); result = callAndPauseOnStart(compiledWrapper, thisValue, exports, diff --git a/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch b/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch index dbbf389088cd5..2772afcbe43c9 100644 --- a/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch +++ b/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch @@ -7,7 +7,7 @@ We use this to allow node's 'fs' module to read from ASAR files as if they were a real filesystem. diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js -index dd9e3e58d72fb9ada1528212f80e0e911292a266..5758c74f6139dbe4fbeeae9d1e9b078688261257 100644 +index 1a39b9f15e689e5c7ca1e3001b2ef6d854f8cc1e..9035311718c0a68e903e0ce748480bc78112c6ff 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -132,6 +132,10 @@ process.domain = null; diff --git a/patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch b/patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch index 1a5b2c83760c5..48cae66788047 100644 --- a/patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch +++ b/patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch @@ -102,10 +102,10 @@ index 1079e3beb02e5f5d71a15fd2db65cb93ebd175d6..a7be609c3ab9093cec5145367b95ae68 worker::Worker* worker_context_ = nullptr; PerIsolateWrapperData* wrapper_data_; diff --git a/src/node.cc b/src/node.cc -index a43d36c731693b9d2ed1ba13f6b4bb33bf6c4ca4..0c2a4d344c991c2ca0d9d90934cf7921abf2a629 100644 +index 61d65094aebd7f3016d51a8e7c9c761fc69cecba..0d383dcdb80fe30e3c2d6880b44f626f065bb1f3 100644 --- a/src/node.cc +++ b/src/node.cc -@@ -1257,6 +1257,14 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, +@@ -1271,6 +1271,14 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, result->platform_ = per_process::v8_platform.Platform(); } @@ -120,7 +120,7 @@ index a43d36c731693b9d2ed1ba13f6b4bb33bf6c4ca4..0c2a4d344c991c2ca0d9d90934cf7921 if (!(flags & ProcessInitializationFlags::kNoInitializeV8)) { V8::Initialize(); -@@ -1266,14 +1274,6 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, +@@ -1280,14 +1288,6 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, absl::SetMutexDeadlockDetectionMode(absl::OnDeadlockCycle::kIgnore); } @@ -174,10 +174,10 @@ index 4119ac1b002681d39711eac810ca2fcc2702ffc7..790347056cde949ffe6cf8498a7eca0c ExitCode NodeMainInstance::Run() { diff --git a/src/node_worker.cc b/src/node_worker.cc -index 9d56d8f793ef48a79867f465530554ae0226f2cd..842eb999c6ef0cb877cc2ee4acf75bb597a117da 100644 +index e2dbdd39b06c4f2f85eba46cbf1383af144456c6..6c43928ba5a9752c78544d1c77198278eb11ccd7 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc -@@ -162,6 +162,9 @@ class WorkerThreadData { +@@ -163,6 +163,9 @@ class WorkerThreadData { SetIsolateCreateParamsForNode(¶ms); w->UpdateResourceConstraints(¶ms.constraints); params.array_buffer_allocator_shared = allocator; @@ -187,7 +187,7 @@ index 9d56d8f793ef48a79867f465530554ae0226f2cd..842eb999c6ef0cb877cc2ee4acf75bb5 Isolate* isolate = NewIsolate(¶ms, &loop_, w->platform_, w->snapshot_data()); if (isolate == nullptr) { -@@ -230,13 +233,8 @@ class WorkerThreadData { +@@ -231,13 +234,8 @@ class WorkerThreadData { *static_cast<bool*>(data) = true; }, &platform_finished); diff --git a/patches/node/test_formally_mark_some_tests_as_flaky.patch b/patches/node/test_formally_mark_some_tests_as_flaky.patch index 595f85a075db7..dd4e460660c05 100644 --- a/patches/node/test_formally_mark_some_tests_as_flaky.patch +++ b/patches/node/test_formally_mark_some_tests_as_flaky.patch @@ -7,7 +7,7 @@ Instead of disabling the tests, flag them as flaky so they still run but don't cause CI failures on flakes. diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status -index 6303908ce180db4d409707ae1f049319358642fb..d487497417e20c778dde57197dc18373799df36a 100644 +index 0546a81ef11ec7ac8d6e214e4090b0e7b94bf70f..25b08be32c7a0aa501b64102f10c9bffc8c57970 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -5,6 +5,16 @@ prefix parallel diff --git a/patches/node/test_use_static_method_names_in_call_stacks.patch b/patches/node/test_use_static_method_names_in_call_stacks.patch index 5fdb4a1fe55d3..5f645c5c3aeb9 100644 --- a/patches/node/test_use_static_method_names_in_call_stacks.patch +++ b/patches/node/test_use_static_method_names_in_call_stacks.patch @@ -6,10 +6,10 @@ Subject: test: use static method names in call stacks Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5907815 diff --git a/test/message/assert_throws_stack.out b/test/message/assert_throws_stack.out -index b1f3ea2108ba9c1a4f98928062b44b927eea31f2..897ddf36a04eb03edd01dd6b9a6fb4394cbdf114 100644 +index 1ecda64889e07fe64d03404d478311f9f8267a4e..2b5587292a2c7a8797589804f14bfd0c3e9725f8 100644 --- a/test/message/assert_throws_stack.out +++ b/test/message/assert_throws_stack.out -@@ -23,7 +23,7 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: +@@ -24,7 +24,7 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: actual: Error: foo at assert.throws.bar (*assert_throws_stack.js:*) at getActual (node:assert:*) diff --git a/script/node-disabled-tests.json b/script/node-disabled-tests.json index 1ffa363aaf799..1cec2c885f19e 100644 --- a/script/node-disabled-tests.json +++ b/script/node-disabled-tests.json @@ -118,6 +118,7 @@ "parallel/test-tls-server-failed-handshake-emits-clienterror", "parallel/test-tls-set-ciphers", "parallel/test-tls-set-ciphers-error", + "parallel/test-tls-set-default-ca-certificates-recovery", "parallel/test-tls-set-sigalgs", "parallel/test-tls-socket-allow-half-open-option", "parallel/test-tls-socket-failed-handshake-emits-error", From bd581285fdeadf45b7ed3f6ca4894e213b30ef56 Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Mon, 8 Sep 2025 12:57:15 +0200 Subject: [PATCH 065/268] chore: bump chromium to 141.0.7390.7 (main) (#48212) * chore: bump chromium in DEPS to 141.0.7381.3 * chore: update patches * chore: bump chromium in DEPS to 141.0.7382.0 * chore: update patches * chore: bump chromium in DEPS to 141.0.7384.0 * chore: bump chromium in DEPS to 141.0.7386.0 * [Extensions] Move devtools_page and chrome_url_overrides handlers Refs https://chromium-review.googlesource.com/c/chromium/src/+/6862700 * Reland "[api] Advance deprecation of GetIsolate" Refs https://chromium-review.googlesource.com/c/v8/v8/+/6875273 * Move "system integrated UI" concept out of NativeTheme. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6867375 * chore: update patches * Reland "[PermissionOptions] Return PermissionResult in callback for requests" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6851838 * Reland "[exit-time-destructors] Enable by default" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6859042 * chore: update patches * [FSA] Revoke Read access after removing file via FileSystemAccess API Refs https://chromium-review.googlesource.com/c/chromium/src/+/6677249 * chore: IWYU * [DevToolsUIBindings] Accept an object for `dispatchHttpRequest` params Refs https://chromium-review.googlesource.com/c/chromium/src/+/6877528 * chore: IWYU * Pass navigation UI parameters on EnterFullscreen in EAM Refs https://chromium-review.googlesource.com/c/chromium/src/+/6874923 * chore: rm band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch * Remove unused PreHandleMouseEvent Refs https://chromium-review.googlesource.com/c/chromium/src/+/6880411 * 6878583: siso: update to version 1.4.1 https://chromium-review.googlesource.com/c/chromium/src/+/6878583 * Fold native_theme_browser into native_theme. https://chromium-review.googlesource.com/c/chromium/src/+/6882627 * fixup: Reland "[exit-time-destructors] Enable by default https://chromium-review.googlesource.com/c/chromium/src/+/6859042 * chore: update filenames.libcxx.gni * chore: IWYU * fixup: chore: IWYU * fixup: Reland "[exit-time-destructors] Enable by default * fixup: Reland "[exit-time-destructors] Enable by default * Remove common_theme.*; place its method in NativeTheme instead. https://chromium-review.googlesource.com/c/chromium/src/+/6886029 * fixup: Reland "[exit-time-destructors] Enable by default * Better track when WebPreferences need updates for color-related changes. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6886797 * chore: bump chromium in DEPS to 141.0.7390.7 * 6904664: Reland "Make BrowserContext::GetPath() const" https://chromium-review.googlesource.com/c/chromium/src/+/6904664 * Restore read access after certain file modification operations https://chromium-review.googlesource.com/c/chromium/src/+/6861041 * fixup: Move "system integrated UI" concept out of NativeTheme. * fixup: Reland "[exit-time-destructors] Enable by default * chore: update patches * 6906096: Remove GetSysSkColor(). https://chromium-review.googlesource.com/c/chromium/src/+/6906096 * Inline implementation of SysColorChangeListener into the lone user. https://chromium-review.googlesource.com/c/chromium/src/+/6905083 Also 6906096: Remove GetSysSkColor(). | https://chromium-review.googlesource.com/c/chromium/src/+/6906096 * fixup: 6906096: Remove GetSysSkColor() --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> --- .github/actions/fix-sync/action.yml | 2 +- BUILD.gn | 1 - DEPS | 2 +- build/checksum_header.py | 2 +- chromium_src/BUILD.gn | 2 + filenames.libcxx.gni | 5 +- patches/boringssl/expose_ripemd160.patch | 6 +- ...xpose_several_extra_cipher_functions.patch | 2 +- ...ack_ssl_error_zero_return_explicitly.patch | 6 +- patches/chromium/.patches | 3 +- ...client_precreatemessageloop_callback.patch | 6 +- .../add_didinstallconditionalfeatures.patch | 20 +- ..._entangleandinjectmessageportchannel.patch | 15 +- ...adjust_accessibility_ui_for_electron.patch | 34 +-- ..._scheduler_throttling_per_renderview.patch | 14 +- ...ith_using_deprecated_nsopenpanel_api.patch | 108 ------- patches/chromium/blink_local_frame.patch | 8 +- .../build_add_electron_tracing_category.patch | 4 +- ...ild_add_public_config_simdutf_config.patch | 4 +- ..._depend_on_packed_resource_integrity.patch | 12 +- patches/chromium/build_gn.patch | 2 +- .../build_libc_as_static_library.patch | 4 +- patches/chromium/can_create_window.patch | 36 +-- ...hore_add_electron_deps_to_gitignores.patch | 2 +- ...ameter_in_script_lifecycle_observers.patch | 272 ++++++++++++++++++ ...ther_in_electron_views_and_delegates.patch | 8 +- ...fy_chromium_handling_of_mouse_events.patch | 6 +- .../chromium/chore_partial_revert_of.patch | 4 +- ...tition_attribute_dcheck_for_webviews.patch | 4 +- .../chore_patch_out_profile_methods.patch | 8 +- ...screationoverridden_with_full_params.patch | 40 +-- .../custom_protocols_plzserviceworker.patch | 8 +- .../disable_compositor_recycling.patch | 4 +- patches/chromium/disable_hidden.patch | 10 +- .../chromium/enable_reset_aspect_ratio.patch | 4 +- ...xpose_setuseragent_on_networkcontext.patch | 28 +- .../extend_apply_webpreferences.patch | 4 +- ...dd_set_theme_source_to_allow_apps_to.patch | 16 +- ..._registry_to_multibuffer_data_source.patch | 4 +- ...t_allow_code_cache_in_custom_schemes.patch | 55 ++-- ...sharingpicker_on_supported_platforms.patch | 30 +- ...e_launch_options_for_service_process.patch | 2 +- ...moothing_css_rule_and_blink_painting.patch | 22 +- ...screen_rendering_with_viz_compositor.patch | 10 +- ...same_application_can_use_safestorage.patch | 6 +- ..._raw_response_headers_from_urlloader.patch | 12 +- ...indows_in_the_current_application_in.patch | 4 +- ...allback_for_sync_and_async_clipboard.patch | 4 +- ..._exclusive_access_for_electron_needs.patch | 35 +-- ...dless_mode_handling_in_native_widget.patch | 6 +- .../fix_aspect_ratio_with_max_size.patch | 2 +- ...ding_non-standard_schemes_in_iframes.patch | 6 +- ..._background_throttling_in_compositor.patch | 12 +- ...ingshelper_behind_branding_buildflag.patch | 6 +- ...board_hides_on_input_blur_in_webview.patch | 8 +- ..._properly_honor_printing_page_ranges.patch | 7 +- ...x_remove_caption-removing_style_call.patch | 2 +- ..._material_update_issue_on_windows_11.patch | 4 +- ...original_resize_performance_on_macos.patch | 4 +- ...from_localframe_requestexecutescript.patch | 24 +- ...t_menu_item_when_opened_via_keyboard.patch | 11 +- patches/chromium/frame_host_manager.patch | 6 +- .../chromium/gritsettings_resource_ids.patch | 6 +- ...reate_a_console_if_logging_to_stderr.patch | 4 +- ..._avoid_private_macos_api_usage.patch.patch | 82 +++--- ...emote_certificate_verification_logic.patch | 26 +- .../chromium/notification_provenance.patch | 6 +- ...xture_remove_keyed_mutex_on_win_dxgi.patch | 6 +- patches/chromium/picture-in-picture.patch | 14 +- ...utofill_colors_to_the_color_pipeline.patch | 12 +- ...r_changes_to_the_webcontentsobserver.patch | 16 +- ..._expose_file_system_access_blocklist.patch | 24 +- ...pose_hostimportmoduledynamically_and.patch | 12 +- ..._electron_permissiontypes_into_blink.patch | 4 +- ...efactor_unfilter_unresponsive_events.patch | 4 +- .../render_widget_host_view_mac.patch | 2 +- ...ean_up_stale_macwebcontentsocclusion.patch | 4 +- ...al_remove_unused_prehandlemouseevent.patch | 119 ++++++++ ...ssivethrottlingwithwebsocket_feature.patch | 2 +- ...windowtreehostwin_window_enlargement.patch | 6 +- patches/chromium/scroll_bounce_flag.patch | 4 +- ...ecks_in_mediastreamdevicescontroller.patch | 21 +- .../support_mixed_sandbox_with_zygote.patch | 4 +- patches/chromium/web_contents.patch | 8 +- patches/chromium/webview_fullscreen.patch | 10 +- .../worker_context_will_destroy.patch | 16 +- ...feat_add_hook_to_notify_script_ready.patch | 12 +- ...i_to_allow_electron_to_set_dock_side.patch | 4 +- patches/node/.patches | 2 + ...de_folder_from_exit-time-destructors.patch | 45 +++ ...pi_advance_deprecation_of_getisolate.patch | 82 ++++++ ...orts_to_avoid_conflicts_with_node_js.patch | 8 +- shell/browser/api/electron_api_app.cc | 15 +- shell/browser/api/electron_api_app.h | 2 - .../browser/api/electron_api_native_theme.cc | 19 +- shell/browser/api/electron_api_native_theme.h | 9 + shell/browser/api/electron_api_protocol.cc | 37 ++- shell/browser/api/electron_api_protocol.h | 4 +- .../api/electron_api_system_preferences.h | 13 +- .../electron_api_system_preferences_mac.mm | 14 +- .../electron_api_system_preferences_win.cc | 22 +- .../browser/api/electron_api_web_contents.cc | 4 +- shell/browser/api/electron_api_web_contents.h | 2 +- shell/browser/api/frame_subscriber.cc | 1 + shell/browser/auto_updater.cc | 8 +- shell/browser/auto_updater.h | 2 +- shell/browser/auto_updater_mac.mm | 12 +- shell/browser/electron_browser_client.cc | 14 + shell/browser/electron_browser_client.h | 3 + shell/browser/electron_browser_context.cc | 2 +- shell/browser/electron_browser_context.h | 2 +- shell/browser/electron_permission_manager.cc | 43 ++- shell/browser/electron_permission_manager.h | 14 +- .../electron_extensions_browser_client.cc | 3 +- .../file_system_access_permission_context.cc | 12 +- .../file_system_access_permission_context.h | 4 + shell/browser/font_defaults.cc | 2 +- shell/browser/native_window_views.cc | 5 +- shell/browser/native_window_views.h | 4 +- shell/browser/native_window_views_win.cc | 8 +- .../linux/libnotify_notification.cc | 52 ++-- .../win/windows_toast_notification.cc | 41 ++- .../win/windows_toast_notification.h | 4 +- shell/browser/relauncher_linux.cc | 10 +- shell/browser/ui/file_dialog.h | 4 + shell/browser/ui/inspectable_web_contents.cc | 3 +- shell/browser/ui/inspectable_web_contents.h | 3 + shell/browser/ui/tray_icon_win.cc | 4 +- shell/browser/ui/views/menu_bar.cc | 5 +- shell/browser/usb/electron_usb_delegate.cc | 1 + .../browser/web_contents_permission_helper.cc | 4 +- shell/common/application_info_win.cc | 19 +- shell/common/color_util.cc | 5 + shell/common/color_util.h | 1 + shell/common/electron_command_line.cc | 18 +- shell/common/electron_command_line.h | 5 +- .../extensions/api/_manifest_features.json | 8 - .../electron_extensions_api_provider.cc | 8 +- .../gin_converters/content_converter.cc | 13 +- .../common/gin_converters/content_converter.h | 5 +- .../common/gin_converters/frame_converter.cc | 18 +- shell/common/gin_helper/callback.cc | 26 +- shell/common/node_util.cc | 15 +- .../api/electron_api_context_bridge.cc | 91 +++--- .../api/electron_api_context_bridge.h | 2 + .../renderer/api/electron_api_ipc_renderer.cc | 6 +- shell/renderer/api/electron_api_web_frame.cc | 26 +- shell/renderer/electron_api_service_impl.cc | 2 +- .../electron_render_frame_observer.cc | 4 +- .../renderer/electron_render_frame_observer.h | 3 +- .../electron_sandboxed_renderer_client.cc | 5 +- .../electron_sandboxed_renderer_client.h | 1 + shell/renderer/preload_realm_context.cc | 15 +- shell/renderer/preload_realm_context.h | 3 +- shell/renderer/renderer_client_base.cc | 7 +- shell/renderer/renderer_client_base.h | 1 + shell/services/node/node_service.cc | 18 +- 157 files changed, 1417 insertions(+), 882 deletions(-) delete mode 100644 patches/chromium/band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch create mode 100644 patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch create mode 100644 patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch create mode 100644 patches/node/chore_exclude_electron_node_folder_from_exit-time-destructors.patch create mode 100644 patches/node/reland_api_advance_deprecation_of_getisolate.patch diff --git a/.github/actions/fix-sync/action.yml b/.github/actions/fix-sync/action.yml index b72d0ab18b9db..b7442702ba292 100644 --- a/.github/actions/fix-sync/action.yml +++ b/.github/actions/fix-sync/action.yml @@ -109,7 +109,7 @@ runs: deps-file: src/DEPS installation-dir: src/third_party/siso/cipd target-platform: ${{ inputs.target-platform }} - package: infra/build/siso/${platform} + package: build/siso/${platform} - name: Fixup angle git if: ${{ inputs.target-platform != 'linux' }} shell: bash diff --git a/BUILD.gn b/BUILD.gn index 1d274958b48f2..5344d87749ab7 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -688,7 +688,6 @@ source_set("electron_lib") { "//components/app_launch_prefetch", "//components/crash/core/app:crash_export_thunks", "//third_party/libxml:xml_writer", - "//ui/native_theme:native_theme_browser", "//ui/wm", "//ui/wm/public", ] diff --git a/DEPS b/DEPS index 494d98dd4f525..90e9130775e9b 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '141.0.7361.0', + '141.0.7390.7', 'node_version': 'v22.19.0', 'nan_version': diff --git a/build/checksum_header.py b/build/checksum_header.py index 9f98c510ee8ef..86237e8885557 100644 --- a/build/checksum_header.py +++ b/build/checksum_header.py @@ -12,7 +12,7 @@ namespace electron::snapshot_checksum { -const std::string kChecksum = "{checksum}"; +inline constexpr std::string_view kChecksum = "{checksum}"; } // namespace electron::snapshot_checksum diff --git a/chromium_src/BUILD.gn b/chromium_src/BUILD.gn index 2acef923561bf..3ae92ec6f881d 100644 --- a/chromium_src/BUILD.gn +++ b/chromium_src/BUILD.gn @@ -23,6 +23,8 @@ static_library("chrome") { "//chrome/browser/browser_process.h", "//chrome/browser/devtools/devtools_contents_resizing_strategy.cc", "//chrome/browser/devtools/devtools_contents_resizing_strategy.h", + "//chrome/browser/devtools/devtools_dispatch_http_request_params.cc", + "//chrome/browser/devtools/devtools_dispatch_http_request_params.h", "//chrome/browser/devtools/devtools_embedder_message_dispatcher.cc", "//chrome/browser/devtools/devtools_embedder_message_dispatcher.h", "//chrome/browser/devtools/devtools_eye_dropper.cc", diff --git a/filenames.libcxx.gni b/filenames.libcxx.gni index 1b32357d69c4a..2e8cacac37182 100644 --- a/filenames.libcxx.gni +++ b/filenames.libcxx.gni @@ -1034,14 +1034,12 @@ libcxx_headers = [ "//third_party/libc++/src/include/__fwd/get.h", "//third_party/libc++/src/include/__fwd/ios.h", "//third_party/libc++/src/include/__fwd/istream.h", - "//third_party/libc++/src/include/__fwd/map.h", "//third_party/libc++/src/include/__fwd/mdspan.h", "//third_party/libc++/src/include/__fwd/memory.h", "//third_party/libc++/src/include/__fwd/memory_resource.h", "//third_party/libc++/src/include/__fwd/ostream.h", "//third_party/libc++/src/include/__fwd/pair.h", "//third_party/libc++/src/include/__fwd/queue.h", - "//third_party/libc++/src/include/__fwd/set.h", "//third_party/libc++/src/include/__fwd/span.h", "//third_party/libc++/src/include/__fwd/sstream.h", "//third_party/libc++/src/include/__fwd/stack.h", @@ -1381,7 +1379,6 @@ libcxx_headers = [ "//third_party/libc++/src/include/__type_traits/aligned_storage.h", "//third_party/libc++/src/include/__type_traits/aligned_union.h", "//third_party/libc++/src/include/__type_traits/alignment_of.h", - "//third_party/libc++/src/include/__type_traits/can_extract_key.h", "//third_party/libc++/src/include/__type_traits/common_reference.h", "//third_party/libc++/src/include/__type_traits/common_type.h", "//third_party/libc++/src/include/__type_traits/conditional.h", @@ -1462,6 +1459,7 @@ libcxx_headers = [ "//third_party/libc++/src/include/__type_traits/is_trivially_relocatable.h", "//third_party/libc++/src/include/__type_traits/is_unbounded_array.h", "//third_party/libc++/src/include/__type_traits/is_union.h", + "//third_party/libc++/src/include/__type_traits/is_unqualified.h", "//third_party/libc++/src/include/__type_traits/is_unsigned.h", "//third_party/libc++/src/include/__type_traits/is_valid_expansion.h", "//third_party/libc++/src/include/__type_traits/is_void.h", @@ -1522,6 +1520,7 @@ libcxx_headers = [ "//third_party/libc++/src/include/__utility/small_buffer.h", "//third_party/libc++/src/include/__utility/swap.h", "//third_party/libc++/src/include/__utility/to_underlying.h", + "//third_party/libc++/src/include/__utility/try_key_extraction.h", "//third_party/libc++/src/include/__utility/unreachable.h", "//third_party/libc++/src/include/__variant/monostate.h", "//third_party/libc++/src/include/__vector/comparison.h", diff --git a/patches/boringssl/expose_ripemd160.patch b/patches/boringssl/expose_ripemd160.patch index e9a3f74d62403..4f0feb3b25ebc 100644 --- a/patches/boringssl/expose_ripemd160.patch +++ b/patches/boringssl/expose_ripemd160.patch @@ -10,10 +10,10 @@ this patch is required to provide ripemd160 support in the nodejs crypto module. diff --git a/crypto/digest/digest_extra.cc b/crypto/digest/digest_extra.cc -index 431214277314941c5ec031f03ad09e7f22800983..4cc48bbc3f8434876f35767c1a9f01d27388be99 100644 +index 345c94f6e26e88aac77b9feb92bd8d6665234981..8ef2ab8987da63f321d1dbb79f2eded8b8209bfc 100644 --- a/crypto/digest/digest_extra.cc +++ b/crypto/digest/digest_extra.cc -@@ -46,6 +46,7 @@ static const struct nid_to_digest nid_to_digest_mapping[] = { +@@ -47,6 +47,7 @@ static const struct nid_to_digest nid_to_digest_mapping[] = { {NID_sha512, EVP_sha512, SN_sha512, LN_sha512}, {NID_sha512_256, EVP_sha512_256, SN_sha512_256, LN_sha512_256}, {NID_md5_sha1, EVP_md5_sha1, SN_md5_sha1, LN_md5_sha1}, @@ -82,7 +82,7 @@ index e04b80cd6a1a215fc87f8fd8d750c3d258c3974f..8fdf1c624794f568bfc77b7b6b0c510b void EVP_MD_do_all(void (*callback)(const EVP_MD *cipher, const char *name, diff --git a/include/openssl/digest.h b/include/openssl/digest.h -index 710c6e6d110378d1db10d8c2ae57b2d844c603b9..dbb1e0cd5e9480d1ac7a86cbca6fae29d6a8dca4 100644 +index b604aba00c1c6cea8002b6dc298ea5fe979589b1..1c123aa1dca09ae60c31be2a6dab9a64748eac17 100644 --- a/include/openssl/digest.h +++ b/include/openssl/digest.h @@ -48,6 +48,9 @@ OPENSSL_EXPORT const EVP_MD *EVP_blake2b256(void); diff --git a/patches/boringssl/feat_expose_several_extra_cipher_functions.patch b/patches/boringssl/feat_expose_several_extra_cipher_functions.patch index b4fdeb6d33b59..f597b35e64321 100644 --- a/patches/boringssl/feat_expose_several_extra_cipher_functions.patch +++ b/patches/boringssl/feat_expose_several_extra_cipher_functions.patch @@ -28,7 +28,7 @@ RC2 Ciphers: rc2-40-cbc It's unclear whether this would be accepted upstream. We should try regardless. diff --git a/crypto/cipher/get_cipher.cc b/crypto/cipher/get_cipher.cc -index 2622dc78d1da236862312f55bc0a40f26116486e..ac7aff6518ad5c2a0e48bd91d60a1f825851b634 100644 +index 6513df01c4b3e4d33fc6b521d9aae78ec5499e73..52eb7fea420e3d81d274fd5c1e21e4da0229687f 100644 --- a/crypto/cipher/get_cipher.cc +++ b/crypto/cipher/get_cipher.cc @@ -31,6 +31,7 @@ static const struct { diff --git a/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch b/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch index 814a889349dbe..11fdd3d719b53 100644 --- a/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch +++ b/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch @@ -20,10 +20,10 @@ index 2cdcbc346175eeee69402ecee7f169e61c655199..f7226fe711e4214b216ea2c5173a0212 case ssl_open_record_error: diff --git a/ssl/ssl_lib.cc b/ssl/ssl_lib.cc -index aa8ef8a0c53978021b675e1d909c3f78045dbb7b..61794458f7a7a849d48a225533ef4f8431434e42 100644 +index 24c0d496f9d655f0f32634430e9c31d5592be939..b62418ba31927c5c4e2b424b993e40c63c868201 100644 --- a/ssl/ssl_lib.cc +++ b/ssl/ssl_lib.cc -@@ -1206,7 +1206,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) { +@@ -1207,7 +1207,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) { } if (ret_code == 0) { @@ -32,7 +32,7 @@ index aa8ef8a0c53978021b675e1d909c3f78045dbb7b..61794458f7a7a849d48a225533ef4f84 return SSL_ERROR_ZERO_RETURN; } // An EOF was observed which violates the protocol, and the underlying -@@ -2567,13 +2567,7 @@ void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx) { +@@ -2568,13 +2568,7 @@ void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx) { return CRYPTO_get_ex_data(&ctx->ex_data, idx); } diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 3bc84f21cc308..ef92669f4538b 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -138,4 +138,5 @@ fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch feat_add_support_for_embedder_snapshot_validation.patch chore_restore_some_deprecated_wrapper_utility_in_gin.patch chore_add_electron_objects_to_wrappablepointertag.patch -band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch +chore_expose_isolate_parameter_in_script_lifecycle_observers.patch +revert_partial_remove_unused_prehandlemouseevent.patch diff --git a/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch b/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch index d1d794b1424b7..b925e0fd10dee 100644 --- a/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch +++ b/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch @@ -10,10 +10,10 @@ Allows Electron to restore WER when ELECTRON_DEFAULT_ERROR_MODE is set. This should be upstreamed. diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc -index 6f8e8dd8e7ddb9e3d4c142493f249f616520d613..f89b2e5b846b3b96c99dea2a3b49bc9823ab51e5 100644 +index 558575cf06b10b59e114a9f53b90f01d8ecf63c4..0204ce5351a5190a20317f0cef6d3e8421541cac 100644 --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc -@@ -271,6 +271,10 @@ int GpuMain(MainFunctionParams parameters) { +@@ -272,6 +272,10 @@ int GpuMain(MainFunctionParams parameters) { // to the GpuProcessHost once the GpuServiceImpl has started. viz::GpuLogMessageManager::GetInstance()->InstallPreInitializeLogHandler(); @@ -24,7 +24,7 @@ index 6f8e8dd8e7ddb9e3d4c142493f249f616520d613..f89b2e5b846b3b96c99dea2a3b49bc98 // We are experiencing what appear to be memory-stomp issues in the GPU // process. These issues seem to be impacting the task executor and listeners // registered to it. Create the task executor on the heap to guard against -@@ -380,7 +384,6 @@ int GpuMain(MainFunctionParams parameters) { +@@ -381,7 +385,6 @@ int GpuMain(MainFunctionParams parameters) { #endif const bool dead_on_arrival = !init_success; diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index 87eae933a9233..2bfa03d84f90e 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -10,10 +10,10 @@ DidCreateScriptContext is called, not all JS APIs are available in the context, which can cause some preload scripts to trip. diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h -index c26cff0adef977617b10bbaa7c0c13cf5e6e91d3..f9c7af85af33572a88956bf1bc9765e90be3d39b 100644 +index 284da783658bec333be748941784d43b13f6f244..18714ce8fc27c8d56c5deac27ba335078c452d0a 100644 --- a/content/public/renderer/render_frame_observer.h +++ b/content/public/renderer/render_frame_observer.h -@@ -138,6 +138,8 @@ class CONTENT_EXPORT RenderFrameObserver { +@@ -139,6 +139,8 @@ class CONTENT_EXPORT RenderFrameObserver { virtual void DidHandleOnloadEvents() {} virtual void DidCreateScriptContext(v8::Local<v8::Context> context, int32_t world_id) {} @@ -23,10 +23,10 @@ index c26cff0adef977617b10bbaa7c0c13cf5e6e91d3..f9c7af85af33572a88956bf1bc9765e9 int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 859113ed13e77dcdd72b2ab327b94e94492f5d24..51948d7fcae02bd85133a859989f93a07dd0e236 100644 +index bc2ec7491d7072be77307d7b8af06e5397e2bdfb..addef4de8a95f47964a895e1d1cc4763f565a028 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4677,6 +4677,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, +@@ -4679,6 +4679,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, observer.DidCreateScriptContext(context, world_id); } @@ -40,10 +40,10 @@ index 859113ed13e77dcdd72b2ab327b94e94492f5d24..51948d7fcae02bd85133a859989f93a0 int world_id) { for (auto& observer : observers_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index 5456a50df5f75509c22afa47034afbb624303a75..bbd1edd567aee984001288901581dfa56dbfa2dc 100644 +index 2950a6f600aab24226ef59acabddc74c9b67cac8..f0f4335aa815ea50dbf9b720b41e4eb31f27fb90 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -603,6 +603,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -602,6 +602,8 @@ class CONTENT_EXPORT RenderFrameImpl void DidObserveLayoutShift(double score, bool after_input_or_scroll) override; void DidCreateScriptContext(v8::Local<v8::Context> context, int world_id) override; @@ -53,10 +53,10 @@ index 5456a50df5f75509c22afa47034afbb624303a75..bbd1edd567aee984001288901581dfa5 int world_id) override; void DidChangeScrollOffset() override; diff --git a/third_party/blink/public/web/web_local_frame_client.h b/third_party/blink/public/web/web_local_frame_client.h -index 5c1c325d1e4037b0b413c3519e963c5f0210086a..994dd3118dfa43816db60e5dfb61c00bf366e92d 100644 +index 101e727b3a97bc764315eb694dc3975f9a408f9c..52e8828d8fffaba8ab05436cb4d727595f18238a 100644 --- a/third_party/blink/public/web/web_local_frame_client.h +++ b/third_party/blink/public/web/web_local_frame_client.h -@@ -662,6 +662,9 @@ class BLINK_EXPORT WebLocalFrameClient { +@@ -661,6 +661,9 @@ class BLINK_EXPORT WebLocalFrameClient { virtual void DidCreateScriptContext(v8::Local<v8::Context>, int32_t world_id) {} @@ -92,7 +92,7 @@ index 36baf908d3be8aed44ff60b8de2cffe2eee15efe..8d73ddb12013ce195026b9f63050cf33 int32_t world_id) = 0; virtual bool AllowScriptExtensions() = 0; diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -index 114cbd9c806572b664b9d9af75955231fa68cc50..03a0b2f762a2d9677212c89e63bb2d2691fac2b7 100644 +index b02b60ff5f6650332c54ecc66f6fdb274b737aa7..1aacf6f66b543a4ede6ab5d885143dd4a0821e8a 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc +++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc @@ -295,6 +295,13 @@ void LocalFrameClientImpl::DidCreateScriptContext( @@ -110,7 +110,7 @@ index 114cbd9c806572b664b9d9af75955231fa68cc50..03a0b2f762a2d9677212c89e63bb2d26 v8::Local<v8::Context> context, int32_t world_id) { diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.h b/third_party/blink/renderer/core/frame/local_frame_client_impl.h -index 081c8fabbcc514e47ff33d7e07a5eac3d112a518..e3fab574523a4b63069587b2fcaf30267fddf7c4 100644 +index fcc0928abbc454281b022e0451d993651ecba42f..16066fe34ee0335a0dabe00b6890e5844349c0b5 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client_impl.h +++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.h @@ -81,6 +81,8 @@ class CORE_EXPORT LocalFrameClientImpl final : public LocalFrameClient { diff --git a/patches/chromium/add_webmessageportconverter_entangleandinjectmessageportchannel.patch b/patches/chromium/add_webmessageportconverter_entangleandinjectmessageportchannel.patch index 19c0f09bb77de..0b622370ca739 100644 --- a/patches/chromium/add_webmessageportconverter_entangleandinjectmessageportchannel.patch +++ b/patches/chromium/add_webmessageportconverter_entangleandinjectmessageportchannel.patch @@ -8,7 +8,7 @@ accessing Blink internals. Its inverse, which already exists, is used in Android WebView. diff --git a/third_party/blink/public/web/web_message_port_converter.h b/third_party/blink/public/web/web_message_port_converter.h -index e7c4464f1b5aa19cbe441d94d88c949798ccb1e3..bd804d509ad5f3581154c6ede8653e7521cb71b8 100644 +index e7c4464f1b5aa19cbe441d94d88c949798ccb1e3..cdf9bca3df292531831b6df0077ba211a29548aa 100644 --- a/third_party/blink/public/web/web_message_port_converter.h +++ b/third_party/blink/public/web/web_message_port_converter.h @@ -13,6 +13,7 @@ @@ -19,18 +19,20 @@ index e7c4464f1b5aa19cbe441d94d88c949798ccb1e3..bd804d509ad5f3581154c6ede8653e75 } // namespace v8 namespace blink { -@@ -25,6 +26,9 @@ class BLINK_EXPORT WebMessagePortConverter { +@@ -25,6 +26,11 @@ class BLINK_EXPORT WebMessagePortConverter { // neutered, it will return nullopt. static std::optional<MessagePortChannel> DisentangleAndExtractMessagePortChannel(v8::Isolate*, v8::Local<v8::Value>); + + BLINK_EXPORT static v8::Local<v8::Value> -+ EntangleAndInjectMessagePortChannel(v8::Local<v8::Context>, MessagePortChannel); ++ EntangleAndInjectMessagePortChannel(v8::Isolate*, ++ v8::Local<v8::Context>, ++ MessagePortChannel); }; } // namespace blink diff --git a/third_party/blink/renderer/core/exported/web_message_port_converter.cc b/third_party/blink/renderer/core/exported/web_message_port_converter.cc -index 3270da19f73077b1fab7522144b9f3d52d9f6a5a..e6c5764c54a18b31223ac8c5b8f2d6ef732225d6 100644 +index 3270da19f73077b1fab7522144b9f3d52d9f6a5a..bbd3c968027549b89087d9a4394f575d84213eba 100644 --- a/third_party/blink/renderer/core/exported/web_message_port_converter.cc +++ b/third_party/blink/renderer/core/exported/web_message_port_converter.cc @@ -6,6 +6,7 @@ @@ -41,19 +43,20 @@ index 3270da19f73077b1fab7522144b9f3d52d9f6a5a..e6c5764c54a18b31223ac8c5b8f2d6ef #include "third_party/blink/renderer/bindings/core/v8/v8_message_port.h" #include "third_party/blink/renderer/core/messaging/message_port.h" -@@ -21,4 +22,15 @@ WebMessagePortConverter::DisentangleAndExtractMessagePortChannel( +@@ -21,4 +22,16 @@ WebMessagePortConverter::DisentangleAndExtractMessagePortChannel( return port->Disentangle(); } +v8::Local<v8::Value> +WebMessagePortConverter::EntangleAndInjectMessagePortChannel( ++ v8::Isolate* isolate, + v8::Local<v8::Context> context, + MessagePortChannel port_channel) { + auto* execution_context = ToExecutionContext(context); + CHECK(execution_context); + auto* port = MakeGarbageCollected<MessagePort>(*execution_context); + port->Entangle(std::move(port_channel)); -+ return port->ToV8(context->GetIsolate(), context->Global()); ++ return port->ToV8(isolate, context->Global()); +} + } // namespace blink diff --git a/patches/chromium/adjust_accessibility_ui_for_electron.patch b/patches/chromium/adjust_accessibility_ui_for_electron.patch index f9d42ad06d4f4..004a322f11c0a 100644 --- a/patches/chromium/adjust_accessibility_ui_for_electron.patch +++ b/patches/chromium/adjust_accessibility_ui_for_electron.patch @@ -10,7 +10,7 @@ usage of BrowserList and Browser as we subclass related methods and use our WindowList. diff --git a/chrome/browser/ui/webui/accessibility/accessibility_ui.cc b/chrome/browser/ui/webui/accessibility/accessibility_ui.cc -index 20ba6b8fa6a7d5edf8ebab80ec15ece93d750000..6c42d825e520982c7fcac52cf3aa8aabbba621cb 100644 +index 7f8d93e3637188280cc6e10c5c47a2cdbc0cc38f..7ccd2a61b45b3f864c1d8caefd3b235308986a8c 100644 --- a/chrome/browser/ui/webui/accessibility/accessibility_ui.cc +++ b/chrome/browser/ui/webui/accessibility/accessibility_ui.cc @@ -48,6 +48,7 @@ @@ -19,9 +19,9 @@ index 20ba6b8fa6a7d5edf8ebab80ec15ece93d750000..6c42d825e520982c7fcac52cf3aa8aab #include "content/public/browser/web_ui_data_source.h" +#include "electron/shell/browser/electron_browser_context.h" #include "ui/accessibility/accessibility_features.h" + #include "ui/accessibility/ax_mode.h" #include "ui/accessibility/ax_updates_and_events.h" - #include "ui/accessibility/platform/ax_platform.h" -@@ -173,7 +174,7 @@ base::Value::Dict BuildTargetDescriptor(content::RenderViewHost* rvh) { +@@ -178,7 +179,7 @@ base::Value::Dict BuildTargetDescriptor(content::RenderViewHost* rvh) { rvh->GetRoutingID(), accessibility_mode); } @@ -30,7 +30,7 @@ index 20ba6b8fa6a7d5edf8ebab80ec15ece93d750000..6c42d825e520982c7fcac52cf3aa8aab base::Value::Dict BuildTargetDescriptor(Browser* browser) { base::Value::Dict target_data; target_data.Set(kSessionIdField, browser->session_id().id()); -@@ -197,7 +198,7 @@ void HandleAccessibilityRequestCallback( +@@ -224,7 +225,7 @@ void HandleAccessibilityRequestCallback( auto& browser_accessibility_state = *content::BrowserAccessibilityState::GetInstance(); base::Value::Dict data; @@ -39,7 +39,7 @@ index 20ba6b8fa6a7d5edf8ebab80ec15ece93d750000..6c42d825e520982c7fcac52cf3aa8aab ui::AXMode mode = browser_accessibility_state.GetAccessibilityMode(); bool native = mode.has_mode(ui::AXMode::kNativeAPIs); bool web = mode.has_mode(ui::AXMode::kWebContents); -@@ -258,7 +259,7 @@ void HandleAccessibilityRequestCallback( +@@ -285,7 +286,7 @@ void HandleAccessibilityRequestCallback( data.Set(kIsScreenReaderActive, is_screen_reader_active); std::string pref_api_type = @@ -48,7 +48,7 @@ index 20ba6b8fa6a7d5edf8ebab80ec15ece93d750000..6c42d825e520982c7fcac52cf3aa8aab bool pref_api_type_supported = false; std::vector<ui::AXApiType::Type> supported_api_types = -@@ -326,11 +327,11 @@ void HandleAccessibilityRequestCallback( +@@ -353,11 +354,11 @@ void HandleAccessibilityRequestCallback( data.Set(kPagesField, std::move(page_list)); base::Value::List browser_list; @@ -61,8 +61,8 @@ index 20ba6b8fa6a7d5edf8ebab80ec15ece93d750000..6c42d825e520982c7fcac52cf3aa8aab +#endif data.Set(kBrowsersField, std::move(browser_list)); - std::string json_string; -@@ -804,7 +805,8 @@ void AccessibilityUIMessageHandler::SetGlobalString( + #if BUILDFLAG(IS_WIN) +@@ -845,7 +846,8 @@ void AccessibilityUIMessageHandler::SetGlobalString( const std::string value = CheckJSValue(data.FindString(kValueField)); if (string_name == kApiTypeField) { @@ -72,7 +72,7 @@ index 20ba6b8fa6a7d5edf8ebab80ec15ece93d750000..6c42d825e520982c7fcac52cf3aa8aab pref->SetString(prefs::kShownAccessibilityApiType, value); } } -@@ -858,7 +860,8 @@ void AccessibilityUIMessageHandler::RequestWebContentsTree( +@@ -899,7 +901,8 @@ void AccessibilityUIMessageHandler::RequestWebContentsTree( AXPropertyFilter::ALLOW_EMPTY); AddPropertyFilters(property_filters, deny, AXPropertyFilter::DENY); @@ -82,7 +82,7 @@ index 20ba6b8fa6a7d5edf8ebab80ec15ece93d750000..6c42d825e520982c7fcac52cf3aa8aab ui::AXApiType::Type api_type = ui::AXApiType::From(pref->GetString(prefs::kShownAccessibilityApiType)); std::string accessibility_contents = -@@ -885,6 +888,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( +@@ -926,6 +929,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( AXPropertyFilter::ALLOW_EMPTY); AddPropertyFilters(property_filters, deny, AXPropertyFilter::DENY); @@ -90,7 +90,7 @@ index 20ba6b8fa6a7d5edf8ebab80ec15ece93d750000..6c42d825e520982c7fcac52cf3aa8aab for (Browser* browser : *BrowserList::GetInstance()) { if (browser->session_id().id() == session_id) { base::Value::Dict result = BuildTargetDescriptor(browser); -@@ -897,6 +901,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( +@@ -938,6 +942,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( return; } } @@ -98,7 +98,7 @@ index 20ba6b8fa6a7d5edf8ebab80ec15ece93d750000..6c42d825e520982c7fcac52cf3aa8aab #endif // !BUILDFLAG(IS_ANDROID) // No browser with the specified |session_id| was found. base::Value::Dict result; -@@ -940,11 +945,13 @@ void AccessibilityUIMessageHandler::StopRecording( +@@ -981,11 +986,13 @@ void AccessibilityUIMessageHandler::StopRecording( } ui::AXApiType::Type AccessibilityUIMessageHandler::GetRecordingApiType() { @@ -115,7 +115,7 @@ index 20ba6b8fa6a7d5edf8ebab80ec15ece93d750000..6c42d825e520982c7fcac52cf3aa8aab // Check to see if it is in the supported types list. if (std::find(supported_types.begin(), supported_types.end(), api_type) == supported_types.end()) { -@@ -1014,8 +1021,11 @@ void AccessibilityUIMessageHandler::RequestAccessibilityEvents( +@@ -1055,10 +1062,13 @@ void AccessibilityUIMessageHandler::RequestAccessibilityEvents( // static void AccessibilityUIMessageHandler::RegisterProfilePrefs( user_prefs::PrefRegistrySyncable* registry) { @@ -127,11 +127,13 @@ index 20ba6b8fa6a7d5edf8ebab80ec15ece93d750000..6c42d825e520982c7fcac52cf3aa8aab + registry->RegisterBooleanPref(prefs::kShowInternalAccessibilityTree, false); +#endif } + + void AccessibilityUIMessageHandler::OnVisibilityChanged( diff --git a/chrome/browser/ui/webui/accessibility/accessibility_ui.h b/chrome/browser/ui/webui/accessibility/accessibility_ui.h -index b171afc941b2b3ef4aeba04a2b1c6eef2774d442..8f431aae69365bc8756e515c603332a7f1648148 100644 +index 4b9d7df73c901c57c14693e9f24a51694ecd375f..93e1c9a79d88c8b4c57b244c9eec1e83c1d1fa0a 100644 --- a/chrome/browser/ui/webui/accessibility/accessibility_ui.h +++ b/chrome/browser/ui/webui/accessibility/accessibility_ui.h -@@ -27,6 +27,8 @@ namespace content { +@@ -28,6 +28,8 @@ namespace content { class WebContents; } // namespace content @@ -140,7 +142,7 @@ index b171afc941b2b3ef4aeba04a2b1c6eef2774d442..8f431aae69365bc8756e515c603332a7 namespace user_prefs { class PrefRegistrySyncable; } // namespace user_prefs -@@ -77,6 +79,8 @@ class AccessibilityUIMessageHandler : public content::WebUIMessageHandler { +@@ -79,6 +81,8 @@ class AccessibilityUIMessageHandler : public content::WebUIMessageHandler, static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); private: diff --git a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch index b0dd83c2ce2cc..73e17def58161 100644 --- a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -51,10 +51,10 @@ index 7944fe64e0da112fc670358b75506bb199bb5e4a..0e3c16c6af2a078943e9f39808134ab2 void SendRendererPreferencesToRenderer( const blink::RendererPreferences& preferences); diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index b14f5bc3f023c512a066ce9ec9f681c96b1fafc4..b930145db575eb8c4e84297ddd610bd90fb5d3a8 100644 +index e98d74fecf4275ef8e7c6d23e5ea5ec3af80b926..0927d69b56d064327f0659d8ffe6ceff98064947 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -580,8 +580,8 @@ void RenderWidgetHostViewAura::ShowImpl(PageVisibilityState page_visibility) { +@@ -579,8 +579,8 @@ void RenderWidgetHostViewAura::ShowImpl(PageVisibilityState page_visibility) { // OnShowWithPageVisibility will not call NotifyHostAndDelegateOnWasShown, // which updates `visibility_`, unless the host is hidden. Make sure no update // is needed. @@ -116,10 +116,10 @@ index b3553c0783a7b00e055f82ef0b72bd866284473d..c91e49807ec0b56d8675048311182691 // Visibility ----------------------------------------------------------- diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index 316e686d00b72bf9d2e153221bfc3b97dbad8b61..b9799837c7ce14fc76045700b30e1358d4705251 100644 +index 714b713cd466ac289b3d172ac484ddfd2b46190b..be43ac07eb6563dcb72374dfc4f3bd34913e98c3 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -2490,6 +2490,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( +@@ -2500,6 +2500,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( TRACE_EVENT2("navigation", "WebViewImpl::SetPageLifecycleStateInternal", "old_state", old_state, "new_state", new_state); @@ -130,7 +130,7 @@ index 316e686d00b72bf9d2e153221bfc3b97dbad8b61..b9799837c7ce14fc76045700b30e1358 bool storing_in_bfcache = new_state->is_in_back_forward_cache && !old_state->is_in_back_forward_cache; bool restoring_from_bfcache = !new_state->is_in_back_forward_cache && -@@ -3999,10 +4003,23 @@ PageScheduler* WebViewImpl::Scheduler() const { +@@ -4009,10 +4013,23 @@ PageScheduler* WebViewImpl::Scheduler() const { return GetPage()->GetPageScheduler(); } @@ -155,7 +155,7 @@ index 316e686d00b72bf9d2e153221bfc3b97dbad8b61..b9799837c7ce14fc76045700b30e1358 // Do not throttle if the page should be painting. bool is_visible = diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h -index efcec3ebab3e60b66c2444e9a5c755c945f052cf..85cd9599cb5169f01c9096d9da89cff59930d1be 100644 +index 883269126ff93c26765ab62013035c6193f8adbb..f821da879a6b6b04d33ef60037a053f3a5c0851d 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h @@ -450,6 +450,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, @@ -166,7 +166,7 @@ index efcec3ebab3e60b66c2444e9a5c755c945f052cf..85cd9599cb5169f01c9096d9da89cff5 void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state, bool is_initial_state) override; mojom::blink::PageVisibilityState GetVisibilityState() override; -@@ -941,6 +942,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, +@@ -943,6 +944,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, // If true, we send IPC messages when |preferred_size_| changes. bool send_preferred_size_changes_ = false; diff --git a/patches/chromium/band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch b/patches/chromium/band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch deleted file mode 100644 index 557c3b3b4a5b5..0000000000000 --- a/patches/chromium/band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Avi Drissman <avi@chromium.org> -Date: Thu, 21 Aug 2025 07:33:53 -0700 -Subject: Band-aid over an issue with using deprecated NSOpenPanel API - -Because deprecated and broken NSOpenPanel API is used, the open panel -will sometimes incorrectly misunderstand a folder to be a package and -return it as a user selection when folders are disallowed from -selection. In that case, skip it. - -Bug: 40861123 -Bug: 41275486 -Bug: 440106155 -Change-Id: Ia0459a2bb76a30f4e126bd83069d7e13894d62f6 -Fixed: 438779953 -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6867298 -Commit-Queue: Avi Drissman <avi@chromium.org> -Reviewed-by: Christine Hollingsworth <christinesm@chromium.org> -Cr-Commit-Position: refs/heads/main@{#1504534} - -diff --git a/components/remote_cocoa/app_shim/select_file_dialog_bridge.mm b/components/remote_cocoa/app_shim/select_file_dialog_bridge.mm -index f0b8108a7f8a63f66664c6c5ad3ada0bf60805b3..67380a76c699d1c2db0d3a96671bb92657c4a6d3 100644 ---- a/components/remote_cocoa/app_shim/select_file_dialog_bridge.mm -+++ b/components/remote_cocoa/app_shim/select_file_dialog_bridge.mm -@@ -225,7 +225,7 @@ - (void)popupAction:(id)sender { - // Unfortunately, there's no great way to do strict type matching with - // NSOpenPanel. Setting explicit extensions via -allowedFileTypes is - // deprecated, and there's no way to specify that strict type equality should -- // be used for -allowedContentTypes (FB13721802). -+ // be used for -allowedContentTypes (https://crbug.com/41275486, FB13721802). - // - // -[NSOpenSavePanelDelegate panel:shouldEnableURL:] could be used to enforce - // strict type matching, however its presence on the delegate means that all -@@ -235,6 +235,10 @@ - (void)popupAction:(id)sender { - // - // Therefore, use the deprecated API, because it's the only way to remain - // performant while achieving strict type matching. -+ // -+ // TODO(https://crbug.com/440106155): Possibly reconsider using -+ // -panel:shouldEnableURL: if the speed impact is judged to be acceptable -+ // nowadays. - - #pragma clang diagnostic push - #pragma clang diagnostic ignored "-Wdeprecated-declarations" -@@ -479,8 +483,8 @@ - (void)popupAction:(id)sender { - - // See -[ExtensionDropdownHandler popupAction:] as to why file extensions - // are collected here rather than being converted to UTTypes. -- // TODO(FB13721802): Use UTTypes when strict type matching can be -- // specified. -+ // TODO(https://crbug.com/440106155, FB13721802): Use UTTypes when strict -+ // type matching can be specified. - NSString* ext_ns = base::SysUTF8ToNSString(ext); - if (![file_extensions_array containsObject:ext_ns]) { - [file_extensions_array addObject:ext_ns]; -@@ -571,18 +575,46 @@ - (void)popupAction:(id)sender { - } - NSString* path = url.path; - -- // There is a bug in macOS where, despite a request to disallow file -- // selection, files/packages are able to be selected. If indeed file -- // selection was disallowed, drop any files selected. -- // https://crbug.com/40861123, FB11405008 -- if (!open_panel.canChooseFiles) { -+ if (base::mac::MacOSMajorVersion() < 14) { -+ // There is a bug in macOS (https://crbug.com/40861123, FB11405008) -+ // where, despite a request to disallow file selection, files/packages -+ // are able to be selected. If indeed file selection was disallowed, -+ // drop any files selected. This issue is fixed in macOS 14, so only -+ // do the workaround on previous releases. -+ if (!open_panel.canChooseFiles) { -+ BOOL is_directory; -+ BOOL exists = -+ [NSFileManager.defaultManager fileExistsAtPath:path -+ isDirectory:&is_directory]; -+ BOOL is_package = -+ [NSWorkspace.sharedWorkspace isFilePackageAtPath:path]; -+ if (!exists || !is_directory || is_package) { -+ continue; -+ } -+ } -+ } -+ -+ // As long as FB13721802 remains unfixed, this class uses extensions to -+ // filter what files are available rather than UTTypes. This deprecated -+ // API has a problem, however. If you specify an extension to be shown -+ // as available, then the NSOpenPanel will assume that any directory -+ // that has that extension is a package, and will offer it to the user -+ // for selection even if directory selection isn't otherwise allowed. -+ // Therefore, if directories are disallowed, filter out any that find -+ // their way in if they're not actually packages. -+ // -+ // TODO(https://crbug.com/440106155, FB13721802): Possibly reconsider -+ // using -panel:shouldEnableURL: if the speed impact is judged to be -+ // acceptable nowadays, and drop this band-aid. -+ if (!open_panel.canChooseDirectories) { - BOOL is_directory; - BOOL exists = - [NSFileManager.defaultManager fileExistsAtPath:path - isDirectory:&is_directory]; - BOOL is_package = - [NSWorkspace.sharedWorkspace isFilePackageAtPath:path]; -- if (!exists || !is_directory || is_package) { -+ if (!exists || (is_directory && !is_package)) { -+ NSLog(@"dropping %@", path); - continue; - } - } diff --git a/patches/chromium/blink_local_frame.patch b/patches/chromium/blink_local_frame.patch index def5a21d47ee5..e629898e85d45 100644 --- a/patches/chromium/blink_local_frame.patch +++ b/patches/chromium/blink_local_frame.patch @@ -15,7 +15,7 @@ Refs changes in: This patch reverts the changes to fix associated crashes in Electron. diff --git a/third_party/blink/renderer/core/frame/frame.cc b/third_party/blink/renderer/core/frame/frame.cc -index c9f34fa47702504ccdefb8d61c55f5eaae501085..26df03d777c9ea487cae37f3df91d1df233b75e2 100644 +index cdb5b9246087b5678cf6a0f2713f6238dafc13de..7efbe7524c5ddd3785fff0e2d8901f931f024f48 100644 --- a/third_party/blink/renderer/core/frame/frame.cc +++ b/third_party/blink/renderer/core/frame/frame.cc @@ -134,14 +134,6 @@ bool Frame::Detach(FrameDetachType type) { @@ -49,10 +49,10 @@ index c9f34fa47702504ccdefb8d61c55f5eaae501085..26df03d777c9ea487cae37f3df91d1df // its owning reference back to our owning LocalFrame. client_->Detached(type); diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index e57912ad2d06ccd3d5c0f4d958a0735d1fab9997..7aeff27d6005d70f962fcbd90e6902987e3abd09 100644 +index 7d0f966131a4e91efd4652e23dec8287e98b82a9..75975a8d48b05ba25b169b93b62bb7d34eb3f5b7 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc -@@ -738,10 +738,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { +@@ -751,10 +751,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { } DCHECK(!view_ || !view_->IsAttached()); @@ -63,7 +63,7 @@ index e57912ad2d06ccd3d5c0f4d958a0735d1fab9997..7aeff27d6005d70f962fcbd90e690298 if (!Client()) return false; -@@ -795,6 +791,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { +@@ -808,6 +804,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { DCHECK(!view_->IsAttached()); Client()->WillBeDetached(); diff --git a/patches/chromium/build_add_electron_tracing_category.patch b/patches/chromium/build_add_electron_tracing_category.patch index d5d2be358809a..7828a1d8f7fd0 100644 --- a/patches/chromium/build_add_electron_tracing_category.patch +++ b/patches/chromium/build_add_electron_tracing_category.patch @@ -8,10 +8,10 @@ categories in use are known / declared. This patch is required for us to introduce a new Electron category for Electron-specific tracing. diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h -index e72bdff1c640ae6f6cbf91727a01985ccf9bd83b..40059b155b5ea9882a2ae4b624c68d3335fdc9f9 100644 +index 28d3c301465335cc664dad51e41133cd04fa8a62..290363dfa65a3207e5ade788825d470122a4afc8 100644 --- a/base/trace_event/builtin_categories.h +++ b/base/trace_event/builtin_categories.h -@@ -124,6 +124,7 @@ PERFETTO_DEFINE_CATEGORIES_IN_NAMESPACE_WITH_ATTRS( +@@ -126,6 +126,7 @@ PERFETTO_DEFINE_CATEGORIES_IN_NAMESPACE_WITH_ATTRS( perfetto::Category("drm"), perfetto::Category("drmcursor"), perfetto::Category("dwrite"), diff --git a/patches/chromium/build_add_public_config_simdutf_config.patch b/patches/chromium/build_add_public_config_simdutf_config.patch index 3417d2da5db21..de63ade9774c0 100644 --- a/patches/chromium/build_add_public_config_simdutf_config.patch +++ b/patches/chromium/build_add_public_config_simdutf_config.patch @@ -11,10 +11,10 @@ To accomplish this, we need to make simdutf's config public here for use by third_party/electron_node. diff --git a/third_party/simdutf/BUILD.gn b/third_party/simdutf/BUILD.gn -index 5fbce38841f04dad38f202f529ae84c609c6a8de..9f5ef9bceade8e30bbd2be616b9143e9708fefd8 100644 +index 68f1ed4e012cff5e0abd64a153a329518860689d..eeb846525e58f038733318915a770bafa22cafc5 100644 --- a/third_party/simdutf/BUILD.gn +++ b/third_party/simdutf/BUILD.gn -@@ -6,9 +6,14 @@ source_set("header") { +@@ -8,9 +8,14 @@ source_set("header") { sources = [ "simdutf.h" ] } diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index 1d639a33a7d0b..ac9e6aa7a1cc7 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -33,10 +33,10 @@ index e648bb4ed2ff72441faa8773e449e0b6174f5af5..fd2c1d3ac575d10de7d5c09e4418d172 "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index a8c2f5c562df8974ad02128a363e11ecd489031f..ca1bf94b55f1412599abbbe47063f0ce036c2352 100644 +index f2f0b13a9b96b906d39cfad4236a7e72b9439e06..7a2dc270b8c19f4418074ad23dd793d15223b33a 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4795,7 +4795,7 @@ static_library("browser") { +@@ -4811,7 +4811,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index a8c2f5c562df8974ad02128a363e11ecd489031f..ca1bf94b55f1412599abbbe47063f0ce # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 9fb0b20dd5feb4f4b6ee4d97bcf9fc8e1b43d89c..a55f08cfa09eb2b1afbaab780db2a275ad490d78 100644 +index c60cdd5bf0b3327b5495238c9296b99413c7c226..433a20d22a4df2355d6d407963047491bf3f3b2b 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7500,9 +7500,12 @@ test("unit_tests") { +@@ -7515,9 +7515,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index 9fb0b20dd5feb4f4b6ee4d97bcf9fc8e1b43d89c..a55f08cfa09eb2b1afbaab780db2a275 "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8428,6 +8431,10 @@ test("unit_tests") { +@@ -8447,6 +8450,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index 9fb0b20dd5feb4f4b6ee4d97bcf9fc8e1b43d89c..a55f08cfa09eb2b1afbaab780db2a275 sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8484,7 +8491,6 @@ test("unit_tests") { +@@ -8503,7 +8510,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/build_gn.patch b/patches/chromium/build_gn.patch index b50bf371f72e0..232bd3bb28e9d 100644 --- a/patches/chromium/build_gn.patch +++ b/patches/chromium/build_gn.patch @@ -7,7 +7,7 @@ These are variables we add to the root BUILDCONFIG so that they're available everywhere, without having to import("//electron/.../flags.gni"). diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn -index b1b5e79b92bea8ea05770d8c48cb4366938d71c5..16664ed3ab4b0ceecd4c74e44e57cca0dc57dc9b 100644 +index 24a1d143954ae05ae0b79b0994b76ef9218fb848..5c9b2ed8ba48a1056560ca1cd1d5b976aee4815c 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -123,6 +123,9 @@ if (current_os == "") { diff --git a/patches/chromium/build_libc_as_static_library.patch b/patches/chromium/build_libc_as_static_library.patch index f488d823be8c2..ea4ccf914b463 100644 --- a/patches/chromium/build_libc_as_static_library.patch +++ b/patches/chromium/build_libc_as_static_library.patch @@ -7,10 +7,10 @@ Build libc++ as static library to compile and pass nan tests diff --git a/buildtools/third_party/libc++/BUILD.gn b/buildtools/third_party/libc++/BUILD.gn -index a024e6e435303a67cfd994d28b5a45a1d5343926..34715a1bbd1820c0d78b86cd9155bcf055778d94 100644 +index 7dcefd2bceb209c6e74445259fac00e3e2280ff7..3a233d2e9dafc2093ead8f9c9104d06fe6176252 100644 --- a/buildtools/third_party/libc++/BUILD.gn +++ b/buildtools/third_party/libc++/BUILD.gn -@@ -860,6 +860,7 @@ target(libcxx_target_type, "libc++") { +@@ -841,6 +841,7 @@ target(libcxx_target_type, "libc++") { # need to explicitly depend on libc++. visibility = [ "//build/config:common_deps", diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index caf6966630ec1..3826c494fc235 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,10 +9,10 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index e812aff087701b5d38fcb0b916335e21f5713040..4f8e3a08890ed7498b29a900ccf4bbda5f9cb494 100644 +index 666ed8890f60cd0477b814b4b44571002eca9bff..73f730ff05a22938a834921d4842bf1f9faaca67 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -9819,6 +9819,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -9823,6 +9823,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To<Referrer>(), params->frame_name, params->disposition, *params->features, @@ -21,10 +21,10 @@ index e812aff087701b5d38fcb0b916335e21f5713040..4f8e3a08890ed7498b29a900ccf4bbda &no_javascript_access); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index a22f9897c47cc0fe0846fd631b0f094c0ded669a..5e35d7af2bcf9078887f4e2658e3f067f3b4f1b7 100644 +index 3677a957465f59ab80ac059bfcb5afdf98513b48..7a6760e0efdf6972eb497407b68202c5bfffd006 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5304,6 +5304,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5298,6 +5298,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( create_params.initially_hidden = renderer_started_hidden; create_params.initial_popup_url = params.target_url; @@ -35,7 +35,7 @@ index a22f9897c47cc0fe0846fd631b0f094c0ded669a..5e35d7af2bcf9078887f4e2658e3f067 // Even though all codepaths leading here are in response to a renderer // trying to open a new window, if the new window ends up in a different // browsing instance, then the RenderViewHost, RenderWidgetHost, -@@ -5359,6 +5363,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5353,6 +5357,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( // Sets the newly created WebContents WindowOpenDisposition. new_contents_impl->original_window_open_disposition_ = params.disposition; @@ -48,7 +48,7 @@ index a22f9897c47cc0fe0846fd631b0f094c0ded669a..5e35d7af2bcf9078887f4e2658e3f067 // If the new frame has a name, make sure any SiteInstances that can find // this named frame have proxies for it. Must be called after // SetSessionStorageNamespace, since this calls CreateRenderView, which uses -@@ -5400,12 +5410,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5394,12 +5404,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( AddWebContentsDestructionObserver(new_contents_impl); } @@ -77,10 +77,10 @@ index 90cc84198b7f23c6a07ab503f60a577fdfba5baa..722b27b8adaf86624058ace5f9b5871f // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 51635fb9f5da026fea3d25f0aa0d2d3f05017504..6a6b444270c3fcd084da7a63d8cc491e30b1eb20 100644 +index 750edc0c6767ab6a59d010b4f3f02770e50450b0..60e7eebb4f40df18e3fa28f57b7bbb20733477e7 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -872,6 +872,8 @@ bool ContentBrowserClient::CanCreateWindow( +@@ -884,6 +884,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -90,7 +90,7 @@ index 51635fb9f5da026fea3d25f0aa0d2d3f05017504..6a6b444270c3fcd084da7a63d8cc491e bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index f9131c7b44751e3ab51a8db52ca22202138aeada..77addfedac20cf8ecf656321dda53ada149f17ff 100644 +index eb7b1fdf7c3b3373201db40f03fc498c4ee08d25..f27b387da5ff4e4f20d28d80043151ad2f2e9d51 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -201,6 +201,7 @@ class NetworkService; @@ -101,7 +101,7 @@ index f9131c7b44751e3ab51a8db52ca22202138aeada..77addfedac20cf8ecf656321dda53ada } // namespace network namespace sandbox { -@@ -1444,6 +1445,8 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -1449,6 +1450,8 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -111,10 +111,10 @@ index f9131c7b44751e3ab51a8db52ca22202138aeada..77addfedac20cf8ecf656321dda53ada bool opener_suppressed, bool* no_javascript_access); diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index ca92e2ddf78d8f386b5ab23a09876d3b44e21334..33be50ce93dd998df5244f9ade391943f06978ad 100644 +index a8c0f1c63847f814b6e71fe24ae9aed24b26ba19..80d004eb9060e33af9e60b31a862a7dcecb254e8 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc -@@ -32,6 +32,17 @@ namespace content { +@@ -33,6 +33,17 @@ namespace content { WebContentsDelegate::WebContentsDelegate() = default; @@ -133,7 +133,7 @@ index ca92e2ddf78d8f386b5ab23a09876d3b44e21334..33be50ce93dd998df5244f9ade391943 WebContents* source, const OpenURLParams& params, diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index a4b8c5f950549e018c0d09522ff8890a1a774966..6c4c6265c26f5304b8f77d7fc5a4fad5dffc831d 100644 +index 1af915fcc91ae29bb9a6e2fc51f788178365ee4c..6a43f8c30857bfb32867e63d570ad26459af9ae8 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -18,6 +18,7 @@ @@ -152,7 +152,7 @@ index a4b8c5f950549e018c0d09522ff8890a1a774966..6c4c6265c26f5304b8f77d7fc5a4fad5 #include "content/public/common/window_container_type.mojom-forward.h" #include "third_party/blink/public/common/input/web_mouse_event.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" -@@ -384,6 +386,16 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -381,6 +383,16 @@ class CONTENT_EXPORT WebContentsDelegate { const StoragePartitionConfig& partition_config, SessionStorageNamespace* session_storage_namespace); @@ -170,10 +170,10 @@ index a4b8c5f950549e018c0d09522ff8890a1a774966..6c4c6265c26f5304b8f77d7fc5a4fad5 // typically happens when popups are created. virtual void WebContentsCreated(WebContents* source_contents, diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 55ff46bd1c24b2341317102f6308a66c1b5aeb23..859113ed13e77dcdd72b2ab327b94e94492f5d24 100644 +index a8d472bb78f3a9478b70cf3d98c35affec7caf39..bc2ec7491d7072be77307d7b8af06e5397e2bdfb 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -6770,6 +6770,10 @@ WebView* RenderFrameImpl::CreateNewWindow( +@@ -6772,6 +6772,10 @@ WebView* RenderFrameImpl::CreateNewWindow( request.HasUserGesture(), GetWebFrame()->IsAdFrame(), GetWebFrame()->IsAdScriptInStack()); @@ -232,10 +232,10 @@ index 82e9d3dfb5f7da76d89fe15ae61d379fa46e177d..fd035512099a54dff6cc951a2226c23a } // namespace blink diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc -index 23a95863dc888a9ffb4b09c2b034665ef1186f7c..558f6afcdf8faa91744ac2143a03de88c0965366 100644 +index 68ab3d483fe60671de50ec8952a0f71f103e4ad3..7ea5e45c08d7af439cf3eec041391ed7902ec865 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc -@@ -2354,6 +2354,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, +@@ -2333,6 +2333,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, WebWindowFeatures window_features = GetWindowFeaturesFromString(features, entered_window); diff --git a/patches/chromium/chore_add_electron_deps_to_gitignores.patch b/patches/chromium/chore_add_electron_deps_to_gitignores.patch index 3ed6a1cd0a480..4444651135106 100644 --- a/patches/chromium/chore_add_electron_deps_to_gitignores.patch +++ b/patches/chromium/chore_add_electron_deps_to_gitignores.patch @@ -6,7 +6,7 @@ Subject: chore: add electron deps to gitignores Makes things like "git status" quicker when developing electron locally diff --git a/.gitignore b/.gitignore -index 901485a978b095c44d344c05564b943b5240a4e0..724d42a18a7a093608e665542859eb3c5bb81243 100644 +index 5eb6e4d1815a7a56c7fff1d6f095e6c7e8127b84..808d897ba80abb9cced32a02cb7026305afe0dd2 100644 --- a/.gitignore +++ b/.gitignore @@ -226,6 +226,7 @@ vs-chromium-project.txt diff --git a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch new file mode 100644 index 0000000000000..3d3e0677f1662 --- /dev/null +++ b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch @@ -0,0 +1,272 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: deepak1556 <hop2deep@gmail.com> +Date: Mon, 1 Sep 2025 18:17:13 +0900 +Subject: chore: expose isolate parameter in script lifecycle observers + +Needed after https://chromium-review.googlesource.com/c/v8/v8/+/6875273 +where callsites that deal with multiple contexts need to distinguish +the current isolate. + +diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h +index 79d59c3f4d3d2d5ff39bd65ded489183247656a8..20b49742578ccf363738ee032228f30a4cd676ea 100644 +--- a/content/public/renderer/content_renderer_client.h ++++ b/content/public/renderer/content_renderer_client.h +@@ -398,6 +398,7 @@ class CONTENT_EXPORT ContentRendererClient { + // WillDestroyServiceWorkerContextOnWorkerThread() is called. + virtual void WillEvaluateServiceWorkerOnWorkerThread( + blink::WebServiceWorkerContextProxy* context_proxy, ++ v8::Isolate* const isolate, + v8::Local<v8::Context> v8_context, + int64_t service_worker_version_id, + const GURL& service_worker_scope, +diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h +index 18714ce8fc27c8d56c5deac27ba335078c452d0a..263405c605a0477b7a39bc274d7ee03be0b9cac5 100644 +--- a/content/public/renderer/render_frame_observer.h ++++ b/content/public/renderer/render_frame_observer.h +@@ -141,7 +141,8 @@ class CONTENT_EXPORT RenderFrameObserver { + int32_t world_id) {} + virtual void DidInstallConditionalFeatures(v8::Local<v8::Context> context, + int32_t world_id) {} +- virtual void WillReleaseScriptContext(v8::Local<v8::Context> context, ++ virtual void WillReleaseScriptContext(v8::Isolate* const isolate, ++ v8::Local<v8::Context> context, + int32_t world_id) {} + virtual void DidClearWindowObject() {} + virtual void DidChangeScrollOffset() {} +diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc +index addef4de8a95f47964a895e1d1cc4763f565a028..8bef2220b9a416011cebf4da672c15d117a34efa 100644 +--- a/content/renderer/render_frame_impl.cc ++++ b/content/renderer/render_frame_impl.cc +@@ -4685,10 +4685,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( + observer.DidInstallConditionalFeatures(context, world_id); + } + +-void RenderFrameImpl::WillReleaseScriptContext(v8::Local<v8::Context> context, ++void RenderFrameImpl::WillReleaseScriptContext(v8::Isolate* const isolate, ++ v8::Local<v8::Context> context, + int world_id) { + for (auto& observer : observers_) +- observer.WillReleaseScriptContext(context, world_id); ++ observer.WillReleaseScriptContext(isolate, context, world_id); + } + + void RenderFrameImpl::DidChangeScrollOffset() { +diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h +index f0f4335aa815ea50dbf9b720b41e4eb31f27fb90..319f222565e4ef25206cc44d33ec5e291b8ea089 100644 +--- a/content/renderer/render_frame_impl.h ++++ b/content/renderer/render_frame_impl.h +@@ -604,7 +604,8 @@ class CONTENT_EXPORT RenderFrameImpl + int world_id) override; + void DidInstallConditionalFeatures(v8::Local<v8::Context> context, + int world_id) override; +- void WillReleaseScriptContext(v8::Local<v8::Context> context, ++ void WillReleaseScriptContext(v8::Isolate* const isolate, ++ v8::Local<v8::Context> context, + int world_id) override; + void DidChangeScrollOffset() override; + blink::WebMediaStreamDeviceObserver* MediaStreamDeviceObserver() override; +diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc +index 37691ecee7a72b2ec47ff575239f628116cf136b..c67e3faf7440514e203e5b15a68fc34525a045a2 100644 +--- a/content/renderer/service_worker/service_worker_context_client.cc ++++ b/content/renderer/service_worker/service_worker_context_client.cc +@@ -318,6 +318,7 @@ void ServiceWorkerContextClient::WorkerContextStarted( + } + + void ServiceWorkerContextClient::WillEvaluateScript( ++ v8::Isolate* const v8_isolate, + v8::Local<v8::Context> v8_context) { + DCHECK(worker_task_runner_->RunsTasksInCurrentSequence()); + start_timing_->script_evaluation_start_time = base::TimeTicks::Now(); +@@ -336,8 +337,8 @@ void ServiceWorkerContextClient::WillEvaluateScript( + + DCHECK(proxy_); + GetContentClient()->renderer()->WillEvaluateServiceWorkerOnWorkerThread( +- proxy_, v8_context, service_worker_version_id_, service_worker_scope_, +- script_url_, service_worker_token_); ++ proxy_, v8_isolate, v8_context, service_worker_version_id_, ++ service_worker_scope_, script_url_, service_worker_token_); + } + + void ServiceWorkerContextClient::DidEvaluateScript(bool success) { +diff --git a/content/renderer/service_worker/service_worker_context_client.h b/content/renderer/service_worker/service_worker_context_client.h +index 1f5e24bc38d6ced52e4773236522e9520efc6f6d..a22ca5968fce5e6a0c436ec9b40f0e2f7c1482cf 100644 +--- a/content/renderer/service_worker/service_worker_context_client.h ++++ b/content/renderer/service_worker/service_worker_context_client.h +@@ -165,7 +165,8 @@ class ServiceWorkerContextClient + void WorkerContextStarted( + blink::WebServiceWorkerContextProxy* proxy, + scoped_refptr<base::SequencedTaskRunner> worker_task_runner) override; +- void WillEvaluateScript(v8::Local<v8::Context> v8_context) override; ++ void WillEvaluateScript(v8::Isolate* const isolate, ++ v8::Local<v8::Context> v8_context) override; + void DidEvaluateScript(bool success) override; + void WillInitializeWorkerContext() override; + void WillDestroyWorkerContext(v8::Local<v8::Context> context) override; +diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc +index 37fc43bfc6804c2abb0cf107e2575c72cfca9023..9f3c88be38b9c8960a38649c7f3bf71dff182383 100644 +--- a/extensions/renderer/dispatcher.cc ++++ b/extensions/renderer/dispatcher.cc +@@ -612,6 +612,7 @@ void Dispatcher::DidInitializeServiceWorkerContextOnWorkerThread( + + void Dispatcher::WillEvaluateServiceWorkerOnWorkerThread( + blink::WebServiceWorkerContextProxy* context_proxy, ++ v8::Isolate* const isolate, + v8::Local<v8::Context> v8_context, + int64_t service_worker_version_id, + const GURL& service_worker_scope, +diff --git a/extensions/renderer/dispatcher.h b/extensions/renderer/dispatcher.h +index 9d4c74b7996e2e573079413cd24a99f86dd5b90f..241c012f1a7434944dc5ea6cad8a8c9988b069b2 100644 +--- a/extensions/renderer/dispatcher.h ++++ b/extensions/renderer/dispatcher.h +@@ -151,6 +151,7 @@ class Dispatcher : public content::RenderThreadObserver, + // variables. + void WillEvaluateServiceWorkerOnWorkerThread( + blink::WebServiceWorkerContextProxy* context_proxy, ++ v8::Isolate* const isolate, + v8::Local<v8::Context> v8_context, + int64_t service_worker_version_id, + const GURL& service_worker_scope, +diff --git a/extensions/renderer/extension_frame_helper.cc b/extensions/renderer/extension_frame_helper.cc +index c89ea22fcd36a9fef2ce8a83ffc46d3358630e90..6c14424384832b5ed193a08c46a0addb27e54244 100644 +--- a/extensions/renderer/extension_frame_helper.cc ++++ b/extensions/renderer/extension_frame_helper.cc +@@ -439,6 +439,7 @@ void ExtensionFrameHelper::DidCreateScriptContext( + } + + void ExtensionFrameHelper::WillReleaseScriptContext( ++ v8::Isolate* const isolate, + v8::Local<v8::Context> context, + int32_t world_id) { + extension_dispatcher_->WillReleaseScriptContext( +diff --git a/extensions/renderer/extension_frame_helper.h b/extensions/renderer/extension_frame_helper.h +index e16f370211ba014f778e7b9021b83988a5d27661..a79b20fe95050d6e92615711988384deea3fa1e0 100644 +--- a/extensions/renderer/extension_frame_helper.h ++++ b/extensions/renderer/extension_frame_helper.h +@@ -188,7 +188,8 @@ class ExtensionFrameHelper + blink::WebDocumentLoader* document_loader) override; + void DidCreateScriptContext(v8::Local<v8::Context>, + int32_t world_id) override; +- void WillReleaseScriptContext(v8::Local<v8::Context>, ++ void WillReleaseScriptContext(v8::Isolate* const isolate, ++ v8::Local<v8::Context>, + int32_t world_id) override; + void OnDestruct() override; + void DidClearWindowObject() override; +diff --git a/third_party/blink/public/web/modules/service_worker/web_service_worker_context_client.h b/third_party/blink/public/web/modules/service_worker/web_service_worker_context_client.h +index f96781a047056876b030581b539be0507acc3a1c..cd9be80be2500a001b1895c81ee597dd16fd295b 100644 +--- a/third_party/blink/public/web/modules/service_worker/web_service_worker_context_client.h ++++ b/third_party/blink/public/web/modules/service_worker/web_service_worker_context_client.h +@@ -120,7 +120,8 @@ class WebServiceWorkerContextClient { + // + // |v8_context| is the V8 context of the worker and is used to support + // service workers in Chrome extensions. +- virtual void WillEvaluateScript(v8::Local<v8::Context> v8_context) {} ++ virtual void WillEvaluateScript(v8::Isolate* const isolate, ++ v8::Local<v8::Context> v8_context) {} + + // Called when initial script evaluation finished for the main script. + // |success| is true if the evaluation completed with no uncaught exception. +diff --git a/third_party/blink/public/web/web_local_frame_client.h b/third_party/blink/public/web/web_local_frame_client.h +index 52e8828d8fffaba8ab05436cb4d727595f18238a..6743653f5018c06d3e173aaacdca7275c6ec703f 100644 +--- a/third_party/blink/public/web/web_local_frame_client.h ++++ b/third_party/blink/public/web/web_local_frame_client.h +@@ -665,7 +665,8 @@ class BLINK_EXPORT WebLocalFrameClient { + int32_t world_id) {} + + // WebKit is about to release its reference to a v8 context for a frame. +- virtual void WillReleaseScriptContext(v8::Local<v8::Context>, ++ virtual void WillReleaseScriptContext(v8::Isolate* const isolate, ++ v8::Local<v8::Context>, + int32_t world_id) {} + + // Geometry notifications ---------------------------------------------- +diff --git a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc +index 2e8653654686f4fc775288f059ff27daa38e02d5..b0e061525f442952e5f8a90fed7002830dbb4bc3 100644 +--- a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc ++++ b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc +@@ -108,11 +108,12 @@ void LocalWindowProxy::DisposeContext(Lifecycle next_status, + + ScriptState::Scope scope(script_state_); + v8::Local<v8::Context> context = script_state_->GetContext(); ++ CHECK_EQ(GetIsolate(), script_state_->GetIsolate()); + // The embedder could run arbitrary code in response to the + // willReleaseScriptContext callback, so all disposing should happen after + // it returns. +- GetFrame()->Client()->WillReleaseScriptContext(context, world_->GetWorldId()); +- CHECK_EQ(GetIsolate(), script_state_->GetIsolate()); ++ GetFrame()->Client()->WillReleaseScriptContext( ++ GetIsolate(), context, world_->GetWorldId()); + MainThreadDebugger::Instance(GetIsolate()) + ->ContextWillBeDestroyed(script_state_); + if (next_status == Lifecycle::kV8MemoryIsForciblyPurged || +diff --git a/third_party/blink/renderer/core/frame/local_frame_client.h b/third_party/blink/renderer/core/frame/local_frame_client.h +index 8d73ddb12013ce195026b9f63050cf33f0bfb0fd..078f0e67e8de6a05178e8e2410f61784fe656dee 100644 +--- a/third_party/blink/renderer/core/frame/local_frame_client.h ++++ b/third_party/blink/renderer/core/frame/local_frame_client.h +@@ -303,7 +303,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient { + int32_t world_id) = 0; + virtual void DidInstallConditionalFeatures(v8::Local<v8::Context>, + int32_t world_id) = 0; +- virtual void WillReleaseScriptContext(v8::Local<v8::Context>, ++ virtual void WillReleaseScriptContext(v8::Isolate* const isolate, ++ v8::Local<v8::Context>, + int32_t world_id) = 0; + virtual bool AllowScriptExtensions() = 0; + +diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc +index 1aacf6f66b543a4ede6ab5d885143dd4a0821e8a..c695d942e295d9137a284e5536a10d49a055bbf4 100644 +--- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc ++++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc +@@ -303,10 +303,11 @@ void LocalFrameClientImpl::DidInstallConditionalFeatures( + } + + void LocalFrameClientImpl::WillReleaseScriptContext( ++ v8::Isolate* const isolate, + v8::Local<v8::Context> context, + int32_t world_id) { + if (web_frame_->Client()) { +- web_frame_->Client()->WillReleaseScriptContext(context, world_id); ++ web_frame_->Client()->WillReleaseScriptContext(isolate, context, world_id); + } + } + +diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.h b/third_party/blink/renderer/core/frame/local_frame_client_impl.h +index 16066fe34ee0335a0dabe00b6890e5844349c0b5..cc84479f65bdbe56cb4b38bfcef0d752bbe68d35 100644 +--- a/third_party/blink/renderer/core/frame/local_frame_client_impl.h ++++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.h +@@ -83,7 +83,8 @@ class CORE_EXPORT LocalFrameClientImpl final : public LocalFrameClient { + int32_t world_id) override; + void DidInstallConditionalFeatures(v8::Local<v8::Context>, + int32_t world_id) override; +- void WillReleaseScriptContext(v8::Local<v8::Context>, ++ void WillReleaseScriptContext(v8::Isolate* const isolate, ++ v8::Local<v8::Context>, + int32_t world_id) override; + + // Returns true if we should allow register V8 extensions to be added. +diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h +index d8f3b11c98fd58baa9995762a29847b9fd760c84..5a9c9356a2098dfa9d28a5d30b19b492463216c8 100644 +--- a/third_party/blink/renderer/core/loader/empty_clients.h ++++ b/third_party/blink/renderer/core/loader/empty_clients.h +@@ -422,7 +422,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { + int32_t world_id) override {} + void DidInstallConditionalFeatures(v8::Local<v8::Context>, + int32_t world_id) override {} +- void WillReleaseScriptContext(v8::Local<v8::Context>, ++ void WillReleaseScriptContext(v8::Isolate* const isolate, ++ v8::Local<v8::Context>, + int32_t world_id) override {} + bool AllowScriptExtensions() override { return false; } + +diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.cc b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.cc +index eff817cda59a7b6e746813d5c42911d80547b5bd..217c4f76d62dd4910e89d4cb4cff4206fc84cfb1 100644 +--- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.cc ++++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.cc +@@ -180,6 +180,7 @@ void ServiceWorkerGlobalScopeProxy::WillEvaluateScript() { + ScriptState::Scope scope( + WorkerGlobalScope()->ScriptController()->GetScriptState()); + Client().WillEvaluateScript( ++ WorkerGlobalScope()->ScriptController()->GetScriptState()->GetIsolate(), + WorkerGlobalScope()->ScriptController()->GetContext()); + top_level_script_evaluation_start_time_ = base::TimeTicks::Now(); + } diff --git a/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch b/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch index 34278a2fe5b3d..de836c49fec8e 100644 --- a/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch +++ b/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch @@ -10,7 +10,7 @@ Subject: chore: "grandfather in" Electron Views and Delegates 6448510: Lock further access to View::set_owned_by_client(). | https://chromium-review.googlesource.com/c/chromium/src/+/6448510 diff --git a/ui/views/view.h b/ui/views/view.h -index 08ec59edf033052233a105ab13cf00ada8bd4e38..b80d3ab4eb24487de6a8a27d67d23d275513b80e 100644 +index ee028fccef7dcc9c3522d09e503d2ac49ffd329a..a56c2f87ee21a2bba2cb65acd426cb192124fa85 100644 --- a/ui/views/view.h +++ b/ui/views/view.h @@ -80,6 +80,19 @@ class ArcNotificationContentView; @@ -49,7 +49,7 @@ index 08ec59edf033052233a105ab13cf00ada8bd4e38..b80d3ab4eb24487de6a8a27d67d23d27 // These existing cases are "grandfathered in", but there shouldn't be more. // See comments atop class. diff --git a/ui/views/widget/widget_delegate.h b/ui/views/widget/widget_delegate.h -index 1b23449ceb8e2c257cd40c375154a5fa93d1a26e..3aca30535eb99132a664936bcb19e58e075f4095 100644 +index ff9c5abfdb02d9798b1491e2bbc296f2c7c74398..47d8a897d58b0d3829734105e81b887684dd009b 100644 --- a/ui/views/widget/widget_delegate.h +++ b/ui/views/widget/widget_delegate.h @@ -168,6 +168,12 @@ namespace crostini { @@ -73,7 +73,7 @@ index 1b23449ceb8e2c257cd40c375154a5fa93d1a26e..3aca30535eb99132a664936bcb19e58e // DO NOT ADD TO THIS LIST! // These existing cases are "grandfathered in", but there shouldn't be more. // See comments atop `SetOwnedByWidget()`. -@@ -465,6 +472,7 @@ class VIEWS_EXPORT WidgetDelegate { +@@ -464,6 +471,7 @@ class VIEWS_EXPORT WidgetDelegate { }; class RegisterDeleteCallbackPassKey { private: @@ -81,7 +81,7 @@ index 1b23449ceb8e2c257cd40c375154a5fa93d1a26e..3aca30535eb99132a664936bcb19e58e // DO NOT ADD TO THIS LIST! // These existing cases are "grandfathered in", but there shouldn't be more. // See comments atop `RegisterDeleteDelegateCallback()`. -@@ -922,6 +930,7 @@ class VIEWS_EXPORT WidgetDelegateView : public WidgetDelegate, public View { +@@ -921,6 +929,7 @@ class VIEWS_EXPORT WidgetDelegateView : public WidgetDelegate, public View { View* GetContentsView() override; private: diff --git a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch index 21cefe2aee268..280ef69ab5cb1 100644 --- a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch +++ b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch @@ -34,7 +34,7 @@ index 2dc44d4787d5198cff7be2cf98ad5acf2d3a9a0b..27a0335aac2bd4239616cf71f5d015c9 class ScrollEvent; diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 315356b513e9f2c0ce7658aefeb69d0ac327c4de..54a94e1348fa196eaee8314076c47286c9ab0bcc 100644 +index 7dd0e38866576389d59aecdd5a9ecc712996a597..4c626e026e5b19db737533607957d0ff2fbeae28 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -1367,6 +1367,10 @@ HBRUSH DesktopWindowTreeHostWin::GetBackgroundPaintBrush() { @@ -61,7 +61,7 @@ index dcda976f4c3cc0ba6bcf015d5bf7435df009ae30..13cfa18bf406f244ec361a1230ccce44 Widget* GetWidget(); const Widget* GetWidget() const; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 3637176c05a7074cb9042b74f7c9ea2e29af5ee5..3ed583cf09dec0ae83c3c9449e6ef7e1fa92aa8d 100644 +index 76893d462786eaff21838614a8251b97bec92a79..72474adfb09f85118b4f752a22d121ab2b4c588a 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -3239,15 +3239,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, @@ -114,7 +114,7 @@ index 3637176c05a7074cb9042b74f7c9ea2e29af5ee5..3ed583cf09dec0ae83c3c9449e6ef7e1 } } else if (message == WM_NCLBUTTONDOWN && diff --git a/ui/views/win/hwnd_message_handler_delegate.h b/ui/views/win/hwnd_message_handler_delegate.h -index 2aa7ca1f713da54d12c7ac78103a260a4744d040..7449d7642022145fc1be76b299fa1db2d724122b 100644 +index 15e8cde9508170addec55290c859c91224bb2c33..a34948b9a42f030c71e453f1c534215fc2e671fa 100644 --- a/ui/views/win/hwnd_message_handler_delegate.h +++ b/ui/views/win/hwnd_message_handler_delegate.h @@ -256,6 +256,10 @@ class VIEWS_EXPORT HWNDMessageHandlerDelegate { diff --git a/patches/chromium/chore_partial_revert_of.patch b/patches/chromium/chore_partial_revert_of.patch index 14ba7ac150480..d8c50995d229b 100644 --- a/patches/chromium/chore_partial_revert_of.patch +++ b/patches/chromium/chore_partial_revert_of.patch @@ -14,10 +14,10 @@ track down the source of this problem & figure out if we can fix it by changing something in Electron. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 3a9264493f90fb8e82e34e13328d74c00d156966..dd274924f1c26efbc9fc3683f69647a0933a9855 100644 +index 2fd9e3ce15869b284ff8716c02ce8dc6392b2a7b..7bda1bd1d7c34e369c27e4ec283888fe4d50458d 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5275,7 +5275,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5269,7 +5269,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( : IsGuest(); // While some guest types do not have a guest SiteInstance, the ones that // don't all override WebContents creation above. diff --git a/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch b/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch index 67a7197a5356c..3fa8f8278ac4c 100644 --- a/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch +++ b/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch @@ -14,10 +14,10 @@ This change patches it out to prevent the DCHECK. It can be removed once/if we see a better solution to the problem. diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc -index 8221d7b96395b06ee177be302dd476c83f569eaf..4c4500421f9cd164ab49b85457e6e37e0b4a703c 100644 +index 354a5870ef5b07a5903a1b40fcbb00462bf4a64b..bf3af2152ff7ca54412442b275ec7eedd60110ba 100644 --- a/content/browser/site_instance_impl.cc +++ b/content/browser/site_instance_impl.cc -@@ -226,7 +226,7 @@ scoped_refptr<SiteInstanceImpl> SiteInstanceImpl::CreateForGuest( +@@ -225,7 +225,7 @@ scoped_refptr<SiteInstanceImpl> SiteInstanceImpl::CreateForGuest( BrowserContext* browser_context, const StoragePartitionConfig& partition_config) { DCHECK(browser_context); diff --git a/patches/chromium/chore_patch_out_profile_methods.patch b/patches/chromium/chore_patch_out_profile_methods.patch index abce6f76a96da..61f52aa913d67 100644 --- a/patches/chromium/chore_patch_out_profile_methods.patch +++ b/patches/chromium/chore_patch_out_profile_methods.patch @@ -27,12 +27,12 @@ index c390a83277f564f1a67a7dcffa36b9d77a35bc0b..b13273a4b194ad5e8ca2d1639ebca831 // When the enterprise policy is not set, use finch/feature flag choice. return base::FeatureList::IsEnabled( diff --git a/chrome/browser/pdf/pdf_extension_util.cc b/chrome/browser/pdf/pdf_extension_util.cc -index 1362d0c69043ac5d1f7e72cf7ac72c272193844c..08efd98ca16555f6a7bbfb4ae3165130e843c981 100644 +index 32e9d7e81ee8008b7e8fd491ec16afc01b5ff35e..51213f193cc5977f9f30dd39548eaf012a4857fa 100644 --- a/chrome/browser/pdf/pdf_extension_util.cc +++ b/chrome/browser/pdf/pdf_extension_util.cc -@@ -271,10 +271,13 @@ bool IsPrintingEnabled(content::BrowserContext* context) { +@@ -234,10 +234,13 @@ bool IsPrintingEnabled(content::BrowserContext* context) { - #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(ENABLE_PDF_INK2) + #if BUILDFLAG(ENABLE_PDF_INK2) bool IsPdfAnnotationsEnabledByPolicy(content::BrowserContext* context) { +# if 0 PrefService* prefs = @@ -42,7 +42,7 @@ index 1362d0c69043ac5d1f7e72cf7ac72c272193844c..08efd98ca16555f6a7bbfb4ae3165130 +#endif + return true; } - #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(ENABLE_PDF_INK2) + #endif // BUILDFLAG(ENABLE_PDF_INK2) diff --git a/chrome/browser/profiles/profile_selections.cc b/chrome/browser/profiles/profile_selections.cc index bc0bad82ebcdceadc505e912ff27202b452fefab..6b77c57fccc4619a1df3b4ed661d2bdd60960228 100644 diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index ea88ca2f2c41b..551abdb8de19b 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -80,20 +80,20 @@ index b6582b4013d9682d32bd524b4053b443a4df00f8..afcbce72e0f247b4d5a637b27c9f25d9 content::WebContents* source, const content::OpenURLParams& params, diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index 5cf1070e3f407fdb1748b2171b3974933d4610c1..96960883dd68c511d66414f66cf989d28bd4eb36 100644 +index 00cea7307c68c3d8ae93f5ed6df33cef9065fe7b..c2a3892b0ade29d59b06753fdc84f44dc0890f39 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc -@@ -2390,8 +2390,7 @@ bool Browser::IsWebContentsCreationOverridden( - content::SiteInstance* source_site_instance, +@@ -2359,7 +2359,8 @@ bool Browser::IsWebContentsCreationOverridden( content::mojom::WindowContainerType window_container_type, const GURL& opener_url, -- const std::string& frame_name, + const std::string& frame_name, - const GURL& target_url) { ++ const GURL& target_url, + const content::mojom::CreateNewWindowParams& params) { - if (IsActorOperatingOnWebContents( + if (actor::IsActorOperatingOnWebContents( profile(), content::WebContents::FromRenderFrameHost(opener))) { // If an ExecutionEngine is acting on the opener, prevent it from creating -@@ -2403,7 +2402,7 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2371,7 +2372,7 @@ bool Browser::IsWebContentsCreationOverridden( return (window_container_type == content::mojom::WindowContainerType::BACKGROUND && ShouldCreateBackgroundContents(source_site_instance, opener_url, @@ -103,10 +103,10 @@ index 5cf1070e3f407fdb1748b2171b3974933d4610c1..96960883dd68c511d66414f66cf989d2 WebContents* Browser::CreateCustomWebContents( diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h -index e80708919d3122d92f6fe63e5c111c999860762e..fb19037baa4cb95f8d581f4ccf984f0b19b6ca70 100644 +index 636b265a6813b01a44930ae73655523b739cafd2..23dad43a14673966af3002263b03bb0cfb91e8f6 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h -@@ -951,8 +951,7 @@ class Browser : public TabStripModelObserver, +@@ -946,8 +946,7 @@ class Browser : public TabStripModelObserver, content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -159,10 +159,10 @@ index 08b9f7ad8544011ee1cbb9bc9857ea06e2fa2c0b..69f666bdc05662bc40e133022b5364cb } content::WebContents* CreateCustomWebContents( diff --git a/components/embedder_support/android/delegate/web_contents_delegate_android.cc b/components/embedder_support/android/delegate/web_contents_delegate_android.cc -index c07249241e5265030c1feada568fbd54f4e18efa..f0946d19ce07723be8a3736f523db1951cccbb95 100644 +index a560d65e113ba4fad4c56d9a2a19df1772079d07..4f621733276141248169b7f5ecc5b6f09140f774 100644 --- a/components/embedder_support/android/delegate/web_contents_delegate_android.cc +++ b/components/embedder_support/android/delegate/web_contents_delegate_android.cc -@@ -202,14 +202,13 @@ bool WebContentsDelegateAndroid::IsWebContentsCreationOverridden( +@@ -204,14 +204,13 @@ bool WebContentsDelegateAndroid::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -180,7 +180,7 @@ index c07249241e5265030c1feada568fbd54f4e18efa..f0946d19ce07723be8a3736f523db195 java_gurl); } diff --git a/components/embedder_support/android/delegate/web_contents_delegate_android.h b/components/embedder_support/android/delegate/web_contents_delegate_android.h -index 13afd2de87888e927d8baf77f4c3de65179c52f5..06de4a27e625745947d2c119fa8f5eb555d99a1d 100644 +index a13f342976cb57b091ebfc95538f9ef91bb9e6fa..40506e913c0506e38cd141a46468a7669d6c2093 100644 --- a/components/embedder_support/android/delegate/web_contents_delegate_android.h +++ b/components/embedder_support/android/delegate/web_contents_delegate_android.h @@ -84,8 +84,7 @@ class WebContentsDelegateAndroid : public content::WebContentsDelegate { @@ -222,10 +222,10 @@ index b969f1d97b7e3396119b579cfbe61e19ff7d2dd4..b8d6169652da28266a514938b45b39c5 content::WebContents* AddNewContents( content::WebContents* source, diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 95ea7eb743ae3e4de52741be7f2969bbf86d8a29..c9472325e55052ead090c55704b590bb6722c429 100644 +index 4e2e910c62534106209758a0e5aeb329cfbaa529..b7967a4ab1c9d2c7b2a49a610af10190bcd6e0f0 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5238,8 +5238,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5232,8 +5232,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( if (delegate_ && delegate_->IsWebContentsCreationOverridden( opener, source_site_instance, params.window_container_type, @@ -236,10 +236,10 @@ index 95ea7eb743ae3e4de52741be7f2969bbf86d8a29..c9472325e55052ead090c55704b590bb static_cast<WebContentsImpl*>(delegate_->CreateCustomWebContents( opener, source_site_instance, is_new_browsing_instance, diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index 33be50ce93dd998df5244f9ade391943f06978ad..3bb9baf76d331351d23d59fc2b9eb82d42b36b11 100644 +index 80d004eb9060e33af9e60b31a862a7dcecb254e8..ea179bdf3e702fb1d5be55affe3958f77901cd08 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc -@@ -160,8 +160,7 @@ bool WebContentsDelegate::IsWebContentsCreationOverridden( +@@ -155,8 +155,7 @@ bool WebContentsDelegate::IsWebContentsCreationOverridden( SiteInstance* source_site_instance, mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -250,10 +250,10 @@ index 33be50ce93dd998df5244f9ade391943f06978ad..3bb9baf76d331351d23d59fc2b9eb82d } diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 6c4c6265c26f5304b8f77d7fc5a4fad5dffc831d..d0842904102fee982bc8502478a0a9067bb77904 100644 +index 6a43f8c30857bfb32867e63d570ad26459af9ae8..97def739ec2418286b76c0039c61b501293c8f5d 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h -@@ -364,8 +364,7 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -361,8 +361,7 @@ class CONTENT_EXPORT WebContentsDelegate { SiteInstance* source_site_instance, mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -356,10 +356,10 @@ index 7eeffdfbda9611806c6f260f0c68f6d84689cb7e..5d8f6d132068d7fabaa52bc61354c71a content::RenderFrameHost* opener, content::SiteInstance* source_site_instance, diff --git a/fuchsia_web/webengine/browser/frame_impl.cc b/fuchsia_web/webengine/browser/frame_impl.cc -index 570cfeb6c74f04d4748648b86661ccf603c71452..da8b64d70e5b26431a576cc52316210fce36f99a 100644 +index fdc6afbf9048fa254d6f361b36765cf95d5eb521..16d297a3f6bde6bc4c038b79a057700aec68b689 100644 --- a/fuchsia_web/webengine/browser/frame_impl.cc +++ b/fuchsia_web/webengine/browser/frame_impl.cc -@@ -582,8 +582,7 @@ bool FrameImpl::IsWebContentsCreationOverridden( +@@ -584,8 +584,7 @@ bool FrameImpl::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -398,7 +398,7 @@ index 1d95f5b521d7ab586fcecda6d6f822b432480367..b534327a8bd5b2c31522339b30caf123 ->options() ->block_new_web_contents(); diff --git a/ui/views/controls/webview/web_dialog_view.cc b/ui/views/controls/webview/web_dialog_view.cc -index 42e0654da5659ba647529c4b0b97ec5df61d59a1..406e2ca73c182005014b56824e89ddfb25fd28f5 100644 +index 3a6d0c589ee634b68e929c17ee912a6b1c19b4f6..b13d80623d1fd0d0798cec33cb92f73ed5947ffa 100644 --- a/ui/views/controls/webview/web_dialog_view.cc +++ b/ui/views/controls/webview/web_dialog_view.cc @@ -490,8 +490,7 @@ bool WebDialogView::IsWebContentsCreationOverridden( diff --git a/patches/chromium/custom_protocols_plzserviceworker.patch b/patches/chromium/custom_protocols_plzserviceworker.patch index 21d42b32cc0b8..e36c46965e8da 100644 --- a/patches/chromium/custom_protocols_plzserviceworker.patch +++ b/patches/chromium/custom_protocols_plzserviceworker.patch @@ -8,10 +8,10 @@ Allow registering custom protocols to handle service worker main script fetching Refs https://bugs.chromium.org/p/chromium/issues/detail?id=996511 diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc -index 6bcf498a08a4600b6fb4892e395d6d20bf771057..5d4b50fbfdb43a3efee99f2e27b7fed1fac42e9e 100644 +index 25c9e17bd063cc07fd2727474395a9276c4a000d..413f3019bd55388e8ebc8fe39af766b7c61e9924 100644 --- a/content/browser/service_worker/service_worker_context_wrapper.cc +++ b/content/browser/service_worker/service_worker_context_wrapper.cc -@@ -1956,6 +1956,26 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( +@@ -1957,6 +1957,26 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( loader_factory_bundle_info = context()->loader_factory_bundle_for_update_check()->Clone(); @@ -38,7 +38,7 @@ index 6bcf498a08a4600b6fb4892e395d6d20bf771057..5d4b50fbfdb43a3efee99f2e27b7fed1 if (auto* config = content::WebUIConfigMap::GetInstance().GetConfig( browser_context(), scope)) { // If this is a Service Worker for a WebUI, the WebUI's URLDataSource -@@ -1975,9 +1995,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( +@@ -1976,9 +1996,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( features::kEnableServiceWorkersForChromeScheme) && scope.scheme_piece() == kChromeUIScheme) { config->RegisterURLDataSource(browser_context()); @@ -49,7 +49,7 @@ index 6bcf498a08a4600b6fb4892e395d6d20bf771057..5d4b50fbfdb43a3efee99f2e27b7fed1 .emplace(kChromeUIScheme, CreateWebUIServiceWorkerLoaderFactory( browser_context(), kChromeUIScheme, base::flat_set<std::string>())); -@@ -1985,9 +2003,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( +@@ -1986,9 +2004,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( features::kEnableServiceWorkersForChromeUntrusted) && scope.scheme_piece() == kChromeUIUntrustedScheme) { config->RegisterURLDataSource(browser_context()); diff --git a/patches/chromium/disable_compositor_recycling.patch b/patches/chromium/disable_compositor_recycling.patch index 7c5570673d4de..3376fea14a257 100644 --- a/patches/chromium/disable_compositor_recycling.patch +++ b/patches/chromium/disable_compositor_recycling.patch @@ -6,10 +6,10 @@ Subject: fix: disabling compositor recycling Compositor recycling is useful for Chrome because there can be many tabs and spinning up a compositor for each one would be costly. In practice, Chrome uses the parent compositor code path of browser_compositor_view_mac.mm; the NSView of each tab is detached when it's hidden and attached when it's shown. For Electron, there is no parent compositor, so we're forced into the "own compositor" code path, which seems to be non-optimal and pretty ruthless in terms of the release of resources. Electron has no real concept of multiple tabs per window, so it should be okay to disable this ruthless recycling altogether in Electron. diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index 59c8d5a2e687ac6148889c87f353b33959e276f6..7ef10194f02e32a9ec137f7f2519c4a834b81b7a 100644 +index 57103054e874017bf9926dcdf71786c679f9aac0..571f4cfd4882f048268ebadf00d05ad3c034fedc 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm -@@ -561,7 +561,11 @@ +@@ -558,7 +558,11 @@ return; host()->WasHidden(); diff --git a/patches/chromium/disable_hidden.patch b/patches/chromium/disable_hidden.patch index c7c6b9f145c4c..173975a40193a 100644 --- a/patches/chromium/disable_hidden.patch +++ b/patches/chromium/disable_hidden.patch @@ -6,7 +6,7 @@ Subject: disable_hidden.patch Electron uses this to disable background throttling for hidden windows. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index c28aa525c51e9be757d5d8f8e5a60857b7a451d4..e8baae79ab127e4626f39247a5e57fe6a6114453 100644 +index 817b5da3f10faf0770274f3e03a3a0cd3400f135..27131371845a81c0af16d59334a98656095f4aeb 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -847,6 +847,10 @@ void RenderWidgetHostImpl::WasHidden() { @@ -21,10 +21,10 @@ index c28aa525c51e9be757d5d8f8e5a60857b7a451d4..e8baae79ab127e4626f39247a5e57fe6 // Prompts should remain open and functional across tab switches. if (!delegate_ || !delegate_->IsWaitingForPointerLockPrompt(this)) { diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h -index f07055487abd76b2a72ba555ff1b5bcd996bbd3a..7d46db80c667900576cf46264034890203020a75 100644 +index 43c840283b1f7ac39c2ecec5741cc206c64a064e..c8b2a66eccc2ca0b2be1f338f6c77b906db69faa 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h -@@ -1026,6 +1026,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl +@@ -1029,6 +1029,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl // cpu-priority boosted to run discard logic. void SetIsDiscarding(bool is_discarding); @@ -35,10 +35,10 @@ index f07055487abd76b2a72ba555ff1b5bcd996bbd3a..7d46db80c667900576cf462640348902 // |routing_id| must not be IPC::mojom::kRoutingIdNone. // If this object outlives |delegate|, DetachDelegate() must be called when diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index f4c657fe36eba54948cacf9770d9c6c1b55b5fe5..b14f5bc3f023c512a066ce9ec9f681c96b1fafc4 100644 +index 1ae2c9328679f12cfe7068c6ea0f1589314bc6f0..e98d74fecf4275ef8e7c6d23e5ea5ec3af80b926 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -644,7 +644,7 @@ void RenderWidgetHostViewAura::HideImpl() { +@@ -643,7 +643,7 @@ void RenderWidgetHostViewAura::HideImpl() { CHECK(visibility_ == Visibility::HIDDEN || visibility_ == Visibility::OCCLUDED); diff --git a/patches/chromium/enable_reset_aspect_ratio.patch b/patches/chromium/enable_reset_aspect_ratio.patch index c0ccee0126d7e..d68274c38c61a 100644 --- a/patches/chromium/enable_reset_aspect_ratio.patch +++ b/patches/chromium/enable_reset_aspect_ratio.patch @@ -6,7 +6,7 @@ Subject: feat: enable setting aspect ratio to 0 Make SetAspectRatio accept 0 as valid input, which would reset to null. diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 95f034ecf921265304cde98d2ce163a2ab09887a..315356b513e9f2c0ce7658aefeb69d0ac327c4de 100644 +index 5d0c67f54a321ecb945b04f4981e93ea1e4c8d84..7dd0e38866576389d59aecdd5a9ecc712996a597 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -619,7 +619,7 @@ void DesktopWindowTreeHostWin::SetOpacity(float opacity) { @@ -19,7 +19,7 @@ index 95f034ecf921265304cde98d2ce163a2ab09887a..315356b513e9f2c0ce7658aefeb69d0a excluded_margin); } diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index df17e97666de639f05b92a79ee7fbd4a3da6c64f..f404c718e0242ec9269e7d14eb236aa928fb5d58 100644 +index 7f4aac3aed53b53d8b8d6bc9b5c507e63906060d..aa5b34fa3fdef76b9bb7afd26ecaeda785e25824 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -1050,8 +1050,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen, diff --git a/patches/chromium/expose_setuseragent_on_networkcontext.patch b/patches/chromium/expose_setuseragent_on_networkcontext.patch index f9b1aa3f85ae7..df940e2987b81 100644 --- a/patches/chromium/expose_setuseragent_on_networkcontext.patch +++ b/patches/chromium/expose_setuseragent_on_networkcontext.patch @@ -33,11 +33,11 @@ index 0ab8187b0db8ae6db46d81738f653a2bc4c566f6..de3d55e85c22317f7f9375eb94d0d5d4 } // namespace net diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index 7721b8e827d9aac6e90ddfe3de264f41915219f2..1bc4f24c3f0eb843033d2aa541d81e910f8021b0 100644 +index 3998bb0849cd5bec52c6148ccf1e1a30511b32fb..5b588c510e1e4d551aaf1a0eef2ec7500fcc326c 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc -@@ -1872,6 +1872,13 @@ void NetworkContext::SetNetworkConditions( - std::move(network_conditions)); +@@ -1892,6 +1892,13 @@ void NetworkContext::EnableDurableMessageCollector( + it->second->AddReceiver(std::move(receiver)); } +void NetworkContext::SetUserAgent(const std::string& new_user_agent) { @@ -51,24 +51,24 @@ index 7721b8e827d9aac6e90ddfe3de264f41915219f2..1bc4f24c3f0eb843033d2aa541d81e91 // This may only be called on NetworkContexts created with the constructor // that calls MakeURLRequestContext(). diff --git a/services/network/network_context.h b/services/network/network_context.h -index b9f201ccf04433a29083cd15cfe599fe9600c9c0..137aaf96a8d02b81afe64fde6b19ed1153569941 100644 +index f7831633a286f7c4aec2dd269b02561275b008c7..799688c0fc662845b1ff75ff472ee667674ab74e 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h -@@ -326,6 +326,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext - void CloseIdleConnections(CloseIdleConnectionsCallback callback) override; - void SetNetworkConditions(const base::UnguessableToken& throttling_profile_id, - mojom::NetworkConditionsPtr conditions) override; +@@ -333,6 +333,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext + const base::UnguessableToken& throttling_profile_id, + mojo::PendingReceiver<network::mojom::DurableMessageCollector> receiver) + override; + void SetUserAgent(const std::string& new_user_agent) override; void SetAcceptLanguage(const std::string& new_accept_language) override; void SetEnableReferrers(bool enable_referrers) override; #if BUILDFLAG(IS_CT_SUPPORTED) diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index 1ed66c3b41e583745c5b309670fc4470fa1983cf..c7464641d0fc944aa47f3f1e0406dd4002d0bd0b 100644 +index 6885ff48db5ddfb8e8ec09e91a4c01231261f8e5..4d674a226ff1ccb0c8288177ce6d55f77d4f8116 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -1288,6 +1288,9 @@ interface NetworkContext { - SetNetworkConditions(mojo_base.mojom.UnguessableToken throttling_profile_id, - NetworkConditions? conditions); +@@ -1317,6 +1317,9 @@ interface NetworkContext { + mojo_base.mojom.UnguessableToken throttling_profile_id, + pending_receiver<DurableMessageCollector> receiver); + // Updates the user agent to be used for requests. + SetUserAgent(string new_user_agent); @@ -77,10 +77,10 @@ index 1ed66c3b41e583745c5b309670fc4470fa1983cf..c7464641d0fc944aa47f3f1e0406dd40 SetAcceptLanguage(string new_accept_language); diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h -index 70a5ab342a8954354a3d8245d30df9520cfd398d..02700030ab651b6f8f0aecfe6857ca40e6f3839f 100644 +index cfd21ce01b7db6a4912de8e4ce0799825fd27e77..def5a1f569d480e95053ca54e117eeae64f28057 100644 --- a/services/network/test/test_network_context.h +++ b/services/network/test/test_network_context.h -@@ -158,6 +158,7 @@ class TestNetworkContext : public mojom::NetworkContext { +@@ -159,6 +159,7 @@ class TestNetworkContext : public mojom::NetworkContext { void CloseIdleConnections(CloseIdleConnectionsCallback callback) override {} void SetNetworkConditions(const base::UnguessableToken& throttling_profile_id, mojom::NetworkConditionsPtr conditions) override {} diff --git a/patches/chromium/extend_apply_webpreferences.patch b/patches/chromium/extend_apply_webpreferences.patch index dbd3c00b50748..6153035f5ead1 100644 --- a/patches/chromium/extend_apply_webpreferences.patch +++ b/patches/chromium/extend_apply_webpreferences.patch @@ -15,10 +15,10 @@ Ideally we could add an embedder observer pattern here but that can be done in future work. diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index b9799837c7ce14fc76045700b30e1358d4705251..5b3ab0837b5a85b4e7dd1685db75f65cd4d5ff43 100644 +index be43ac07eb6563dcb72374dfc4f3bd34913e98c3..099297e6fac7962eb731ba50cb51b868fa7070ac 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -1890,6 +1890,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, +@@ -1900,6 +1900,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, #if BUILDFLAG(IS_MAC) web_view_impl->SetMaximumLegibleScale( prefs.default_maximum_page_scale_factor); diff --git a/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch b/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch index 453b23e5ff63c..e3d012f5b2160 100644 --- a/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch +++ b/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch @@ -13,11 +13,11 @@ uses internally for things like menus and devtools. We can remove this patch once it has in some shape been upstreamed. diff --git a/ui/native_theme/native_theme.cc b/ui/native_theme/native_theme.cc -index 3f8801c6042ef2b20635838e4d4c572d89b94601..055b15ff72844cd54c60cc92042a5465ce2870ad 100644 +index e761050d9afbbc6d1c25dd8ec6a2a90d548c1195..fc28431861f2499095ecedfd1ffb8c4d43545ea4 100644 --- a/ui/native_theme/native_theme.cc +++ b/ui/native_theme/native_theme.cc -@@ -210,6 +210,8 @@ NativeTheme::NativeTheme(bool should_use_dark_colors, - NativeTheme::~NativeTheme() = default; +@@ -240,6 +240,8 @@ void NativeTheme::PaintMenuItemBackground( + } bool NativeTheme::ShouldUseDarkColors() const { + if (theme_source() == ThemeSource::kForcedLight) return false; @@ -26,10 +26,10 @@ index 3f8801c6042ef2b20635838e4d4c572d89b94601..055b15ff72844cd54c60cc92042a5465 } diff --git a/ui/native_theme/native_theme.h b/ui/native_theme/native_theme.h -index 67d63aa0048c2a4e331763a869b46bc1142b921c..34ddc49fe66c1824734a6d524af68862892801e2 100644 +index cbe76bbc68692228072fa69a8562c290e571505e..a9fd486a77b7edcba63ee889d583dc4e99f008f4 100644 --- a/ui/native_theme/native_theme.h +++ b/ui/native_theme/native_theme.h -@@ -459,6 +459,23 @@ class COMPONENT_EXPORT(NATIVE_THEME) NativeTheme { +@@ -460,6 +460,23 @@ class COMPONENT_EXPORT(NATIVE_THEME) NativeTheme { scoped_refptr<ColorProviderKey::ThemeInitializerSupplier> custom_theme, bool use_custom_frame = true) const; @@ -53,7 +53,7 @@ index 67d63aa0048c2a4e331763a869b46bc1142b921c..34ddc49fe66c1824734a6d524af68862 // Returns a shared instance of the native theme that should be used for web // rendering. Do not use it in a normal application context (i.e. browser). // The returned object should not be deleted by the caller. This function is -@@ -714,6 +731,7 @@ class COMPONENT_EXPORT(NATIVE_THEME) NativeTheme { +@@ -701,6 +718,7 @@ class COMPONENT_EXPORT(NATIVE_THEME) NativeTheme { PreferredContrast preferred_contrast_ = PreferredContrast::kNoPreference; std::optional<base::TimeDelta> caret_blink_interval_; bool use_overlay_scrollbars_ = false; @@ -62,10 +62,10 @@ index 67d63aa0048c2a4e331763a869b46bc1142b921c..34ddc49fe66c1824734a6d524af68862 SEQUENCE_CHECKER(sequence_checker_); }; diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc -index 0c6d689295a03fc088b57487037d85f4d634a5f4..8e3bab233e8611c68e79d53f125560f4fb086a1e 100644 +index 0ca923fb1b402ce7a5b112600b86e79b02d96168..5362243aa69bf1a64f860c5757d15298101cde74 100644 --- a/ui/native_theme/native_theme_win.cc +++ b/ui/native_theme/native_theme_win.cc -@@ -697,6 +697,8 @@ bool NativeThemeWin::ShouldUseDarkColors() const { +@@ -678,6 +678,8 @@ bool NativeThemeWin::ShouldUseDarkColors() const { if (InForcedColorsMode() && !IsForcedDarkMode()) { return false; } diff --git a/patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch b/patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch index 7d6bd4f2165ba..293ac9ab1ff7d 100644 --- a/patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch +++ b/patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch @@ -17,7 +17,7 @@ which removed range-requests-supported on non-http protocols. See https://issues for more information. diff --git a/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc b/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc -index 5972dcf91aeb8446af4fa0b902b086a5492815bd..ac37d7f601f24d9ec53c4c1fd5e00c8a262e1580 100644 +index 23d5e86aad9509159c74fef32419e26ca68b2e4c..767e6b7e4c85f9f2fafac282c4ebc6ba80e52528 100644 --- a/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc +++ b/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc @@ -11,8 +11,10 @@ @@ -104,7 +104,7 @@ index 8c92f1c0c5028069cdad967b5be2bccf8005ed43..8b49dc182296f7f277981aed29b58947 using InitializeCB = base::OnceCallback<void(bool)>; void Initialize(InitializeCB init_cb) override; diff --git a/third_party/blink/renderer/platform/media/resource_multi_buffer_data_provider.cc b/third_party/blink/renderer/platform/media/resource_multi_buffer_data_provider.cc -index 1b5dc45902fc30386dfcb98a19d532e3be46706b..fb2c7f09c210f6aa178e663b1c1ce91468c71e10 100644 +index 093e01ba30f66e29d13c129a230f8acf875f5eb4..8fb40e4d5827985c2760e57f0dccfeb9ab700a03 100644 --- a/third_party/blink/renderer/platform/media/resource_multi_buffer_data_provider.cc +++ b/third_party/blink/renderer/platform/media/resource_multi_buffer_data_provider.cc @@ -8,6 +8,7 @@ diff --git a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch index cebc62f39b163..8481e0f6e5e81 100644 --- a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch +++ b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch @@ -259,7 +259,7 @@ index 28556e56f2fd591c46ce6f48d39eb907876a499d..f5737ba60fb9e182459066ffa62c7c58 + } // namespace content diff --git a/content/browser/renderer_host/code_cache_host_impl.cc b/content/browser/renderer_host/code_cache_host_impl.cc -index d95cba73aacf4b9156e8c0c3100abd7934369fdd..1583ae512e34c29e849efc2f570e09e74b348406 100644 +index 404ff1e48a990570dc411a714e570d4f8e1a9ef1..916c5d350cfabae0bfd3da97d6a058f2fb93530d 100644 --- a/content/browser/renderer_host/code_cache_host_impl.cc +++ b/content/browser/renderer_host/code_cache_host_impl.cc @@ -6,6 +6,7 @@ @@ -284,7 +284,7 @@ index d95cba73aacf4b9156e8c0c3100abd7934369fdd..1583ae512e34c29e849efc2f570e09e7 +bool ProcessLockURLIsCodeCacheScheme(const ProcessLock& process_lock) { + return base::Contains(url::GetCodeCacheSchemes(), -+ process_lock.lock_url().scheme()); ++ process_lock.GetProcessLockURL().scheme()); +} + bool CheckSecurityForAccessingCodeCacheData( @@ -303,17 +303,9 @@ index d95cba73aacf4b9156e8c0c3100abd7934369fdd..1583ae512e34c29e849efc2f570e09e7 // chrome-untrusted scripts, so any http(s) page attempting to store data // about a chrome or chrome-untrusted script would be an indication of // suspicious activity. -- if (resource_url.SchemeIs(content::kChromeUIScheme) || -- resource_url.SchemeIs(content::kChromeUIUntrustedScheme)) { -- if (!process_lock.is_locked_to_site()) { -- // We can't tell for certain whether this renderer is doing something -- // malicious, but we don't trust it enough to store data. -- return false; -- } + if (resource_url.SchemeIsHTTPOrHTTPS()) { - if (process_lock.matches_scheme(url::kHttpScheme) || - process_lock.matches_scheme(url::kHttpsScheme)) { -- if (operation == CodeCacheHostImpl::Operation::kWrite) { ++ if (process_lock.MatchesScheme(url::kHttpScheme) || ++ process_lock.MatchesScheme(url::kHttpsScheme)) { + return true; + } + // Pages in custom schemes like isolated-app: are allowed to load http(s) @@ -327,15 +319,22 @@ index d95cba73aacf4b9156e8c0c3100abd7934369fdd..1583ae512e34c29e849efc2f570e09e7 + return false; + } + -+ if (resource_url.SchemeIs(kChromeUIScheme) || -+ resource_url.SchemeIs(kChromeUIUntrustedScheme)) { -+ if (process_lock.matches_scheme(kChromeUIScheme) || -+ process_lock.matches_scheme(kChromeUIUntrustedScheme)) { + if (resource_url.SchemeIs(content::kChromeUIScheme) || + resource_url.SchemeIs(content::kChromeUIUntrustedScheme)) { +- if (!process_lock.IsLockedToSite()) { +- // We can't tell for certain whether this renderer is doing something +- // malicious, but we don't trust it enough to store data. +- return false; ++ if (process_lock.MatchesScheme(content::kChromeUIScheme) || ++ process_lock.MatchesScheme(content::kChromeUIUntrustedScheme)) { + return true; -+ } + } +- if (process_lock.MatchesScheme(url::kHttpScheme) || +- process_lock.MatchesScheme(url::kHttpsScheme)) { +- if (operation == CodeCacheHostImpl::Operation::kWrite) { + if (operation == CodeCacheHostImpl::Operation::kWrite) { -+ if (process_lock.matches_scheme(url::kHttpScheme) || -+ process_lock.matches_scheme(url::kHttpsScheme)) { ++ if (process_lock.MatchesScheme(url::kHttpScheme) || ++ process_lock.MatchesScheme(url::kHttpsScheme)) { mojo::ReportBadMessage("HTTP(S) pages cannot cache WebUI code"); } + if (ProcessLockURLIsCodeCacheScheme(process_lock)) { @@ -348,15 +347,15 @@ index d95cba73aacf4b9156e8c0c3100abd7934369fdd..1583ae512e34c29e849efc2f570e09e7 // Other schemes which might successfully load chrome or chrome-untrusted // scripts, such as the PDF viewer, are unsupported but not considered - // dangerous. -- return process_lock.matches_scheme(content::kChromeUIScheme) || -- process_lock.matches_scheme(content::kChromeUIUntrustedScheme); +- return process_lock.MatchesScheme(content::kChromeUIScheme) || +- process_lock.MatchesScheme(content::kChromeUIUntrustedScheme); + // dangerous. Similarly, the process might not be locked to a site. + return false; } - if (resource_url.SchemeIsHTTPOrHTTPS() || - blink::CommonSchemeRegistry::IsExtensionScheme(resource_url.scheme())) { -- if (process_lock.matches_scheme(content::kChromeUIScheme) || -- process_lock.matches_scheme(content::kChromeUIUntrustedScheme)) { +- if (process_lock.MatchesScheme(content::kChromeUIScheme) || +- process_lock.MatchesScheme(content::kChromeUIUntrustedScheme)) { - // It is possible for WebUI pages to include open-web content, but such - // usage is rare and we've decided that reasoning about security is easier - // if the WebUI code cache includes only WebUI scripts. @@ -370,13 +369,13 @@ index d95cba73aacf4b9156e8c0c3100abd7934369fdd..1583ae512e34c29e849efc2f570e09e7 if (operation == CodeCacheHostImpl::Operation::kWrite) { @@ -433,6 +458,7 @@ std::optional<GURL> CodeCacheHostImpl::GetSecondaryKeyForCodeCache( - process_lock.matches_scheme(url::kHttpsScheme) || - process_lock.matches_scheme(content::kChromeUIScheme) || - process_lock.matches_scheme(content::kChromeUIUntrustedScheme) || + process_lock.MatchesScheme(url::kHttpsScheme) || + process_lock.MatchesScheme(content::kChromeUIScheme) || + process_lock.MatchesScheme(content::kChromeUIUntrustedScheme) || + ProcessLockURLIsCodeCacheScheme(process_lock) || blink::CommonSchemeRegistry::IsExtensionScheme( - process_lock.lock_url().scheme())) { - return process_lock.lock_url(); + process_lock.GetProcessLockURL().scheme())) { + return process_lock.GetProcessLockURL(); diff --git a/content/common/url_schemes.cc b/content/common/url_schemes.cc index 225e017909b8869231b870eaaf161a0b5e93e2a0..846a5251429630b8528a84a3d67ed56cb28df5a1 100644 --- a/content/common/url_schemes.cc diff --git a/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch b/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch index f5e7abc1fb76d..a04f37e424bbc 100644 --- a/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch +++ b/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch @@ -46,7 +46,7 @@ index e2771b7b281274cdcb601a5bc78a948ad592087b..48d116823a28213e50775f378e6ce04c // OnStop is called by StopAndDeAllocate. virtual void OnStop() = 0; diff --git a/content/browser/media/capture/screen_capture_kit_device_mac.mm b/content/browser/media/capture/screen_capture_kit_device_mac.mm -index 7e17594c30ac3cf8cb484b53563b03fc75bd2e0b..0e4a68f2fd8179640f877cb258b4049610fd49da 100644 +index 86128a6555798e8380ffebd635e02329ccb96a12..7733e2d70b604efd41ce42638dd3472cba0b78ad 100644 --- a/content/browser/media/capture/screen_capture_kit_device_mac.mm +++ b/content/browser/media/capture/screen_capture_kit_device_mac.mm @@ -27,6 +27,61 @@ @@ -134,7 +134,7 @@ index 7e17594c30ac3cf8cb484b53563b03fc75bd2e0b..0e4a68f2fd8179640f877cb258b40496 _errorCallback = errorCallback; } return self; -@@ -211,29 +270,53 @@ + (SCStreamConfiguration*)streamConfigurationWithFrameSize:(gfx::Size)frameSize +@@ -210,29 +269,53 @@ + (SCStreamConfiguration*)streamConfigurationWithFrameSize:(gfx::Size)frameSize class API_AVAILABLE(macos(12.3)) ScreenCaptureKitDeviceMac : public IOSurfaceCaptureDeviceBase, @@ -192,7 +192,7 @@ index 7e17594c30ac3cf8cb484b53563b03fc75bd2e0b..0e4a68f2fd8179640f877cb258b40496 void OnShareableContentCreated(SCShareableContent* content) { DCHECK(device_task_runner_->RunsTasksInCurrentSequence()); -@@ -301,7 +384,7 @@ void CreateStream(SCContentFilter* filter) { +@@ -300,7 +383,7 @@ void CreateStream(SCContentFilter* filter) { return; } @@ -201,7 +201,7 @@ index 7e17594c30ac3cf8cb484b53563b03fc75bd2e0b..0e4a68f2fd8179640f877cb258b40496 // Update the content size. This step is neccessary when used together // with SCContentSharingPicker. If the Chrome picker is used, it will // change to retina resolution if applicable. -@@ -310,6 +393,9 @@ void CreateStream(SCContentFilter* filter) { +@@ -309,6 +392,9 @@ void CreateStream(SCContentFilter* filter) { filter.contentRect.size.height * filter.pointPixelScale); } @@ -211,7 +211,7 @@ index 7e17594c30ac3cf8cb484b53563b03fc75bd2e0b..0e4a68f2fd8179640f877cb258b40496 gfx::RectF dest_rect_in_frame; actual_capture_format_ = capture_params().requested_format; actual_capture_format_.pixel_format = media::PIXEL_FORMAT_NV12; -@@ -323,6 +409,7 @@ void CreateStream(SCContentFilter* filter) { +@@ -322,6 +408,7 @@ void CreateStream(SCContentFilter* filter) { stream_ = [[SCStream alloc] initWithFilter:filter configuration:config delegate:helper_]; @@ -219,7 +219,7 @@ index 7e17594c30ac3cf8cb484b53563b03fc75bd2e0b..0e4a68f2fd8179640f877cb258b40496 { NSError* error = nil; bool add_stream_output_result = -@@ -480,7 +567,7 @@ void OnStreamError() { +@@ -479,7 +566,7 @@ void OnStreamError() { if (fullscreen_module_) { fullscreen_module_->Reset(); } @@ -228,7 +228,7 @@ index 7e17594c30ac3cf8cb484b53563b03fc75bd2e0b..0e4a68f2fd8179640f877cb258b40496 } else { client()->OnError(media::VideoCaptureError::kScreenCaptureKitStreamError, FROM_HERE, "Stream delegate called didStopWithError"); -@@ -503,23 +590,41 @@ void OnUpdateConfigurationError() { +@@ -502,23 +589,41 @@ void OnUpdateConfigurationError() { } // IOSurfaceCaptureDeviceBase: @@ -285,7 +285,7 @@ index 7e17594c30ac3cf8cb484b53563b03fc75bd2e0b..0e4a68f2fd8179640f877cb258b40496 } void OnStop() override { DCHECK(device_task_runner_->RunsTasksInCurrentSequence()); -@@ -577,8 +682,9 @@ void ResetStreamTo(SCWindow* window) override { +@@ -576,8 +681,9 @@ void ResetStreamTo(SCWindow* window) override { } private: @@ -296,7 +296,7 @@ index 7e17594c30ac3cf8cb484b53563b03fc75bd2e0b..0e4a68f2fd8179640f877cb258b40496 const scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; // The actual format of the video frames that are sent to `client`. -@@ -594,6 +700,10 @@ void ResetStreamTo(SCWindow* window) override { +@@ -593,6 +699,10 @@ void ResetStreamTo(SCWindow* window) override { // Helper class that acts as output and delegate for `stream_`. ScreenCaptureKitDeviceHelper* __strong helper_; @@ -307,7 +307,7 @@ index 7e17594c30ac3cf8cb484b53563b03fc75bd2e0b..0e4a68f2fd8179640f877cb258b40496 // This is used to detect when a captured presentation enters fullscreen mode. // If this happens, the module will call the ResetStreamTo function. std::unique_ptr<ScreenCaptureKitFullscreenModule> fullscreen_module_; -@@ -606,6 +716,8 @@ void ResetStreamTo(SCWindow* window) override { +@@ -605,6 +715,8 @@ void ResetStreamTo(SCWindow* window) override { base::WeakPtrFactory<ScreenCaptureKitDeviceMac> weak_factory_{this}; }; @@ -317,10 +317,10 @@ index 7e17594c30ac3cf8cb484b53563b03fc75bd2e0b..0e4a68f2fd8179640f877cb258b40496 // Although ScreenCaptureKit is available in 12.3 there were some bugs that diff --git a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc -index a5bc6f63c771fdf68ed9251285eac9d2c91acdc0..f719ff68e18093791bf13e434f40a3d1a9626dca 100644 +index 7c8f4b60a9299114ac5e71ede6f602643326507a..203422ff6ab9cf98c3e76820e230321c3cafb5ef 100644 --- a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc +++ b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc -@@ -321,8 +321,16 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( +@@ -322,8 +322,16 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( break; } @@ -338,7 +338,7 @@ index a5bc6f63c771fdf68ed9251285eac9d2c91acdc0..f719ff68e18093791bf13e434f40a3d1 // For the other capturers, when a bug reports the type of capture it's // easy enough to determine which capturer was used, but it's a little // fuzzier with window capture. -@@ -338,13 +346,15 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( +@@ -339,13 +347,15 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( } #endif // defined(USE_AURA) || BUILDFLAG(IS_MAC) @@ -369,10 +369,10 @@ index 294b5f79955ba72976f8ba127fd19556c81e322c..27553e51b281575c5cb7a4ba4dab06d1 #if defined(USE_AURA) || BUILDFLAG(IS_MAC) // Assigns integer identifier to the |window| and returns its DesktopMediaID. diff --git a/media/capture/video_capture_types.h b/media/capture/video_capture_types.h -index 53e8077c9c0b635df0abdeca43fa9a6373c68252..2805e36cc42190d8197d83f5df235094570e3d5d 100644 +index accd52db0cf7cb043d7d767b778079b5d1160cfb..357ee6111471405d1f860ea6d5000ac65f4ecb9a 100644 --- a/media/capture/video_capture_types.h +++ b/media/capture/video_capture_types.h -@@ -355,6 +355,8 @@ struct CAPTURE_EXPORT VideoCaptureParams { +@@ -358,6 +358,8 @@ struct CAPTURE_EXPORT VideoCaptureParams { // Flag indicating whether HiDPI mode should be enabled for tab capture // sessions. bool is_high_dpi_enabled = true; diff --git a/patches/chromium/feat_configure_launch_options_for_service_process.patch b/patches/chromium/feat_configure_launch_options_for_service_process.patch index 0b2ab620f7343..e618525ba9ef0 100644 --- a/patches/chromium/feat_configure_launch_options_for_service_process.patch +++ b/patches/chromium/feat_configure_launch_options_for_service_process.patch @@ -707,7 +707,7 @@ index c5fee4ad8b246bc1113a383794c6101bade24df3..61f0a0f62795b30105c42da363205284 #if BUILDFLAG(IS_MAC) // Whether or not to disclaim TCC responsibility for the process, defaults to diff --git a/sandbox/policy/win/sandbox_win.cc b/sandbox/policy/win/sandbox_win.cc -index a0a8545a9c967f1059119cf3dda849fa7d96cb15..3a3a9c1e2fa3ad88eaf721da75a305966c6833c4 100644 +index 7f67a828fc76765fa88c1be4d5eed08637c1bae3..b16b7e56efedeb1c10b0b33a569ad2e02505ebf3 100644 --- a/sandbox/policy/win/sandbox_win.cc +++ b/sandbox/policy/win/sandbox_win.cc @@ -588,11 +588,9 @@ base::win::ScopedHandle CreateUnsandboxedJob() { diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index 7e9677b92b07e..39151eadcac37 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -20,7 +20,7 @@ making three primary changes to Blink: * Controls whether the CSS rule is available. diff --git a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom -index bb284c62d1d0dcd693bcb092044e6723bb339258..3c754cf37c18d0d17dc27e184ba5e8c5ebf8bdae 100644 +index c5fa337dd4dc80e6dd5e8485ad9ba68ee051ae68..716b487b85d44afe3cf940078983d461375fe556 100644 --- a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom +++ b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom @@ -48,6 +48,7 @@ enum CSSSampleId { @@ -45,10 +45,10 @@ index e189d584f05f2ce6354c03a9b19f56985df8a15e..41b430e8f2416be098494f5c49fb97ca 'internal-forced-visited-'): internal_visited_order = 0 diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 -index 27e52d4fd24d575fded2016a720d4587d5fb1998..e39ad72d2d3e56ff918f3274be86633e930fd24f 100644 +index 3d8de3b51b474f8c10b93e042c7a6f989aec6076..b39d90de9e740b8d908645a1c46b0aa234225903 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5 -@@ -8966,6 +8966,26 @@ +@@ -8976,6 +8976,26 @@ property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], }, @@ -76,10 +76,10 @@ index 27e52d4fd24d575fded2016a720d4587d5fb1998..e39ad72d2d3e56ff918f3274be86633e { name: "-internal-visited-color", diff --git a/third_party/blink/renderer/core/css/css_property_equality.cc b/third_party/blink/renderer/core/css/css_property_equality.cc -index 687332cf68b3b826d7dcbd5dc10d47f0cd7ce688..653bbb8aef7e6edb31d63b02a9799d5454ce8d57 100644 +index fc3d725bcff1921756e9c4956dbe1e611bb00ba3..27462de749a760418b5c1457d786e95bf892f9c3 100644 --- a/third_party/blink/renderer/core/css/css_property_equality.cc +++ b/third_party/blink/renderer/core/css/css_property_equality.cc -@@ -352,6 +352,8 @@ bool CSSPropertyEquality::PropertiesEqual(const PropertyHandle& property, +@@ -354,6 +354,8 @@ bool CSSPropertyEquality::PropertiesEqual(const PropertyHandle& property, return a.DominantBaseline() == b.DominantBaseline(); case CSSPropertyID::kDynamicRangeLimit: return a.GetDynamicRangeLimit() == b.GetDynamicRangeLimit(); @@ -89,10 +89,10 @@ index 687332cf68b3b826d7dcbd5dc10d47f0cd7ce688..653bbb8aef7e6edb31d63b02a9799d54 return a.EmptyCells() == b.EmptyCells(); case CSSPropertyID::kFill: diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -index 8833941b927a076a73336b5d651c033258c13793..525f2303efbe9222567a1bbcdbc7321d5d93048f 100644 +index 0ba66a67636d75ed8677f66ba8c6f80645f378bb..ef9ce49a3ca4f7760effe09c8619f49f1575c362 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -@@ -12289,5 +12289,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( +@@ -12292,5 +12292,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( CSSValueID::kNone>(stream); } @@ -130,7 +130,7 @@ index 8833941b927a076a73336b5d651c033258c13793..525f2303efbe9222567a1bbcdbc7321d } // namespace css_longhand } // namespace blink diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc -index 7a5a5e370daea769e710f56a8004d79efa721268..4ba371436c33049952d919dc734be835dfbc783a 100644 +index d5754172748072b522c73e3071effd8206befda6..31ff0e8df2e30d0d46d6d117154b9b4313a76848 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc @@ -4022,6 +4022,15 @@ PositionTryFallback StyleBuilderConverter::ConvertSinglePositionTryFallback( @@ -201,10 +201,10 @@ index 0802c73aa4aaf4e1fb5efd367758f19c36691f71..5f06c0af277a7c937e694470beac707a return result; } diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn -index 4c0ab9ea098c76063ece82ee79e4fb6465f822c8..2eaf538e48407a4cb12d1509e012f41847c716f2 100644 +index ad5d60eae0f2e451ebe82ce3d86a9d0417d1c2c7..93e1ebc69a605d23985045962210ad4061eb2f1e 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn -@@ -1659,6 +1659,8 @@ component("platform") { +@@ -1671,6 +1671,8 @@ component("platform") { "widget/widget_base.h", "widget/widget_base_client.h", "windows_keyboard_codes.h", @@ -312,7 +312,7 @@ index 7e3d46902fbf736b4240eb3fcb89975a7b222197..57fdc89fc265ad70cb0bff8443cc1026 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index e58bd2c672fcfd68b7dbc0c861d5be1d2a099e97..7dbe46a7390a988c21b2fbfbd5fbb3a3e822b7f5 100644 +index 8325c24ea4549b6e1ba5404f4756aaf3d9408e2f..9e25ca9f0fbcc3819149c10c6bfd8a5e5ea5acf3 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch index d8f1258346eec..9abbcbbd896bf 100644 --- a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch +++ b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch @@ -39,7 +39,7 @@ index aed835411f5728c5685baa43eda2dd1585119b18..0e66085b1c457c1f1f6be241c7d331d7 gpu::SurfaceHandle child_window) { NOTREACHED(); diff --git a/components/viz/host/host_display_client.h b/components/viz/host/host_display_client.h -index 9e94f648060e9873a120f2c45591ad599a2e62df..93dabe09e44bda68644dcab568a827a92c550e4a 100644 +index 7236eee85fdbb285a9873138075183d37c129666..2ecb1a92fb3216211e8d429254f5b18e3dcc7346 100644 --- a/components/viz/host/host_display_client.h +++ b/components/viz/host/host_display_client.h @@ -39,6 +39,9 @@ class VIZ_HOST_EXPORT HostDisplayClient : public mojom::DisplayClient { @@ -597,7 +597,7 @@ index e063835e87f08e6a2359886a96d7b78954e3d5b2..34bcf67726f64466d11a56d7a315ce7e // Sends the created child window to the browser process so that it can be diff --git a/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom b/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom -index 3066550e422058eec23d5fe3e655625f5446d694..7358b05a646a2f80717a91182c4929776a404179 100644 +index 4f1e9c6c4aad3a4c3d52d57f1234841471a4649e..cda1963ca4119db70c94b64365ab67fea89e9255 100644 --- a/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom +++ b/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom @@ -39,6 +39,7 @@ struct RootCompositorFrameSinkParams { @@ -620,7 +620,7 @@ index 2f462f0deb5fc8a637457243fb5d5849fc214d14..695869b83cefaa24af93a2e11b39de05 + Draw(gfx.mojom.Rect damage_rect) => (); }; diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h -index f1a4674323d96bc6a1a291b0aaa4c2a35b20648e..682b23f083eff17bc36cdc4698e35d853beb90cc 100644 +index 0d1fd44c615041039579691802012b8ef96dc9b5..11e6186b8e06008564246e8034b780a09a498838 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h @@ -87,6 +87,7 @@ class DisplayPrivate; @@ -647,7 +647,7 @@ index f1a4674323d96bc6a1a291b0aaa4c2a35b20648e..682b23f083eff17bc36cdc4698e35d85 // Compositor object to take care of GPU painting. // A Browser compositor object is responsible for generating the final -@@ -189,6 +199,9 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, +@@ -195,6 +205,9 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, // Schedules a redraw of the layer tree associated with this compositor. void ScheduleDraw(); @@ -657,7 +657,7 @@ index f1a4674323d96bc6a1a291b0aaa4c2a35b20648e..682b23f083eff17bc36cdc4698e35d85 // Sets the root of the layer tree drawn by this Compositor. The root layer // must have no parent. The compositor's root layer is reset if the root layer // is destroyed. NULL can be passed to reset the root layer, in which case the -@@ -630,6 +643,8 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, +@@ -636,6 +649,8 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, simple_begin_frame_observers_; std::unique_ptr<ui::HostBeginFrameObserver> host_begin_frame_observer_; diff --git a/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch b/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch index 5356a433ff375..f1c39be91ad79 100644 --- a/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch +++ b/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch @@ -172,7 +172,7 @@ index d2b9526f9a0bfa9d12a594c35c71499810cb6bb0..aef0eb3508fc37e3a0e9e1c27a71e1aa + } // namespace crypto::apple diff --git a/crypto/apple/keychain_seckeychain.cc b/crypto/apple/keychain_seckeychain.cc -index 4ad5acbf29607fe2ea28637f5470599984e317db..61056948062f3fcb5138e309b9f5019c96f9ce00 100644 +index a737276cb146fdb51433be8ca81947edb54f626e..3adf18cc0f0eb40e88691ba2f5a4b11073f86820 100644 --- a/crypto/apple/keychain_seckeychain.cc +++ b/crypto/apple/keychain_seckeychain.cc @@ -25,14 +25,15 @@ KeychainSecKeychain::~KeychainSecKeychain() = default; @@ -182,7 +182,7 @@ index 4ad5acbf29607fe2ea28637f5470599984e317db..61056948062f3fcb5138e309b9f5019c - std::string_view account_name) const { + std::string_view account_name, + AppleSecKeychainItemRef* item) const { - base::AutoLock lock(GetMacSecurityServicesLock()); + base::AutoLock lock(GetSecurityFrameworkLock()); uint32_t password_length = 0; void* password_data = nullptr; OSStatus status = SecKeychainFindGenericPassword( @@ -198,7 +198,7 @@ index 4ad5acbf29607fe2ea28637f5470599984e317db..61056948062f3fcb5138e309b9f5019c } +OSStatus KeychainSecKeychain::ItemDelete(AppleSecKeychainItemRef item) const { -+ base::AutoLock lock(GetMacSecurityServicesLock()); ++ base::AutoLock lock(GetSecurityFrameworkLock()); + return SecKeychainItemDelete(item); +} + diff --git a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch index cdcaff7156e38..823196d3be1fd 100644 --- a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch +++ b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch @@ -112,10 +112,10 @@ index 3a5fbaea905e7c01caee3659ff3be06e8def5615..89da9461e8290b8099456e5222f27877 string mime_type; diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc -index 61f3909c6f0fe606d30da08fbd3222af44c1a9e4..8b5f2162a2bbfe0bd422b89bc13e9ff93d826afe 100644 +index a130ee693ca02585a03ee1806d811db81e4e64c7..38a0bf930ad98de932865a871856e615631dbc12 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc -@@ -398,6 +398,9 @@ URLLoader::URLLoader( +@@ -400,6 +400,9 @@ URLLoader::URLLoader( mojo::SimpleWatcher::ArmingPolicy::MANUAL, TaskRunner(request.priority)), per_factory_orb_state_(context.GetMutableOrbState()), @@ -125,7 +125,7 @@ index 61f3909c6f0fe606d30da08fbd3222af44c1a9e4..8b5f2162a2bbfe0bd422b89bc13e9ff9 devtools_request_id_(request.devtools_request_id), options_(PopulateOptions(options, factory_params_->is_orb_enabled, -@@ -536,7 +539,7 @@ void URLLoader::SetUpUrlRequestCallbacks( +@@ -539,7 +542,7 @@ void URLLoader::SetUpUrlRequestCallbacks( &URLLoader::IsSharedDictionaryReadAllowed, base::Unretained(this))); } @@ -134,7 +134,7 @@ index 61f3909c6f0fe606d30da08fbd3222af44c1a9e4..8b5f2162a2bbfe0bd422b89bc13e9ff9 url_request_->SetResponseHeadersCallback(base::BindRepeating( &URLLoader::SetRawResponseHeaders, base::Unretained(this))); } -@@ -1151,6 +1154,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) { +@@ -1154,6 +1157,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) { } response_ = BuildResponseHead(); @@ -155,10 +155,10 @@ index 61f3909c6f0fe606d30da08fbd3222af44c1a9e4..8b5f2162a2bbfe0bd422b89bc13e9ff9 ad_auction_event_record_request_helper_.HandleResponse( diff --git a/services/network/url_loader.h b/services/network/url_loader.h -index 6ba39c957af7927b060be59f7d8837a3e2d41215..e52a276b0dd671317797104d85ccf75f5a333153 100644 +index 21dc5e84807eb89a4e331e5cca5b38f08c41f72d..9f55ff05f239df939833d98d45d455e864f4f2c3 100644 --- a/services/network/url_loader.h +++ b/services/network/url_loader.h -@@ -615,6 +615,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader +@@ -622,6 +622,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader std::unique_ptr<ResourceScheduler::ScheduledResourceRequest> resource_scheduler_request_handle_; diff --git a/patches/chromium/feat_filter_out_non-shareable_windows_in_the_current_application_in.patch b/patches/chromium/feat_filter_out_non-shareable_windows_in_the_current_application_in.patch index 5da28b3c084f9..dd00d6888dc0d 100644 --- a/patches/chromium/feat_filter_out_non-shareable_windows_in_the_current_application_in.patch +++ b/patches/chromium/feat_filter_out_non-shareable_windows_in_the_current_application_in.patch @@ -7,10 +7,10 @@ Subject: feat: filter out non-shareable windows in the current application in This patch ensures that windows protected via win.setContentProtection(true) do not appear in full display captures via desktopCapturer. This patch could be upstreamed but as the check is limited to in-process windows it doesn't make a lot of sense for Chromium itself. This patch currently has a limitation that it only function for windows created / protected BEFORE the stream is started. There is theoretical future work we can do via polling / observers to automatically update the SCContentFilter when new windows are made but for now this will solve 99+% of the problem and folks can re-order their logic a bit to get it working for their use cases. diff --git a/content/browser/media/capture/screen_capture_kit_device_mac.mm b/content/browser/media/capture/screen_capture_kit_device_mac.mm -index 42705a5c59fb76ba4a6a17a060e215436307de49..7e17594c30ac3cf8cb484b53563b03fc75bd2e0b 100644 +index 2b90b268dcc43202f5c01ac5a65b4bdfb79235e5..86128a6555798e8380ffebd635e02329ccb96a12 100644 --- a/content/browser/media/capture/screen_capture_kit_device_mac.mm +++ b/content/browser/media/capture/screen_capture_kit_device_mac.mm -@@ -254,8 +254,17 @@ void OnShareableContentCreated(SCShareableContent* content) { +@@ -253,8 +253,17 @@ void OnShareableContentCreated(SCShareableContent* content) { // fallback. See https://crbug.com/325530044. if (source_.id == display.displayID || source_.id == webrtc::kFullDesktopScreenId) { diff --git a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch index f09102aa996b6..80aaa9daf8fbe 100644 --- a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch +++ b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch @@ -20,7 +20,7 @@ This patch will be removed when the deprecated sync api support is removed. diff --git a/components/permissions/permission_util.cc b/components/permissions/permission_util.cc -index 21abffe390a8213ce1a5b71f382b37a60a014f52..38134a075fbb3586eec543591c88fcf7dcd53e3d 100644 +index 2b132446e1e384de0e51355a44fab38dbaf64f53..83b0237a56d5ea7555ae989bd7bd13886f0c8f13 100644 --- a/components/permissions/permission_util.cc +++ b/components/permissions/permission_util.cc @@ -536,6 +536,7 @@ ContentSettingsType PermissionUtil::PermissionTypeToContentSettingsTypeSafe( @@ -32,7 +32,7 @@ index 21abffe390a8213ce1a5b71f382b37a60a014f52..38134a075fbb3586eec543591c88fcf7 break; } diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc -index 93375d87a26961edd8ae0c25fecc0ea5afc8c0bc..f6a28f5efae758a93aa52ebd28e25ece996f0e7e 100644 +index 8af9381691776fd7968cab890e32546c285979e4..d92f15f9ff1bf8dc23361e668f6d48199540c4e6 100644 --- a/content/browser/permissions/permission_controller_impl.cc +++ b/content/browser/permissions/permission_controller_impl.cc @@ -88,6 +88,7 @@ PermissionToSchedulingFeature(PermissionType permission_name) { diff --git a/patches/chromium/fix_adapt_exclusive_access_for_electron_needs.patch b/patches/chromium/fix_adapt_exclusive_access_for_electron_needs.patch index 2a4ea12135311..d537ad8fd8ba4 100644 --- a/patches/chromium/fix_adapt_exclusive_access_for_electron_needs.patch +++ b/patches/chromium/fix_adapt_exclusive_access_for_electron_needs.patch @@ -16,10 +16,10 @@ Linux or Windows to un-fullscreen in some circumstances without this change. diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc -index c38ce5558472c785837f1d4d2542f2edf2ffab58..219f562f51b45d2c961246e232ef4daf9d1f5c19 100644 +index 52ab5b76078ac160162c6781d886c5466db5f037..0ee6e12a3194d9c99dd7d884afd33f58dad07d09 100644 --- a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc -@@ -46,7 +46,7 @@ +@@ -47,7 +47,7 @@ #include "components/prefs/pref_service.h" #endif @@ -28,7 +28,7 @@ index c38ce5558472c785837f1d4d2542f2edf2ffab58..219f562f51b45d2c961246e232ef4daf #include "chrome/browser/ui/blocked_content/popunder_preventer.h" #endif // !BUILDFLAG(IS_ANDROID) -@@ -271,7 +271,7 @@ void FullscreenController::EnterFullscreenModeForTab( +@@ -196,7 +196,7 @@ void FullscreenController::EnterFullscreenModeForTab( return; } @@ -37,7 +37,7 @@ index c38ce5558472c785837f1d4d2542f2edf2ffab58..219f562f51b45d2c961246e232ef4daf if (!popunder_preventer_) { popunder_preventer_ = std::make_unique<PopunderPreventer>(web_contents); } else { -@@ -391,12 +391,14 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) { +@@ -317,12 +317,14 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) { void FullscreenController::FullscreenTabOpeningPopup( content::WebContents* opener, content::WebContents* popup) { @@ -52,7 +52,7 @@ index c38ce5558472c785837f1d4d2542f2edf2ffab58..219f562f51b45d2c961246e232ef4daf } #endif // !BUILDFLAG(IS_ANDROID) -@@ -487,8 +489,7 @@ void FullscreenController::FullscreenTransitionCompleted() { +@@ -406,8 +408,7 @@ void FullscreenController::FullscreenTransitionCompleted() { #endif // DCHECK_IS_ON() tab_fullscreen_target_display_id_ = display::kInvalidDisplayId; started_fullscreen_transition_ = false; @@ -62,7 +62,7 @@ index c38ce5558472c785837f1d4d2542f2edf2ffab58..219f562f51b45d2c961246e232ef4daf if (!IsTabFullscreen()) { // Activate any popup windows created while content fullscreen, after exit. popunder_preventer_.reset(); -@@ -623,18 +624,17 @@ void FullscreenController::EnterFullscreenModeInternal( +@@ -543,18 +544,17 @@ void FullscreenController::EnterFullscreenModeInternal( // Do not enter fullscreen mode if disallowed by pref. This prevents the user // from manually entering fullscreen mode and also disables kiosk mode on // desktop platforms. @@ -86,7 +86,7 @@ index c38ce5558472c785837f1d4d2542f2edf2ffab58..219f562f51b45d2c961246e232ef4daf if (option == TAB) { origin = GetRequestingOrigin(); tab_fullscreen_ = true; -@@ -671,6 +671,7 @@ void FullscreenController::EnterFullscreenModeInternal( +@@ -592,6 +592,7 @@ void FullscreenController::EnterFullscreenModeInternal( origin = url::Origin::Create(extension_url_.value()); } } @@ -94,7 +94,7 @@ index c38ce5558472c785837f1d4d2542f2edf2ffab58..219f562f51b45d2c961246e232ef4daf fullscreen_start_time_ = base::TimeTicks::Now(); if (option == BROWSER) { -@@ -692,6 +693,7 @@ void FullscreenController::ExitFullscreenModeInternal() { +@@ -613,6 +614,7 @@ void FullscreenController::ExitFullscreenModeInternal() { return; } @@ -102,7 +102,7 @@ index c38ce5558472c785837f1d4d2542f2edf2ffab58..219f562f51b45d2c961246e232ef4daf // `fullscreen_start_time_` is null if a fullscreen tab moves to a new window. if (fullscreen_start_time_ && exclusive_access_tab()) { ukm::SourceId source_id = -@@ -703,18 +705,19 @@ void FullscreenController::ExitFullscreenModeInternal() { +@@ -624,18 +626,19 @@ void FullscreenController::ExitFullscreenModeInternal() { .Record(ukm::UkmRecorder::Get()); fullscreen_start_time_.reset(); } @@ -125,24 +125,11 @@ index c38ce5558472c785837f1d4d2542f2edf2ffab58..219f562f51b45d2c961246e232ef4daf exclusive_access_manager()->context()->ExitFullscreen(); extension_url_.reset(); exclusive_access_manager()->UpdateBubble(base::NullCallback()); -@@ -778,8 +781,12 @@ url::Origin FullscreenController::GetEmbeddingOrigin() const { - void FullscreenController::RecordMetricsOnFullscreenApiRequested( - content::RenderFrameHost* requesting_frame) { - history::HistoryService* service = -+ #if 0 - HistoryServiceFactory::GetForProfileWithoutCreating( - exclusive_access_manager()->context()->GetProfile()); -+ #else -+ nullptr; -+ #endif - if (service) { - // Check if the origin has been visited more than a day ago and whether it's - // on an allowlist, then record those bits of information in a metric. diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.h b/chrome/browser/ui/exclusive_access/fullscreen_controller.h -index 0fa707f6dfcfb26ed15488b099cc03efe548785b..0ef6faf1e2385b091df36b0c0efb89167b17ac34 100644 +index f9e3ec3c61e0c9f16b13e2ee5fd447e26b49a6da..e06b1fb4a0c256c0f51ff66d06663af46c9c88ae 100644 --- a/chrome/browser/ui/exclusive_access/fullscreen_controller.h +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.h -@@ -254,7 +254,7 @@ class FullscreenController : public ExclusiveAccessControllerBase { +@@ -256,7 +256,7 @@ class FullscreenController : public ExclusiveAccessControllerBase { // Used in testing to set the state to tab fullscreen. bool is_tab_fullscreen_for_testing_ = false; diff --git a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch index fc6206fe10c42..6ae5e9a32cef2 100644 --- a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch +++ b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch @@ -15,7 +15,7 @@ We also need to ensure that an initial paint is scheduled when the compositor is unsuspended in headles mode. diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -index 48dfca966a594f54523c129fa49d2a561cb41dec..049cf4f1adcf4f64cd8692f6e6eda7418008e799 100644 +index eafa32f62cac0627a4e32aa2301c2cbe0b18ede9..8e20b757a1d6d15e5ab2d633b2c8fd65a6cb88b3 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm @@ -664,9 +664,10 @@ void HandleAccelerator(const ui::Accelerator& accelerator, @@ -31,10 +31,10 @@ index 48dfca966a594f54523c129fa49d2a561cb41dec..049cf4f1adcf4f64cd8692f6e6eda741 // Register the CGWindowID (used to identify this window for video capture) diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h -index b1bae5f73c9509e9fc837220a103d0dcff501ab2..aa5ab5fe546c1ebf8cc57b2a32f21b7c1802e4f2 100644 +index 31709448e70a4213d1e9dedcb26ac27c4829a32c..3b9da80b4673faae16d8ef7722cd7804e3fac82e 100644 --- a/ui/views/widget/widget.h +++ b/ui/views/widget/widget.h -@@ -1298,6 +1298,8 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, +@@ -1302,6 +1302,8 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, // True if widget was created in headless mode. bool is_headless() const { return is_headless_; } diff --git a/patches/chromium/fix_aspect_ratio_with_max_size.patch b/patches/chromium/fix_aspect_ratio_with_max_size.patch index 3a64048c8e9de..c64a82c51e4a7 100644 --- a/patches/chromium/fix_aspect_ratio_with_max_size.patch +++ b/patches/chromium/fix_aspect_ratio_with_max_size.patch @@ -11,7 +11,7 @@ enlarge window above dimensions set during creation of the BrowserWindow. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index f404c718e0242ec9269e7d14eb236aa928fb5d58..3637176c05a7074cb9042b74f7c9ea2e29af5ee5 100644 +index aa5b34fa3fdef76b9bb7afd26ecaeda785e25824..76893d462786eaff21838614a8251b97bec92a79 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -3843,15 +3843,30 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param, diff --git a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch index c1117059342ec..ca5718a72fccd 100644 --- a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch +++ b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch @@ -28,10 +28,10 @@ The patch should be removed in favor of either: Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397. diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index 07284d1cca9d78cfd0081d41823766e0051e1eed..2daded6fb83043ced67378fca9367168e5e76f4f 100644 +index ed42146d41ed88133780217cea15ab068ca77745..f151330a55443f9e4518265ccc2c1368a38474ae 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc -@@ -11392,6 +11392,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { +@@ -11316,6 +11316,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { target_rph_id); } @@ -44,7 +44,7 @@ index 07284d1cca9d78cfd0081d41823766e0051e1eed..2daded6fb83043ced67378fca9367168 // origin of |common_params.url| and/or |common_params.initiator_origin|. url::Origin resolved_origin = url::Origin::Resolve( diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc -index a7c069c44622d1a247b44395007261b5323da982..639f9a93f4b27bda9082ed1b7a4c914c493b714f 100644 +index 24ca17c2cf3e633f5609d13cebfc521991e9aabf..8e34fadf2cb21e561d6a4d3b0c7e8c384e33cc73 100644 --- a/third_party/blink/renderer/core/loader/document_loader.cc +++ b/third_party/blink/renderer/core/loader/document_loader.cc @@ -2322,6 +2322,10 @@ Frame* DocumentLoader::CalculateOwnerFrame() { diff --git a/patches/chromium/fix_disabling_background_throttling_in_compositor.patch b/patches/chromium/fix_disabling_background_throttling_in_compositor.patch index 906bc3c6a1623..e61b1144adbce 100644 --- a/patches/chromium/fix_disabling_background_throttling_in_compositor.patch +++ b/patches/chromium/fix_disabling_background_throttling_in_compositor.patch @@ -12,7 +12,7 @@ invisible state of the `viz::DisplayScheduler` owned by the `ui::Compositor`. diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc -index 1cb8ea92e46ad45cd8bf9e99f38889964b16768f..3e80241add13eeeb3b5970932f23acec0d91fd4e 100644 +index 57cac208e943687226348b427c3d80b2cc9288a7..c2794daaa48af44f9cfd374bac45c64b315a6817 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc @@ -358,7 +358,8 @@ void Compositor::SetLayerTreeFrameSink( @@ -25,7 +25,7 @@ index 1cb8ea92e46ad45cd8bf9e99f38889964b16768f..3e80241add13eeeb3b5970932f23acec display_private_->SetDisplayColorSpaces(display_color_spaces_); display_private_->SetDisplayColorMatrix( gfx::SkM44ToTransform(display_color_matrix_)); -@@ -609,7 +610,9 @@ void Compositor::SetVisible(bool visible) { +@@ -615,7 +616,9 @@ void Compositor::SetVisible(bool visible) { // updated then. We need to call this even if the visibility hasn't changed, // for the same reason. if (display_private_) @@ -36,7 +36,7 @@ index 1cb8ea92e46ad45cd8bf9e99f38889964b16768f..3e80241add13eeeb3b5970932f23acec if (changed) { observer_list_.Notify(&CompositorObserver::OnCompositorVisibilityChanged, -@@ -1073,6 +1076,15 @@ void Compositor::MaybeUpdateObserveBeginFrame() { +@@ -1079,6 +1082,15 @@ void Compositor::MaybeUpdateObserveBeginFrame() { host_begin_frame_observer_->GetBoundRemote()); } @@ -53,10 +53,10 @@ index 1cb8ea92e46ad45cd8bf9e99f38889964b16768f..3e80241add13eeeb3b5970932f23acec void Compositor::SetSeamlessRefreshRates( const std::vector<float>& seamless_refresh_rates) { diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h -index 682b23f083eff17bc36cdc4698e35d853beb90cc..df9e598b65594748d59284e1e91d61233eef83a0 100644 +index 11e6186b8e06008564246e8034b780a09a498838..902c14d3d88fd6e65332ea05c566793cce569089 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h -@@ -514,6 +514,10 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, +@@ -520,6 +520,10 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, const cc::LayerTreeSettings& GetLayerTreeSettings() const; @@ -67,7 +67,7 @@ index 682b23f083eff17bc36cdc4698e35d853beb90cc..df9e598b65594748d59284e1e91d6123 size_t saved_events_metrics_count_for_testing() const { return host_->saved_events_metrics_count_for_testing(); } -@@ -724,6 +728,12 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, +@@ -730,6 +734,12 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, // See go/report-ux-metrics-at-painting for details. bool animation_started_ = false; diff --git a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch index 3dcd4fd9c4dd6..4df73711b0cbb 100644 --- a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch +++ b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch @@ -9,7 +9,7 @@ to support content settings UI. The support pulls in chrome content settings and UI code which are not valid in the scope of Electron. diff --git a/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc b/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc -index 32f0f62dbc4f0c541440fd99d20e0fc80825f480..bcf7e67eb024a6ec8d2470a338e016c6779840a4 100644 +index 387a75ac7b0c7be1e38c3ba2b357f729f1e09229..fecf72a6d434f7c22159420c1cbbf34a285838c8 100644 --- a/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc +++ b/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc @@ -6,6 +6,7 @@ @@ -23,7 +23,7 @@ index 32f0f62dbc4f0c541440fd99d20e0fc80825f480..bcf7e67eb024a6ec8d2470a338e016c6 @@ -28,8 +29,10 @@ #include "base/task/sequenced_task_runner.h" // TODO(crbug.com/421608904): include auto_picture_in_picture_tab_helper for - // Android. + // Android when supporting document PiP. +#if BUILDFLAG(GOOGLE_CHROME_BRANDING) #include "chrome/browser/picture_in_picture/auto_picture_in_picture_tab_helper.h" #include "chrome/browser/picture_in_picture/auto_pip_setting_overlay_view.h" @@ -83,7 +83,7 @@ index 32f0f62dbc4f0c541440fd99d20e0fc80825f480..bcf7e67eb024a6ec8d2470a338e016c6 PictureInPictureOcclusionTracker* diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -index 489d68b6452a4814f4cba1e65ab036629583f5b5..a306cbb8e5bfa585bceb140a0c66d1c64b7a8813 100644 +index fea71317b41429dd3bbd50947673124f7c230394..ddfd48582869c6285274d241b5d876e9c4fbe555 100644 --- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc @@ -471,11 +471,13 @@ std::unique_ptr<VideoOverlayWindowViews> VideoOverlayWindowViews::Create( diff --git a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch index 94c8680e86009..18acfffe06e07 100644 --- a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch +++ b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch @@ -9,10 +9,10 @@ focus node change via TextInputManager. chromium-bug: https://crbug.com/1369605 diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index b930145db575eb8c4e84297ddd610bd90fb5d3a8..8407b3a87219d314617295fa664c39b5daa2ce0a 100644 +index 0927d69b56d064327f0659d8ffe6ceff98064947..c64efad51c18254f957dd0b5b89f3d6ee25bac13 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -3249,6 +3249,12 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( +@@ -3247,6 +3247,12 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( } } @@ -87,10 +87,10 @@ index 75df43e3cd2721a92c90c18154d53d5c203e2465..ce42c75c8face36d21f53f44c0201ac4 // The view with active text input state, i.e., a focused <input> element. // It will be nullptr if no such view exists. Note that the active view diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 0a6a205f49d7bc853879ac4919868aadd6fdd42f..3a9264493f90fb8e82e34e13328d74c00d156966 100644 +index 7f49174c2e0121ddde50250a38b4ac4fcc43d125..2fd9e3ce15869b284ff8716c02ce8dc6392b2a7b 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10089,7 +10089,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( +@@ -10083,7 +10083,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( "WebContentsImpl::OnFocusedElementChangedInFrame", "render_frame_host", frame); RenderWidgetHostViewBase* root_view = diff --git a/patches/chromium/fix_properly_honor_printing_page_ranges.patch b/patches/chromium/fix_properly_honor_printing_page_ranges.patch index 972d369b3ccd8..3fc0ce71b2f48 100644 --- a/patches/chromium/fix_properly_honor_printing_page_ranges.patch +++ b/patches/chromium/fix_properly_honor_printing_page_ranges.patch @@ -62,7 +62,7 @@ index b504350cb53273d1db7204771ae080647fe6b878..8fdf6a14d0913aca8f14c412c4afae3a PMPrintSettings print_settings = static_cast<PMPrintSettings>([print_info_ PMPrintSettings]); diff --git a/printing/printing_context_system_dialog_win.cc b/printing/printing_context_system_dialog_win.cc -index 2808248f6eb3f5c75f20775d61c9d0d20aaaecf6..c7367251f5b9735994ac4c173281b89d1c5f4579 100644 +index f8e903f21cee7041dea67b479c298baf9093d719..ed5d59f29992b0925efd89cb0ac4b33a03a31788 100644 --- a/printing/printing_context_system_dialog_win.cc +++ b/printing/printing_context_system_dialog_win.cc @@ -4,10 +4,12 @@ @@ -78,12 +78,11 @@ index 2808248f6eb3f5c75f20775d61c9d0d20aaaecf6..c7367251f5b9735994ac4c173281b89d #include "base/strings/utf_string_conversions.h" #include "base/task/current_thread.h" #include "printing/backend/win_helper.h" -@@ -74,14 +76,28 @@ void PrintingContextSystemDialogWin::AskUserForSettings( - PRINTPAGERANGE ranges[32]; +@@ -74,13 +76,28 @@ void PrintingContextSystemDialogWin::AskUserForSettings( + PRINTPAGERANGE ranges[32] = {}; dialog_options.nStartPage = START_PAGE_GENERAL; if (max_pages) { - // Default initialize to print all the pages. -- UNSAFE_TODO(memset(ranges, 0, sizeof(ranges))); - ranges[0].nFromPage = 1; - ranges[0].nToPage = max_pages; - dialog_options.nPageRanges = 1; diff --git a/patches/chromium/fix_remove_caption-removing_style_call.patch b/patches/chromium/fix_remove_caption-removing_style_call.patch index 610abd8000b5e..182db09dbc700 100644 --- a/patches/chromium/fix_remove_caption-removing_style_call.patch +++ b/patches/chromium/fix_remove_caption-removing_style_call.patch @@ -18,7 +18,7 @@ or resizing, but Electron does not seem to run into that issue for opaque frameless windows even with that block commented out. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 3ed583cf09dec0ae83c3c9449e6ef7e1fa92aa8d..1287e9eda295061a7ee9b758b3c0618933896d82 100644 +index 72474adfb09f85118b4f752a22d121ab2b4c588a..fa4912943171789f6f326a245185885a4e74c0bb 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -1857,7 +1857,23 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) { diff --git a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch index 6ebdf419dba5f..4c8b39ab34213 100644 --- a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch +++ b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch @@ -8,7 +8,7 @@ such as the background turning black when maximizing the window and dynamic background material settings not taking effect. diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index ed4d2c4d849085c0e7830c5d52d47daf2700ce34..31ee28c3f8d04a4a9239a781ef9f79da8ee699b9 100644 +index 7d899eef72721c6f3e27c9892ba963fd6b5aaeef..7c61f1f8d57a04cb5c0151c134b4b3d617159032 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -183,6 +183,10 @@ void DesktopWindowTreeHostWin::FinishTouchDrag(gfx::Point screen_point) { @@ -36,7 +36,7 @@ index d8be4dffee3947e7ac6dc09cb8e1f2a6a834789b..8eb539af74c1934a55f9b14ad97dd93b // Overridden from DesktopWindowTreeHost: void Init(const Widget::InitParams& params) override; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 1287e9eda295061a7ee9b758b3c0618933896d82..e2b899dd25c12448068c99f1344cba4fea26e2c6 100644 +index fa4912943171789f6f326a245185885a4e74c0bb..f8832efce276c6dfc520cab2870697aa4d88eff5 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -994,13 +994,13 @@ void HWNDMessageHandler::FrameTypeChanged() { diff --git a/patches/chromium/fix_restore_original_resize_performance_on_macos.patch b/patches/chromium/fix_restore_original_resize_performance_on_macos.patch index a3e7d3b7dbaeb..3288015f37ac9 100644 --- a/patches/chromium/fix_restore_original_resize_performance_on_macos.patch +++ b/patches/chromium/fix_restore_original_resize_performance_on_macos.patch @@ -11,10 +11,10 @@ This patch should be upstreamed as a conditional revert of the logic in desktop vs mobile runtimes. i.e. restore the old logic only on desktop platforms diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 8073bdba33d6ddbc0306e8e9256b36cd87537eca..7ae6336c4e3c09ae16639b616a4757f75a044bc4 100644 +index 9cccc151a7c1b7d11a88545e168fd878276a91ea..349d591b0b35421f91e70dde257a726341e94ad9 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -2164,9 +2164,8 @@ RenderWidgetHostImpl::GetWidgetInputHandler() { +@@ -2160,9 +2160,8 @@ RenderWidgetHostImpl::GetWidgetInputHandler() { void RenderWidgetHostImpl::NotifyScreenInfoChanged() { // The resize message (which may not happen immediately) will carry with it // the screen info as well as the new size (if the screen has changed scale diff --git a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch index 49cc427c921c2..eaef507146c58 100644 --- a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch +++ b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch @@ -20,10 +20,10 @@ index fc9cb7e68bdad4c40fab63f70243e09ad005ab80..199fbceda530da31aab9126d78b4bd21 injector_->ExpectsResults(), injector_->ShouldWaitForPromise()); } diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h -index ca2155188474863dca7a811a9c484027447026e8..4c4064f99bbffe03c525694797aef70e9decd346 100644 +index e4362d8b19bc91a56d84f2fb2756cc8489b98287..a4594215dbec1a77bf511297a5a1a8886b542e97 100644 --- a/third_party/blink/public/web/web_local_frame.h +++ b/third_party/blink/public/web/web_local_frame.h -@@ -462,6 +462,7 @@ class BLINK_EXPORT WebLocalFrame : public WebFrame { +@@ -463,6 +463,7 @@ class BLINK_EXPORT WebLocalFrame : public WebFrame { mojom::EvaluationTiming, mojom::LoadEventBlockingOption, WebScriptExecutionCallback, @@ -59,10 +59,10 @@ index cba373664bec3a32abad6fe0396bd67b53b7e67f..a54f1b3351efd2d8f324436f7f35cd43 #endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_SCRIPT_EXECUTION_CALLBACK_H_ diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index 7aeff27d6005d70f962fcbd90e6902987e3abd09..37eb4b97f9f1f90998e65f6cb253f826b27088a4 100644 +index 75975a8d48b05ba25b169b93b62bb7d34eb3f5b7..31a876e234f4228220ab6cf5b41c22de31779c84 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc -@@ -3176,6 +3176,7 @@ void LocalFrame::RequestExecuteScript( +@@ -3194,6 +3194,7 @@ void LocalFrame::RequestExecuteScript( mojom::blink::EvaluationTiming evaluation_timing, mojom::blink::LoadEventBlockingOption blocking_option, WebScriptExecutionCallback callback, @@ -70,7 +70,7 @@ index 7aeff27d6005d70f962fcbd90e6902987e3abd09..37eb4b97f9f1f90998e65f6cb253f826 BackForwardCacheAware back_forward_cache_aware, mojom::blink::WantResultOption want_result_option, mojom::blink::PromiseResultOption promise_behavior) { -@@ -3208,7 +3209,7 @@ void LocalFrame::RequestExecuteScript( +@@ -3251,7 +3252,7 @@ void LocalFrame::RequestExecuteScript( PausableScriptExecutor::CreateAndRun( script_state, std::move(script_sources), execute_script_policy, user_gesture, evaluation_timing, blocking_option, want_result_option, @@ -80,7 +80,7 @@ index 7aeff27d6005d70f962fcbd90e6902987e3abd09..37eb4b97f9f1f90998e65f6cb253f826 void LocalFrame::SetEvictCachedSessionStorageOnFreezeOrUnload() { diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h -index b68a56d2dd05ce614c9b2c387dc960bad58fab0b..e53bad5ef91d6d86d25996a62f26a24015b607fe 100644 +index 27a48a7ccdee3a15bd42e7ebb01cf109ec80fbf3..fc0dc28d97dc7e73ec0b86ed221179b1f538de9d 100644 --- a/third_party/blink/renderer/core/frame/local_frame.h +++ b/third_party/blink/renderer/core/frame/local_frame.h @@ -831,6 +831,7 @@ class CORE_EXPORT LocalFrame final @@ -92,7 +92,7 @@ index b68a56d2dd05ce614c9b2c387dc960bad58fab0b..e53bad5ef91d6d86d25996a62f26a240 mojom::blink::WantResultOption, mojom::blink::PromiseResultOption); diff --git a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc -index a7d638b474011b564f326b128183278fd3fdb6e2..11a49018d7c004f34897d1a7f21c7e4705da023c 100644 +index 6516d0bc1a2a1891e59268bc29ca20bf27ec4789..c2d7ac40b253135c5d0342863e88a60d721afd00 100644 --- a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc +++ b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc @@ -968,6 +968,7 @@ void LocalFrameMojoHandler::JavaScriptExecuteRequestInIsolatedWorld( @@ -104,7 +104,7 @@ index a7d638b474011b564f326b128183278fd3fdb6e2..11a49018d7c004f34897d1a7f21c7e47 wants_result ? mojom::blink::WantResultOption::kWantResultDateAndRegExpAllowed diff --git a/third_party/blink/renderer/core/frame/pausable_script_executor.cc b/third_party/blink/renderer/core/frame/pausable_script_executor.cc -index 19e5c838cc17844092df5652542a767316bc03b2..105f61bf14cdcfbf9cd284d80ba7bde756d5fcf2 100644 +index 7c31a69ccd7a74d75e5df63d895b91239d243a92..1b435cb43592afba984fe203d1ccf2d9f4ef85f5 100644 --- a/third_party/blink/renderer/core/frame/pausable_script_executor.cc +++ b/third_party/blink/renderer/core/frame/pausable_script_executor.cc @@ -243,7 +243,7 @@ void PausableScriptExecutor::CreateAndRun( @@ -203,7 +203,7 @@ index fa65331f40b90d812b71a489fd560e9359152d2b..390714d631dc88ef92d59ef9618a5706 const mojom::blink::UserActivationOption user_activation_option_; const mojom::blink::LoadEventBlockingOption blocking_option_; diff --git a/third_party/blink/renderer/core/frame/web_frame_test.cc b/third_party/blink/renderer/core/frame/web_frame_test.cc -index bb32bd4b10280ec767af6589efc843c264e13533..06e70645fe57b1d0576c69fd64d3532636dd9184 100644 +index afee60b061eb816286f34323f6dad8cb81d8f203..0d81f7e997225f25c17f3ec2c16962ab5ecfe465 100644 --- a/third_party/blink/renderer/core/frame/web_frame_test.cc +++ b/third_party/blink/renderer/core/frame/web_frame_test.cc @@ -295,6 +295,7 @@ void ExecuteScriptsInMainWorld( @@ -215,10 +215,10 @@ index bb32bd4b10280ec767af6589efc843c264e13533..06e70645fe57b1d0576c69fd64d35326 mojom::blink::WantResultOption::kWantResult, wait_for_promise); } diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -index 8fd3d92ef3fb132922bcf041840161f32804fd1f..212e6d5678fbc50fc155bd9beb4806315e5c2202 100644 +index 8035d2ee0dbef988f87de48a6aa5371b74377637..30e3a7613bc7c951faccc44b5989d2840a6ce6ad 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -@@ -1121,14 +1121,15 @@ void WebLocalFrameImpl::RequestExecuteScript( +@@ -1122,14 +1122,15 @@ void WebLocalFrameImpl::RequestExecuteScript( mojom::blink::EvaluationTiming evaluation_timing, mojom::blink::LoadEventBlockingOption blocking_option, WebScriptExecutionCallback callback, @@ -237,7 +237,7 @@ index 8fd3d92ef3fb132922bcf041840161f32804fd1f..212e6d5678fbc50fc155bd9beb480631 bool WebLocalFrameImpl::IsInspectorConnected() { diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.h b/third_party/blink/renderer/core/frame/web_local_frame_impl.h -index a605d360906b68cd55bba57d383ff92a326d8b98..2806254047b707b65ea6117066734505b715f6d7 100644 +index a2850434615d5439fa25bcb75c8d23811564d1bc..2be52adcae8ec252a1274ccf0ca21838727e0564 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h @@ -199,6 +199,7 @@ class CORE_EXPORT WebLocalFrameImpl final diff --git a/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch b/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch index bfabf4fc4280d..668267c67b1bd 100644 --- a/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch +++ b/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch @@ -6,10 +6,10 @@ Subject: fix: select the first menu item when opened via keyboard This fixes an accessibility issue where the root view is 'focused' to the screen reader instead of the first menu item as with all other native menus. This patch will be upstreamed. diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc -index c206a2ebcb069616be1205efc261ec060249f35b..0300e9b05feaa14895a05eb9ca7b41fb84a05bee 100644 +index a4b272aa24dc59e68451d72adaf08df4d1657925..aaf13673d2b934638f467bb070fb96aa823c51a1 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc -@@ -713,6 +713,16 @@ void MenuController::Run(Widget* parent, +@@ -740,6 +740,16 @@ void MenuController::Run(Widget* parent, SetSelection(root, SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY); } @@ -26,7 +26,7 @@ index c206a2ebcb069616be1205efc261ec060249f35b..0300e9b05feaa14895a05eb9ca7b41fb if (button_controller) { pressed_lock_ = button_controller->TakeLock( false, ui::LocatedEvent::FromIfValid(event)); -@@ -2456,19 +2466,15 @@ void MenuController::OpenMenuImpl(MenuItemView* item, bool show) { +@@ -2482,18 +2492,15 @@ void MenuController::OpenMenuImpl(MenuItemView* item, bool show) { } item->GetSubmenu()->ShowAt(params); @@ -39,13 +39,14 @@ index c206a2ebcb069616be1205efc261ec060249f35b..0300e9b05feaa14895a05eb9ca7b41fb + // `ConvertFromScreen` doesn't work correctly if the widget isn't shown. if (item->GetSubmenu()->GetWidget()) { const gfx::Point mouse_pos = ConvertFromScreen( - *item->submenu_, - display::Screen::GetScreen()->GetCursorScreenPoint()); +- *item->submenu_, display::Screen::Get()->GetCursorScreenPoint()); - MenuPart part_under_mouse = GetMenuPart(item->submenu_.get(), mouse_pos); - if (part_under_mouse.type != MenuPartType::kNone) { - menu_open_mouse_loc_ = - GetLocationInRootMenu(*item->submenu_, mouse_pos); - } ++ *item->submenu_, ++ display::Screen::Get()->GetCursorScreenPoint()); + menu_open_mouse_loc_ = + GetLocationInRootMenu(*item->submenu_, mouse_pos); } diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index 27d5491f24ac2..5b2d633c8eff3 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -6,10 +6,10 @@ Subject: frame_host_manager.patch Allows embedder to intercept site instances created by chromium. diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc -index 15da2281d9b2e556aecd723802c952a7135edde7..4802bba61e069b99af76716c148aaaa04b7bdfad 100644 +index f365208f46749cd7cc08e55f8ddf3187afef64c9..51869cc02beb6b4eca6b2e24e6e3e05fa8c78e50 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc -@@ -4780,6 +4780,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -4801,6 +4801,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( request->ResetStateForSiteInstanceChange(); } @@ -20,7 +20,7 @@ index 15da2281d9b2e556aecd723802c952a7135edde7..4802bba61e069b99af76716c148aaaa0 } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 77addfedac20cf8ecf656321dda53ada149f17ff..b813b39b83ebb777a6de960d32ba3b64d2a31907 100644 +index f27b387da5ff4e4f20d28d80043151ad2f2e9d51..21720c0734155eca8110ae84b937f9cf0291cfb5 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -339,6 +339,11 @@ class CONTENT_EXPORT ContentBrowserClient { diff --git a/patches/chromium/gritsettings_resource_ids.patch b/patches/chromium/gritsettings_resource_ids.patch index eb6127622930d..b1b4ab1b0c47c 100644 --- a/patches/chromium/gritsettings_resource_ids.patch +++ b/patches/chromium/gritsettings_resource_ids.patch @@ -6,11 +6,11 @@ Subject: gritsettings_resource_ids.patch Add electron resources file to the list of resource ids generation. diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec -index b1ac3dbdae5f57873a3259d90883500b01c5fe1a..bffba25874c654a8bbd784c48e8d49f4db2d8f26 100644 +index bba1bed7b351171434d9b6d8170f6b015f5acb6c..83004f00857a8d260756443f1675228336926896 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec -@@ -1566,6 +1566,11 @@ - "structures": [10100], +@@ -1575,6 +1575,11 @@ + "messages": [10120], }, + "electron/build/electron_resources.grd": { diff --git a/patches/chromium/logging_win32_only_create_a_console_if_logging_to_stderr.patch b/patches/chromium/logging_win32_only_create_a_console_if_logging_to_stderr.patch index 19de0716b7e6a..32512d1922ce2 100644 --- a/patches/chromium/logging_win32_only_create_a_console_if_logging_to_stderr.patch +++ b/patches/chromium/logging_win32_only_create_a_console_if_logging_to_stderr.patch @@ -9,10 +9,10 @@ be created for each child process, despite logs being redirected to a file. diff --git a/content/app/content_main.cc b/content/app/content_main.cc -index 1be84c4cc45951ce874fb4a56d18bd2cbee440a4..c51d40ccef015d6453878debecccdec5681c9614 100644 +index 47ffb24940071be6f3747a85022a2b226ae8b63b..4632bc6e1801da827a7db37484084288fd709268 100644 --- a/content/app/content_main.cc +++ b/content/app/content_main.cc -@@ -327,16 +327,14 @@ NO_STACK_PROTECTOR int RunContentProcess( +@@ -324,16 +324,14 @@ NO_STACK_PROTECTOR int RunContentProcess( #if BUILDFLAG(IS_WIN) base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index cb66c64ff8650..6b0f6d03393fd 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -35,10 +35,10 @@ system font by checking if it's kCTFontPriorityAttribute is set to system priority. diff --git a/base/BUILD.gn b/base/BUILD.gn -index 39780da0d0074845b4d17ff4f6f7e2fbf2aec59f..3eab6a8c37f351bce24b7b581e09e9471cbd527b 100644 +index c835d9ea235070abaca36b38dc5f573da98fd469..a8d867b18c73abfe55da053a93696eb43c848dde 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn -@@ -1061,6 +1061,7 @@ component("base") { +@@ -1058,6 +1058,7 @@ component("base") { "//build:ios_buildflags", "//build/config/compiler:compiler_buildflags", "//third_party/modp_b64", @@ -220,10 +220,10 @@ index 1d4c16a300227e5e8269e2c2564cb5e87ec8ee65..3bcbb33700b2b9349795c05c12e44b4f using crypto::apple::Keychain; diff --git a/components/remote_cocoa/app_shim/BUILD.gn b/components/remote_cocoa/app_shim/BUILD.gn -index f93b68dacdba883b259555f486417b94e80152bf..21b6b7a169e201d570d77da9dde54cc2a334c21c 100644 +index ba813851fde2660c21f99248a124161d2ac2ca07..c34f920e4a592b6798f5307c726bc34ebedf3f88 100644 --- a/components/remote_cocoa/app_shim/BUILD.gn +++ b/components/remote_cocoa/app_shim/BUILD.gn -@@ -75,6 +75,7 @@ component("app_shim") { +@@ -77,6 +77,7 @@ component("app_shim") { "//components/crash/core/common", "//components/remote_cocoa/common:mojo", "//components/system_media_controls", @@ -232,7 +232,7 @@ index f93b68dacdba883b259555f486417b94e80152bf..21b6b7a169e201d570d77da9dde54cc2 "//net", "//ui/accelerated_widget_mac", diff --git a/components/remote_cocoa/app_shim/application_bridge.mm b/components/remote_cocoa/app_shim/application_bridge.mm -index e9f4e5131238b9fb5f1b4b3e90a0cb84a7fc15b4..8b5f4cae3123ac5480ad73f0c873fca0d62f7c9f 100644 +index b5801f8d4b4d5f5ed9f70b61cbd63f28a80840a6..7bf371952ba5ce01f28c79ffe156ee33812d6874 100644 --- a/components/remote_cocoa/app_shim/application_bridge.mm +++ b/components/remote_cocoa/app_shim/application_bridge.mm @@ -12,6 +12,7 @@ @@ -270,7 +270,7 @@ index e9f4e5131238b9fb5f1b4b3e90a0cb84a7fc15b4..8b5f4cae3123ac5480ad73f0c873fca0 +#endif }; - } // namespace + bool g_is_out_of_process_app_shim = false; diff --git a/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm b/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm index f7200edbe6059ac6d7ade0672852b52da7642a71..0cc5da96411b46eb39d0c01dfec59cb503df0d9b 100644 --- a/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm @@ -385,7 +385,7 @@ index 71158ca9a7101911bb76f0c1b5300b0ff0e326b3..1441b9d4f9560c8b26d4beffe31449ed // The NSWindow used by BridgedNativeWidget. Provides hooks into AppKit that // can only be accomplished by overriding methods. diff --git a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm -index d2200451e0040a0f597a8ee28de4d16398bdf9ea..49f6579f997c8d60288add0ed8ab7bab69e1a550 100644 +index 0f65c4272547f31890b872dc208cd01d02848e20..2634fddf9b7b71cd4b97e9ecb5de06bff7217355 100644 --- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm +++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm @@ -21,6 +21,7 @@ @@ -452,7 +452,7 @@ index d2200451e0040a0f597a8ee28de4d16398bdf9ea..49f6579f997c8d60288add0ed8ab7bab bool shouldShowWindowTitle = YES; if (_bridge) diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm -index acc9537464c2a54ffc22956873dbdba74500c20b..b0b7d98e20ed0cc63a38d6a2ce462ac63e183ed9 100644 +index 6ea211c221d74f26be924334ac8b5b007f38e7a3..c5171b3f1a0b25825dded8828ed683282c06e151 100644 --- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm +++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm @@ -42,6 +42,7 @@ @@ -548,7 +548,7 @@ index 010c713090e5038dc90db131c8f621422d30c03b..20c35e887a0496ee609c077e3b0494bd void ForwardKeyboardEvent(const input::NativeWebKeyboardEvent& key_event, diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -index 437b47fd3a1a43fd52980ea550db953ba47990eb..180b186de6177bcf3345c71646362e9655b9a81f 100644 +index e5b59a9d364dd5a8f847d9543b19fdc068098754..86abd01371ce8a9c21d020f1a69a5d33b656d72b 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -34,6 +34,7 @@ @@ -582,10 +582,10 @@ index 437b47fd3a1a43fd52980ea550db953ba47990eb..180b186de6177bcf3345c71646362e96 return kAttributes; } diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index 17ec69e510d6af3d64053edce8efc7188a0c62ed..57358a499c0e713c6cec98229fd304636467234d 100644 +index c92c7110c747cc575c94cf941cf9131987ef4fd6..08bd7dc0663b7d3a7fa327e8795db13129e891de 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn -@@ -345,6 +345,7 @@ source_set("browser") { +@@ -344,6 +344,7 @@ source_set("browser") { "//ui/webui/resources", "//v8", "//v8:v8_version", @@ -628,7 +628,7 @@ index e7007a9a7788cbc89a0bbb2387ff2c62bb7d2c79..c2b672a3bd1e61089b411d139f708371 // Used to force the NSApplication's focused accessibility element to be the // content::BrowserAccessibilityCocoa accessibility tree when the NSView for diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index 7cd35ebe42cf3b5604a001baf3d4353d6a2bf777..59c8d5a2e687ac6148889c87f353b33959e276f6 100644 +index d667fdd34ba42be6a7d6486bb9add2bd65953101..57103054e874017bf9926dcdf71786c679f9aac0 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -52,6 +52,7 @@ @@ -639,7 +639,7 @@ index 7cd35ebe42cf3b5604a001baf3d4353d6a2bf777..59c8d5a2e687ac6148889c87f353b339 #include "media/base/media_switches.h" #include "skia/ext/platform_canvas.h" #include "skia/ext/skia_utils_mac.h" -@@ -275,8 +276,10 @@ +@@ -274,8 +275,10 @@ void RenderWidgetHostViewMac::MigrateNSViewBridge( remote_cocoa::mojom::Application* remote_cocoa_application, uint64_t parent_ns_view_id) { @@ -650,7 +650,7 @@ index 7cd35ebe42cf3b5604a001baf3d4353d6a2bf777..59c8d5a2e687ac6148889c87f353b339 // Reset `ns_view_` before resetting `remote_ns_view_` to avoid dangling // pointers. `ns_view_` gets reinitialized later in this method. -@@ -1633,10 +1636,12 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1630,10 +1633,12 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, gfx::NativeViewAccessible RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() { @@ -663,7 +663,7 @@ index 7cd35ebe42cf3b5604a001baf3d4353d6a2bf777..59c8d5a2e687ac6148889c87f353b339 return gfx::NativeViewAccessible([GetInProcessNSView() window]); } -@@ -1688,9 +1693,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1685,9 +1690,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, } void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) { @@ -675,7 +675,7 @@ index 7cd35ebe42cf3b5604a001baf3d4353d6a2bf777..59c8d5a2e687ac6148889c87f353b339 } bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame( -@@ -2193,20 +2200,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -2190,20 +2197,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, void RenderWidgetHostViewMac::GetRenderWidgetAccessibilityToken( GetRenderWidgetAccessibilityTokenCallback callback) { base::ProcessId pid = getpid(); @@ -797,7 +797,7 @@ index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbe } // namespace content diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn -index 738aff50df5ca48ebd0d142dd738c7c8bfab635d..ae293d37bf014c8c899bb2105a941bd2c092ae86 100644 +index 8e939c6c74a016779cc2a9da2ce68f3ebb11a05a..4c4fb37276f58ba32baaddb5b9e61b95eab8336f 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn @@ -673,6 +673,7 @@ static_library("test_support") { @@ -808,7 +808,7 @@ index 738aff50df5ca48ebd0d142dd738c7c8bfab635d..ae293d37bf014c8c899bb2105a941bd2 ] data_deps = [ -@@ -1127,6 +1128,8 @@ static_library("browsertest_support") { +@@ -1143,6 +1144,8 @@ static_library("browsertest_support") { # TODO(crbug.com/40031409): Fix code that adds exit-time destructors and # enable the diagnostic by removing this line. configs += [ "//build/config/compiler:no_exit_time_destructors" ] @@ -817,7 +817,7 @@ index 738aff50df5ca48ebd0d142dd738c7c8bfab635d..ae293d37bf014c8c899bb2105a941bd2 } mojom("content_test_mojo_bindings") { -@@ -2014,6 +2017,7 @@ test("content_browsertests") { +@@ -2029,6 +2032,7 @@ test("content_browsertests") { "//ui/shell_dialogs", "//ui/snapshot", "//ui/webui:test_support", @@ -825,7 +825,7 @@ index 738aff50df5ca48ebd0d142dd738c7c8bfab635d..ae293d37bf014c8c899bb2105a941bd2 ] if (!(is_chromeos && target_cpu == "arm64" && current_cpu == "arm")) { -@@ -3330,6 +3334,7 @@ test("content_unittests") { +@@ -3354,6 +3358,7 @@ test("content_unittests") { "//ui/shell_dialogs", "//ui/webui:test_support", "//url", @@ -938,10 +938,10 @@ index d288ffce5c1265adbdefc571f840851026e7479e..e9a6e8c31401750d270fcc55ef1116b2 namespace ui { diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn -index 90e73686ebc5befecaa64d745b474ed46a1d4293..96d2c7fa2c8960263215d12fc5a15b4d16d3c3fe 100644 +index 7bc208697690ac36a3fc546748a05cbe952f1003..2fa14c45a5f3ce23985b7e9e9b2c2a14d3596d63 100644 --- a/media/audio/BUILD.gn +++ b/media/audio/BUILD.gn -@@ -201,6 +201,7 @@ source_set("audio") { +@@ -203,6 +203,7 @@ source_set("audio") { "CoreMedia.framework", ] weak_frameworks = [ "ScreenCaptureKit.framework" ] # macOS 13.0 @@ -950,7 +950,7 @@ index 90e73686ebc5befecaa64d745b474ed46a1d4293..96d2c7fa2c8960263215d12fc5a15b4d if (is_ios) { diff --git a/media/audio/apple/audio_low_latency_input.cc b/media/audio/apple/audio_low_latency_input.cc -index 0f7c441ba44fe22b1bf4913ae8e61a8bb7ef7fe7..2311fdbbfa566e76b4709059b707ac4d4ff195d9 100644 +index 5eda5e58b30b84795ec3827aad7ce97171400097..60bf6c34e8d824ea6d4e02b2951568604db68f43 100644 --- a/media/audio/apple/audio_low_latency_input.cc +++ b/media/audio/apple/audio_low_latency_input.cc @@ -29,6 +29,7 @@ @@ -1396,10 +1396,10 @@ index eb81a70e4d5d5cd3e6ae9b45f8cd1c795ea76c51..9921ccb10d3455600eddd85f77f10228 } // namespace sandbox diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn -index 29c93be451657a8844210acba66fe8b9b4b2eed0..64300176d5a2cd4d2243d22d1c298c5315d24474 100644 +index 96b487da179dd60e325194335cb091b36ec08d35..33efac95559d5ae91a377077b8df357dfa5b7edc 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn -@@ -425,6 +425,7 @@ component("core") { +@@ -428,6 +428,7 @@ component("core") { "//ui/gfx/geometry", "//ui/gfx/geometry:geometry_skia", "//ui/strings", @@ -1428,10 +1428,10 @@ index c771cee7be34f36521de34ef893ee578b648a8c8..b0bd447b848bfdb7a9ff9cd98ba95574 blink_core_sources_editing += [ "kill_ring_none.cc" ] } diff --git a/ui/accelerated_widget_mac/BUILD.gn b/ui/accelerated_widget_mac/BUILD.gn -index 8c07f1ad347cbc3e5024b25e1dd4a9d14396a82b..601df4d169d7ff2925a9762d353438b3eb8665b5 100644 +index 4a2e4211864cd93cdf3f1e065fedd01d0ddd18f2..8c8916f2a424fea3508a3c0c8266d73c539b16fd 100644 --- a/ui/accelerated_widget_mac/BUILD.gn +++ b/ui/accelerated_widget_mac/BUILD.gn -@@ -81,6 +81,7 @@ component("accelerated_widget_mac") { +@@ -85,6 +85,7 @@ component("accelerated_widget_mac") { "//ui/gfx", "//ui/gfx/geometry", "//ui/gl", @@ -1544,10 +1544,10 @@ index dcf493d62990018040a3f84b6f875af737bd2214..3d1c4dcc9ee0bbfdac15f40d9c74e9f3 void DisplayCALayerTree::GotIOSurfaceFrame( diff --git a/ui/accessibility/platform/BUILD.gn b/ui/accessibility/platform/BUILD.gn -index 79a01b007924230edf8c0b32945d3fb4e6f2445d..649a4a80b023808b2c4c28689a0da0401560090a 100644 +index 54d483d6b3f1a56573e21b1f873b8dee8fc25a0f..33bc8c9ef097a907060ed347dca2ad46b6d081f5 100644 --- a/ui/accessibility/platform/BUILD.gn +++ b/ui/accessibility/platform/BUILD.gn -@@ -298,6 +298,7 @@ component("platform") { +@@ -299,6 +299,7 @@ component("platform") { "AppKit.framework", "Foundation.framework", ] @@ -1556,7 +1556,7 @@ index 79a01b007924230edf8c0b32945d3fb4e6f2445d..649a4a80b023808b2c4c28689a0da040 if (is_ios) { diff --git a/ui/accessibility/platform/browser_accessibility_manager_mac.mm b/ui/accessibility/platform/browser_accessibility_manager_mac.mm -index 2a7352c1925bdce988c9f1a44f387e160532f508..8c07cc82bd6c42e6da8de314ca52867bcb3b9532 100644 +index 8ef5c8c7ac9a555fe41e6146997833ae43164951..4c17f1d29dac780195e07bcdb7e12a8fdd3f2130 100644 --- a/ui/accessibility/platform/browser_accessibility_manager_mac.mm +++ b/ui/accessibility/platform/browser_accessibility_manager_mac.mm @@ -14,6 +14,7 @@ @@ -1593,7 +1593,7 @@ index 2a7352c1925bdce988c9f1a44f387e160532f508..8c07cc82bd6c42e6da8de314ca52867b // Use native VoiceOver support for live regions. BrowserAccessibilityCocoa* retained_node = native_node; -@@ -703,6 +708,7 @@ void PostAnnouncementNotification(NSString* announcement, +@@ -696,6 +701,7 @@ void PostAnnouncementNotification(NSString* announcement, return window == [NSApp accessibilityFocusedWindow]; } @@ -1601,7 +1601,7 @@ index 2a7352c1925bdce988c9f1a44f387e160532f508..8c07cc82bd6c42e6da8de314ca52867b // TODO(accessibility): We need a solution to the problem described below. // If the window is NSAccessibilityRemoteUIElement, there are some challenges: // 1. NSApp is the browser which spawned the PWA, and what it considers the -@@ -731,6 +737,7 @@ void PostAnnouncementNotification(NSString* announcement, +@@ -724,6 +730,7 @@ void PostAnnouncementNotification(NSString* announcement, if ([window isKindOfClass:[NSAccessibilityRemoteUIElement class]]) { return true; } @@ -1638,10 +1638,10 @@ index 6846060ef9622d8fc8d1d6c8da16e2f1b785e6bd..05c22db87e882b246bd7034e027cf149 // Accessible object if (AXElementWrapper::IsValidElement(value)) { diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn -index 660c4f5939df164ab5db868ddd19c97e2c782f36..3dae3e6d8aa651f0f382a7af7f1fa8a6ebd480f4 100644 +index 1428a0aa8d233062990e825050e71d3e3b6dd6f0..009d3446ae976150b25c92ee50590f0926956bca 100644 --- a/ui/base/BUILD.gn +++ b/ui/base/BUILD.gn -@@ -369,6 +369,13 @@ component("base") { +@@ -355,6 +355,13 @@ component("base") { ] } @@ -1655,7 +1655,7 @@ index 660c4f5939df164ab5db868ddd19c97e2c782f36..3dae3e6d8aa651f0f382a7af7f1fa8a6 if (is_ios) { sources += [ "device_form_factor_ios.mm", -@@ -517,6 +524,12 @@ component("base") { +@@ -503,6 +510,12 @@ component("base") { "//url", ] @@ -1808,7 +1808,7 @@ index 85d9170ae8de43ec0fa18c033d66c0583c26ec2f..c4f76301818404ce853583adf01af85c // Query the display's refresh rate. double refresh_rate = 1.0 / screen.minimumRefreshInterval; diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn -index a4226f4f8d4bb5401edb79855e95c7fff3cd0bb1..9e8da8ab0b21c2b8d7a3a0b9c9eeeb2fdd15201e 100644 +index 6f09aea6a492f44f5771c635b8d766bb1868938c..bd82e70622e04d83d5d07a9f5e08a1ddacb568e4 100644 --- a/ui/gfx/BUILD.gn +++ b/ui/gfx/BUILD.gn @@ -337,6 +337,12 @@ component("gfx") { @@ -1863,10 +1863,10 @@ index fe3f85073e31de487a08e57d7f9b07aa4eccf8f3..cf5b07203c8bd559a404600cc98cc8ec // enough. return PlatformFontMac::SystemFontType::kGeneral; diff --git a/ui/views/BUILD.gn b/ui/views/BUILD.gn -index f3db960f1963e9fbc575a13b570a8b7564535a5d..0bbf9182ec826a7add3a52b782b9ba319548c687 100644 +index a7ba817422eb2b82f7a722e8e5df886acd4012aa..1fd81ae13caefbc0950a6c5d87d959455fbf9ce9 100644 --- a/ui/views/BUILD.gn +++ b/ui/views/BUILD.gn -@@ -724,6 +724,8 @@ component("views") { +@@ -720,6 +720,8 @@ component("views") { "IOSurface.framework", "QuartzCore.framework", ] @@ -1875,7 +1875,7 @@ index f3db960f1963e9fbc575a13b570a8b7564535a5d..0bbf9182ec826a7add3a52b782b9ba31 } if (is_win) { -@@ -1153,6 +1155,8 @@ source_set("test_support") { +@@ -1151,6 +1153,8 @@ source_set("test_support") { "//ui/base/mojom:ui_base_types", ] @@ -1920,7 +1920,7 @@ index 4cc9db3ae1ef2443b1ecf923c9c572b7d0e85662..f7bf6a6bb63f9c38cc21c03da1c884d6 // Used to force the NSApplication's focused accessibility element to be the // views::Views accessibility tree when the NSView for this is focused. diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -index 7c4250a4b5610182abd97469e83e71f32f5bd2b3..48dfca966a594f54523c129fa49d2a561cb41dec 100644 +index 4c83545e75535469ccdf2bdf7ec3266f4acd64c4..eafa32f62cac0627a4e32aa2301c2cbe0b18ede9 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm @@ -21,6 +21,7 @@ @@ -1999,7 +1999,7 @@ index 7c4250a4b5610182abd97469e83e71f32f5bd2b3..48dfca966a594f54523c129fa49d2a56 } diff --git a/ui/views/controls/webview/BUILD.gn b/ui/views/controls/webview/BUILD.gn -index 111d6432586f47833dde50678b908c76ad88d37a..429ca4402652a2d89ead228d92971f0cb3b6222c 100644 +index 7f4eff1017119fc90107c2d86436f7bbf596ac72..688d8a17625765c63151117554933627427829f1 100644 --- a/ui/views/controls/webview/BUILD.gn +++ b/ui/views/controls/webview/BUILD.gn @@ -46,6 +46,12 @@ component("webview") { diff --git a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch index 6be75cb340423..f3be51653253c 100644 --- a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch +++ b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch @@ -7,10 +7,10 @@ This adds a callback from the network service that's used to implement session.setCertificateVerifyCallback. diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index a5fa5553641c2be3a3e73e362f89dd3defd90947..7721b8e827d9aac6e90ddfe3de264f41915219f2 100644 +index 26019db9116d02a3ef4899ff697b7d1060eba046..3998bb0849cd5bec52c6148ccf1e1a30511b32fb 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc -@@ -165,6 +165,11 @@ +@@ -166,6 +166,11 @@ #include "services/network/web_transport.h" #include "url/gurl.h" @@ -22,7 +22,7 @@ index a5fa5553641c2be3a3e73e362f89dd3defd90947..7721b8e827d9aac6e90ddfe3de264f41 #if BUILDFLAG(IS_CT_SUPPORTED) // gn check does not account for BUILDFLAG(). So, for iOS builds, it will // complain about a missing dependency on the target exposing this header. Add a -@@ -620,6 +625,111 @@ void RecordHSTSPreconnectUpgradeReason(HSTSRedirectUpgradeReason reason) { +@@ -621,6 +626,111 @@ void RecordHSTSPreconnectUpgradeReason(HSTSRedirectUpgradeReason reason) { } // namespace @@ -134,7 +134,7 @@ index a5fa5553641c2be3a3e73e362f89dd3defd90947..7721b8e827d9aac6e90ddfe3de264f41 constexpr uint32_t NetworkContext::kMaxOutstandingRequestsPerProcess; NetworkContext::NetworkContextHttpAuthPreferences:: -@@ -1023,6 +1133,13 @@ void NetworkContext::SetClient( +@@ -1021,6 +1131,13 @@ void NetworkContext::SetClient( client_.Bind(std::move(client)); } @@ -148,7 +148,7 @@ index a5fa5553641c2be3a3e73e362f89dd3defd90947..7721b8e827d9aac6e90ddfe3de264f41 void NetworkContext::CreateURLLoaderFactory( mojo::PendingReceiver<mojom::URLLoaderFactory> receiver, mojom::URLLoaderFactoryParamsPtr params) { -@@ -2660,6 +2777,10 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( +@@ -2662,6 +2779,10 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( cert_verifier = std::make_unique<net::CachingCertVerifier>( std::make_unique<net::CoalescingCertVerifier>( std::move(cert_verifier))); @@ -160,10 +160,10 @@ index a5fa5553641c2be3a3e73e362f89dd3defd90947..7721b8e827d9aac6e90ddfe3de264f41 builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier( diff --git a/services/network/network_context.h b/services/network/network_context.h -index 6a60953f3b51dcfdfed8cf6516846c915a583e0b..b9f201ccf04433a29083cd15cfe599fe9600c9c0 100644 +index c8d877b36343d10b0ba7fe75f15ee91851e43f59..f7831633a286f7c4aec2dd269b02561275b008c7 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h -@@ -115,6 +115,7 @@ class URLMatcher; +@@ -117,6 +117,7 @@ class URLMatcher; } namespace network { @@ -171,7 +171,7 @@ index 6a60953f3b51dcfdfed8cf6516846c915a583e0b..b9f201ccf04433a29083cd15cfe599fe class CookieManager; class HostResolver; class MdnsResponderManager; -@@ -252,6 +253,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext +@@ -254,6 +255,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext void CreateURLLoaderFactory( mojo::PendingReceiver<mojom::URLLoaderFactory> receiver, mojom::URLLoaderFactoryParamsPtr params) override; @@ -180,7 +180,7 @@ index 6a60953f3b51dcfdfed8cf6516846c915a583e0b..b9f201ccf04433a29083cd15cfe599fe void ResetURLLoaderFactories() override; void GetViaObliviousHttp( mojom::ObliviousHttpRequestPtr request, -@@ -971,6 +974,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext +@@ -987,6 +990,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext std::vector<base::OnceClosure> dismount_closures_; #endif // BUILDFLAG(IS_DIRECTORY_TRANSFER_REQUIRED) @@ -190,10 +190,10 @@ index 6a60953f3b51dcfdfed8cf6516846c915a583e0b..b9f201ccf04433a29083cd15cfe599fe std::unique_ptr<HostResolver> internal_host_resolver_; std::set<std::unique_ptr<HostResolver>, base::UniquePtrComparator> diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index 5986f8444e582ea0571590060dbcddbe366df74d..1ed66c3b41e583745c5b309670fc4470fa1983cf 100644 +index a28ff5cd43ef84d3b0d24d2828b7fdad628f8d27..6885ff48db5ddfb8e8ec09e91a4c01231261f8e5 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -315,6 +315,17 @@ struct SocketBrokerRemotes { +@@ -317,6 +317,17 @@ struct SocketBrokerRemotes { pending_remote<SocketBroker> server; }; @@ -211,7 +211,7 @@ index 5986f8444e582ea0571590060dbcddbe366df74d..1ed66c3b41e583745c5b309670fc4470 // Parameters for constructing a network context. struct NetworkContextParams { // The user agent string. -@@ -967,6 +978,9 @@ interface NetworkContext { +@@ -985,6 +996,9 @@ interface NetworkContext { // Sets a client for this network context. SetClient(pending_remote<NetworkContextClient> client); @@ -222,7 +222,7 @@ index 5986f8444e582ea0571590060dbcddbe366df74d..1ed66c3b41e583745c5b309670fc4470 CreateURLLoaderFactory( pending_receiver<URLLoaderFactory> url_loader_factory, diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h -index 54bfe6a699a5de7641423548a2a4f5de5a582786..70a5ab342a8954354a3d8245d30df9520cfd398d 100644 +index e0289f9f74fc9e9b4480dd8ecae45fcde66bed61..cfd21ce01b7db6a4912de8e4ce0799825fd27e77 100644 --- a/services/network/test/test_network_context.h +++ b/services/network/test/test_network_context.h @@ -63,6 +63,8 @@ class TestNetworkContext : public mojom::NetworkContext { diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index ed7ba67c81e75..03258207e27f9 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -133,10 +133,10 @@ index 5be62a3fb27e37f3c1db6b811172f6dfebe18f61..34349f9832fe4b9a3d48db613a789afb const GURL& document_url, const WeakDocumentPtr& weak_document_ptr, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index d3f53f539544e5206e1c8cf8d3f9f87906630954..c20d6b898f517856efb01e9f504a9dfa967fa3c3 100644 +index 8e2c92d1cef7f76ec8e2fadb2be7c0e0aa288a15..9d5c6428a0f35d678f8723dd0b959fa34e8fc32c 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -2218,7 +2218,7 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2249,7 +2249,7 @@ void RenderProcessHostImpl::CreateNotificationService( case RenderProcessHost::NotificationServiceCreatorType::kSharedWorker: case RenderProcessHost::NotificationServiceCreatorType::kDedicatedWorker: { storage_partition_impl_->GetPlatformNotificationContext()->CreateService( @@ -145,7 +145,7 @@ index d3f53f539544e5206e1c8cf8d3f9f87906630954..c20d6b898f517856efb01e9f504a9dfa creator_type, std::move(receiver)); break; } -@@ -2226,7 +2226,7 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2257,7 +2257,7 @@ void RenderProcessHostImpl::CreateNotificationService( CHECK(rfh); storage_partition_impl_->GetPlatformNotificationContext()->CreateService( diff --git a/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch b/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch index fe039ce3f537a..bc6f440cbea0b 100644 --- a/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch +++ b/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch @@ -11,10 +11,10 @@ For resolving complex conflict please pin @reitowo For more reason please see: https://crrev.com/c/5465148 diff --git a/gpu/ipc/service/gpu_memory_buffer_factory_dxgi.cc b/gpu/ipc/service/gpu_memory_buffer_factory_dxgi.cc -index 31543b5b018313d2e5890f599109bd48d7bc5e64..2f4003b0557ae275ee3697062fafb6428f5da010 100644 +index bb33e469e2d38ee4a23b19acfa52f962a5e9c854..6e83c65334f1ce0134dc4efc1dc40eb7ffed028d 100644 --- a/gpu/ipc/service/gpu_memory_buffer_factory_dxgi.cc +++ b/gpu/ipc/service/gpu_memory_buffer_factory_dxgi.cc -@@ -166,7 +166,8 @@ gfx::GpuMemoryBufferHandle GpuMemoryBufferFactoryDXGI::CreateNativeGmbHandle( +@@ -152,7 +152,8 @@ gfx::GpuMemoryBufferHandle GpuMemoryBufferFactoryDXGI::CreateNativeGmbHandle( // so make sure that the usage is one that we support. DCHECK(usage == gfx::BufferUsage::GPU_READ || usage == gfx::BufferUsage::SCANOUT || @@ -24,7 +24,7 @@ index 31543b5b018313d2e5890f599109bd48d7bc5e64..2f4003b0557ae275ee3697062fafb642 << "Incorrect usage, usage=" << gfx::BufferUsageToString(usage); D3D11_TEXTURE2D_DESC desc = { -@@ -180,7 +181,9 @@ gfx::GpuMemoryBufferHandle GpuMemoryBufferFactoryDXGI::CreateNativeGmbHandle( +@@ -166,7 +167,9 @@ gfx::GpuMemoryBufferHandle GpuMemoryBufferFactoryDXGI::CreateNativeGmbHandle( D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET, 0, D3D11_RESOURCE_MISC_SHARED_NTHANDLE | diff --git a/patches/chromium/picture-in-picture.patch b/patches/chromium/picture-in-picture.patch index 5f5a8b5a1e8fc..661672d074f70 100644 --- a/patches/chromium/picture-in-picture.patch +++ b/patches/chromium/picture-in-picture.patch @@ -9,7 +9,7 @@ don't get errors for Chrome's generated resources, which are non-existent because we don't generate them in our build. diff --git a/chrome/browser/ui/views/overlay/close_image_button.cc b/chrome/browser/ui/views/overlay/close_image_button.cc -index 8168b4cfbafd42fa93a5aa9a3691c2552fabfb86..ba49212bd76d209f99c1cee649fc1466215a13c1 100644 +index 85df555841ac0d32d2f097547c9991cecf0f4b1a..7a108339448fad3105e87c9d9af678c2f85b8ed5 100644 --- a/chrome/browser/ui/views/overlay/close_image_button.cc +++ b/chrome/browser/ui/views/overlay/close_image_button.cc @@ -5,9 +5,12 @@ @@ -22,10 +22,10 @@ index 8168b4cfbafd42fa93a5aa9a3691c2552fabfb86..ba49212bd76d209f99c1cee649fc1466 +#if BUILDFLAG(GOOGLE_CHROME_BRANDING) #include "components/vector_icons/vector_icons.h" +#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) - #include "media/base/media_switches.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" -@@ -29,7 +32,10 @@ CloseImageButton::CloseImageButton(PressedCallback callback) + #include "ui/base/models/image_model.h" +@@ -28,7 +31,10 @@ CloseImageButton::CloseImageButton(PressedCallback callback) : OverlayWindowImageButton(std::move(callback)) { SetSize(gfx::Size(kCloseButtonSize, kCloseButtonSize)); @@ -38,7 +38,7 @@ index 8168b4cfbafd42fa93a5aa9a3691c2552fabfb86..ba49212bd76d209f99c1cee649fc1466 ui::ImageModel::FromVectorIcon(*icon, kColorPipWindowForeground, kCloseButtonIconSize)); diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -index 937c84308a2894e2abaaec3f068be0ba1741e448..489d68b6452a4814f4cba1e65ab036629583f5b5 100644 +index fcb7d2c18f39acb174fc456362de51c484de398c..fea71317b41429dd3bbd50947673124f7c230394 100644 --- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc @@ -18,12 +18,16 @@ @@ -76,7 +76,7 @@ index 937c84308a2894e2abaaec3f068be0ba1741e448..489d68b6452a4814f4cba1e65ab03662 std::wstring app_user_model_id; Browser* browser = chrome::FindBrowserWithTab(controller->GetWebContents()); if (browser) { -@@ -1247,11 +1251,13 @@ void VideoOverlayWindowViews::SetUpViews() { +@@ -1270,11 +1274,13 @@ void VideoOverlayWindowViews::SetUpViews() { &VideoOverlayWindowViews::OnLiveCaptionButtonPressed, base::Unretained(this))); live_caption_button->SetSize(kActionButtonSize); @@ -90,7 +90,7 @@ index 937c84308a2894e2abaaec3f068be0ba1741e448..489d68b6452a4814f4cba1e65ab03662 toggle_microphone_button = std::make_unique<ToggleMicrophoneButton>(base::BindRepeating( [](VideoOverlayWindowViews* overlay) { -@@ -2541,6 +2547,7 @@ gfx::Rect VideoOverlayWindowViews::GetLiveCaptionDialogBounds() { +@@ -2561,6 +2567,7 @@ gfx::Rect VideoOverlayWindowViews::GetLiveCaptionDialogBounds() { bool VideoOverlayWindowViews::HasHighMediaEngagement( const url::Origin& origin) const { @@ -98,7 +98,7 @@ index 937c84308a2894e2abaaec3f068be0ba1741e448..489d68b6452a4814f4cba1e65ab03662 MediaEngagementService* service = MediaEngagementService::Get(Profile::FromBrowserContext( GetController()->GetWebContents()->GetBrowserContext())); -@@ -2549,6 +2556,8 @@ bool VideoOverlayWindowViews::HasHighMediaEngagement( +@@ -2569,6 +2576,8 @@ bool VideoOverlayWindowViews::HasHighMediaEngagement( } return service->HasHighEngagement(origin); diff --git a/patches/chromium/port_autofill_colors_to_the_color_pipeline.patch b/patches/chromium/port_autofill_colors_to_the_color_pipeline.patch index bc040f92d1550..27656b0881fb1 100644 --- a/patches/chromium/port_autofill_colors_to_the_color_pipeline.patch +++ b/patches/chromium/port_autofill_colors_to_the_color_pipeline.patch @@ -8,7 +8,7 @@ needed in chromium but our autofill implementation uses them. This patch can be our autofill implementation to work like Chromium's. diff --git a/ui/color/color_id.h b/ui/color/color_id.h -index 8308dd53c198e4e3c7fe08fd6115b0ed53cf466c..e3323e4c4ff4f96ce235511a38e4e2d8cbb701c0 100644 +index b6fe461a04dfabab9b114b4a0c0c6cc08718cdaf..e57d928023a2defe5c2586aa6bd8385be6687f99 100644 --- a/ui/color/color_id.h +++ b/ui/color/color_id.h @@ -431,6 +431,10 @@ @@ -61,10 +61,10 @@ index f606d2a058ed9ebf86b5f020b6897be718a40b68..003e95ca8bb6364fb6b937871b2c78b9 ? SkColorSetRGB(0x99, 0xC8, 0xFF) : SkColorSetRGB(0x00, 0x75, 0xFF)}; diff --git a/ui/color/win/native_color_mixers_win.cc b/ui/color/win/native_color_mixers_win.cc -index ebc3156ef1df8bfc9bc6e20ddddea4a0259e17e9..c5cbe13ad241564ecdef320de8a10112cda4cdfc 100644 +index 179dc53711ed96421a66cb6c1651983af5f49c6a..686661965ebb56d2de7ff5279669491d95f81cca 100644 --- a/ui/color/win/native_color_mixers_win.cc +++ b/ui/color/win/native_color_mixers_win.cc -@@ -171,6 +171,10 @@ void AddNativeUiColorMixer(ColorProvider* provider, +@@ -146,6 +146,10 @@ void AddNativeUiColorMixer(ColorProvider* provider, SetAlpha(kColorNotificationInputForeground, gfx::kGoogleGreyAlpha700); mixer[kColorSliderTrack] = AlphaBlend( kColorNativeHighlight, kColorNativeWindow, gfx::kGoogleGreyAlpha400); @@ -75,7 +75,7 @@ index ebc3156ef1df8bfc9bc6e20ddddea4a0259e17e9..c5cbe13ad241564ecdef320de8a10112 // Window Background mixer[kColorBubbleFooterBackground] = {kColorNativeWindow}; -@@ -179,6 +183,7 @@ void AddNativeUiColorMixer(ColorProvider* provider, +@@ -154,6 +158,7 @@ void AddNativeUiColorMixer(ColorProvider* provider, mixer[kColorFrameInactive] = {kColorNativeWindow}; mixer[kColorPrimaryBackground] = {kColorNativeWindow}; mixer[kColorTooltipBackground] = {kColorNativeWindow}; @@ -83,7 +83,7 @@ index ebc3156ef1df8bfc9bc6e20ddddea4a0259e17e9..c5cbe13ad241564ecdef320de8a10112 // Window Text mixer[kColorAlertLowSeverity] = {kColorNativeWindowText}; -@@ -192,6 +197,7 @@ void AddNativeUiColorMixer(ColorProvider* provider, +@@ -167,6 +172,7 @@ void AddNativeUiColorMixer(ColorProvider* provider, mixer[kColorTableGroupingIndicator] = {kColorNativeWindowText}; mixer[kColorThrobber] = {kColorNativeWindowText}; mixer[kColorTooltipForeground] = {kColorNativeWindowText}; @@ -91,7 +91,7 @@ index ebc3156ef1df8bfc9bc6e20ddddea4a0259e17e9..c5cbe13ad241564ecdef320de8a10112 // Hyperlinks mixer[kColorLinkForegroundDefault] = {kColorNativeHotlight}; -@@ -234,6 +240,7 @@ void AddNativeUiColorMixer(ColorProvider* provider, +@@ -209,6 +215,7 @@ void AddNativeUiColorMixer(ColorProvider* provider, mixer[kColorTextfieldForeground] = {kColorNativeBtnText}; mixer[kColorTextfieldForegroundPlaceholder] = {kColorNativeBtnText}; mixer[kColorTextfieldForegroundDisabled] = {kColorNativeBtnText}; diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index b774bce37da97..604ff06be8a9b 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -8,7 +8,7 @@ Chrome moved the SetCursor IPC message to mojo, which we use to tell OSR about ` Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2172779 diff --git a/content/browser/renderer_host/render_widget_host_delegate.h b/content/browser/renderer_host/render_widget_host_delegate.h -index 18c6ee6657e5edb5e90102dd9a20e5c0efeed843..af763ad4e441e54556854cd40c4cb9098f84bb58 100644 +index 27b51f78f4676071a8fdc2340f650cb7df1d883b..7db3a07ff9e0f52f1232c25f8e4e72d3c299e623 100644 --- a/content/browser/renderer_host/render_widget_host_delegate.h +++ b/content/browser/renderer_host/render_widget_host_delegate.h @@ -27,6 +27,7 @@ @@ -19,7 +19,7 @@ index 18c6ee6657e5edb5e90102dd9a20e5c0efeed843..af763ad4e441e54556854cd40c4cb909 #include "ui/gfx/native_widget_types.h" namespace blink { -@@ -299,6 +300,9 @@ class CONTENT_EXPORT RenderWidgetHostDelegate { +@@ -293,6 +294,9 @@ class CONTENT_EXPORT RenderWidgetHostDelegate { // Returns the associated RenderViewHostDelegateView*, if possible. virtual RenderViewHostDelegateView* GetDelegateView(); @@ -30,10 +30,10 @@ index 18c6ee6657e5edb5e90102dd9a20e5c0efeed843..af763ad4e441e54556854cd40c4cb909 // RenderWidgetHost on the primary main frame, and false otherwise. virtual bool IsWidgetForPrimaryMainFrame(RenderWidgetHostImpl*); diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index e8baae79ab127e4626f39247a5e57fe6a6114453..8073bdba33d6ddbc0306e8e9256b36cd87537eca 100644 +index 27131371845a81c0af16d59334a98656095f4aeb..9cccc151a7c1b7d11a88545e168fd878276a91ea 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -2083,6 +2083,9 @@ void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) { +@@ -2079,6 +2079,9 @@ void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) { if (view_) { view_->UpdateCursor(cursor); } @@ -44,10 +44,10 @@ index e8baae79ab127e4626f39247a5e57fe6a6114453..8073bdba33d6ddbc0306e8e9256b36cd void RenderWidgetHostImpl::ShowContextMenuAtPoint( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 5e35d7af2bcf9078887f4e2658e3f067f3b4f1b7..95ea7eb743ae3e4de52741be7f2969bbf86d8a29 100644 +index 7a6760e0efdf6972eb497407b68202c5bfffd006..4e2e910c62534106209758a0e5aeb329cfbaa529 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -6116,6 +6116,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { +@@ -6110,6 +6110,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { return text_input_manager_.get(); } @@ -60,10 +60,10 @@ index 5e35d7af2bcf9078887f4e2658e3f067f3b4f1b7..95ea7eb743ae3e4de52741be7f2969bb RenderWidgetHostImpl* render_widget_host) { return render_widget_host == GetPrimaryMainFrame()->GetRenderWidgetHost(); diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index 8ae956ce13ae0be1436875228bc5f2915caf9f91..aff1ff3112b2d52f5e111fe7343aca2d59165e64 100644 +index 8bad6ba62f98732676920f334c49fe46aad42bf2..9dfd229af26127dee8e21c77fcedef5285f3aafa 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -1176,6 +1176,7 @@ class CONTENT_EXPORT WebContentsImpl +@@ -1178,6 +1178,7 @@ class CONTENT_EXPORT WebContentsImpl void SendScreenRects() override; void SendActiveState(bool active) override; TextInputManager* GetTextInputManager() override; diff --git a/patches/chromium/refactor_expose_file_system_access_blocklist.patch b/patches/chromium/refactor_expose_file_system_access_blocklist.patch index 0d20c82bcbcb0..89779bc57344c 100644 --- a/patches/chromium/refactor_expose_file_system_access_blocklist.patch +++ b/patches/chromium/refactor_expose_file_system_access_blocklist.patch @@ -8,10 +8,10 @@ it in Electron and prevent drift from Chrome's blocklist. We should look for a w to upstream this change to Chrome. diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc -index 7611ba742de5b11c5a1f43c2e18d78cb01c9562f..640076ba6fc15637e53e1126db4f5333fc01c4ee 100644 +index 570d768d017bdf235c31d919a9308e3c0e7390f0..7c930cf3b149410e2a5f9a93e666cf765e0fabc6 100644 --- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc +++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc -@@ -82,11 +82,13 @@ +@@ -84,11 +84,13 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tabs/public/tab_features.h" #include "chrome/browser/ui/views/file_system_access/file_system_access_page_action_controller.h" @@ -25,7 +25,7 @@ index 7611ba742de5b11c5a1f43c2e18d78cb01c9562f..640076ba6fc15637e53e1126db4f5333 #include "components/tabs/public/tab_interface.h" #if BUILDFLAG(ENABLE_PLATFORM_APPS) #include "extensions/browser/extension_registry.h" // nogncheck -@@ -262,190 +264,10 @@ bool MaybeIsLocalUNCPath(const base::FilePath& path) { +@@ -264,190 +266,10 @@ bool MaybeIsLocalUNCPath(const base::FilePath& path) { } #endif @@ -220,7 +220,7 @@ index 7611ba742de5b11c5a1f43c2e18d78cb01c9562f..640076ba6fc15637e53e1126db4f5333 // Checks if `path` should be blocked by the `rules`. // The BlockType of the nearest ancestor of a path to check is what -@@ -1271,16 +1093,6 @@ struct ChromeFileSystemAccessPermissionContext::OriginState { +@@ -1362,16 +1184,6 @@ struct ChromeFileSystemAccessPermissionContext::OriginState { std::unique_ptr<base::RetainingOneShotTimer> cleanup_timer; }; @@ -237,7 +237,7 @@ index 7611ba742de5b11c5a1f43c2e18d78cb01c9562f..640076ba6fc15637e53e1126db4f5333 ChromeFileSystemAccessPermissionContext:: ChromeFileSystemAccessPermissionContext(content::BrowserContext* context, const base::Clock* clock) -@@ -1299,7 +1111,7 @@ ChromeFileSystemAccessPermissionContext:: +@@ -1390,7 +1202,7 @@ ChromeFileSystemAccessPermissionContext:: #if BUILDFLAG(IS_ANDROID) one_time_permissions_tracker_.Observe( OneTimePermissionsTrackerFactory::GetForBrowserContext(context)); @@ -246,7 +246,7 @@ index 7611ba742de5b11c5a1f43c2e18d78cb01c9562f..640076ba6fc15637e53e1126db4f5333 auto* provider = web_app::WebAppProvider::GetForWebApps( Profile::FromBrowserContext(profile_)); if (provider) { -@@ -2566,7 +2378,7 @@ void ChromeFileSystemAccessPermissionContext::OnShutdown() { +@@ -2775,7 +2587,7 @@ void ChromeFileSystemAccessPermissionContext::OnShutdown() { one_time_permissions_tracker_.Reset(); } @@ -255,7 +255,7 @@ index 7611ba742de5b11c5a1f43c2e18d78cb01c9562f..640076ba6fc15637e53e1126db4f5333 void ChromeFileSystemAccessPermissionContext::OnWebAppInstalled( const webapps::AppId& app_id) { if (!base::FeatureList::IsEnabled( -@@ -2901,11 +2713,7 @@ bool ChromeFileSystemAccessPermissionContext:: +@@ -3110,11 +2922,7 @@ bool ChromeFileSystemAccessPermissionContext:: HandleType handle_type, UserAction user_action, GrantType grant_type) { @@ -268,7 +268,7 @@ index 7611ba742de5b11c5a1f43c2e18d78cb01c9562f..640076ba6fc15637e53e1126db4f5333 if (!base::FeatureList::IsEnabled( features::kFileSystemAccessPersistentPermissions)) { return false; -@@ -2956,6 +2764,7 @@ bool ChromeFileSystemAccessPermissionContext:: +@@ -3165,6 +2973,7 @@ bool ChromeFileSystemAccessPermissionContext:: return false; #endif // BUILDFLAG(IS_ANDROID) @@ -277,7 +277,7 @@ index 7611ba742de5b11c5a1f43c2e18d78cb01c9562f..640076ba6fc15637e53e1126db4f5333 std::vector<FileRequestData> ChromeFileSystemAccessPermissionContext:: diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h -index 51bec8ef2a5212494625898fdeb500344525d8f4..6deb4b86b35c2ba38849e25af7691ac858dfaa3e 100644 +index c026a5ac558d3570c8d893943f93a5833c16ccd2..4a9bc924e609066086812bc1002258b6ce586c14 100644 --- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h +++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h @@ -9,10 +9,13 @@ @@ -302,9 +302,9 @@ index 51bec8ef2a5212494625898fdeb500344525d8f4..6deb4b86b35c2ba38849e25af7691ac8 #include "components/enterprise/buildflags/buildflags.h" #include "components/permissions/features.h" #include "components/permissions/object_permission_context_base.h" -@@ -403,6 +407,191 @@ class ChromeFileSystemAccessPermissionContext - return is_block_path_rules_init_complete_; - } +@@ -419,6 +423,191 @@ class ChromeFileSystemAccessPermissionContext + bool IsPathInDowngradedReadPathsForTesting(const url::Origin& origin, + const base::FilePath& path); + // Sentinel used to indicate that no PathService key is specified for a path in + // the struct below. diff --git a/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch b/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch index 2c58d3c9665fa..7e15e0e027bff 100644 --- a/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch +++ b/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch @@ -7,10 +7,10 @@ Subject: refactor: expose HostImportModuleDynamically and This is so that Electron can blend Blink's and Node's implementations of these isolate handlers. diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -index d7a222d99389ae8f826080ae31321043e75b3fc9..9b31bf1176e72b69468244a1a4be24ab5878c74a 100644 +index 1fac8bc97292767149887ff77ebb425124a77f95..2137de2f69cec918c5651292cd79c0ad26a86ae9 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -@@ -645,8 +645,9 @@ bool WasmJSPromiseIntegrationEnabledCallback(v8::Local<v8::Context> context) { +@@ -644,8 +644,9 @@ bool WasmJSPromiseIntegrationEnabledCallback(v8::Local<v8::Context> context) { return RuntimeEnabledFeatures::WebAssemblyJSPromiseIntegrationEnabled( execution_context); } @@ -21,7 +21,7 @@ index d7a222d99389ae8f826080ae31321043e75b3fc9..9b31bf1176e72b69468244a1a4be24ab v8::Local<v8::Context> context, v8::Local<v8::Data> v8_host_defined_options, v8::Local<v8::Value> v8_referrer_resource_url, -@@ -724,20 +725,23 @@ v8::MaybeLocal<v8::Promise> HostImportModuleWithPhaseDynamically( +@@ -723,20 +724,23 @@ v8::MaybeLocal<v8::Promise> HostImportModuleWithPhaseDynamically( return resolver->Promise().V8Promise(); } @@ -47,7 +47,7 @@ index d7a222d99389ae8f826080ae31321043e75b3fc9..9b31bf1176e72b69468244a1a4be24ab v8::Local<v8::Module> module, v8::Local<v8::Object> meta) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); -@@ -764,6 +768,7 @@ void HostGetImportMetaProperties(v8::Local<v8::Context> context, +@@ -763,6 +767,7 @@ void HostGetImportMetaProperties(v8::Local<v8::Context> context, meta->CreateDataProperty(context, resolve_key, resolve_value).ToChecked(); } @@ -55,7 +55,7 @@ index d7a222d99389ae8f826080ae31321043e75b3fc9..9b31bf1176e72b69468244a1a4be24ab bool IsDOMExceptionWrapper(v8::Isolate* isolate, v8::Local<v8::Object> object) { return V8DOMException::HasInstance(isolate, object); } -@@ -794,7 +799,6 @@ void EmitDevToolsEvent(v8::Isolate* isolate) { +@@ -793,7 +798,6 @@ void EmitDevToolsEvent(v8::Isolate* isolate) { } // namespace @@ -63,7 +63,7 @@ index d7a222d99389ae8f826080ae31321043e75b3fc9..9b31bf1176e72b69468244a1a4be24ab void V8Initializer::InitializeV8Common(v8::Isolate* isolate) { // Set up garbage collection before setting up anything else as V8 may trigger // GCs during Blink setup. -@@ -811,9 +815,9 @@ void V8Initializer::InitializeV8Common(v8::Isolate* isolate) { +@@ -810,9 +814,9 @@ void V8Initializer::InitializeV8Common(v8::Isolate* isolate) { SharedArrayBufferConstructorEnabledCallback); isolate->SetHostImportModuleDynamicallyCallback(HostImportModuleDynamically); isolate->SetHostImportModuleWithPhaseDynamicallyCallback( diff --git a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch index dece1ac680550..4aff3cf4bb374 100644 --- a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch +++ b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch @@ -6,7 +6,7 @@ Subject: refactor: patch electron PermissionTypes into blink 6387077: [PermissionOptions] Generalize PermissionRequestDescription | https://chromium-review.googlesource.com/c/chromium/src/+/6387077 diff --git a/components/permissions/permission_util.cc b/components/permissions/permission_util.cc -index 38134a075fbb3586eec543591c88fcf7dcd53e3d..a65838e017a01c8fbb8cd9afe7e3edcce22bf947 100644 +index 83b0237a56d5ea7555ae989bd7bd13886f0c8f13..0377c8c0c3a112ec40132b8441747652b0c15870 100644 --- a/components/permissions/permission_util.cc +++ b/components/permissions/permission_util.cc @@ -536,7 +536,17 @@ ContentSettingsType PermissionUtil::PermissionTypeToContentSettingsTypeSafe( @@ -28,7 +28,7 @@ index 38134a075fbb3586eec543591c88fcf7dcd53e3d..a65838e017a01c8fbb8cd9afe7e3edcc break; } diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc -index f6a28f5efae758a93aa52ebd28e25ece996f0e7e..7a6e702126234fa8f09ea5e8eeb3bc67155f76ca 100644 +index d92f15f9ff1bf8dc23361e668f6d48199540c4e6..aa13c5e85fef3de67e41889b0ea1c751c5144f85 100644 --- a/content/browser/permissions/permission_controller_impl.cc +++ b/content/browser/permissions/permission_controller_impl.cc @@ -88,7 +88,15 @@ PermissionToSchedulingFeature(PermissionType permission_name) { diff --git a/patches/chromium/refactor_unfilter_unresponsive_events.patch b/patches/chromium/refactor_unfilter_unresponsive_events.patch index 127bc7d374fb1..b2f62f9650f71 100644 --- a/patches/chromium/refactor_unfilter_unresponsive_events.patch +++ b/patches/chromium/refactor_unfilter_unresponsive_events.patch @@ -15,10 +15,10 @@ This CL removes these filters so the unresponsive event can still be accessed from our JS event. The filtering is moved into Electron's code. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index dd274924f1c26efbc9fc3683f69647a0933a9855..35def2ce3af887c8f13f2d55590468397c89c708 100644 +index 7bda1bd1d7c34e369c27e4ec283888fe4d50458d..7ec8dea94a9f97f0938f57743a35e8de09efb8c9 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10226,25 +10226,13 @@ void WebContentsImpl::RendererUnresponsive( +@@ -10220,25 +10220,13 @@ void WebContentsImpl::RendererUnresponsive( base::RepeatingClosure hang_monitor_restarter) { OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RendererUnresponsive", "render_widget_host", render_widget_host); diff --git a/patches/chromium/render_widget_host_view_mac.patch b/patches/chromium/render_widget_host_view_mac.patch index 8a814118a29e1..8500564343ee8 100644 --- a/patches/chromium/render_widget_host_view_mac.patch +++ b/patches/chromium/render_widget_host_view_mac.patch @@ -8,7 +8,7 @@ respond to the first mouse click in their window, which is desirable for some kinds of utility windows. Similarly for `disableAutoHideCursor`. diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -index 4c2223346b3db6d12585cf8ca9f0fb55dfc327f0..437b47fd3a1a43fd52980ea550db953ba47990eb 100644 +index b1064aff3a47ee475ccd449bbf89bf419a7d59cc..e5b59a9d364dd5a8f847d9543b19fdc068098754 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -167,6 +167,15 @@ void ExtractUnderlines(NSAttributedString* string, diff --git a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch index 968a7f21cebbb..f9395adb2f8a1 100644 --- a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch +++ b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch @@ -233,7 +233,7 @@ index d8167e854a3264b19a07544039fd01aba45e27a1..2e5a4ae715529e3b7b5c8fbb7195c7ce } diff --git a/content/common/features.cc b/content/common/features.cc -index c0723c13069f570206ea6b536b1a41a1200e3d48..fe5b95303d6cf06b99889307930252effdea6e0f 100644 +index 1ff501a5ea3aa1591957ba6d13b7a264542f5ff9..5cc21f1b1a58df0892491feee5c7042f6ab79951 100644 --- a/content/common/features.cc +++ b/content/common/features.cc @@ -324,6 +324,14 @@ BASE_FEATURE(kIOSurfaceCapturer, @@ -252,7 +252,7 @@ index c0723c13069f570206ea6b536b1a41a1200e3d48..fe5b95303d6cf06b99889307930252ef BASE_FEATURE(kKeepChildProcessAfterIPCReset, "KeepChildProcessAfterIPCReset", diff --git a/content/common/features.h b/content/common/features.h -index 93017367d5ef77b00a73d849608a7af16fe44527..394ee07b58a9b6021143b2168b1065350420cfca 100644 +index 5ad549904c7797e770e0ac08c02e60595f387fe9..5dbe417669d8c267c7b7dbcaa7784147bc756e08 100644 --- a/content/common/features.h +++ b/content/common/features.h @@ -101,6 +101,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); diff --git a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch new file mode 100644 index 0000000000000..f2f463edb6c23 --- /dev/null +++ b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch @@ -0,0 +1,119 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: deepak1556 <hop2deep@gmail.com> +Date: Mon, 1 Sep 2025 23:31:49 +0900 +Subject: Revert: partial "Remove unused PreHandleMouseEvent" + +Refs https://chromium-review.googlesource.com/c/chromium/src/+/6880411 + +diff --git a/content/browser/renderer_host/render_widget_host_delegate.cc b/content/browser/renderer_host/render_widget_host_delegate.cc +index 74fea36ea7f9a345b3474ea18be00704831a685e..c75785d5a26fa52a39d1a3552da9a7621e4c8430 100644 +--- a/content/browser/renderer_host/render_widget_host_delegate.cc ++++ b/content/browser/renderer_host/render_widget_host_delegate.cc +@@ -13,6 +13,11 @@ + + namespace content { + ++bool RenderWidgetHostDelegate::PreHandleMouseEvent( ++ const blink::WebMouseEvent& event) { ++ return false; ++} ++ + KeyboardEventProcessingResult RenderWidgetHostDelegate::PreHandleKeyboardEvent( + const input::NativeWebKeyboardEvent& event) { + return KeyboardEventProcessingResult::NOT_HANDLED; +diff --git a/content/browser/renderer_host/render_widget_host_delegate.h b/content/browser/renderer_host/render_widget_host_delegate.h +index 7db3a07ff9e0f52f1232c25f8e4e72d3c299e623..af763ad4e441e54556854cd40c4cb9098f84bb58 100644 +--- a/content/browser/renderer_host/render_widget_host_delegate.h ++++ b/content/browser/renderer_host/render_widget_host_delegate.h +@@ -103,6 +103,12 @@ class CONTENT_EXPORT RenderWidgetHostDelegate { + virtual void ResizeDueToAutoResize(RenderWidgetHostImpl* render_widget_host, + const gfx::Size& new_size) {} + ++ // Callback to give the browser a chance to handle the specified mouse ++ // event before sending it to the renderer. Returns true if the event was ++ // handled, false otherwise. A true value means no more processing should ++ // happen on the event. The default return value is false. ++ virtual bool PreHandleMouseEvent(const blink::WebMouseEvent& event); ++ + // Callback to give the browser a chance to handle the specified keyboard + // event before sending it to the renderer. See enum for details on return + // value. +diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc +index 349d591b0b35421f91e70dde257a726341e94ad9..6b0bbda767d547cf8365a240692904b3c0e50985 100644 +--- a/content/browser/renderer_host/render_widget_host_impl.cc ++++ b/content/browser/renderer_host/render_widget_host_impl.cc +@@ -1595,6 +1595,10 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( + CHECK_GE(mouse_event.GetType(), WebInputEvent::Type::kMouseTypeFirst); + CHECK_LE(mouse_event.GetType(), WebInputEvent::Type::kMouseTypeLast); + ++ if (delegate_ && delegate_->PreHandleMouseEvent(mouse_event)) { ++ return; ++ } ++ + for (auto& mouse_event_callback : mouse_event_callbacks_) { + if (mouse_event_callback.Run(mouse_event)) { + return; +diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc +index 7ec8dea94a9f97f0938f57743a35e8de09efb8c9..81eabc6be87037a54a8c9b000ce374cc2d87794f 100644 +--- a/content/browser/web_contents/web_contents_impl.cc ++++ b/content/browser/web_contents/web_contents_impl.cc +@@ -4426,6 +4426,12 @@ void WebContentsImpl::RenderWidgetWasResized( + width_changed); + } + ++bool WebContentsImpl::PreHandleMouseEvent(const blink::WebMouseEvent& event) { ++ OPTIONAL_TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("content.verbose"), ++ "WebContentsImpl::PreHandleMouseEvent"); ++ return delegate_ ? delegate_->PreHandleMouseEvent(this, event) : false; ++} ++ + void WebContentsImpl::PreHandleDragUpdate(const DropData& drop_data, + const gfx::PointF& client_pt) { + if (delegate_) { +diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h +index 9dfd229af26127dee8e21c77fcedef5285f3aafa..63a38ac602ae00e6df40e4c883937bc57d513ead 100644 +--- a/content/browser/web_contents/web_contents_impl.h ++++ b/content/browser/web_contents/web_contents_impl.h +@@ -1109,6 +1109,7 @@ class CONTENT_EXPORT WebContentsImpl + + double GetPendingZoomLevel(RenderWidgetHostImpl* rwh) override; + ++ bool PreHandleMouseEvent(const blink::WebMouseEvent& event) override; + void PreHandleDragUpdate(const DropData& drop_data, + const gfx::PointF& client_pt); + void PreHandleDragExit(); +diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc +index ea179bdf3e702fb1d5be55affe3958f77901cd08..4b99edf823034115387c19cf1a8df9284e674d9b 100644 +--- a/content/public/browser/web_contents_delegate.cc ++++ b/content/public/browser/web_contents_delegate.cc +@@ -121,6 +121,12 @@ bool WebContentsDelegate::HandleContextMenu(RenderFrameHost& render_frame_host, + return false; + } + ++bool WebContentsDelegate::PreHandleMouseEvent( ++ WebContents* source, ++ const blink::WebMouseEvent& event) { ++ return false; ++} ++ + KeyboardEventProcessingResult WebContentsDelegate::PreHandleKeyboardEvent( + WebContents* source, + const input::NativeWebKeyboardEvent& event) { +diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h +index 97def739ec2418286b76c0039c61b501293c8f5d..23acbc47f2c2e5b56b674a675e5ea92a643c4715 100644 +--- a/content/public/browser/web_contents_delegate.h ++++ b/content/public/browser/web_contents_delegate.h +@@ -306,6 +306,13 @@ class CONTENT_EXPORT WebContentsDelegate { + virtual bool HandleContextMenu(RenderFrameHost& render_frame_host, + const ContextMenuParams& params); + ++ // Allows delegates to handle mouse events before sending to the renderer. ++ // Returns true if the event was handled, false otherwise. A true value means ++ // no more processing should happen on the event. The default return value is ++ // false. ++ virtual bool PreHandleMouseEvent(WebContents* source, ++ const blink::WebMouseEvent& event); ++ + // Allows delegates to handle mouse drag events before sending to the + // renderer. Returns true if the event was handled, false otherwise. A true + // value means no more processing should happen on the event. The default diff --git a/patches/chromium/revert_remove_the_allowaggressivethrottlingwithwebsocket_feature.patch b/patches/chromium/revert_remove_the_allowaggressivethrottlingwithwebsocket_feature.patch index 9b65125aef097..8110506f35f42 100644 --- a/patches/chromium/revert_remove_the_allowaggressivethrottlingwithwebsocket_feature.patch +++ b/patches/chromium/revert_remove_the_allowaggressivethrottlingwithwebsocket_feature.patch @@ -6,7 +6,7 @@ Subject: Revert "Remove the AllowAggressiveThrottlingWithWebSocket feature." This reverts commit 615c1810a187840ffeb04096087efff86edb37de. diff --git a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc -index b5dde9f0b46663db5c7cf072cc58e271f83995eb..88a503e23ea4fa787a91a2a7934dc1783264a700 100644 +index 6c3d01cfba017bee1dc7bc96f2707f80358923e9..d771cd323529f2e80d71ca20ef37c71c1f356b7c 100644 --- a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc +++ b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc @@ -101,6 +101,17 @@ enum WebSocketOpCode { diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index b91614ca15b88..dbca60b9d1be5 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index 85f5e8902836f91994e9dd4018d1db4d126ffc69..f17308098e72c0087203a18ddd2967cb50b424c1 100644 +index 64da47969f25d5ba71f850e85cdb96eb0d66a5d7..056991b98af53190f0229e3ce84a22b2aa0f55f7 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25240,6 +25240,21 @@ +@@ -25306,6 +25306,21 @@ ] } ], @@ -67,7 +67,7 @@ index 58063f2452dc484a97c79b382067d9b34875e344..d586436498263c595a17454f54644d2d } // namespace views::features diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 54a94e1348fa196eaee8314076c47286c9ab0bcc..ed4d2c4d849085c0e7830c5d52d47daf2700ce34 100644 +index 4c626e026e5b19db737533607957d0ff2fbeae28..7d899eef72721c6f3e27c9892ba963fd6b5aaeef 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -84,6 +84,23 @@ namespace { diff --git a/patches/chromium/scroll_bounce_flag.patch b/patches/chromium/scroll_bounce_flag.patch index ceb2f66520567..f7d2e57413f13 100644 --- a/patches/chromium/scroll_bounce_flag.patch +++ b/patches/chromium/scroll_bounce_flag.patch @@ -6,10 +6,10 @@ Subject: scroll_bounce_flag.patch Patch to make scrollBounce option work. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc -index 69e4b789138ae4de83d93e177e1e5ef02d3246bc..038980cc833e17ee1b0383e92d190c4d92d880c8 100644 +index dbc0224b59409d6a602f3af6d8378d86181b57d9..0d0857f801be22dfffd937e02865b1a90f75917c 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc -@@ -1261,7 +1261,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { +@@ -1231,7 +1231,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { } bool RenderThreadImpl::IsElasticOverscrollEnabled() { diff --git a/patches/chromium/short-circuit_permissions_checks_in_mediastreamdevicescontroller.patch b/patches/chromium/short-circuit_permissions_checks_in_mediastreamdevicescontroller.patch index a37e6eff5454d..0763fcead569d 100644 --- a/patches/chromium/short-circuit_permissions_checks_in_mediastreamdevicescontroller.patch +++ b/patches/chromium/short-circuit_permissions_checks_in_mediastreamdevicescontroller.patch @@ -15,7 +15,7 @@ short-circuit all the permissions checks in MSDC for now to allow us to unduplicate this code. diff --git a/components/webrtc/media_stream_devices_controller.cc b/components/webrtc/media_stream_devices_controller.cc -index 50b665fea15c81326ea7610c66ecad970bc5b261..99c34a259786176c24c67cf91aa528ce88a6e58d 100644 +index d98c6fb6870df8ab29234d4f7d1f3ca4ac903089..9933b5b5965ee74666cfe11554f0ccd56fae37c5 100644 --- a/components/webrtc/media_stream_devices_controller.cc +++ b/components/webrtc/media_stream_devices_controller.cc @@ -57,7 +57,8 @@ bool PermissionIsRequested(blink::PermissionType permission, @@ -37,7 +37,7 @@ index 50b665fea15c81326ea7610c66ecad970bc5b261..99c34a259786176c24c67cf91aa528ce content::PermissionController* permission_controller = web_contents->GetBrowserContext()->GetPermissionController(); -@@ -174,19 +175,26 @@ void MediaStreamDevicesController::RequestPermissions( +@@ -174,19 +175,31 @@ void MediaStreamDevicesController::RequestPermissions( requested_audio_capture_device_ids; permission_request_description.requested_video_capture_device_ids = requested_video_capture_device_ids; @@ -56,8 +56,13 @@ index 50b665fea15c81326ea7610c66ecad970bc5b261..99c34a259786176c24c67cf91aa528ce - &MediaStreamDevicesController::PromptAnsweredGroupedRequest, - std::move(controller))); + if (previously_approved) { -+ controller->PromptAnsweredGroupedRequest({blink::mojom::PermissionStatus::GRANTED /*audio*/, -+ blink::mojom::PermissionStatus::GRANTED /*video*/}); ++ controller->PromptAnsweredGroupedRequest( ++ {content::PermissionResult( ++ content::PermissionStatus::GRANTED /*audio*/, ++ content::PermissionStatusSource::UNSPECIFIED), ++ content::PermissionResult( ++ content::PermissionStatus::GRANTED /*video*/, ++ content::PermissionStatusSource::UNSPECIFIED)}); + } else { + rfh->GetBrowserContext() + ->GetPermissionController() @@ -72,7 +77,7 @@ index 50b665fea15c81326ea7610c66ecad970bc5b261..99c34a259786176c24c67cf91aa528ce } MediaStreamDevicesController::~MediaStreamDevicesController() { -@@ -436,6 +444,7 @@ bool MediaStreamDevicesController::PermissionIsBlockedForReason( +@@ -436,6 +449,7 @@ bool MediaStreamDevicesController::PermissionIsBlockedForReason( return false; } @@ -80,7 +85,7 @@ index 50b665fea15c81326ea7610c66ecad970bc5b261..99c34a259786176c24c67cf91aa528ce // TODO(raymes): This function wouldn't be needed if // PermissionManager::RequestPermissions returned a denial reason. content::PermissionResult result = -@@ -449,6 +458,7 @@ bool MediaStreamDevicesController::PermissionIsBlockedForReason( +@@ -449,6 +463,7 @@ bool MediaStreamDevicesController::PermissionIsBlockedForReason( DCHECK_EQ(blink::mojom::PermissionStatus::DENIED, result.status); return true; } @@ -89,10 +94,10 @@ index 50b665fea15c81326ea7610c66ecad970bc5b261..99c34a259786176c24c67cf91aa528ce } diff --git a/components/webrtc/media_stream_devices_controller.h b/components/webrtc/media_stream_devices_controller.h -index a976526aedc2107dd43242199b04142ca4d34eda..0410c8818d6ffdd55c49f1bef27ddb4ea16d8ab9 100644 +index 5e46e66f51994d3eef3b19ee57b37e6cf32658e8..d01403717a0df2c18b3d88495d9a4f85f242693a 100644 --- a/components/webrtc/media_stream_devices_controller.h +++ b/components/webrtc/media_stream_devices_controller.h -@@ -49,7 +49,8 @@ class MediaStreamDevicesController { +@@ -50,7 +50,8 @@ class MediaStreamDevicesController { // synchronously or asynchronously returned via |callback|. static void RequestPermissions(const content::MediaStreamRequest& request, MediaStreamDeviceEnumerator* enumerator, diff --git a/patches/chromium/support_mixed_sandbox_with_zygote.patch b/patches/chromium/support_mixed_sandbox_with_zygote.patch index a14d76dffbd1d..748825f2f77a0 100644 --- a/patches/chromium/support_mixed_sandbox_with_zygote.patch +++ b/patches/chromium/support_mixed_sandbox_with_zygote.patch @@ -22,10 +22,10 @@ However, the patch would need to be reviewed by the security team, as it does touch a security-sensitive class. diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index c20d6b898f517856efb01e9f504a9dfa967fa3c3..95b4a649055e03ef7822a33347ed904ac7d64695 100644 +index 9d5c6428a0f35d678f8723dd0b959fa34e8fc32c..26a8f384897c2a60f60f441decc3f4f895c9c049 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -1833,6 +1833,10 @@ bool RenderProcessHostImpl::Init() { +@@ -1864,6 +1864,10 @@ bool RenderProcessHostImpl::Init() { std::unique_ptr<SandboxedProcessLauncherDelegate> sandbox_delegate = std::make_unique<RendererSandboxedProcessLauncherDelegateWin>( *cmd_line, IsPdf(), IsJitDisabled()); diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index 4e71f8a943f20..bdd029052f25a 100644 --- a/patches/chromium/web_contents.patch +++ b/patches/chromium/web_contents.patch @@ -9,7 +9,7 @@ is needed for OSR. Originally landed in https://github.com/electron/libchromiumcontent/pull/226. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index c9472325e55052ead090c55704b590bb6722c429..fbf58cc058ee37aab227a632c5f4caf8c4cd6620 100644 +index b7967a4ab1c9d2c7b2a49a610af10190bcd6e0f0..d6b188a6fd5f3a591b4651db40ca258bb03e7a17 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -4160,6 +4160,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, @@ -35,10 +35,10 @@ index c9472325e55052ead090c55704b590bb6722c429..fbf58cc058ee37aab227a632c5f4caf8 CHECK(view_.get()); diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index f196deb55065a6016ceabbdb8d165eb9f15add74..53bf8f0368f33926a4d2e7f945db7f871558647f 100644 +index 37c2351c8a286327e2f6f352e7255e09a5a484dd..780a2d8e05665a6deea26a5e29a392bc058d4202 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h -@@ -125,11 +125,14 @@ class PrerenderHandle; +@@ -128,11 +128,14 @@ class PrerenderHandle; class RenderFrameHost; class RenderViewHost; class RenderWidgetHost; @@ -53,7 +53,7 @@ index f196deb55065a6016ceabbdb8d165eb9f15add74..53bf8f0368f33926a4d2e7f945db7f87 class WebUI; struct DropData; struct MHTMLGenerationParams; -@@ -283,6 +286,10 @@ class WebContents : public PageNavigator, public base::SupportsUserData { +@@ -289,6 +292,10 @@ class WebContents : public PageNavigator, public base::SupportsUserData { network::mojom::WebSandboxFlags starting_sandbox_flags = network::mojom::WebSandboxFlags::kNone; diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index fe95d84fbf7df..d4c462237ac46 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,10 +15,10 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 4f8e3a08890ed7498b29a900ccf4bbda5f9cb494..bfce01f531d30cabe5fc33d258652597922a1de8 100644 +index 73f730ff05a22938a834921d4842bf1f9faaca67..dbd436cafbb0c1d49e76bcd569bca5e04ed89b44 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -8925,6 +8925,17 @@ void RenderFrameHostImpl::EnterFullscreen( +@@ -8929,6 +8929,17 @@ void RenderFrameHostImpl::EnterFullscreen( } } @@ -37,10 +37,10 @@ index 4f8e3a08890ed7498b29a900ccf4bbda5f9cb494..bfce01f531d30cabe5fc33d258652597 if (had_fullscreen_token && !GetView()->HasFocus()) GetView()->Focus(); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index fbf58cc058ee37aab227a632c5f4caf8c4cd6620..0a6a205f49d7bc853879ac4919868aadd6fdd42f 100644 +index d6b188a6fd5f3a591b4651db40ca258bb03e7a17..7f49174c2e0121ddde50250a38b4ac4fcc43d125 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4449,21 +4449,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( +@@ -4443,21 +4443,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( const input::NativeWebKeyboardEvent& event) { OPTIONAL_TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("content.verbose"), "WebContentsImpl::PreHandleKeyboardEvent"); @@ -80,7 +80,7 @@ index fbf58cc058ee37aab227a632c5f4caf8c4cd6620..0a6a205f49d7bc853879ac4919868aad } bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) { -@@ -4622,7 +4626,7 @@ void WebContentsImpl::EnterFullscreenMode( +@@ -4616,7 +4620,7 @@ void WebContentsImpl::EnterFullscreenMode( OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::EnterFullscreenMode"); DCHECK(CanEnterFullscreenMode(requesting_frame)); DCHECK(requesting_frame->IsActive()); diff --git a/patches/chromium/worker_context_will_destroy.patch b/patches/chromium/worker_context_will_destroy.patch index fb09a140de830..669d0e9d3e9a8 100644 --- a/patches/chromium/worker_context_will_destroy.patch +++ b/patches/chromium/worker_context_will_destroy.patch @@ -26,10 +26,10 @@ index d794a461eedde1003c72f47af0517249ab20806d..6d2033d2023a7c4c936933a050d2372c // An empty URL is returned if the URL is not overriden. virtual GURL OverrideFlashEmbedWithHTML(const GURL& url); diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index 74ae1472a2134efcab4f3b258911b39a8e8ed27a..c74f99805cea8c939a5278d120fd348df7a94d32 100644 +index b3fe9e1bfa0976b438ddf8ab0cec6394faca98fd..10c50e675f50025da7dee5f992458605c2b944e6 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -903,6 +903,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { +@@ -926,6 +926,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread(); } @@ -43,10 +43,10 @@ index 74ae1472a2134efcab4f3b258911b39a8e8ed27a..c74f99805cea8c939a5278d120fd348d const v8::Local<v8::Context>& worker) { GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h -index c2c2b533e42cfcc8c3ecdde1ab6ed9bc2a353b5e..b2238f512b30e64399a901a3c9f430e5be54c27c 100644 +index 8b684e0e2a43bed314822a4107820aa29eacfae3..8666fbfed28d4138d2c16baebe97912b68481803 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h -@@ -200,6 +200,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -205,6 +205,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { void DidStartWorkerThread() override; void WillStopWorkerThread() override; void WorkerContextCreated(const v8::Local<v8::Context>& worker) override; @@ -55,10 +55,10 @@ index c2c2b533e42cfcc8c3ecdde1ab6ed9bc2a353b5e..b2238f512b30e64399a901a3c9f430e5 const blink::WebSecurityOrigin& script_origin) override; blink::ProtocolHandlerSecurityLevel GetProtocolHandlerSecurityLevel( diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h -index 87aebe19abd4690ace9d524364ef32a34afd3592..e33318c3e673741a05083cf064152e24ff39ca02 100644 +index 2462293cb1099c0edd47134bd835641820cf34b4..d3baf3f488179d82e91d012043d6ccc517a858f5 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -673,6 +673,7 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -664,6 +664,7 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void DidStartWorkerThread() {} virtual void WillStopWorkerThread() {} virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {} @@ -67,10 +67,10 @@ index 87aebe19abd4690ace9d524364ef32a34afd3592..e33318c3e673741a05083cf064152e24 const WebSecurityOrigin& script_origin) { return false; diff --git a/third_party/blink/renderer/core/workers/worker_thread.cc b/third_party/blink/renderer/core/workers/worker_thread.cc -index 8aaf3c12144273bb35bba3e77e0fd505282213df..a6eab67460b49b4594440be2f6e41f852b201e12 100644 +index 0660054931e295abafb420ce567f6b45d9af39d6..bea00fa0a9faaa0c0e7fa5b444c1e485d1e883d1 100644 --- a/third_party/blink/renderer/core/workers/worker_thread.cc +++ b/third_party/blink/renderer/core/workers/worker_thread.cc -@@ -823,6 +823,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() { +@@ -824,6 +824,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() { } pause_handle_.reset(); diff --git a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch index 04770e62499e9..7865ef6ca04b1 100644 --- a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch +++ b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch @@ -35,10 +35,10 @@ index 6d2033d2023a7c4c936933a050d2372cf490eb44..79d59c3f4d3d2d5ff39bd65ded489183 // from the worker thread. virtual void WillDestroyWorkerContextOnWorkerThread( diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index c74f99805cea8c939a5278d120fd348df7a94d32..a1e92922c11cb995e8814ca693332a9c075ca012 100644 +index 10c50e675f50025da7dee5f992458605c2b944e6..bdba9ca63b81485e21aa1d2bb048c721c7895e47 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -915,6 +915,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated( +@@ -938,6 +938,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated( worker); } @@ -52,10 +52,10 @@ index c74f99805cea8c939a5278d120fd348df7a94d32..a1e92922c11cb995e8814ca693332a9c const blink::WebSecurityOrigin& script_origin) { return GetContentClient()->renderer()->AllowScriptExtensionForServiceWorker( diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h -index b2238f512b30e64399a901a3c9f430e5be54c27c..6231d97d52de2245c6f9396d9769554fd590c128 100644 +index 8666fbfed28d4138d2c16baebe97912b68481803..7f639364ecff5506d414aedf0537d87e54d5fef1 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h -@@ -200,6 +200,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -205,6 +205,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { void DidStartWorkerThread() override; void WillStopWorkerThread() override; void WorkerContextCreated(const v8::Local<v8::Context>& worker) override; @@ -65,10 +65,10 @@ index b2238f512b30e64399a901a3c9f430e5be54c27c..6231d97d52de2245c6f9396d9769554f bool AllowScriptExtensionForServiceWorker( const blink::WebSecurityOrigin& script_origin) override; diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h -index e33318c3e673741a05083cf064152e24ff39ca02..a5a13ad4724aec8b5c471fd81995cf19c3ff7086 100644 +index d3baf3f488179d82e91d012043d6ccc517a858f5..a3288c6229116ed71f16f9f9cde3a8121a603580 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -673,6 +673,8 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -664,6 +664,8 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void DidStartWorkerThread() {} virtual void WillStopWorkerThread() {} virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {} diff --git a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch index 8798d2b26a32e..219c5bcc94db8 100644 --- a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch +++ b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch @@ -10,10 +10,10 @@ to handle this without patching, but this is fairly clean for now and no longer patching legacy devtools code. diff --git a/front_end/entrypoints/main/MainImpl.ts b/front_end/entrypoints/main/MainImpl.ts -index d3d9a5f373d324eb3cb234c43915476716912cdb..b0ed5173e52abd4eeed4f069d6960c6b01e5e076 100644 +index c1880f1d379d4999f595f34bdb34695010919a0a..42196f67953736db9e005c041ddf7e65bd98e2ed 100644 --- a/front_end/entrypoints/main/MainImpl.ts +++ b/front_end/entrypoints/main/MainImpl.ts -@@ -733,6 +733,8 @@ export class MainImpl { +@@ -736,6 +736,8 @@ export class MainImpl { globalThis.Main = globalThis.Main || {}; // @ts-expect-error Exported for Tests.js globalThis.Main.Main = MainImpl; diff --git a/patches/node/.patches b/patches/node/.patches index bd0290aa2f09d..9c882f7339bcc 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -48,3 +48,5 @@ fix_expose_readfilesync_override_for_modules.patch fix_array_out-of-bounds_read_in_boyer-moore_search.patch chore_add_missing_include_of_iterator.patch test_accomodate_v8_thenable_stack_trace_change_in_snapshot.patch +chore_exclude_electron_node_folder_from_exit-time-destructors.patch +reland_api_advance_deprecation_of_getisolate.patch diff --git a/patches/node/chore_exclude_electron_node_folder_from_exit-time-destructors.patch b/patches/node/chore_exclude_electron_node_folder_from_exit-time-destructors.patch new file mode 100644 index 0000000000000..098073d58bea1 --- /dev/null +++ b/patches/node/chore_exclude_electron_node_folder_from_exit-time-destructors.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: deepak1556 <hop2deep@gmail.com> +Date: Mon, 1 Sep 2025 03:12:06 +0900 +Subject: chore: exclude electron_node folder from exit-time-destructors + +Refs https://issues.chromium.org/issues/430332953 +It contains multiple third_party dependencies that doesn't +align with the chromium style guide. + +diff --git a/deps/ada/unofficial.gni b/deps/ada/unofficial.gni +index ab7dc27de3e304f6d912d5834da47e3b4eb25495..b6c0fd4ceee989dac55c7d54e52fef183ab4621c 100644 +--- a/deps/ada/unofficial.gni ++++ b/deps/ada/unofficial.gni +@@ -20,6 +20,7 @@ template("ada_gn_build") { + source_set(target_name) { + forward_variables_from(invoker, "*") + public_configs = [ ":ada_config" ] ++ configs += [ "//build/config/compiler:no_exit_time_destructors" ] + sources = gypi_values.ada_sources + } + } +diff --git a/unofficial.gni b/unofficial.gni +index 8886f2a79ae77614789d6ae0defd4f18fc756456..a64d2e4ac475abc049fff7ea62ec76de565a747d 100644 +--- a/unofficial.gni ++++ b/unofficial.gni +@@ -143,7 +143,10 @@ template("node_gn_build") { + [ "node.gyp" ]) + + source_set("libnode") { +- configs += [ ":node_internal_config" ] ++ configs += [ ++ ":node_internal_config", ++ "//build/config/compiler:no_exit_time_destructors" ++ ] + public_configs = [ + ":node_external_config", + "deps/googletest:googletest_config", +@@ -345,6 +348,7 @@ template("node_gn_build") { + "src/embedded_data.h", + ] + include_dirs = [ "src", "tools" ] ++ configs += [ "//build/config/compiler:no_exit_time_destructors" ] + + if (!is_win) { + defines += [ "NODE_JS2C_USE_STRING_LITERALS" ] diff --git a/patches/node/reland_api_advance_deprecation_of_getisolate.patch b/patches/node/reland_api_advance_deprecation_of_getisolate.patch new file mode 100644 index 0000000000000..4c98e9f94468e --- /dev/null +++ b/patches/node/reland_api_advance_deprecation_of_getisolate.patch @@ -0,0 +1,82 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: deepak1556 <hop2deep@gmail.com> +Date: Mon, 1 Sep 2025 03:13:53 +0900 +Subject: Reland "[api] Advance deprecation of GetIsolate" + +https://chromium-review.googlesource.com/c/v8/v8/+/6875273 + +diff --git a/src/util-inl.h b/src/util-inl.h +index cc41a1fb5459a5cfe5fcf593055cbd03bdb1f74f..fdde74f4e43047916146d092b4cb3490bdc5a947 100644 +--- a/src/util-inl.h ++++ b/src/util-inl.h +@@ -326,14 +326,14 @@ v8::Maybe<void> FromV8Array(v8::Local<v8::Context> context, + std::vector<v8::Global<v8::Value>>* out) { + uint32_t count = js_array->Length(); + out->reserve(count); +- ArrayIterationData data{out, context->GetIsolate()}; ++ ArrayIterationData data{out, v8::Isolate::GetCurrent()}; + return js_array->Iterate(context, PushItemToVector, &data); + } + + v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, + std::string_view str, + v8::Isolate* isolate) { +- if (isolate == nullptr) isolate = context->GetIsolate(); ++ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); + if (str.size() >= static_cast<size_t>(v8::String::kMaxLength)) [[unlikely]] { + // V8 only has a TODO comment about adding an exception when the maximum + // string size is exceeded. +@@ -349,7 +349,7 @@ v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, + v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, + v8_inspector::StringView str, + v8::Isolate* isolate) { +- if (isolate == nullptr) isolate = context->GetIsolate(); ++ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); + if (str.length() >= static_cast<size_t>(v8::String::kMaxLength)) + [[unlikely]] { + // V8 only has a TODO comment about adding an exception when the maximum +@@ -376,7 +376,7 @@ template <typename T> + v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, + const std::vector<T>& vec, + v8::Isolate* isolate) { +- if (isolate == nullptr) isolate = context->GetIsolate(); ++ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope handle_scope(isolate); + + MaybeStackBuffer<v8::Local<v8::Value>, 128> arr(vec.size()); +@@ -393,7 +393,7 @@ template <typename T> + v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, + const std::set<T>& set, + v8::Isolate* isolate) { +- if (isolate == nullptr) isolate = context->GetIsolate(); ++ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); + v8::Local<v8::Set> set_js = v8::Set::New(isolate); + v8::HandleScope handle_scope(isolate); + +@@ -412,7 +412,7 @@ template <typename T, typename U> + v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, + const std::unordered_map<T, U>& map, + v8::Isolate* isolate) { +- if (isolate == nullptr) isolate = context->GetIsolate(); ++ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope handle_scope(isolate); + + v8::Local<v8::Map> ret = v8::Map::New(isolate); +@@ -455,7 +455,7 @@ template <typename T, typename> + v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, + const T& number, + v8::Isolate* isolate) { +- if (isolate == nullptr) isolate = context->GetIsolate(); ++ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); + return ConvertNumberToV8Value(isolate, number); + } + +@@ -468,7 +468,7 @@ v8::Local<v8::Array> ToV8ValuePrimitiveArray(v8::Local<v8::Context> context, + std::is_floating_point_v<T>, + "Only primitive types (bool, integral, floating-point) are supported."); + +- if (isolate == nullptr) isolate = context->GetIsolate(); ++ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope handle_scope(isolate); + + v8::LocalVector<v8::Value> elements(isolate); diff --git a/patches/sqlite/fix_rename_sqlite_win32_exports_to_avoid_conflicts_with_node_js.patch b/patches/sqlite/fix_rename_sqlite_win32_exports_to_avoid_conflicts_with_node_js.patch index 75eb0d2cd3cbf..d539776faa397 100644 --- a/patches/sqlite/fix_rename_sqlite_win32_exports_to_avoid_conflicts_with_node_js.patch +++ b/patches/sqlite/fix_rename_sqlite_win32_exports_to_avoid_conflicts_with_node_js.patch @@ -10,13 +10,13 @@ the exported symbols in SQLite to avoid conflicts with Node.js. This should be upstreamed to SQLite. diff --git a/amalgamation/rename_exports.h b/amalgamation/rename_exports.h -index 1d45c732431e1031b7431ade967f0cfb66e500ea..be03b5b7e09108ba1e8ad4ff408b013c3ece90e3 100644 +index f61b7c38dcfa3a69ccc392c3e808fc8c2622773f..f4d5bb88a176ccb28c37420d30ac88c690486f96 100644 --- a/amalgamation/rename_exports.h +++ b/amalgamation/rename_exports.h @@ -367,6 +367,15 @@ - #define sqlite3session_patchset chrome_sqlite3session_patchset // Lines 11680-11684 - #define sqlite3session_patchset_strm chrome_sqlite3session_patchset_strm // Lines 12946-12950 - #define sqlite3session_table_filter chrome_sqlite3session_table_filter // Lines 11448-11455 + #define sqlite3session_patchset chrome_sqlite3session_patchset // Lines 11682-11686 + #define sqlite3session_patchset_strm chrome_sqlite3session_patchset_strm // Lines 12948-12952 + #define sqlite3session_table_filter chrome_sqlite3session_table_filter // Lines 11450-11457 +#define sqlite3_win32_write_debug chrome_sqlite3_win32_write_debug +#define sqlite3_win32_sleep chrome_sqlite3_win32_sleep +#define sqlite3_win32_is_nt chrome_sqlite3_win32_is_nt diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc index 2db351326ab68..4fb59a5157ce6 100644 --- a/shell/browser/api/electron_api_app.cc +++ b/shell/browser/api/electron_api_app.cc @@ -369,9 +369,6 @@ namespace electron::api { gin::WrapperInfo App::kWrapperInfo = {{gin::kEmbedderNativeGin}, gin::kElectronApp}; -// static -cppgc::Persistent<App> App::instance_; - namespace { IconLoader::IconSize GetIconSizeByString(const std::string& size) { @@ -1701,17 +1698,15 @@ void ConfigureHostResolver(v8::Isolate* isolate, // static App* App::Get() { - CHECK_NE(instance_, nullptr); - return instance_.Get(); + return Create(nullptr); } // static App* App::Create(v8::Isolate* isolate) { - if (!instance_) { - instance_ = cppgc::MakeGarbageCollected<App>( - isolate->GetCppHeap()->GetAllocationHandle()); - } - return instance_.Get(); + static base::NoDestructor<cppgc::Persistent<App>> instance( + cppgc::MakeGarbageCollected<App>( + isolate->GetCppHeap()->GetAllocationHandle())); + return instance->Get(); } const gin::WrapperInfo* App::wrapper_info() const { diff --git a/shell/browser/api/electron_api_app.h b/shell/browser/api/electron_api_app.h index dad2ed76a81ac..7e91e44eb76d6 100644 --- a/shell/browser/api/electron_api_app.h +++ b/shell/browser/api/electron_api_app.h @@ -282,8 +282,6 @@ class App final : public gin::Wrappable<App>, bool watch_singleton_socket_on_ready_ = false; std::unique_ptr<content::ScopedAccessibilityMode> scoped_accessibility_mode_; - - static cppgc::Persistent<App> instance_; }; } // namespace api diff --git a/shell/browser/api/electron_api_native_theme.cc b/shell/browser/api/electron_api_native_theme.cc index adccf5f8e50b8..f4ec558a6c193 100644 --- a/shell/browser/api/electron_api_native_theme.cc +++ b/shell/browser/api/electron_api_native_theme.cc @@ -25,6 +25,12 @@ NativeTheme::NativeTheme(v8::Isolate* isolate, ui::NativeTheme* web_theme) : ui_theme_(ui_theme), web_theme_(web_theme) { ui_theme_->AddObserver(this); +#if BUILDFLAG(IS_WIN) + std::ignore = hkcu_themes_regkey_.Open(HKEY_CURRENT_USER, + L"Software\\Microsoft\\Windows\\" + L"CurrentVersion\\Themes\\Personalize", + KEY_READ); +#endif } NativeTheme::~NativeTheme() { @@ -32,6 +38,16 @@ NativeTheme::~NativeTheme() { } void NativeTheme::OnNativeThemeUpdatedOnUI() { +#if BUILDFLAG(IS_WIN) + if (hkcu_themes_regkey_.Valid()) { + DWORD system_uses_light_theme = 1; + hkcu_themes_regkey_.ReadValueDW(L"SystemUsesLightTheme", + &system_uses_light_theme); + bool system_dark_mode_enabled = (system_uses_light_theme == 0); + should_use_dark_colors_for_system_integrated_ui_ = + std::make_optional<bool>(system_dark_mode_enabled); + } +#endif Emit("updated"); } @@ -65,7 +81,8 @@ bool NativeTheme::ShouldUseHighContrastColors() { } bool NativeTheme::ShouldUseDarkColorsForSystemIntegratedUI() { - return ui_theme_->ShouldUseDarkColorsForSystemIntegratedUI(); + return should_use_dark_colors_for_system_integrated_ui_.value_or( + ShouldUseDarkColors()); } bool NativeTheme::InForcedColorsMode() { diff --git a/shell/browser/api/electron_api_native_theme.h b/shell/browser/api/electron_api_native_theme.h index 04351ffb944a0..7a4b7b4eecc07 100644 --- a/shell/browser/api/electron_api_native_theme.h +++ b/shell/browser/api/electron_api_native_theme.h @@ -11,6 +11,10 @@ #include "ui/native_theme/native_theme.h" #include "ui/native_theme/native_theme_observer.h" +#if BUILDFLAG(IS_WIN) +#include "base/win/registry.h" +#endif + namespace gin_helper { template <typename T> class Handle; @@ -58,6 +62,11 @@ class NativeTheme final : public gin_helper::DeprecatedWrappable<NativeTheme>, void OnNativeThemeUpdatedOnUI(); private: +#if BUILDFLAG(IS_WIN) + base::win::RegKey hkcu_themes_regkey_; +#endif + std::optional<bool> should_use_dark_colors_for_system_integrated_ui_ = + std::nullopt; raw_ptr<ui::NativeTheme> ui_theme_; raw_ptr<ui::NativeTheme> web_theme_; }; diff --git a/shell/browser/api/electron_api_protocol.cc b/shell/browser/api/electron_api_protocol.cc index 1d1f1a209ec89..a8afe13cfed5e 100644 --- a/shell/browser/api/electron_api_protocol.cc +++ b/shell/browser/api/electron_api_protocol.cc @@ -9,6 +9,7 @@ #include "base/command_line.h" #include "base/containers/contains.h" +#include "base/no_destructor.h" #include "content/common/url_schemes.h" #include "content/public/browser/child_process_security_policy.h" #include "gin/object_template_builder.h" @@ -28,15 +29,6 @@ namespace { -// List of registered custom standard schemes. -std::vector<std::string> g_standard_schemes; - -// List of registered custom streaming schemes. -std::vector<std::string> g_streaming_schemes; - -// Schemes that support V8 code cache. -std::vector<std::string> g_code_cache_schemes; - struct SchemeOptions { bool standard = false; bool secure = false; @@ -89,12 +81,19 @@ namespace electron::api { gin::DeprecatedWrapperInfo Protocol::kWrapperInfo = {gin::kEmbedderNativeGin}; -const std::vector<std::string>& GetStandardSchemes() { - return g_standard_schemes; +std::vector<std::string>& GetStandardSchemes() { + static base::NoDestructor<std::vector<std::string>> g_standard_schemes; + return *g_standard_schemes; +} + +std::vector<std::string>& GetCodeCacheSchemes() { + static base::NoDestructor<std::vector<std::string>> g_code_cache_schemes; + return *g_code_cache_schemes; } -const std::vector<std::string>& GetCodeCacheSchemes() { - return g_code_cache_schemes; +std::vector<std::string>& GetStreamingSchemes() { + static base::NoDestructor<std::vector<std::string>> g_streaming_schemes; + return *g_streaming_schemes; } void AddServiceWorkerScheme(const std::string& scheme) { @@ -132,7 +131,7 @@ void RegisterSchemesAsPrivileged(gin_helper::ErrorThrower thrower, auto* policy = content::ChildProcessSecurityPolicy::GetInstance(); url::AddStandardScheme(custom_scheme.scheme.c_str(), url::SCHEME_WITH_HOST); - g_standard_schemes.push_back(custom_scheme.scheme); + GetStandardSchemes().push_back(custom_scheme.scheme); policy->RegisterWebSafeScheme(custom_scheme.scheme); } if (custom_scheme.options.secure) { @@ -155,10 +154,10 @@ void RegisterSchemesAsPrivileged(gin_helper::ErrorThrower thrower, AddServiceWorkerScheme(custom_scheme.scheme); } if (custom_scheme.options.stream) { - g_streaming_schemes.push_back(custom_scheme.scheme); + GetStreamingSchemes().push_back(custom_scheme.scheme); } if (custom_scheme.options.codeCache) { - g_code_cache_schemes.push_back(custom_scheme.scheme); + GetCodeCacheSchemes().push_back(custom_scheme.scheme); url::AddCodeCacheScheme(custom_scheme.scheme.c_str()); } } @@ -181,11 +180,11 @@ void RegisterSchemesAsPrivileged(gin_helper::ErrorThrower thrower, AppendSchemesToCmdLine(electron::switches::kServiceWorkerSchemes, service_worker_schemes); AppendSchemesToCmdLine(electron::switches::kStandardSchemes, - g_standard_schemes); + GetStandardSchemes()); AppendSchemesToCmdLine(electron::switches::kStreamingSchemes, - g_streaming_schemes); + GetStreamingSchemes()); AppendSchemesToCmdLine(electron::switches::kCodeCacheSchemes, - g_code_cache_schemes); + GetCodeCacheSchemes()); } namespace { diff --git a/shell/browser/api/electron_api_protocol.h b/shell/browser/api/electron_api_protocol.h index dfb935c175630..63c395b98d738 100644 --- a/shell/browser/api/electron_api_protocol.h +++ b/shell/browser/api/electron_api_protocol.h @@ -29,8 +29,8 @@ class ProtocolRegistry; namespace api { -const std::vector<std::string>& GetStandardSchemes(); -const std::vector<std::string>& GetCodeCacheSchemes(); +std::vector<std::string>& GetStandardSchemes(); +std::vector<std::string>& GetCodeCacheSchemes(); void AddServiceWorkerScheme(const std::string& scheme); diff --git a/shell/browser/api/electron_api_system_preferences.h b/shell/browser/api/electron_api_system_preferences.h index 7582a68faec12..c325669cede41 100644 --- a/shell/browser/api/electron_api_system_preferences.h +++ b/shell/browser/api/electron_api_system_preferences.h @@ -8,6 +8,7 @@ #include <memory> #include <string> +#include "base/functional/bind.h" #include "base/values.h" #include "shell/browser/event_emitter_mixin.h" #include "shell/common/gin_helper/wrappable.h" @@ -15,7 +16,7 @@ #if BUILDFLAG(IS_WIN) #include "shell/browser/browser.h" #include "shell/browser/browser_observer.h" -#include "ui/gfx/sys_color_change_listener.h" +#include "ui/gfx/win/singleton_hwnd_observer.h" #endif namespace gin_helper { @@ -42,8 +43,7 @@ class SystemPreferences final public gin_helper::EventEmitterMixin<SystemPreferences> #if BUILDFLAG(IS_WIN) , - public BrowserObserver, - public gfx::SysColorChangeListener + public BrowserObserver #endif { public: @@ -65,8 +65,8 @@ class SystemPreferences final #if BUILDFLAG(IS_WIN) void InitializeWindow(); - // gfx::SysColorChangeListener: - void OnSysColorChange() override; + // Called by `singleton_hwnd_observer_`. + void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); // BrowserObserver: void OnFinishLaunching(base::Value::Dict launch_info) override; @@ -159,7 +159,8 @@ class SystemPreferences final std::string current_color_; - std::unique_ptr<gfx::ScopedSysColorChangeListener> color_change_listener_; + // Color/high contrast mode change observer. + std::unique_ptr<gfx::SingletonHwndObserver> singleton_hwnd_observer_; #endif }; diff --git a/shell/browser/api/electron_api_system_preferences_mac.mm b/shell/browser/api/electron_api_system_preferences_mac.mm index 582b7bc74fc0d..eb9d3e972d8a1 100644 --- a/shell/browser/api/electron_api_system_preferences_mac.mm +++ b/shell/browser/api/electron_api_system_preferences_mac.mm @@ -14,6 +14,7 @@ #include "base/apple/scoped_cftyperef.h" #include "base/containers/flat_map.h" +#include "base/no_destructor.h" #include "base/strings/sys_string_conversions.h" #include "base/task/sequenced_task_runner.h" #include "base/values.h" @@ -80,7 +81,10 @@ static bool FromV8(v8::Isolate* isolate, int g_next_id = 0; // The map to convert |id| to |int|. -base::flat_map<int, id> g_id_map; +auto& GetIdMap() { + static base::NoDestructor<base::flat_map<int, id>> g_id_map; + return *g_id_map; +} AVMediaType ParseMediaType(const std::string& media_type) { if (media_type == "camera") { @@ -214,7 +218,7 @@ AVMediaType ParseMediaType(const std::string& media_type) { auto* name = maybe_name->IsNull() ? nil : base::SysUTF8ToNSString(name_str); - g_id_map[request_id] = [GetNotificationCenter(kind) + GetIdMap()[request_id] = [GetNotificationCenter(kind) addObserverForName:name object:nil queue:nil @@ -240,11 +244,11 @@ AVMediaType ParseMediaType(const std::string& media_type) { void SystemPreferences::DoUnsubscribeNotification(int request_id, NotificationCenterKind kind) { - auto iter = g_id_map.find(request_id); - if (iter != g_id_map.end()) { + auto iter = GetIdMap().find(request_id); + if (iter != GetIdMap().end()) { id observer = iter->second; [GetNotificationCenter(kind) removeObserver:observer]; - g_id_map.erase(iter); + GetIdMap().erase(iter); } } diff --git a/shell/browser/api/electron_api_system_preferences_win.cc b/shell/browser/api/electron_api_system_preferences_win.cc index d03f0f0c3e1ba..3d7b3969ab3fd 100644 --- a/shell/browser/api/electron_api_system_preferences_win.cc +++ b/shell/browser/api/electron_api_system_preferences_win.cc @@ -16,7 +16,6 @@ #include "base/win/wrapped_window_proc.h" #include "shell/common/color_util.h" #include "shell/common/process_util.h" -#include "ui/gfx/color_utils.h" #include "ui/gfx/win/hwnd_util.h" namespace electron { @@ -127,7 +126,7 @@ std::string SystemPreferences::GetColor(gin_helper::ErrorThrower thrower, }); if (auto iter = Lookup.find(color); iter != Lookup.end()) - return ToRGBAHex(color_utils::GetSysSkColor(iter->second)); + return ToRGBAHex(GetSysSkColor(iter->second)); thrower.ThrowError("Unknown color: " + color); return ""; @@ -158,8 +157,9 @@ void SystemPreferences::InitializeWindow() { // Creating this listener before the app is ready causes global shortcuts // to not fire if (Browser::Get()->is_ready()) - color_change_listener_ = - std::make_unique<gfx::ScopedSysColorChangeListener>(this); + singleton_hwnd_observer_ = + std::make_unique<gfx::SingletonHwndObserver>(base::BindRepeating( + &SystemPreferences::OnWndProc, base::Unretained(this))); else Browser::Get()->AddObserver(this); @@ -208,13 +208,21 @@ LRESULT CALLBACK SystemPreferences::WndProc(HWND hwnd, return ::DefWindowProc(hwnd, message, wparam, lparam); } -void SystemPreferences::OnSysColorChange() { +void SystemPreferences::OnWndProc(HWND hwnd, + UINT message, + WPARAM wparam, + LPARAM lparam) { + if (message != WM_SYSCOLORCHANGE && + (message != WM_SETTINGCHANGE || wparam != SPI_SETHIGHCONTRAST)) { + return; + } Emit("color-changed"); } void SystemPreferences::OnFinishLaunching(base::Value::Dict launch_info) { - color_change_listener_ = - std::make_unique<gfx::ScopedSysColorChangeListener>(this); + singleton_hwnd_observer_ = + std::make_unique<gfx::SingletonHwndObserver>(base::BindRepeating( + &SystemPreferences::OnWndProc, base::Unretained(this))); } } // namespace api diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index a0cba67673ef6..14e4f498331c6 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -1434,7 +1434,7 @@ bool WebContents::IsFullscreen() const { void WebContents::EnterFullscreen(const url::Origin& origin, ExclusiveAccessBubbleType bubble_type, - const int64_t display_id) {} + FullscreenTabParams fullscreen_tab_params) {} content::WebContents* WebContents::GetWebContentsForExclusiveAccess() { return web_contents(); @@ -1480,7 +1480,7 @@ void WebContents::OnEnterFullscreenModeForTab( owner_window()->set_fullscreen_transition_type( NativeWindow::FullScreenTransitionType::kHTML); exclusive_access_manager_.fullscreen_controller()->EnterFullscreenModeForTab( - requesting_frame, options.display_id); + requesting_frame, FullscreenTabParams{options.display_id}); SetHtmlApiFullscreen(true); diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h index 9deb95e341d29..09c3edf534226 100644 --- a/shell/browser/api/electron_api_web_contents.h +++ b/shell/browser/api/electron_api_web_contents.h @@ -697,7 +697,7 @@ class WebContents final : public ExclusiveAccessContext, bool IsFullscreen() const override; void EnterFullscreen(const url::Origin& origin, ExclusiveAccessBubbleType bubble_type, - const int64_t display_id) override; + FullscreenTabParams fullscreen_tab_params) override; void ExitFullscreen() override {} void UpdateExclusiveAccessBubble( const ExclusiveAccessBubbleParams& params, diff --git a/shell/browser/api/frame_subscriber.cc b/shell/browser/api/frame_subscriber.cc index cef2e20b0ad0b..b3171c433991b 100644 --- a/shell/browser/api/frame_subscriber.cc +++ b/shell/browser/api/frame_subscriber.cc @@ -6,6 +6,7 @@ #include <utility> +#include "content/public/browser/page.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host.h" #include "content/public/browser/render_widget_host_view.h" diff --git a/shell/browser/auto_updater.cc b/shell/browser/auto_updater.cc index e3fbf865c95fb..54ca9ab1ab59e 100644 --- a/shell/browser/auto_updater.cc +++ b/shell/browser/auto_updater.cc @@ -4,6 +4,7 @@ #include "shell/browser/auto_updater.h" +#include "base/no_destructor.h" #include "build/build_config.h" #include "electron/mas.h" @@ -19,11 +20,12 @@ void AutoUpdater::SetDelegate(Delegate* delegate) { delegate_ = delegate; } -#if !BUILDFLAG(IS_MAC) || IS_MAS_BUILD() -std::string AutoUpdater::GetFeedURL() { - return ""; +std::string& AutoUpdater::GetFeedURL() { + static base::NoDestructor<std::string> feed_url; + return *feed_url; } +#if !BUILDFLAG(IS_MAC) || IS_MAS_BUILD() void AutoUpdater::SetFeedURL(gin::Arguments* args) {} void AutoUpdater::CheckForUpdates() {} diff --git a/shell/browser/auto_updater.h b/shell/browser/auto_updater.h index 8b8cd48f1d9bd..1c145b00e37b2 100644 --- a/shell/browser/auto_updater.h +++ b/shell/browser/auto_updater.h @@ -60,7 +60,7 @@ class AutoUpdater { static Delegate* GetDelegate(); static void SetDelegate(Delegate* delegate); - static std::string GetFeedURL(); + static std::string& GetFeedURL(); // FIXME(zcbenz): We should not do V8 in this file, this method should only // accept C++ struct as parameter, and atom_api_auto_updater.cc is responsible // for parsing the parameter from JavaScript. diff --git a/shell/browser/auto_updater_mac.mm b/shell/browser/auto_updater_mac.mm index 50b9f645b9c68..91c077b12e1f7 100644 --- a/shell/browser/auto_updater_mac.mm +++ b/shell/browser/auto_updater_mac.mm @@ -26,20 +26,10 @@ // The global SQRLUpdater object. SQRLUpdater* __strong g_updater = nil; - -} // namespace - -namespace { - bool g_update_available = false; -std::string update_url_ = ""; // NOLINT(runtime/string) } // namespace -std::string AutoUpdater::GetFeedURL() { - return update_url_; -} - // static void AutoUpdater::SetFeedURL(gin::Arguments* args) { gin_helper::ErrorThrower thrower(args->isolate()); @@ -76,7 +66,7 @@ if (!delegate) return; - update_url_ = feed; + GetFeedURL() = feed; NSURL* url = [NSURL URLWithString:base::SysUTF8ToNSString(feed)]; NSMutableURLRequest* urlRequest = [NSMutableURLRequest requestWithURL:url]; diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index 627b8f18b974c..67078d24c7bb7 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -441,6 +441,20 @@ void ElectronBrowserClient::OverrideWebPreferences( } } +bool ElectronBrowserClient::WebPreferencesNeedUpdateForColorRelatedStateChanges( + content::WebContents& web_contents, + const content::SiteInstance& main_frame_site) const { + const auto& prefs = web_contents.GetOrCreateWebPreferences(); + ui::NativeTheme* native_theme = ui::NativeTheme::GetInstanceForNativeUi(); + bool in_forced_colors = native_theme->InForcedColorsMode(); + blink::mojom::PreferredColorScheme preferred_color_scheme = + native_theme->ShouldUseDarkColors() + ? blink::mojom::PreferredColorScheme::kDark + : blink::mojom::PreferredColorScheme::kLight; + return prefs.in_forced_colors != in_forced_colors || + prefs.preferred_color_scheme != preferred_color_scheme; +} + void ElectronBrowserClient::RegisterPendingSiteInstance( content::RenderFrameHost* rfh, content::SiteInstance* pending_site_instance) { diff --git a/shell/browser/electron_browser_client.h b/shell/browser/electron_browser_client.h index 5e2fc2ad905ad..46eb0e790ad05 100644 --- a/shell/browser/electron_browser_client.h +++ b/shell/browser/electron_browser_client.h @@ -133,6 +133,9 @@ class ElectronBrowserClient : public content::ContentBrowserClient, void OverrideWebPreferences(content::WebContents* web_contents, content::SiteInstance& main_frame_site, blink::web_pref::WebPreferences* prefs) override; + bool WebPreferencesNeedUpdateForColorRelatedStateChanges( + content::WebContents& web_contents, + const content::SiteInstance& main_frame_site) const override; void RegisterPendingSiteInstance( content::RenderFrameHost* render_frame_host, content::SiteInstance* pending_site_instance) override; diff --git a/shell/browser/electron_browser_context.cc b/shell/browser/electron_browser_context.cc index 9a86b3040be28..18fccacabae2f 100644 --- a/shell/browser/electron_browser_context.cc +++ b/shell/browser/electron_browser_context.cc @@ -499,7 +499,7 @@ void ElectronBrowserContext::SetUserAgent(const std::string& user_agent) { user_agent_ = user_agent; } -base::FilePath ElectronBrowserContext::GetPath() { +base::FilePath ElectronBrowserContext::GetPath() const { return path_; } diff --git a/shell/browser/electron_browser_context.h b/shell/browser/electron_browser_context.h index 17e5bb02dab8a..b643e75b79aa4 100644 --- a/shell/browser/electron_browser_context.h +++ b/shell/browser/electron_browser_context.h @@ -94,7 +94,7 @@ class ElectronBrowserContext : public content::BrowserContext { std::string GetMediaDeviceIDSalt(); // content::BrowserContext: - base::FilePath GetPath() override; + base::FilePath GetPath() const override; bool IsOffTheRecord() override; std::unique_ptr<content::ZoomLevelDelegate> CreateZoomLevelDelegate( const base::FilePath& partition_path) override; diff --git a/shell/browser/electron_permission_manager.cc b/shell/browser/electron_permission_manager.cc index d947c5246b2c7..77b55f37bf851 100644 --- a/shell/browser/electron_permission_manager.cc +++ b/shell/browser/electron_permission_manager.cc @@ -46,7 +46,7 @@ bool WebContentsDestroyed(content::RenderFrameHost* rfh) { void PermissionRequestResponseCallbackWrapper( ElectronPermissionManager::StatusCallback callback, - const std::vector<blink::mojom::PermissionStatus>& vector) { + const std::vector<content::PermissionResult>& vector) { std::move(callback).Run(vector[0]); } @@ -60,7 +60,10 @@ class ElectronPermissionManager::PendingRequest { : render_frame_host_id_(render_frame_host->GetGlobalId()), callback_(std::move(callback)), permissions_(std::move(permissions)), - results_(permissions_.size(), blink::mojom::PermissionStatus::DENIED), + results_(permissions_.size(), + content::PermissionResult( + blink::mojom::PermissionStatus::DENIED, + content::PermissionStatusSource::UNSPECIFIED)), remaining_results_(permissions_.size()) {} void SetPermissionStatus(int permission_id, @@ -80,7 +83,8 @@ class ElectronPermissionManager::PendingRequest { } } - results_[permission_id] = status; + results_[permission_id] = content::PermissionResult( + status, content::PermissionStatusSource::UNSPECIFIED); --remaining_results_; } @@ -100,7 +104,7 @@ class ElectronPermissionManager::PendingRequest { content::GlobalRenderFrameHostId render_frame_host_id_; StatusesCallback callback_; std::vector<blink::mojom::PermissionDescriptorPtr> permissions_; - std::vector<blink::mojom::PermissionStatus> results_; + std::vector<content::PermissionResult> results_; size_t remaining_results_; }; @@ -150,7 +154,10 @@ void ElectronPermissionManager::RequestPermissionWithDetails( base::Value::Dict details, StatusCallback response_callback) { if (render_frame_host->IsNestedWithinFencedFrame()) { - std::move(response_callback).Run(blink::mojom::PermissionStatus::DENIED); + std::move(response_callback) + .Run(content::PermissionResult( + blink::mojom::PermissionStatus::DENIED, + content::PermissionStatusSource::UNSPECIFIED)); return; } @@ -168,9 +175,11 @@ void ElectronPermissionManager::RequestPermissions( const content::PermissionRequestDescription& request_description, StatusesCallback callback) { if (render_frame_host->IsNestedWithinFencedFrame()) { - std::move(callback).Run(std::vector<blink::mojom::PermissionStatus>( + std::move(callback).Run(std::vector<content::PermissionResult>( request_description.permissions.size(), - blink::mojom::PermissionStatus::DENIED)); + content::PermissionResult( + blink::mojom::PermissionStatus::DENIED, + content::PermissionStatusSource::UNSPECIFIED))); return; } @@ -194,7 +203,7 @@ void ElectronPermissionManager::RequestPermissionsWithDetails( }); if (request_handler_.is_null()) { - std::vector<blink::mojom::PermissionStatus> statuses; + std::vector<content::PermissionResult> results; for (const auto& permission : permissions) { const auto permission_type = blink::PermissionDescriptorToPermissionType(permission); @@ -207,9 +216,11 @@ void ElectronPermissionManager::RequestPermissionsWithDetails( ->GetGeolocationControl() ->UserDidOptIntoLocationServices(); } - statuses.push_back(blink::mojom::PermissionStatus::GRANTED); + results.push_back(content::PermissionResult( + blink::mojom::PermissionStatus::GRANTED, + content::PermissionStatusSource::UNSPECIFIED)); } - std::move(response_callback).Run(statuses); + std::move(response_callback).Run(results); return; } @@ -235,12 +246,12 @@ void ElectronPermissionManager::RequestPermissionsWithDetails( void ElectronPermissionManager::OnPermissionResponse( int request_id, int permission_id, - blink::mojom::PermissionStatus status) { + content::PermissionResult result) { auto* pending_request = pending_requests_.Lookup(request_id); if (!pending_request) return; - pending_request->SetPermissionStatus(permission_id, status); + pending_request->SetPermissionStatus(permission_id, result.status); if (pending_request->IsComplete()) { pending_request->RunCallback(); pending_requests_.Remove(request_id); @@ -255,12 +266,14 @@ void ElectronPermissionManager::ResetPermission( void ElectronPermissionManager::RequestPermissionsFromCurrentDocument( content::RenderFrameHost* render_frame_host, const content::PermissionRequestDescription& request_description, - base::OnceCallback<void(const std::vector<blink::mojom::PermissionStatus>&)> + base::OnceCallback<void(const std::vector<content::PermissionResult>&)> callback) { if (render_frame_host->IsNestedWithinFencedFrame()) { - std::move(callback).Run(std::vector<blink::mojom::PermissionStatus>( + std::move(callback).Run(std::vector<content::PermissionResult>( request_description.permissions.size(), - blink::mojom::PermissionStatus::DENIED)); + content::PermissionResult( + blink::mojom::PermissionStatus::DENIED, + content::PermissionStatusSource::UNSPECIFIED))); return; } diff --git a/shell/browser/electron_permission_manager.h b/shell/browser/electron_permission_manager.h index a0e720d93203d..a1bb9172176f4 100644 --- a/shell/browser/electron_permission_manager.h +++ b/shell/browser/electron_permission_manager.h @@ -43,10 +43,9 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate { using USBProtectedClasses = std::vector<uint8_t>; - using StatusCallback = - base::OnceCallback<void(blink::mojom::PermissionStatus)>; - using StatusesCallback = base::OnceCallback<void( - const std::vector<blink::mojom::PermissionStatus>&)>; + using StatusCallback = base::OnceCallback<void(content::PermissionResult)>; + using StatusesCallback = + base::OnceCallback<void(const std::vector<content::PermissionResult>&)>; using PairCallback = base::OnceCallback<void(base::Value::Dict)>; using RequestHandler = base::RepeatingCallback<void(content::WebContents*, blink::PermissionType, @@ -111,7 +110,7 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate { protected: void OnPermissionResponse(int request_id, int permission_id, - blink::mojom::PermissionStatus status); + content::PermissionResult result); // content::PermissionControllerDelegate: void RequestPermissions( @@ -128,9 +127,8 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate { void RequestPermissionsFromCurrentDocument( content::RenderFrameHost* render_frame_host, const content::PermissionRequestDescription& request_description, - base::OnceCallback< - void(const std::vector<blink::mojom::PermissionStatus>&)> callback) - override; + base::OnceCallback<void(const std::vector<content::PermissionResult>&)> + callback) override; content::PermissionResult GetPermissionResultForOriginWithoutContext( const blink::mojom::PermissionDescriptorPtr& permission_descriptor, const url::Origin& requesting_origin, diff --git a/shell/browser/extensions/electron_extensions_browser_client.cc b/shell/browser/extensions/electron_extensions_browser_client.cc index ec73efbc9a5b3..3e5ed3161a5c5 100644 --- a/shell/browser/extensions/electron_extensions_browser_client.cc +++ b/shell/browser/extensions/electron_extensions_browser_client.cc @@ -12,7 +12,6 @@ #include "base/path_service.h" #include "chrome/browser/extensions/chrome_url_request_util.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/extensions/chrome_manifest_url_handlers.h" #include "components/version_info/version_info.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_task_traits.h" @@ -32,6 +31,8 @@ #include "extensions/common/features/feature_channel.h" #include "extensions/common/file_util.h" #include "extensions/common/manifest_constants.h" +#include "extensions/common/manifest_handlers/chrome_url_overrides_handler.h" +#include "extensions/common/manifest_handlers/devtools_page_handler.h" #include "extensions/common/manifest_url_handlers.h" #include "services/network/public/mojom/url_loader.mojom.h" #include "shell/browser/browser.h" diff --git a/shell/browser/file_system_access/file_system_access_permission_context.cc b/shell/browser/file_system_access/file_system_access_permission_context.cc index 34eb74a7f6bb2..654ce61d16e34 100644 --- a/shell/browser/file_system_access/file_system_access_permission_context.cc +++ b/shell/browser/file_system_access/file_system_access_permission_context.cc @@ -415,10 +415,10 @@ class FileSystemAccessPermissionContext::PermissionGrantImpl private: void OnPermissionRequestResult( base::OnceCallback<void(PermissionRequestOutcome)> callback, - blink::mojom::PermissionStatus status) { + content::PermissionResult result) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - if (status == blink::mojom::PermissionStatus::GRANTED) { + if (result.status == blink::mojom::PermissionStatus::GRANTED) { SetStatus(PermissionStatus::GRANTED); std::move(callback).Run(PermissionRequestOutcome::kUserGranted); } else { @@ -916,6 +916,14 @@ void FileSystemAccessPermissionContext::NotifyEntryMoved( } } +void FileSystemAccessPermissionContext::NotifyEntryModified( + const url::Origin& origin, + const content::PathInfo& path) {} + +void FileSystemAccessPermissionContext::NotifyEntryRemoved( + const url::Origin& origin, + const content::PathInfo& path) {} + void FileSystemAccessPermissionContext::OnFileCreatedFromShowSaveFilePicker( const GURL& file_picker_binding_context, const storage::FileSystemURL& url) {} diff --git a/shell/browser/file_system_access/file_system_access_permission_context.h b/shell/browser/file_system_access/file_system_access_permission_context.h index 591c1288e2dda..2419ae536df3d 100644 --- a/shell/browser/file_system_access/file_system_access_permission_context.h +++ b/shell/browser/file_system_access/file_system_access_permission_context.h @@ -102,6 +102,10 @@ class FileSystemAccessPermissionContext void NotifyEntryMoved(const url::Origin& origin, const content::PathInfo& old_path, const content::PathInfo& new_path) override; + void NotifyEntryModified(const url::Origin& origin, + const content::PathInfo& path) override; + void NotifyEntryRemoved(const url::Origin& origin, + const content::PathInfo& path) override; void OnFileCreatedFromShowSaveFilePicker( const GURL& file_picker_binding_context, diff --git a/shell/browser/font_defaults.cc b/shell/browser/font_defaults.cc index 884021b7d55d6..5432caf584801 100644 --- a/shell/browser/font_defaults.cc +++ b/shell/browser/font_defaults.cc @@ -308,7 +308,7 @@ auto MakeDefaultFontCopier() { namespace electron { void SetFontDefaults(blink::web_pref::WebPreferences* prefs) { - static const auto copy_default_fonts_to_web_prefs = MakeDefaultFontCopier(); + static const auto& copy_default_fonts_to_web_prefs = MakeDefaultFontCopier(); copy_default_fonts_to_web_prefs(prefs); } diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index ceee28bfc7689..043e9b8a808e7 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -85,7 +85,6 @@ #include "shell/common/color_util.h" #include "skia/ext/skia_utils_win.h" #include "ui/display/win/screen_win.h" -#include "ui/gfx/color_utils.h" #include "ui/gfx/win/hwnd_util.h" #include "ui/gfx/win/msg_util.h" #endif @@ -216,8 +215,8 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options, if (transparent()) thick_frame_ = false; - overlay_button_color_ = color_utils::GetSysSkColor(COLOR_BTNFACE); - overlay_symbol_color_ = color_utils::GetSysSkColor(COLOR_BTNTEXT); + overlay_button_color_ = GetSysSkColor(COLOR_BTNFACE); + overlay_symbol_color_ = GetSysSkColor(COLOR_BTNTEXT); if (std::string str; options.Get(options::kAccentColor, &str)) { std::optional<SkColor> parsed_color = ParseCSSColor(str); diff --git a/shell/browser/native_window_views.h b/shell/browser/native_window_views.h index a4f3bb40a3747..69d19ea6093ee 100644 --- a/shell/browser/native_window_views.h +++ b/shell/browser/native_window_views.h @@ -12,6 +12,7 @@ #include <string> #include "base/memory/raw_ptr.h" +#include "base/no_destructor.h" #include "shell/browser/ui/views/root_view.h" #include "third_party/abseil-cpp/absl/container/flat_hash_set.h" #include "ui/base/ozone_buildflags.h" @@ -302,7 +303,8 @@ class NativeWindowViews : public NativeWindow, base::win::ScopedGDIObject<HICON> app_icon_; // The set of windows currently forwarding mouse messages. - static inline absl::flat_hash_set<NativeWindowViews*> forwarding_windows_; + static inline base::NoDestructor<absl::flat_hash_set<NativeWindowViews*>> + forwarding_windows_; static HHOOK mouse_hook_; bool forwarding_mouse_messages_ = false; HWND legacy_window_ = nullptr; diff --git a/shell/browser/native_window_views_win.cc b/shell/browser/native_window_views_win.cc index 2a7f74f013b57..fc1f476a93b8e 100644 --- a/shell/browser/native_window_views_win.cc +++ b/shell/browser/native_window_views_win.cc @@ -663,7 +663,7 @@ void NativeWindowViews::SetRoundedCorners(bool rounded) { void NativeWindowViews::SetForwardMouseMessages(bool forward) { if (forward && !forwarding_mouse_messages_) { forwarding_mouse_messages_ = true; - forwarding_windows_.insert(this); + forwarding_windows_->insert(this); // Subclassing is used to fix some issues when forwarding mouse messages; // see comments in |SubclassProc|. @@ -675,11 +675,11 @@ void NativeWindowViews::SetForwardMouseMessages(bool forward) { } } else if (!forward && forwarding_mouse_messages_) { forwarding_mouse_messages_ = false; - forwarding_windows_.erase(this); + forwarding_windows_->erase(this); RemoveWindowSubclass(legacy_window_, SubclassProc, 1); - if (forwarding_windows_.empty()) { + if (forwarding_windows_->empty()) { UnhookWindowsHookEx(mouse_hook_); mouse_hook_ = nullptr; } @@ -726,7 +726,7 @@ LRESULT CALLBACK NativeWindowViews::MouseHookProc(int n_code, // the cursor since they are in a state where they would otherwise ignore all // mouse input. if (w_param == WM_MOUSEMOVE) { - for (auto* window : forwarding_windows_) { + for (auto* window : *forwarding_windows_) { // At first I considered enumerating windows to check whether the cursor // was directly above the window, but since nothing bad seems to happen // if we post the message even if some other window occludes it I have diff --git a/shell/browser/notifications/linux/libnotify_notification.cc b/shell/browser/notifications/linux/libnotify_notification.cc index 231ba25485a16..5364f1d9ede47 100644 --- a/shell/browser/notifications/linux/libnotify_notification.cc +++ b/shell/browser/notifications/linux/libnotify_notification.cc @@ -10,6 +10,7 @@ #include "base/files/file_enumerator.h" #include "base/functional/bind.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/process/process_handle.h" #include "base/strings/utf_string_conversions.h" #include "shell/browser/notifications/notification_delegate.h" @@ -22,17 +23,20 @@ namespace electron { namespace { -LibNotifyLoader libnotify_loader_; +LibNotifyLoader& GetLibNotifyLoader() { + static base::NoDestructor<LibNotifyLoader> loader; + return *loader; +} const base::flat_set<std::string>& GetServerCapabilities() { - static base::flat_set<std::string> caps; - if (caps.empty()) { - auto* capabilities = libnotify_loader_.notify_get_server_caps(); + static base::NoDestructor<base::flat_set<std::string>> caps; + if (caps->empty()) { + auto* capabilities = GetLibNotifyLoader().notify_get_server_caps(); for (auto* l = capabilities; l != nullptr; l = l->next) - caps.insert(static_cast<const char*>(l->data)); + caps->insert(static_cast<const char*>(l->data)); g_list_free_full(capabilities, g_free); } - return caps; + return *caps; } bool HasCapability(const std::string& capability) { @@ -57,15 +61,15 @@ void log_and_clear_error(GError* error, const char* context) { // static bool LibnotifyNotification::Initialize() { - if (!libnotify_loader_.Load("libnotify.so.4") && // most common one - !libnotify_loader_.Load("libnotify.so.5") && - !libnotify_loader_.Load("libnotify.so.1") && - !libnotify_loader_.Load("libnotify.so")) { + if (!GetLibNotifyLoader().Load("libnotify.so.4") && // most common one + !GetLibNotifyLoader().Load("libnotify.so.5") && + !GetLibNotifyLoader().Load("libnotify.so.1") && + !GetLibNotifyLoader().Load("libnotify.so")) { LOG(WARNING) << "Unable to find libnotify; notifications disabled"; return false; } - if (!libnotify_loader_.notify_is_initted() && - !libnotify_loader_.notify_init(GetApplicationName().c_str())) { + if (!GetLibNotifyLoader().notify_is_initted() && + !GetLibNotifyLoader().notify_init(GetApplicationName().c_str())) { LOG(WARNING) << "Unable to initialize libnotify; notifications disabled"; return false; } @@ -84,7 +88,7 @@ LibnotifyNotification::~LibnotifyNotification() { } void LibnotifyNotification::Show(const NotificationOptions& options) { - notification_ = libnotify_loader_.notify_notification_new( + notification_ = GetLibNotifyLoader().notify_notification_new( base::UTF16ToUTF8(options.title).c_str(), base::UTF16ToUTF8(options.msg).c_str(), nullptr); @@ -96,7 +100,7 @@ void LibnotifyNotification::Show(const NotificationOptions& options) { // NB: On Unity and on any other DE using Notify-OSD, adding a notification // action will cause the notification to display as a modal dialog box. if (NotifierSupportsActions()) { - libnotify_loader_.notify_notification_add_action( + GetLibNotifyLoader().notify_notification_add_action( notification_, "default", "View", OnNotificationView, this, nullptr); } @@ -108,19 +112,19 @@ void LibnotifyNotification::Show(const NotificationOptions& options) { } // Set the urgency level of the notification. - libnotify_loader_.notify_notification_set_urgency(notification_, urgency); + GetLibNotifyLoader().notify_notification_set_urgency(notification_, urgency); if (!options.icon.drawsNothing()) { GdkPixbuf* pixbuf = gtk_util::GdkPixbufFromSkBitmap(options.icon); - libnotify_loader_.notify_notification_set_image_from_pixbuf(notification_, - pixbuf); + GetLibNotifyLoader().notify_notification_set_image_from_pixbuf( + notification_, pixbuf); g_object_unref(pixbuf); } // Set the timeout duration for the notification bool neverTimeout = options.timeout_type == u"never"; int timeout = (neverTimeout) ? NOTIFY_EXPIRES_NEVER : NOTIFY_EXPIRES_DEFAULT; - libnotify_loader_.notify_notification_set_timeout(notification_, timeout); + GetLibNotifyLoader().notify_notification_set_timeout(notification_, timeout); if (!options.tag.empty()) { GQuark id = g_quark_from_string(options.tag.c_str()); @@ -130,10 +134,10 @@ void LibnotifyNotification::Show(const NotificationOptions& options) { // Always try to append notifications. // Unique tags can be used to prevent this. if (HasCapability("append")) { - libnotify_loader_.notify_notification_set_hint( + GetLibNotifyLoader().notify_notification_set_hint( notification_, "append", g_variant_new_string("true")); } else if (HasCapability("x-canonical-append")) { - libnotify_loader_.notify_notification_set_hint( + GetLibNotifyLoader().notify_notification_set_hint( notification_, "x-canonical-append", g_variant_new_string("true")); } @@ -141,17 +145,17 @@ void LibnotifyNotification::Show(const NotificationOptions& options) { // The desktop-entry is the part before the .desktop std::string desktop_id = platform_util::GetXdgAppId(); if (!desktop_id.empty()) { - libnotify_loader_.notify_notification_set_hint( + GetLibNotifyLoader().notify_notification_set_hint( notification_, "desktop-entry", g_variant_new_string(desktop_id.c_str())); } - libnotify_loader_.notify_notification_set_hint( + GetLibNotifyLoader().notify_notification_set_hint( notification_, "sender-pid", g_variant_new_int64(base::GetCurrentProcId())); GError* error = nullptr; - libnotify_loader_.notify_notification_show(notification_, &error); + GetLibNotifyLoader().notify_notification_show(notification_, &error); if (error) { log_and_clear_error(error, "notify_notification_show"); NotificationFailed(); @@ -169,7 +173,7 @@ void LibnotifyNotification::Dismiss() { GError* error = nullptr; on_dismissing_ = true; - libnotify_loader_.notify_notification_close(notification_, &error); + GetLibNotifyLoader().notify_notification_close(notification_, &error); if (error) { log_and_clear_error(error, "notify_notification_close"); } diff --git a/shell/browser/notifications/win/windows_toast_notification.cc b/shell/browser/notifications/win/windows_toast_notification.cc index a9eae96c96bc2..aecf564384e01 100644 --- a/shell/browser/notifications/win/windows_toast_notification.cc +++ b/shell/browser/notifications/win/windows_toast_notification.cc @@ -147,12 +147,12 @@ const char* GetTemplateType(bool two_lines, bool has_icon) { } // namespace // static -ComPtr<winui::Notifications::IToastNotificationManagerStatics> - WindowsToastNotification::toast_manager_; +ComPtr<winui::Notifications::IToastNotificationManagerStatics>* + WindowsToastNotification::toast_manager_ = nullptr; // static -ComPtr<winui::Notifications::IToastNotifier> - WindowsToastNotification::toast_notifier_; +ComPtr<winui::Notifications::IToastNotifier>* + WindowsToastNotification::toast_notifier_ = nullptr; // static bool WindowsToastNotification::Initialize() { @@ -163,21 +163,35 @@ bool WindowsToastNotification::Initialize() { RuntimeClass_Windows_UI_Notifications_ToastNotificationManager); if (!toast_manager_str.success()) return false; - if (FAILED(Windows::Foundation::GetActivationFactory(toast_manager_str, - &toast_manager_))) + + if (!toast_manager_) { + toast_manager_ = new ComPtr< + ABI::Windows::UI::Notifications::IToastNotificationManagerStatics>(); + } + + if (FAILED(Windows::Foundation::GetActivationFactory( + toast_manager_str, toast_manager_->GetAddressOf()))) return false; + if (!toast_notifier_) { + toast_notifier_ = + new ComPtr<ABI::Windows::UI::Notifications::IToastNotifier>(); + } + if (IsRunningInDesktopBridge()) { // Ironically, the Desktop Bridge / UWP environment // requires us to not give Windows an appUserModelId. - return SUCCEEDED(toast_manager_->CreateToastNotifier(&toast_notifier_)); + return SUCCEEDED( + (*toast_manager_) + ->CreateToastNotifier(toast_notifier_->GetAddressOf())); } else { ScopedHString app_id; if (!GetAppUserModelID(&app_id)) return false; - return SUCCEEDED( - toast_manager_->CreateToastNotifierWithId(app_id, &toast_notifier_)); + return SUCCEEDED((*toast_manager_) + ->CreateToastNotifierWithId( + app_id, toast_notifier_->GetAddressOf())); } } @@ -207,7 +221,7 @@ void WindowsToastNotification::Remove() { ComPtr<winui::Notifications::IToastNotificationManagerStatics2> toast_manager2; - if (FAILED(toast_manager_.As(&toast_manager2))) + if (FAILED(toast_manager_->As(&toast_manager2))) return; ComPtr<winui::Notifications::IToastNotificationHistory> notification_history; @@ -226,7 +240,7 @@ void WindowsToastNotification::Remove() { void WindowsToastNotification::Dismiss() { DebugLog("Hiding notification"); - toast_notifier_->Hide(toast_notification_.Get()); + (*toast_notifier_)->Hide(toast_notification_.Get()); } HRESULT WindowsToastNotification::ShowInternal( @@ -281,8 +295,9 @@ HRESULT WindowsToastNotification::ShowInternal( REPORT_AND_RETURN_IF_FAILED(SetupCallbacks(toast_notification_.Get()), "WinAPI: SetupCallbacks failed"); - REPORT_AND_RETURN_IF_FAILED(toast_notifier_->Show(toast_notification_.Get()), - "WinAPI: Show failed"); + REPORT_AND_RETURN_IF_FAILED( + (*toast_notifier_)->Show(toast_notification_.Get()), + "WinAPI: Show failed"); return S_OK; } diff --git a/shell/browser/notifications/win/windows_toast_notification.h b/shell/browser/notifications/win/windows_toast_notification.h index 3065700efd0a1..da6eca87f95d9 100644 --- a/shell/browser/notifications/win/windows_toast_notification.h +++ b/shell/browser/notifications/win/windows_toast_notification.h @@ -72,9 +72,9 @@ class WindowsToastNotification : public Notification { ABI::Windows::UI::Notifications::IToastNotification* toast); static ComPtr< - ABI::Windows::UI::Notifications::IToastNotificationManagerStatics> + ABI::Windows::UI::Notifications::IToastNotificationManagerStatics>* toast_manager_; - static ComPtr<ABI::Windows::UI::Notifications::IToastNotifier> + static ComPtr<ABI::Windows::UI::Notifications::IToastNotifier>* toast_notifier_; EventRegistrationToken activated_token_; diff --git a/shell/browser/relauncher_linux.cc b/shell/browser/relauncher_linux.cc index 7c9c1fa048407..ab9b6b62c8144 100644 --- a/shell/browser/relauncher_linux.cc +++ b/shell/browser/relauncher_linux.cc @@ -11,6 +11,7 @@ #include "base/files/scoped_file.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/posix/eintr_wrapper.h" #include "base/process/launch.h" #include "base/synchronization/waitable_event.h" @@ -18,7 +19,10 @@ namespace relauncher::internal { // this is global to be visible to the sa_handler -base::WaitableEvent parentWaiter; +auto& GetParentWaiter() { + static base::NoDestructor<base::WaitableEvent> parentWaiter; + return *parentWaiter; +} void RelauncherSynchronizeWithParent() { base::ScopedFD relauncher_sync_fd(kRelauncherSyncFD); @@ -32,7 +36,7 @@ void RelauncherSynchronizeWithParent() { // set up a signum handler struct sigaction action = {}; - action.sa_handler = [](int /*signum*/) { parentWaiter.Signal(); }; + action.sa_handler = [](int /*signum*/) { GetParentWaiter().Signal(); }; if (sigaction(signum, &action, nullptr) != 0) { PLOG(ERROR) << "sigaction"; return; @@ -46,7 +50,7 @@ void RelauncherSynchronizeWithParent() { } // Wait for the parent to exit - parentWaiter.Wait(); + GetParentWaiter().Wait(); } int LaunchProgram(const StringVector& relauncher_args, diff --git a/shell/browser/ui/file_dialog.h b/shell/browser/ui/file_dialog.h index f7757da491c65..6cdfc7b667a37 100644 --- a/shell/browser/ui/file_dialog.h +++ b/shell/browser/ui/file_dialog.h @@ -13,6 +13,10 @@ #include "base/files/file_path.h" #include "base/memory/raw_ptr_exclusion.h" +#if BUILDFLAG(IS_LINUX) +#include <bits/stdint-uintn.h> +#endif + namespace electron { class NativeWindow; } diff --git a/shell/browser/ui/inspectable_web_contents.cc b/shell/browser/ui/inspectable_web_contents.cc index f05476527bd73..5add166e8176c 100644 --- a/shell/browser/ui/inspectable_web_contents.cc +++ b/shell/browser/ui/inspectable_web_contents.cc @@ -60,10 +60,11 @@ #include "v8/include/v8.h" #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) -#include "chrome/common/extensions/chrome_manifest_url_handlers.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/render_process_host.h" #include "extensions/browser/extension_registry.h" +#include "extensions/common/manifest_handlers/chrome_url_overrides_handler.h" +#include "extensions/common/manifest_handlers/devtools_page_handler.h" #include "extensions/common/permissions/permissions_data.h" #endif diff --git a/shell/browser/ui/inspectable_web_contents.h b/shell/browser/ui/inspectable_web_contents.h index fd7ef2f59c5ed..c5163d5d15e29 100644 --- a/shell/browser/ui/inspectable_web_contents.h +++ b/shell/browser/ui/inspectable_web_contents.h @@ -195,6 +195,9 @@ class InspectableWebContents const std::string& request) override {} void RegisterAidaClientEvent(DispatchCallback callback, const std::string& request) override {} + void DispatchHttpRequest( + DispatchCallback callback, + const DevToolsDispatchHttpRequestParams& params) override {} // content::DevToolsFrontendHostDelegate: void HandleMessageFromDevToolsFrontend(base::Value::Dict message); diff --git a/shell/browser/ui/tray_icon_win.cc b/shell/browser/ui/tray_icon_win.cc index 9153748f5ea60..bc4267bf21615 100644 --- a/shell/browser/ui/tray_icon_win.cc +++ b/shell/browser/ui/tray_icon_win.cc @@ -9,8 +9,8 @@ namespace electron { // static TrayIcon* TrayIcon::Create(std::optional<base::Uuid> guid) { - static NotifyIconHost host; - return host.CreateNotifyIcon(guid); + static NotifyIconHost* host = new NotifyIconHost(); + return host->CreateNotifyIcon(guid); } } // namespace electron diff --git a/shell/browser/ui/views/menu_bar.cc b/shell/browser/ui/views/menu_bar.cc index bde828d8d72ff..c451acdfb71cf 100644 --- a/shell/browser/ui/views/menu_bar.cc +++ b/shell/browser/ui/views/menu_bar.cc @@ -10,7 +10,6 @@ #include "shell/browser/ui/views/submenu_button.h" #include "ui/base/mojom/menu_source_type.mojom.h" #include "ui/color/color_provider.h" -#include "ui/native_theme/common_theme.h" #include "ui/views/background.h" #include "ui/views/layout/box_layout.h" @@ -19,7 +18,7 @@ #endif #if BUILDFLAG(IS_WIN) -#include "ui/gfx/color_utils.h" +#include "shell/common/color_util.h" #endif namespace electron { @@ -261,7 +260,7 @@ void MenuBar::UpdateViewColors() { #elif BUILDFLAG(IS_WIN) for (views::View* child : GetChildrenInZOrder()) { auto* button = static_cast<SubmenuButton*>(child); - button->SetUnderlineColor(color_utils::GetSysSkColor(COLOR_MENUTEXT)); + button->SetUnderlineColor(GetSysSkColor(COLOR_MENUTEXT)); } #endif } diff --git a/shell/browser/usb/electron_usb_delegate.cc b/shell/browser/usb/electron_usb_delegate.cc index 446b68fb4bfc2..916112e16d05d 100644 --- a/shell/browser/usb/electron_usb_delegate.cc +++ b/shell/browser/usb/electron_usb_delegate.cc @@ -9,6 +9,7 @@ #include "base/observer_list.h" #include "base/scoped_observation.h" +#include "content/public/browser/page.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "electron/buildflags/buildflags.h" diff --git a/shell/browser/web_contents_permission_helper.cc b/shell/browser/web_contents_permission_helper.cc index fcffbac319a40..dbe7253802ac8 100644 --- a/shell/browser/web_contents_permission_helper.cc +++ b/shell/browser/web_contents_permission_helper.cc @@ -195,8 +195,8 @@ void MediaAccessAllowed(const content::MediaStreamRequest& request, } void OnPermissionResponse(base::OnceCallback<void(bool)> callback, - blink::mojom::PermissionStatus status) { - if (status == blink::mojom::PermissionStatus::GRANTED) + content::PermissionResult result) { + if (result.status == blink::mojom::PermissionStatus::GRANTED) std::move(callback).Run(true); else std::move(callback).Run(false); diff --git a/shell/common/application_info_win.cc b/shell/common/application_info_win.cc index 5b0a28c9ab4b1..76eacffce17f8 100644 --- a/shell/common/application_info_win.cc +++ b/shell/common/application_info_win.cc @@ -13,6 +13,7 @@ #include <memory> #include "base/file_version_info.h" +#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "base/strings/string_util_win.h" #include "base/strings/utf_string_conversions.h" @@ -20,13 +21,13 @@ namespace electron { -namespace { +const wchar_t kAppUserModelIDFormat[] = L"electron.app.$1"; -std::wstring g_app_user_model_id; +std::wstring& GetAppUserModelId() { + static base::NoDestructor<std::wstring> g_app_user_model_id; + return *g_app_user_model_id; } -const wchar_t kAppUserModelIDFormat[] = L"electron.app.$1"; - std::string GetApplicationName() { auto* module = GetModuleHandle(nullptr); std::unique_ptr<FileVersionInfo> info( @@ -42,15 +43,15 @@ std::string GetApplicationVersion() { } void SetAppUserModelID(const std::wstring& name) { - g_app_user_model_id = name; - SetCurrentProcessExplicitAppUserModelID(g_app_user_model_id.c_str()); + GetAppUserModelId() = name; + SetCurrentProcessExplicitAppUserModelID(GetAppUserModelId().c_str()); } PCWSTR GetRawAppUserModelID() { - if (g_app_user_model_id.empty()) { + if (GetAppUserModelId().empty()) { PWSTR current_app_id; if (SUCCEEDED(GetCurrentProcessExplicitAppUserModelID(¤t_app_id))) { - g_app_user_model_id = current_app_id; + GetAppUserModelId() = current_app_id; } else { std::string name = GetApplicationName(); std::wstring generated_app_id = base::ReplaceStringPlaceholders( @@ -60,7 +61,7 @@ PCWSTR GetRawAppUserModelID() { CoTaskMemFree(current_app_id); } - return g_app_user_model_id.c_str(); + return GetAppUserModelId().c_str(); } bool GetAppUserModelID(ScopedHString* app_id) { diff --git a/shell/common/color_util.cc b/shell/common/color_util.cc index 80c998b86b27d..33c0c40818b04 100644 --- a/shell/common/color_util.cc +++ b/shell/common/color_util.cc @@ -14,6 +14,7 @@ #include <dwmapi.h> #include "base/win/registry.h" +#include "skia/ext/skia_utils_win.h" #endif namespace { @@ -83,6 +84,10 @@ std::optional<DWORD> GetSystemAccentColor() { return accent_color; } + +SkColor GetSysSkColor(int which) { + return skia::COLORREFToSkColor(GetSysColor(which)); +} #endif } // namespace electron diff --git a/shell/common/color_util.h b/shell/common/color_util.h index 873ec67790255..2c28e1b189fd3 100644 --- a/shell/common/color_util.h +++ b/shell/common/color_util.h @@ -39,6 +39,7 @@ std::string ToRGBAHex(SkColor color, bool include_hash = true); #if BUILDFLAG(IS_WIN) std::optional<DWORD> GetSystemAccentColor(); +SkColor GetSysSkColor(int which); #endif } // namespace electron diff --git a/shell/common/electron_command_line.cc b/shell/common/electron_command_line.cc index 0f474e91ebe9a..45c26715fd18a 100644 --- a/shell/common/electron_command_line.cc +++ b/shell/common/electron_command_line.cc @@ -6,39 +6,43 @@ #include "base/command_line.h" #include "base/containers/to_vector.h" +#include "base/no_destructor.h" #include "base/strings/utf_string_conversions.h" namespace electron { // static -base::CommandLine::StringVector ElectronCommandLine::argv_; +base::CommandLine::StringVector& ElectronCommandLine::argv() { + static base::NoDestructor<base::CommandLine::StringVector> g_argv; + return *g_argv; +} // static void ElectronCommandLine::Init(int argc, base::CommandLine::CharType const* const* argv) { - DCHECK(argv_.empty()); + DCHECK(ElectronCommandLine::argv().empty()); // Safety: as is normal in command lines, argc and argv must correspond // to one another. Otherwise there will be out-of-bounds accesses. - argv_.assign(argv, UNSAFE_BUFFERS(argv + argc)); + ElectronCommandLine::argv().assign(argv, UNSAFE_BUFFERS(argv + argc)); } // static std::vector<std::string> ElectronCommandLine::AsUtf8() { - DCHECK(!argv_.empty()); + DCHECK(!argv().empty()); #if BUILDFLAG(IS_WIN) return base::ToVector( - argv_, [](const auto& wstr) { return base::WideToUTF8(wstr); }); + argv(), [](const auto& wstr) { return base::WideToUTF8(wstr); }); #else - return argv_; + return argv(); #endif } #if BUILDFLAG(IS_LINUX) // static void ElectronCommandLine::InitializeFromCommandLine() { - argv_ = base::CommandLine::ForCurrentProcess()->argv(); + argv() = base::CommandLine::ForCurrentProcess()->argv(); } #endif diff --git a/shell/common/electron_command_line.h b/shell/common/electron_command_line.h index f9e713c6c35b9..5595bd0e5a171 100644 --- a/shell/common/electron_command_line.h +++ b/shell/common/electron_command_line.h @@ -18,7 +18,7 @@ class ElectronCommandLine { ElectronCommandLine(const ElectronCommandLine&) = delete; ElectronCommandLine& operator=(const ElectronCommandLine&) = delete; - static const base::CommandLine::StringVector& argv() { return argv_; } + static base::CommandLine::StringVector& argv(); static std::vector<std::string> AsUtf8(); @@ -29,9 +29,6 @@ class ElectronCommandLine { // it is using zygote. static void InitializeFromCommandLine(); #endif - - private: - static base::CommandLine::StringVector argv_; }; } // namespace electron diff --git a/shell/common/extensions/api/_manifest_features.json b/shell/common/extensions/api/_manifest_features.json index 03ceb2df004dc..e854b22c39493 100644 --- a/shell/common/extensions/api/_manifest_features.json +++ b/shell/common/extensions/api/_manifest_features.json @@ -22,10 +22,6 @@ "extension_types": ["extension"], "platforms": ["win", "mac"] }, - "chrome_url_overrides": { - "channel": "stable", - "extension_types": ["extension", "legacy_packaged_app"] - }, "content_scripts": { "channel": "stable", "extension_types": ["extension", "legacy_packaged_app"] @@ -36,10 +32,6 @@ "extension", "legacy_packaged_app", "hosted_app" ] }, - "devtools_page": { - "channel": "stable", - "extension_types": ["extension", "legacy_packaged_app"] - }, "file_browser_handlers": { "channel": "stable", "extension_types": ["extension", "legacy_packaged_app"] diff --git a/shell/common/extensions/electron_extensions_api_provider.cc b/shell/common/extensions/electron_extensions_api_provider.cc index 3d870af093228..2d310a69eb8f4 100644 --- a/shell/common/extensions/electron_extensions_api_provider.cc +++ b/shell/common/extensions/electron_extensions_api_provider.cc @@ -8,7 +8,6 @@ #include <string> #include "base/containers/span.h" -#include "chrome/common/extensions/chrome_manifest_url_handlers.h" #include "chrome/common/extensions/manifest_handlers/minimum_chrome_version_checker.h" // nogncheck #include "electron/buildflags/buildflags.h" #include "electron/shell/common/extensions/api/generated_schemas.h" @@ -19,6 +18,7 @@ #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handler.h" #include "extensions/common/manifest_handler_registry.h" +#include "extensions/common/manifest_handlers/chrome_url_overrides_handler.h" #include "extensions/common/manifest_handlers/permissions_parser.h" #include "extensions/common/manifest_url_handlers.h" #include "extensions/common/permissions/permissions_info.h" @@ -30,10 +30,6 @@ namespace extensions { namespace { constexpr APIPermissionInfo::InitInfo permissions_to_register[] = { - {mojom::APIPermissionID::kDevtools, "devtools", - APIPermissionInfo::kFlagImpliesFullURLAccess | - APIPermissionInfo::kFlagCannotBeOptional | - APIPermissionInfo::kFlagInternal}, {mojom::APIPermissionID::kResourcesPrivate, "resourcesPrivate", APIPermissionInfo::kFlagCannotBeOptional}, #if BUILDFLAG(ENABLE_PDF_VIEWER) @@ -104,8 +100,6 @@ void ElectronExtensionsAPIProvider::RegisterPermissions( void ElectronExtensionsAPIProvider::RegisterManifestHandlers() { extensions::ManifestHandlerRegistry* registry = extensions::ManifestHandlerRegistry::Get(); - registry->RegisterHandler( - std::make_unique<extensions::DevToolsPageHandler>()); registry->RegisterHandler( std::make_unique<extensions::MinimumChromeVersionChecker>()); } diff --git a/shell/common/gin_converters/content_converter.cc b/shell/common/gin_converters/content_converter.cc index ee21095df3546..69c88e1427508 100644 --- a/shell/common/gin_converters/content_converter.cc +++ b/shell/common/gin_converters/content_converter.cc @@ -10,6 +10,7 @@ #include "base/containers/fixed_flat_map.h" #include "components/input/native_web_keyboard_event.h" #include "content/public/browser/context_menu_params.h" +#include "content/public/browser/permission_result.h" #include "content/public/browser/web_contents.h" #include "shell/browser/api/electron_api_web_contents.h" #include "shell/browser/web_contents_permission_helper.h" @@ -128,18 +129,22 @@ v8::Local<v8::Value> Converter<ContextMenuParamsWithRenderFrameHost>::ToV8( } // static -bool Converter<blink::mojom::PermissionStatus>::FromV8( +bool Converter<content::PermissionResult>::FromV8( v8::Isolate* isolate, v8::Local<v8::Value> val, - blink::mojom::PermissionStatus* out) { + content::PermissionResult* out) { bool result; if (!ConvertFromV8(isolate, val, &result)) return false; if (result) - *out = blink::mojom::PermissionStatus::GRANTED; + *out = + content::PermissionResult(blink::mojom::PermissionStatus::GRANTED, + content::PermissionStatusSource::UNSPECIFIED); else - *out = blink::mojom::PermissionStatus::DENIED; + *out = + content::PermissionResult(blink::mojom::PermissionStatus::DENIED, + content::PermissionStatusSource::UNSPECIFIED); return true; } diff --git a/shell/common/gin_converters/content_converter.h b/shell/common/gin_converters/content_converter.h index 2fa5f7f118df9..d9bab26dacba3 100644 --- a/shell/common/gin_converters/content_converter.h +++ b/shell/common/gin_converters/content_converter.h @@ -17,6 +17,7 @@ namespace content { struct ContextMenuParams; +struct PermissionResult; class RenderFrameHost; class WebContents; } // namespace content @@ -53,10 +54,10 @@ struct Converter<ui::mojom::MenuSourceType> { }; template <> -struct Converter<blink::mojom::PermissionStatus> { +struct Converter<content::PermissionResult> { static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val, - blink::mojom::PermissionStatus* out); + content::PermissionResult* out); }; template <> diff --git a/shell/common/gin_converters/frame_converter.cc b/shell/common/gin_converters/frame_converter.cc index f02b44014a6a8..306daa2415139 100644 --- a/shell/common/gin_converters/frame_converter.cc +++ b/shell/common/gin_converters/frame_converter.cc @@ -12,12 +12,6 @@ namespace gin { -namespace { - -v8::Persistent<v8::ObjectTemplate> rfh_templ; - -} // namespace - // static v8::Local<v8::Value> Converter<content::FrameTreeNodeId>::ToV8( v8::Isolate* isolate, @@ -59,17 +53,11 @@ Converter<gin_helper::AccessorValue<content::RenderFrameHost*>>::ToV8( const int32_t process_id = rfh->GetProcess()->GetID().GetUnsafeValue(); const int routing_id = rfh->GetRoutingID(); - if (rfh_templ.IsEmpty()) { - v8::EscapableHandleScope inner(isolate); - v8::Local<v8::ObjectTemplate> local = v8::ObjectTemplate::New(isolate); - local->SetInternalFieldCount(2); - rfh_templ.Reset(isolate, inner.Escape(local)); - } + v8::Local<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate); + templ->SetInternalFieldCount(2); v8::Local<v8::Object> rfh_obj = - v8::Local<v8::ObjectTemplate>::New(isolate, rfh_templ) - ->NewInstance(isolate->GetCurrentContext()) - .ToLocalChecked(); + templ->NewInstance(isolate->GetCurrentContext()).ToLocalChecked(); rfh_obj->SetInternalField(0, v8::Number::New(isolate, process_id)); rfh_obj->SetInternalField(1, v8::Number::New(isolate, routing_id)); diff --git a/shell/common/gin_helper/callback.cc b/shell/common/gin_helper/callback.cc index b5342ebcb7238..fb56f95a01bb2 100644 --- a/shell/common/gin_helper/callback.cc +++ b/shell/common/gin_helper/callback.cc @@ -28,15 +28,14 @@ struct TranslatorHolder { delete data.GetParameter(); } + static gin::DeprecatedWrapperInfo kWrapperInfo; + v8::Global<v8::External> handle; Translator translator; }; -// Cached JavaScript version of |CallTranslator|. -// v8::Persistent handles are bound to a specific v8::Isolate. Require -// initializing per-thread to avoid using the wrong isolate from service -// worker preload scripts. -thread_local v8::Persistent<v8::FunctionTemplate> g_call_translator; +gin::DeprecatedWrapperInfo TranslatorHolder::kWrapperInfo = { + gin::kEmbedderNativeGin}; void CallTranslator(v8::Local<v8::External> external, v8::Local<v8::Object> state, @@ -117,14 +116,17 @@ v8::Local<v8::Function> SafeV8Function::NewHandle(v8::Isolate* isolate) const { v8::Local<v8::Value> CreateFunctionFromTranslator(v8::Isolate* isolate, const Translator& translator, bool one_time) { + gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); + auto* wrapper_info = &TranslatorHolder::kWrapperInfo; + v8::Local<v8::FunctionTemplate> constructor = + data->DeprecatedGetFunctionTemplate(wrapper_info); // The FunctionTemplate is cached. - if (g_call_translator.IsEmpty()) - g_call_translator.Reset( - isolate, - CreateFunctionTemplate(isolate, base::BindRepeating(&CallTranslator))); + if (constructor.IsEmpty()) { + constructor = + CreateFunctionTemplate(isolate, base::BindRepeating(&CallTranslator)); + data->DeprecatedSetFunctionTemplate(wrapper_info, constructor); + } - v8::Local<v8::FunctionTemplate> call_translator = - v8::Local<v8::FunctionTemplate>::New(isolate, g_call_translator); auto* holder = new TranslatorHolder(isolate); holder->translator = translator; auto state = gin::Dictionary::CreateEmpty(isolate); @@ -132,7 +134,7 @@ v8::Local<v8::Value> CreateFunctionFromTranslator(v8::Isolate* isolate, state.Set("oneTime", true); auto context = isolate->GetCurrentContext(); return BindFunctionWith( - isolate, context, call_translator->GetFunction(context).ToLocalChecked(), + isolate, context, constructor->GetFunction(context).ToLocalChecked(), holder->handle.Get(isolate), gin::ConvertToV8(isolate, state)); } diff --git a/shell/common/node_util.cc b/shell/common/node_util.cc index fb763208c3443..233cbeeb2d884 100644 --- a/shell/common/node_util.cc +++ b/shell/common/node_util.cc @@ -8,8 +8,11 @@ #include "base/containers/to_value_list.h" #include "base/json/json_writer.h" #include "base/logging.h" +#include "base/memory/ptr_util.h" +#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" +#include "base/threading/thread_local.h" #include "base/values.h" #include "gin/converter.h" #include "shell/browser/javascript_environment.h" @@ -28,9 +31,15 @@ v8::MaybeLocal<v8::Value> CompileAndCall( v8::LocalVector<v8::Value>* arguments) { v8::TryCatch try_catch{isolate}; - thread_local node::builtins::BuiltinLoader builtin_loader; - v8::MaybeLocal<v8::Function> compiled = builtin_loader.LookupAndCompile( - context, id, parameters, node::Realm::GetCurrent(context)); + static base::NoDestructor< + base::ThreadLocalOwnedPointer<node::builtins::BuiltinLoader>> + builtin_loader; + if (!builtin_loader->Get()) { + builtin_loader->Set(base::WrapUnique(new node::builtins::BuiltinLoader)); + } + v8::MaybeLocal<v8::Function> compiled = + builtin_loader->Get()->LookupAndCompile(context, id, parameters, + node::Realm::GetCurrent(context)); if (compiled.IsEmpty()) { // TODO(samuelmaddock): how can we get the compilation error message? diff --git a/shell/renderer/api/electron_api_context_bridge.cc b/shell/renderer/api/electron_api_context_bridge.cc index e12b5c992ff3a..23b4d507a6ba5 100644 --- a/shell/renderer/api/electron_api_context_bridge.cc +++ b/shell/renderer/api/electron_api_context_bridge.cc @@ -269,10 +269,11 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContextInner( v8::TryCatch try_catch(isolate); v8::Local<v8::Context> source_context = global_source_context.Get(isolate); - val = PassValueToOtherContext( - source_context, global_destination_context.Get(isolate), result, - source_context->Global(), false, - BridgeErrorTarget::kDestination); + val = + PassValueToOtherContext(isolate, source_context, isolate, + global_destination_context.Get(isolate), + result, source_context->Global(), false, + BridgeErrorTarget::kDestination); if (try_catch.HasCaught()) { if (try_catch.Message().IsEmpty()) { proxied_promise->RejectWithErrorMessage( @@ -316,10 +317,11 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContextInner( v8::TryCatch try_catch(isolate); v8::Local<v8::Context> source_context = global_source_context.Get(isolate); - val = PassValueToOtherContext( - source_context, global_destination_context.Get(isolate), result, - source_context->Global(), false, - BridgeErrorTarget::kDestination); + val = + PassValueToOtherContext(isolate, source_context, isolate, + global_destination_context.Get(isolate), + result, source_context->Global(), false, + BridgeErrorTarget::kDestination); if (try_catch.HasCaught()) { if (try_catch.Message().IsEmpty()) { proxied_promise->RejectWithErrorMessage( @@ -419,10 +421,10 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContextInner( // Custom logic to "clone" VideoFrame references blink::VideoFrame* video_frame = - blink::V8VideoFrame::ToWrappable(source_context->GetIsolate(), value); + blink::V8VideoFrame::ToWrappable(source_isolate, value); if (video_frame != nullptr) { - blink::ScriptState* script_state = blink::ScriptState::ForCurrentRealm( - destination_context->GetIsolate()); + blink::ScriptState* script_state = + blink::ScriptState::ForCurrentRealm(destination_isolate); return v8::MaybeLocal<v8::Value>( blink::ToV8Traits<blink::VideoFrame>::ToV8(script_state, video_frame)); @@ -467,7 +469,9 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContextInner( } v8::MaybeLocal<v8::Value> PassValueToOtherContext( + v8::Isolate* source_isolate, v8::Local<v8::Context> source_context, + v8::Isolate* destination_isolate, v8::Local<v8::Context> destination_context, v8::Local<v8::Value> value, v8::Local<v8::Value> parent_value, @@ -484,9 +488,9 @@ v8::MaybeLocal<v8::Value> PassValueToOtherContext( blink::ExecutionContext::From(source_context); DCHECK(source_execution_context); return PassValueToOtherContextInner( - source_context->GetIsolate(), source_context, source_execution_context, - destination_context->GetIsolate(), destination_context, value, - parent_value, object_cache, support_dynamic_properties, 0, error_target); + source_isolate, source_context, source_execution_context, + destination_isolate, destination_context, value, parent_value, + object_cache, support_dynamic_properties, 0, error_target); } void ProxyFunctionWrapper(const v8::FunctionCallbackInfo<v8::Value>& info) { @@ -529,7 +533,7 @@ void ProxyFunctionWrapper(const v8::FunctionCallbackInfo<v8::Value>& info) { for (auto value : original_args) { auto arg = PassValueToOtherContext( - calling_context, func_owning_context, value, + isolate, calling_context, isolate, func_owning_context, value, calling_context->Global(), support_dynamic_properties, BridgeErrorTarget::kSource, &object_cache); if (arg.IsEmpty()) @@ -597,7 +601,7 @@ void ProxyFunctionWrapper(const v8::FunctionCallbackInfo<v8::Value>& info) { { v8::TryCatch try_catch(isolate); ret = PassValueToOtherContext( - func_owning_context, calling_context, + isolate, func_owning_context, isolate, calling_context, maybe_return_value.ToLocalChecked(), func_owning_context->Global(), support_dynamic_properties, BridgeErrorTarget::kDestination); if (try_catch.HasCaught()) { @@ -732,14 +736,14 @@ namespace { void ExposeAPI(v8::Isolate* isolate, v8::Local<v8::Context> source_context, + v8::Isolate* target_isolate, v8::Local<v8::Context> target_context, const std::string& key, v8::Local<v8::Value> api, gin_helper::Arguments* args) { DCHECK(!target_context.IsEmpty()); v8::Context::Scope target_context_scope(target_context); - gin_helper::Dictionary global(target_context->GetIsolate(), - target_context->Global()); + gin_helper::Dictionary global(target_isolate, target_context->Global()); if (global.Has(key)) { args->ThrowError( @@ -749,8 +753,8 @@ void ExposeAPI(v8::Isolate* isolate, } v8::MaybeLocal<v8::Value> maybe_proxy = PassValueToOtherContext( - source_context, target_context, api, source_context->Global(), false, - BridgeErrorTarget::kSource); + isolate, source_context, target_isolate, target_context, api, + source_context->Global(), false, BridgeErrorTarget::kSource); if (maybe_proxy.IsEmpty()) return; auto proxy = maybe_proxy.ToLocalChecked(); @@ -773,7 +777,8 @@ void ExposeAPI(v8::Isolate* isolate, // world ID. For service workers, Electron only supports one isolated // context and the main worker context. Anything else is invalid. v8::MaybeLocal<v8::Context> GetTargetContext(v8::Isolate* isolate, - const int world_id) { + const int world_id, + v8::Isolate* target_isolate) { v8::Local<v8::Context> source_context = isolate->GetCurrentContext(); v8::MaybeLocal<v8::Context> maybe_target_context; @@ -795,8 +800,8 @@ v8::MaybeLocal<v8::Context> GetTargetContext(v8::Isolate* isolate, isolate, "Isolated worlds are not supported in preload realms."))); return maybe_target_context; } - maybe_target_context = - electron::preload_realm::GetInitiatorContext(source_context); + maybe_target_context = electron::preload_realm::GetInitiatorContext( + source_context, target_isolate); } else { NOTREACHED(); } @@ -814,12 +819,14 @@ void ExposeAPIInWorld(v8::Isolate* isolate, "worldId", world_id); v8::Local<v8::Context> source_context = isolate->GetCurrentContext(); CHECK(!source_context.IsEmpty()); + v8::Isolate* target_isolate = isolate; v8::MaybeLocal<v8::Context> maybe_target_context = - GetTargetContext(isolate, world_id); - if (maybe_target_context.IsEmpty()) + GetTargetContext(isolate, world_id, target_isolate); + if (maybe_target_context.IsEmpty() || !target_isolate) return; v8::Local<v8::Context> target_context = maybe_target_context.ToLocalChecked(); - ExposeAPI(isolate, source_context, target_context, key, api, args); + ExposeAPI(isolate, source_context, target_isolate, target_context, key, api, + args); } gin_helper::Dictionary TraceKeyPath(const gin_helper::Dictionary& start, @@ -844,8 +851,7 @@ void OverrideGlobalValueFromIsolatedWorld( auto* frame = render_frame->GetWebFrame(); CHECK(frame); v8::Local<v8::Context> main_context = frame->MainWorldScriptContext(); - gin_helper::Dictionary global(main_context->GetIsolate(), - main_context->Global()); + gin_helper::Dictionary global(isolate, main_context->Global()); const std::string final_key = key_path[key_path.size() - 1]; gin_helper::Dictionary target_object = TraceKeyPath(global, key_path); @@ -855,8 +861,9 @@ void OverrideGlobalValueFromIsolatedWorld( v8::Local<v8::Context> source_context = value->GetCreationContextChecked(isolate); v8::MaybeLocal<v8::Value> maybe_proxy = PassValueToOtherContext( - source_context, main_context, value, source_context->Global(), - support_dynamic_properties, BridgeErrorTarget::kSource); + isolate, source_context, isolate, main_context, value, + source_context->Global(), support_dynamic_properties, + BridgeErrorTarget::kSource); DCHECK(!maybe_proxy.IsEmpty()); auto proxy = maybe_proxy.ToLocalChecked(); @@ -878,8 +885,7 @@ bool OverrideGlobalPropertyFromIsolatedWorld( auto* frame = render_frame->GetWebFrame(); CHECK(frame); v8::Local<v8::Context> main_context = frame->MainWorldScriptContext(); - gin_helper::Dictionary global(main_context->GetIsolate(), - main_context->Global()); + gin_helper::Dictionary global(isolate, main_context->Global()); const std::string final_key = key_path[key_path.size() - 1]; v8::Local<v8::Object> target_object = @@ -894,8 +900,8 @@ bool OverrideGlobalPropertyFromIsolatedWorld( v8::Local<v8::Context> source_context = getter->GetCreationContextChecked(isolate); v8::MaybeLocal<v8::Value> maybe_getter_proxy = PassValueToOtherContext( - source_context, main_context, getter, source_context->Global(), false, - BridgeErrorTarget::kSource); + isolate, source_context, isolate, main_context, getter, + source_context->Global(), false, BridgeErrorTarget::kSource); DCHECK(!maybe_getter_proxy.IsEmpty()); getter_proxy = maybe_getter_proxy.ToLocalChecked(); } @@ -903,8 +909,8 @@ bool OverrideGlobalPropertyFromIsolatedWorld( v8::Local<v8::Context> source_context = getter->GetCreationContextChecked(isolate); v8::MaybeLocal<v8::Value> maybe_setter_proxy = PassValueToOtherContext( - source_context, main_context, setter, source_context->Global(), false, - BridgeErrorTarget::kSource); + isolate, source_context, isolate, main_context, setter, + source_context->Global(), false, BridgeErrorTarget::kSource); DCHECK(!maybe_setter_proxy.IsEmpty()); setter_proxy = maybe_setter_proxy.ToLocalChecked(); } @@ -966,8 +972,9 @@ v8::Local<v8::Value> ExecuteInWorld(v8::Isolate* isolate, } // Get the target context + v8::Isolate* target_isolate = isolate; v8::MaybeLocal<v8::Context> maybe_target_context = - GetTargetContext(isolate, world_id); + GetTargetContext(isolate, world_id, target_isolate); v8::Local<v8::Context> target_context; if (!maybe_target_context.ToLocal(&target_context)) { isolate->ThrowException(v8::Exception::Error(gin::StringToV8( @@ -1053,9 +1060,9 @@ v8::Local<v8::Value> ExecuteInWorld(v8::Isolate* isolate, } auto proxied_arg = PassValueToOtherContext( - source_context, target_context, arg, source_context->Global(), - support_dynamic_properties, BridgeErrorTarget::kSource, - &object_cache); + isolate, source_context, target_isolate, target_context, arg, + source_context->Global(), support_dynamic_properties, + BridgeErrorTarget::kSource, &object_cache); if (proxied_arg.IsEmpty()) { gin_helper::ErrorThrower(isolate).ThrowError( absl::StrFormat("Failed to proxy argument at index %d", i)); @@ -1100,8 +1107,8 @@ v8::Local<v8::Value> ExecuteInWorld(v8::Isolate* isolate, v8::TryCatch try_catch(isolate); // Pass value from target context back to source context maybe_cloned_result = PassValueToOtherContext( - target_context, source_context, result, target_context->Global(), - false, BridgeErrorTarget::kSource); + target_isolate, target_context, isolate, source_context, result, + target_context->Global(), false, BridgeErrorTarget::kSource); if (try_catch.HasCaught()) { v8::String::Utf8Value utf8(isolate, try_catch.Exception()); error_message = *utf8 ? *utf8 : "Unknown error cloning result"; diff --git a/shell/renderer/api/electron_api_context_bridge.h b/shell/renderer/api/electron_api_context_bridge.h index f8498ae658ae4..d26243cf79159 100644 --- a/shell/renderer/api/electron_api_context_bridge.h +++ b/shell/renderer/api/electron_api_context_bridge.h @@ -31,7 +31,9 @@ enum class BridgeErrorTarget { }; v8::MaybeLocal<v8::Value> PassValueToOtherContext( + v8::Isolate* source_isolate, v8::Local<v8::Context> source_context, + v8::Isolate* destination_isolate, v8::Local<v8::Context> destination_context, v8::Local<v8::Value> value, /** diff --git a/shell/renderer/api/electron_api_ipc_renderer.cc b/shell/renderer/api/electron_api_ipc_renderer.cc index 61cade3c982c8..1bf1065ca8f45 100644 --- a/shell/renderer/api/electron_api_ipc_renderer.cc +++ b/shell/renderer/api/electron_api_ipc_renderer.cc @@ -221,10 +221,10 @@ class IPCRenderFrame : public IPCBase<IPCRenderFrame>, void OnDestruct() override { electron_ipc_remote_.reset(); } - void WillReleaseScriptContext(v8::Local<v8::Context> context, + void WillReleaseScriptContext(v8::Isolate* const isolate, + v8::Local<v8::Context> context, int32_t world_id) override { - if (weak_context_.IsEmpty() || - weak_context_.Get(context->GetIsolate()) == context) { + if (weak_context_.IsEmpty() || weak_context_.Get(isolate) == context) { OnDestruct(); } } diff --git a/shell/renderer/api/electron_api_web_frame.cc b/shell/renderer/api/electron_api_web_frame.cc index 44ff3b647d966..58aaf911b3aab 100644 --- a/shell/renderer/api/electron_api_web_frame.cc +++ b/shell/renderer/api/electron_api_web_frame.cc @@ -11,6 +11,7 @@ #include "base/containers/span.h" #include "base/memory/memory_pressure_listener.h" +#include "base/no_destructor.h" #include "base/strings/strcat.h" #include "base/strings/utf_string_conversions.h" #include "components/spellcheck/renderer/spellcheck.h" @@ -107,6 +108,13 @@ namespace api { namespace { +class SpellCheckerHolder; + +std::set<SpellCheckerHolder*>& GetSpellCheckerHolderInstances() { + static base::NoDestructor<std::set<SpellCheckerHolder*>> instances; + return *instances; +} + #if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER) bool SpellCheckWord(content::RenderFrame* render_frame, @@ -160,8 +168,8 @@ class ScriptExecutionCallback { v8::Local<v8::Context> source_context = result->GetCreationContextChecked(isolate); maybe_result = PassValueToOtherContext( - source_context, promise_.GetContext(), result, - source_context->Global(), false, BridgeErrorTarget::kSource); + isolate, source_context, promise_.isolate(), promise_.GetContext(), + result, source_context->Global(), false, BridgeErrorTarget::kSource); if (maybe_result.IsEmpty() || try_catch.HasCaught()) { success = false; } @@ -282,7 +290,7 @@ class SpellCheckerHolder final : private content::RenderFrameObserver { // Find existing holder for the |render_frame|. static SpellCheckerHolder* FromRenderFrame( content::RenderFrame* render_frame) { - for (auto* holder : instances_) { + for (auto* holder : GetSpellCheckerHolderInstances()) { if (holder->render_frame() == render_frame) return holder; } @@ -294,10 +302,10 @@ class SpellCheckerHolder final : private content::RenderFrameObserver { : content::RenderFrameObserver(render_frame), spell_check_client_(std::move(spell_check_client)) { DCHECK(!FromRenderFrame(render_frame)); - instances_.insert(this); + GetSpellCheckerHolderInstances().insert(this); } - ~SpellCheckerHolder() final { instances_.erase(this); } + ~SpellCheckerHolder() final { GetSpellCheckerHolderInstances().erase(this); } void UnsetAndDestroy() { FrameSetSpellChecker set_spell_checker(nullptr, render_frame()); @@ -319,7 +327,8 @@ class SpellCheckerHolder final : private content::RenderFrameObserver { delete this; } - void WillReleaseScriptContext(v8::Local<v8::Context> context, + void WillReleaseScriptContext(v8::Isolate* const isolate, + v8::Local<v8::Context> context, int world_id) final { // Unset spell checker when the script context is going to be released, as // the spell check implementation lives there. @@ -327,8 +336,6 @@ class SpellCheckerHolder final : private content::RenderFrameObserver { } private: - static std::set<SpellCheckerHolder*> instances_; - std::unique_ptr<SpellCheckClient> spell_check_client_; }; @@ -941,9 +948,6 @@ class WebFrameRenderer final gin::DeprecatedWrapperInfo WebFrameRenderer::kWrapperInfo = { gin::kEmbedderNativeGin}; -// static -std::set<SpellCheckerHolder*> SpellCheckerHolder::instances_; - } // namespace api } // namespace electron diff --git a/shell/renderer/electron_api_service_impl.cc b/shell/renderer/electron_api_service_impl.cc index e527061455ce6..19c9bce33a1f2 100644 --- a/shell/renderer/electron_api_service_impl.cc +++ b/shell/renderer/electron_api_service_impl.cc @@ -120,7 +120,7 @@ void ElectronApiServiceImpl::ReceivePostMessage( for (auto& port : message.ports) { ports.emplace_back( blink::WebMessagePortConverter::EntangleAndInjectMessagePortChannel( - context, std::move(port))); + isolate, context, std::move(port))); } std::vector<v8::Local<v8::Value>> args = {message_value}; diff --git a/shell/renderer/electron_render_frame_observer.cc b/shell/renderer/electron_render_frame_observer.cc index cfca2519482ec..da4128349ff96 100644 --- a/shell/renderer/electron_render_frame_observer.cc +++ b/shell/renderer/electron_render_frame_observer.cc @@ -148,11 +148,11 @@ void ElectronRenderFrameObserver::DidInstallConditionalFeatures( } void ElectronRenderFrameObserver::WillReleaseScriptContext( + v8::Isolate* const isolate, v8::Local<v8::Context> context, int world_id) { if (ShouldNotifyClient(world_id)) - renderer_client_->WillReleaseScriptContext(context->GetIsolate(), context, - render_frame_); + renderer_client_->WillReleaseScriptContext(isolate, context, render_frame_); } void ElectronRenderFrameObserver::OnDestruct() { diff --git a/shell/renderer/electron_render_frame_observer.h b/shell/renderer/electron_render_frame_observer.h index 5919cf6d0d862..f72faff431c4d 100644 --- a/shell/renderer/electron_render_frame_observer.h +++ b/shell/renderer/electron_render_frame_observer.h @@ -31,7 +31,8 @@ class ElectronRenderFrameObserver : private content::RenderFrameObserver { void DidClearWindowObject() override; void DidInstallConditionalFeatures(v8::Local<v8::Context> context, int world_id) override; - void WillReleaseScriptContext(v8::Local<v8::Context> context, + void WillReleaseScriptContext(v8::Isolate* const isolate, + v8::Local<v8::Context> context, int world_id) override; void OnDestruct() override; void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override; diff --git a/shell/renderer/electron_sandboxed_renderer_client.cc b/shell/renderer/electron_sandboxed_renderer_client.cc index 4243a128f2c89..f797b7f09226b 100644 --- a/shell/renderer/electron_sandboxed_renderer_client.cc +++ b/shell/renderer/electron_sandboxed_renderer_client.cc @@ -172,19 +172,18 @@ void ElectronSandboxedRendererClient::EmitProcessEvent( void ElectronSandboxedRendererClient::WillEvaluateServiceWorkerOnWorkerThread( blink::WebServiceWorkerContextProxy* context_proxy, + v8::Isolate* const v8_isolate, v8::Local<v8::Context> v8_context, int64_t service_worker_version_id, const GURL& service_worker_scope, const GURL& script_url, const blink::ServiceWorkerToken& service_worker_token) { RendererClientBase::WillEvaluateServiceWorkerOnWorkerThread( - context_proxy, v8_context, service_worker_version_id, + context_proxy, v8_isolate, v8_context, service_worker_version_id, service_worker_scope, script_url, service_worker_token); auto* command_line = base::CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kServiceWorkerPreload)) { - v8::Isolate* const v8_isolate = v8_context->GetIsolate(); - if (!service_worker_data) { service_worker_data = new ServiceWorkerData{ context_proxy, service_worker_version_id, v8_isolate, v8_context}; diff --git a/shell/renderer/electron_sandboxed_renderer_client.h b/shell/renderer/electron_sandboxed_renderer_client.h index 42e72ddd18527..45da50fdb5045 100644 --- a/shell/renderer/electron_sandboxed_renderer_client.h +++ b/shell/renderer/electron_sandboxed_renderer_client.h @@ -47,6 +47,7 @@ class ElectronSandboxedRendererClient : public RendererClientBase { void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame) override; void WillEvaluateServiceWorkerOnWorkerThread( blink::WebServiceWorkerContextProxy* context_proxy, + v8::Isolate* const isolate, v8::Local<v8::Context> v8_context, int64_t service_worker_version_id, const GURL& service_worker_scope, diff --git a/shell/renderer/preload_realm_context.cc b/shell/renderer/preload_realm_context.cc index 1912c9aabcc87..ad6c96a305938 100644 --- a/shell/renderer/preload_realm_context.cc +++ b/shell/renderer/preload_realm_context.cc @@ -98,6 +98,12 @@ class PreloadRealmLifetimeController : v8::MaybeLocal<v8::Context>(); } + v8::Isolate* GetInitiatorIsolate() { + return initiator_script_state_->ContextIsValid() + ? initiator_script_state_->GetIsolate() + : nullptr; + } + electron::ServiceWorkerData* service_worker_data() { return service_worker_data_; } @@ -199,16 +205,19 @@ class PreloadRealmLifetimeController } // namespace -v8::MaybeLocal<v8::Context> GetInitiatorContext( - v8::Local<v8::Context> context) { +v8::MaybeLocal<v8::Context> GetInitiatorContext(v8::Local<v8::Context> context, + v8::Isolate* target_isolate) { DCHECK(!context.IsEmpty()); + DCHECK(target_isolate); blink::ExecutionContext* execution_context = blink::ExecutionContext::From(context); if (!execution_context->IsShadowRealmGlobalScope()) return v8::MaybeLocal<v8::Context>(); auto* controller = PreloadRealmLifetimeController::From(context); - if (controller) + if (controller) { + target_isolate = controller->GetInitiatorIsolate(); return controller->GetInitiatorContext(); + } return v8::MaybeLocal<v8::Context>(); } diff --git a/shell/renderer/preload_realm_context.h b/shell/renderer/preload_realm_context.h index ec5f354722376..223a8fc838eac 100644 --- a/shell/renderer/preload_realm_context.h +++ b/shell/renderer/preload_realm_context.h @@ -14,7 +14,8 @@ class ServiceWorkerData; namespace electron::preload_realm { // Get initiator context given the preload context. -v8::MaybeLocal<v8::Context> GetInitiatorContext(v8::Local<v8::Context> context); +v8::MaybeLocal<v8::Context> GetInitiatorContext(v8::Local<v8::Context> context, + v8::Isolate* target_isolate); // Get the preload context given the initiator context. v8::MaybeLocal<v8::Context> GetPreloadRealmContext( diff --git a/shell/renderer/renderer_client_base.cc b/shell/renderer/renderer_client_base.cc index 4d2548c6074aa..bb8a836de5f38 100644 --- a/shell/renderer/renderer_client_base.cc +++ b/shell/renderer/renderer_client_base.cc @@ -489,6 +489,7 @@ void RendererClientBase::DidInitializeServiceWorkerContextOnWorkerThread( void RendererClientBase::WillEvaluateServiceWorkerOnWorkerThread( blink::WebServiceWorkerContextProxy* context_proxy, + v8::Isolate* const v8_isolate, v8::Local<v8::Context> v8_context, int64_t service_worker_version_id, const GURL& service_worker_scope, @@ -497,7 +498,7 @@ void RendererClientBase::WillEvaluateServiceWorkerOnWorkerThread( #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) extensions_renderer_client_->dispatcher() ->WillEvaluateServiceWorkerOnWorkerThread( - context_proxy, v8_context, service_worker_version_id, + context_proxy, v8_isolate, v8_context, service_worker_version_id, service_worker_scope, script_url, service_worker_token); #endif } @@ -591,8 +592,8 @@ void RendererClientBase::SetupMainWorldOverrides( v8::Local<v8::Value> guest_view_internal; if (global.GetHidden("guestViewInternal", &guest_view_internal)) { auto result = api::PassValueToOtherContext( - source_context, context, guest_view_internal, source_context->Global(), - false, api::BridgeErrorTarget::kSource); + isolate, source_context, isolate, context, guest_view_internal, + source_context->Global(), false, api::BridgeErrorTarget::kSource); if (!result.IsEmpty()) { isolated_api.Set("guestViewInternal", result.ToLocalChecked()); } diff --git a/shell/renderer/renderer_client_base.h b/shell/renderer/renderer_client_base.h index c14158eef53fd..e4571fa976569 100644 --- a/shell/renderer/renderer_client_base.h +++ b/shell/renderer/renderer_client_base.h @@ -124,6 +124,7 @@ class RendererClientBase : public content::ContentRendererClient const GURL& script_url) override; void WillEvaluateServiceWorkerOnWorkerThread( blink::WebServiceWorkerContextProxy* context_proxy, + v8::Isolate* const isolate, v8::Local<v8::Context> v8_context, int64_t service_worker_version_id, const GURL& service_worker_scope, diff --git a/shell/services/node/node_service.cc b/shell/services/node/node_service.cc index 11a4a34fc9285..ffb7f3c007b96 100644 --- a/shell/services/node/node_service.cc +++ b/shell/services/node/node_service.cc @@ -30,15 +30,19 @@ namespace electron { -mojo::Remote<node::mojom::NodeServiceClient> g_client_remote; +mojo::Remote<node::mojom::NodeServiceClient>& GetRemote() { + static base::NoDestructor<mojo::Remote<node::mojom::NodeServiceClient>> + instance; + return *instance; +} void V8FatalErrorCallback(const char* location, const char* message) { - if (g_client_remote.is_bound() && g_client_remote.is_connected()) { + if (GetRemote().is_bound() && GetRemote().is_connected()) { auto* isolate = v8::Isolate::TryGetCurrent(); std::ostringstream outstream; node::GetNodeReport(isolate, message, location, v8::Local<v8::Object>() /* error */, outstream); - g_client_remote->OnV8FatalError(location, outstream.str()); + GetRemote()->OnV8FatalError(location, outstream.str()); } #if !IS_MAS_BUILD() @@ -101,7 +105,7 @@ NodeService::~NodeService() { ParentPort::GetInstance()->Close(); js_env_->DestroyMicrotasksRunner(); node::Stop(node_env_.get(), node::StopFlags::kDoNotTerminateIsolate); - g_client_remote.reset(); + GetRemote().reset(); } } @@ -111,8 +115,8 @@ void NodeService::Initialize( if (NodeBindings::IsInitialized()) return; - g_client_remote.Bind(std::move(client_pending_remote)); - g_client_remote.reset_on_disconnect(); + GetRemote().Bind(std::move(client_pending_remote)); + GetRemote().reset_on_disconnect(); ParentPort::GetInstance()->Initialize(std::move(params->port)); @@ -155,7 +159,7 @@ void NodeService::Initialize( node_env_stopped_ = true; ParentPort::GetInstance()->Close(); js_env_->DestroyMicrotasksRunner(); - g_client_remote.reset(); + GetRemote().reset(); receiver_.ResetWithReason(exit_code, "process_exit_termination"); node::DefaultProcessExitHandler(env, exit_code); }); From 9c9c3aee6f03999a90acba30e5c46aeeebb7c073 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt <nilay2014@gmail.com> Date: Mon, 8 Sep 2025 15:44:47 -0400 Subject: [PATCH 066/268] chore: update patches (#48278) --- patches/node/reland_api_advance_deprecation_of_getisolate.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/node/reland_api_advance_deprecation_of_getisolate.patch b/patches/node/reland_api_advance_deprecation_of_getisolate.patch index 4c98e9f94468e..d4685058fa499 100644 --- a/patches/node/reland_api_advance_deprecation_of_getisolate.patch +++ b/patches/node/reland_api_advance_deprecation_of_getisolate.patch @@ -6,7 +6,7 @@ Subject: Reland "[api] Advance deprecation of GetIsolate" https://chromium-review.googlesource.com/c/v8/v8/+/6875273 diff --git a/src/util-inl.h b/src/util-inl.h -index cc41a1fb5459a5cfe5fcf593055cbd03bdb1f74f..fdde74f4e43047916146d092b4cb3490bdc5a947 100644 +index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330cb47c1a7 100644 --- a/src/util-inl.h +++ b/src/util-inl.h @@ -326,14 +326,14 @@ v8::Maybe<void> FromV8Array(v8::Local<v8::Context> context, From aa23f136b7a0769b7cd802158b93f500532bd871 Mon Sep 17 00:00:00 2001 From: Michaela Laurencin <nilay2014@gmail.com> Date: Tue, 9 Sep 2025 18:03:48 -0400 Subject: [PATCH 067/268] docs: update release timeline for unsupported v35 (#48285) --- docs/tutorial/electron-timelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/electron-timelines.md b/docs/tutorial/electron-timelines.md index 259987b33ae0a..4d530a608cf71 100644 --- a/docs/tutorial/electron-timelines.md +++ b/docs/tutorial/electron-timelines.md @@ -13,7 +13,7 @@ check out our [Electron Versioning](./electron-versioning.md) doc. | 38.0.0 | 2025-Jun-26 | 2025-Aug-06 | 2025-Sep-02 | 2026-Mar-10 | M140 | v22.18 | ✅ | | 37.0.0 | 2025-May-01 | 2025-May-28 | 2025-Jun-24 | 2026-Jan-13 | M138 | v22.16 | ✅ | | 36.0.0 | 2025-Mar-06 | 2025-Apr-02 | 2025-Apr-29 | 2025-Oct-28 | M136 | v22.14 | ✅ | -| 35.0.0 | 2025-Jan-16 | 2025-Feb-05 | 2025-Mar-04 | 2025-Sep-02 | M134 | v22.14 | ✅ | +| 35.0.0 | 2025-Jan-16 | 2025-Feb-05 | 2025-Mar-04 | 2025-Sep-02 | M134 | v22.14 | 🚫 | | 34.0.0 | 2024-Oct-17 | 2024-Nov-13 | 2025-Jan-14 | 2025-Jun-24 | M132 | v20.18 | 🚫 | | 33.0.0 | 2024-Aug-22 | 2024-Sep-18 | 2024-Oct-15 | 2025-Apr-29 | M130 | v20.18 | 🚫 | | 32.0.0 | 2024-Jun-14 | 2024-Jul-24 | 2024-Aug-20 | 2025-Mar-04 | M128 | v20.16 | 🚫 | From 64919a23dae13b3849bd9cff8dda9b645fd76b1c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Wed, 10 Sep 2025 09:47:34 -0500 Subject: [PATCH 068/268] build(deps): bump github/codeql-action from 3.29.11 to 3.30.1 (#48283) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.11 to 3.30.1. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/3c3833e0f8c1c83d449a7478aa59c036a9165498...f1f6e5f6af878fb37288ce1c627459e94dbf7d01) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 3.30.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/scorecards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index bf2c12e61e3ec..36ce4ca1b8b00 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -50,6 +50,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.5 + uses: github/codeql-action/upload-sarif@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # v3.29.5 with: sarif_file: results.sarif From 1179d91e5efa05d13599923ad31ce7cc2edc5721 Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Wed, 10 Sep 2025 11:16:35 -0500 Subject: [PATCH 069/268] refactor: avoid unused inheritance in ServiceWorkerMain (#48279) ServiceWorkerMain does not need to inherit from EventEmitterMixin --- shell/browser/api/electron_api_service_worker_main.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/shell/browser/api/electron_api_service_worker_main.h b/shell/browser/api/electron_api_service_worker_main.h index 9cd79653ecb85..c8e4ed59f8836 100644 --- a/shell/browser/api/electron_api_service_worker_main.h +++ b/shell/browser/api/electron_api_service_worker_main.h @@ -16,7 +16,6 @@ #include "mojo/public/cpp/bindings/associated_remote.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/remote.h" -#include "shell/browser/event_emitter_mixin.h" #include "shell/common/api/api.mojom.h" #include "shell/common/gin_helper/constructible.h" #include "shell/common/gin_helper/pinnable.h" @@ -80,7 +79,6 @@ struct ServiceWorkerKey { // the default StoragePartition for the associated BrowserContext. class ServiceWorkerMain final : public gin_helper::DeprecatedWrappable<ServiceWorkerMain>, - public gin_helper::EventEmitterMixin<ServiceWorkerMain>, public gin_helper::Pinnable<ServiceWorkerMain>, public gin_helper::Constructible<ServiceWorkerMain> { public: From c38f031240ae7f3998350ecf1360c0a653bbcd34 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Wed, 10 Sep 2025 21:35:54 -0500 Subject: [PATCH 070/268] build(deps): bump actions/setup-node from 4.4.0 to 5.0.0 (#48282) Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4.4.0 to 5.0.0. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/49933ea5288caeca8642d1e84afbd3f7d6820020...a0853c24544627f65ddf259abe73b1d18a591444) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: 5.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/archaeologist-dig.yml | 2 +- .github/workflows/audit-branch-ci.yml | 2 +- .github/workflows/pipeline-segment-electron-build.yml | 2 +- .github/workflows/pipeline-segment-electron-test.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/archaeologist-dig.yml b/.github/workflows/archaeologist-dig.yml index 4be9246226ce8..9684a742b7a95 100644 --- a/.github/workflows/archaeologist-dig.yml +++ b/.github/workflows/archaeologist-dig.yml @@ -13,7 +13,7 @@ jobs: with: fetch-depth: 0 - name: Setup Node.js/npm - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 + uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 20.19.x - name: Setting Up Dig Site diff --git a/.github/workflows/audit-branch-ci.yml b/.github/workflows/audit-branch-ci.yml index 05c37badd1fd8..62d0ccbb44703 100644 --- a/.github/workflows/audit-branch-ci.yml +++ b/.github/workflows/audit-branch-ci.yml @@ -16,7 +16,7 @@ jobs: contents: read steps: - name: Setup Node.js - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 with: node-version: 22.17.x - run: npm install @actions/cache@4.0.3 @electron/fiddle-core@2.0.1 diff --git a/.github/workflows/pipeline-segment-electron-build.yml b/.github/workflows/pipeline-segment-electron-build.yml index b634e2b675700..f0f0e767df793 100644 --- a/.github/workflows/pipeline-segment-electron-build.yml +++ b/.github/workflows/pipeline-segment-electron-build.yml @@ -113,7 +113,7 @@ jobs: run: df -h - name: Setup Node.js/npm if: ${{ inputs.target-platform == 'macos' }} - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 + uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 20.19.x cache: yarn diff --git a/.github/workflows/pipeline-segment-electron-test.yml b/.github/workflows/pipeline-segment-electron-test.yml index 7f4417f3bd433..ceeaabd1703f6 100644 --- a/.github/workflows/pipeline-segment-electron-test.yml +++ b/.github/workflows/pipeline-segment-electron-test.yml @@ -70,7 +70,7 @@ jobs: cp $(which node) /mnt/runner-externals/node20/bin/ - name: Setup Node.js/npm if: ${{ inputs.target-platform == 'win' }} - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 + uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 20.19.x - name: Add TCC permissions on macOS From c87509a95589d0b59c3845b9c7f3285646a7a6ac Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Thu, 11 Sep 2025 15:03:17 -0500 Subject: [PATCH 071/268] refactor: allocate api::Debugger on cpp heap (#48266) * refactor: remove unused isolate arg from Debugger ctor * refactor: make Debugger ctor, dtor public needed for cppgc::MakeGarbageCollected() This is what upstream does, e.g. https://chromium-review.googlesource.com/c/chromium/src/+/6722236 * fixup! refactor: remove unused isolate arg from Debugger ctor mark Debugger ctor as explicit * refactor: in EventEmitterMixin, handle both old and new WrapperInfo types * refactor: make electron::api::Debugger inherit from gin::Wrappable * refactor: add api::Debugger::GetTypeName() * refactor: add api::Debugger::GetClassName() --- ...ctron_objects_to_wrappablepointertag.patch | 7 ++-- shell/browser/api/electron_api_debugger.cc | 25 ++++++++----- shell/browser/api/electron_api_debugger.h | 23 ++++++------ .../browser/api/electron_api_web_contents.cc | 13 ++++--- shell/browser/api/electron_api_web_contents.h | 3 +- shell/browser/event_emitter_mixin.h | 35 +++++++++++++++---- 6 files changed, 72 insertions(+), 34 deletions(-) diff --git a/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch b/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch index 4f63db0719663..807c2c461f6c0 100644 --- a/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch +++ b/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch @@ -8,17 +8,18 @@ electron objects that extend gin::Wrappable and gets allocated on the cpp heap diff --git a/gin/public/wrappable_pointer_tags.h b/gin/public/wrappable_pointer_tags.h -index 80ec409efe1635390887d1324be661643818abff..112a23f81680f5fcc2b016d8f5362e3a03507c8a 100644 +index 80ec409efe1635390887d1324be661643818abff..2b82f96d12715b6476c456b73dfd1a7342736f8e 100644 --- a/gin/public/wrappable_pointer_tags.h +++ b/gin/public/wrappable_pointer_tags.h -@@ -66,7 +66,10 @@ enum WrappablePointerTag : uint16_t { +@@ -66,7 +66,11 @@ enum WrappablePointerTag : uint16_t { kTextInputControllerBindings, // content::TextInputControllerBindings kWebAXObjectProxy, // content::WebAXObjectProxy kWrappedExceptionHandler, // extensions::WrappedExceptionHandler - kLastPointerTag = kWrappedExceptionHandler, + kElectronApp, // electron::api::App -+ kElectronSession, // electron::api::Session ++ kElectronDebugger, // electron::api::Debugger + kElectronEvent, // gin_helper::internal::Event ++ kElectronSession, // electron::api::Session + kLastPointerTag = kElectronEvent, }; diff --git a/shell/browser/api/electron_api_debugger.cc b/shell/browser/api/electron_api_debugger.cc index b760639166276..29f496c746fa8 100644 --- a/shell/browser/api/electron_api_debugger.cc +++ b/shell/browser/api/electron_api_debugger.cc @@ -19,15 +19,18 @@ #include "shell/common/gin_converters/value_converter.h" #include "shell/common/gin_helper/handle.h" #include "shell/common/gin_helper/promise.h" +#include "v8/include/cppgc/allocation.h" +#include "v8/include/v8-cppgc.h" using content::DevToolsAgentHost; namespace electron::api { -gin::DeprecatedWrapperInfo Debugger::kWrapperInfo = {gin::kEmbedderNativeGin}; +gin::WrapperInfo Debugger::kWrapperInfo = {{gin::kEmbedderNativeGin}, + gin::kElectronDebugger}; -Debugger::Debugger(v8::Isolate* isolate, content::WebContents* web_contents) - : content::WebContentsObserver(web_contents), web_contents_(web_contents) {} +Debugger::Debugger(content::WebContents* web_contents) + : content::WebContentsObserver{web_contents}, web_contents_{web_contents} {} Debugger::~Debugger() = default; @@ -178,10 +181,10 @@ void Debugger::ClearPendingRequests() { } // static -gin_helper::Handle<Debugger> Debugger::Create( - v8::Isolate* isolate, - content::WebContents* web_contents) { - return gin_helper::CreateHandle(isolate, new Debugger(isolate, web_contents)); +Debugger* Debugger::Create(v8::Isolate* isolate, + content::WebContents* web_contents) { + return cppgc::MakeGarbageCollected<Debugger>( + isolate->GetCppHeap()->GetAllocationHandle(), web_contents); } gin::ObjectTemplateBuilder Debugger::GetObjectTemplateBuilder( @@ -194,8 +197,12 @@ gin::ObjectTemplateBuilder Debugger::GetObjectTemplateBuilder( .SetMethod("sendCommand", &Debugger::SendCommand); } -const char* Debugger::GetTypeName() { - return "Debugger"; +const gin::WrapperInfo* Debugger::wrapper_info() const { + return &kWrapperInfo; +} + +const char* Debugger::GetHumanReadableName() const { + return "Electron / Debugger"; } } // namespace electron::api diff --git a/shell/browser/api/electron_api_debugger.h b/shell/browser/api/electron_api_debugger.h index 4a017244d3614..1d40c4f16ee00 100644 --- a/shell/browser/api/electron_api_debugger.h +++ b/shell/browser/api/electron_api_debugger.h @@ -11,8 +11,8 @@ #include "base/values.h" #include "content/public/browser/devtools_agent_host_client.h" #include "content/public/browser/web_contents_observer.h" +#include "gin/wrappable.h" #include "shell/browser/event_emitter_mixin.h" -#include "shell/common/gin_helper/wrappable.h" namespace content { class DevToolsAgentHost; @@ -32,29 +32,32 @@ class Promise; namespace electron::api { -class Debugger final : public gin_helper::DeprecatedWrappable<Debugger>, +class Debugger final : public gin::Wrappable<Debugger>, public gin_helper::EventEmitterMixin<Debugger>, public content::DevToolsAgentHostClient, private content::WebContentsObserver { public: - static gin_helper::Handle<Debugger> Create( - v8::Isolate* isolate, - content::WebContents* web_contents); + static Debugger* Create(v8::Isolate* isolate, + content::WebContents* web_contents); + + // Make public for cppgc::MakeGarbageCollected. + explicit Debugger(content::WebContents* web_contents); + ~Debugger() override; // gin_helper::Wrappable - static gin::DeprecatedWrapperInfo kWrapperInfo; + static gin::WrapperInfo kWrapperInfo; gin::ObjectTemplateBuilder GetObjectTemplateBuilder( v8::Isolate* isolate) override; - const char* GetTypeName() override; + const gin::WrapperInfo* wrapper_info() const override; + const char* GetHumanReadableName() const override; + + const char* GetClassName() const { return "Debugger"; } // disable copy Debugger(const Debugger&) = delete; Debugger& operator=(const Debugger&) = delete; protected: - Debugger(v8::Isolate* isolate, content::WebContents* web_contents); - ~Debugger() override; - // content::DevToolsAgentHostClient: void AgentHostClosed(content::DevToolsAgentHost* agent_host) override; void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host, diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 14e4f498331c6..5e5797a3bc6b0 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -3804,11 +3804,16 @@ v8::Local<v8::Value> WebContents::DevToolsWebContents(v8::Isolate* isolate) { } v8::Local<v8::Value> WebContents::Debugger(v8::Isolate* isolate) { - if (debugger_.IsEmpty()) { - auto handle = electron::api::Debugger::Create(isolate, web_contents()); - debugger_.Reset(isolate, handle.ToV8()); + if (!debugger_) { + debugger_ = electron::api::Debugger::Create(isolate, web_contents()); } - return v8::Local<v8::Value>::New(isolate, debugger_); + + v8::HandleScope handle_scope{isolate}; + v8::Local<v8::Object> wrapper; + if (!debugger_->GetWrapper(isolate).ToLocal(&wrapper)) { + return v8::Null(isolate); + } + return v8::Local<v8::Value>::New(isolate, wrapper); } content::RenderFrameHost* WebContents::MainFrame() { diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h index 09c3edf534226..9e506880f6b57 100644 --- a/shell/browser/api/electron_api_web_contents.h +++ b/shell/browser/api/electron_api_web_contents.h @@ -31,6 +31,7 @@ #include "content/public/common/stop_find_action.h" #include "electron/buildflags/buildflags.h" #include "printing/buildflags/buildflags.h" +#include "shell/browser/api/electron_api_debugger.h" #include "shell/browser/api/electron_api_session.h" #include "shell/browser/api/save_page_handler.h" #include "shell/browser/background_throttling_source.h" @@ -772,7 +773,7 @@ class WebContents final : public ExclusiveAccessContext, cppgc::Persistent<api::Session> session_; v8::Global<v8::Value> devtools_web_contents_; - v8::Global<v8::Value> debugger_; + cppgc::Persistent<api::Debugger> debugger_; std::unique_ptr<WebViewGuestDelegate> guest_delegate_; std::unique_ptr<FrameSubscriber> frame_subscriber_; diff --git a/shell/browser/event_emitter_mixin.h b/shell/browser/event_emitter_mixin.h index 7260f93407046..33d77a1bb1358 100644 --- a/shell/browser/event_emitter_mixin.h +++ b/shell/browser/event_emitter_mixin.h @@ -6,6 +6,7 @@ #define ELECTRON_SHELL_BROWSER_EVENT_EMITTER_MIXIN_H_ #include <string_view> +#include <type_traits> #include <utility> #include "gin/object_template_builder.h" @@ -57,17 +58,37 @@ class EventEmitterMixin { gin::ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate* isolate) { gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); auto* wrapper_info = &(static_cast<T*>(this)->kWrapperInfo); - v8::Local<v8::FunctionTemplate> constructor = - data->DeprecatedGetFunctionTemplate(wrapper_info); + + // DeprecatedWrapperInfo support will be removed as part of + // https://github.com/electron/electron/issues/47922 + constexpr bool is_deprecated_wrapper = + std::is_same_v<decltype(wrapper_info), gin::DeprecatedWrapperInfo*>; + + v8::Local<v8::FunctionTemplate> constructor; + if constexpr (is_deprecated_wrapper) { + constructor = data->DeprecatedGetFunctionTemplate(wrapper_info); + } else { + constructor = data->GetFunctionTemplate(wrapper_info); + } + + const char* class_name = ""; + if constexpr (is_deprecated_wrapper) { + class_name = static_cast<T*>(this)->GetTypeName(); + } else { + class_name = static_cast<T*>(this)->GetClassName(); + } + if (constructor.IsEmpty()) { constructor = v8::FunctionTemplate::New(isolate); - constructor->SetClassName( - gin::StringToV8(isolate, static_cast<T*>(this)->GetTypeName())); + constructor->SetClassName(gin::StringToV8(isolate, class_name)); constructor->Inherit(internal::GetEventEmitterTemplate(isolate)); - data->DeprecatedSetFunctionTemplate(wrapper_info, constructor); + if constexpr (is_deprecated_wrapper) { + data->DeprecatedSetFunctionTemplate(wrapper_info, constructor); + } else { + data->SetFunctionTemplate(wrapper_info, constructor); + } } - return gin::ObjectTemplateBuilder(isolate, - static_cast<T*>(this)->GetTypeName(), + return gin::ObjectTemplateBuilder(isolate, class_name, constructor->InstanceTemplate()); } }; From 9b572e6cbdf16961f93c225b6e7f613e682a55c4 Mon Sep 17 00:00:00 2001 From: Calvin <nilay2014@gmail.com> Date: Fri, 12 Sep 2025 17:17:06 -0600 Subject: [PATCH 072/268] fix: set ozone platform for wayland (#48301) * fix: set ozone platform for wayland * whoops, includes. thx charles --- BUILD.gn | 1 + shell/browser/electron_browser_main_parts.cc | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/BUILD.gn b/BUILD.gn index 5344d87749ab7..2a6ee90e5faa7 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -655,6 +655,7 @@ source_set("electron_lib") { "//ui/events/devices/x11", "//ui/events/platform/x11", "//ui/gtk:gtk_config", + "//ui/linux:display_server_utils", "//ui/linux:linux_ui", "//ui/linux:linux_ui_factory", "//ui/wm", diff --git a/shell/browser/electron_browser_main_parts.cc b/shell/browser/electron_browser_main_parts.cc index bb1cc5bd295a3..2b7b02eade9a6 100644 --- a/shell/browser/electron_browser_main_parts.cc +++ b/shell/browser/electron_browser_main_parts.cc @@ -68,6 +68,7 @@ #include "ui/base/ui_base_switches.h" #include "ui/color/color_provider_manager.h" #include "ui/display/screen.h" +#include "ui/linux/display_server_utils.h" #include "ui/views/layout/layout_provider.h" #include "url/url_util.h" @@ -209,9 +210,14 @@ int ElectronBrowserMainParts::PreEarlyInitialization() { #if BUILDFLAG(IS_POSIX) HandleSIGCHLD(); #endif +#if BUILDFLAG(IS_OZONE) + // Initialize Ozone platform and add required feature flags as per platform's + // properties. #if BUILDFLAG(IS_LINUX) - ui::OzonePlatform::PreEarlyInitialization(); + ui::SetOzonePlatformForLinuxIfNeeded(*base::CommandLine::ForCurrentProcess()); #endif + ui::OzonePlatform::PreEarlyInitialization(); +#endif // BUILDFLAG(IS_OZONE) #if BUILDFLAG(IS_MAC) screen_ = std::make_unique<display::ScopedNativeScreen>(); #endif From e560935bdb77c0242b5393f1a23263c85d9fe68d Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Fri, 12 Sep 2025 18:19:07 -0500 Subject: [PATCH 073/268] refactor: narrow or remove gin arguments (#48300) * refactor: narrow App:SetJumpList() arg from gin::Arguments* to v8::Isolate* * refactor: narrow WebContents::AddWorkSpace() arg from gin::Arguments* to v8::Isolate* * refactor: narrow ShowMessageBox() arg from gin::Arguments* to v8::Isolate* * refactor: narrow ShowOpenDialog() arg from gin::Arguments* to v8::Isolate* * refactor: remove unused gin::Arguments* arg from OverrideGlobalPropertyFromIsolatedWorld() * refactor: narrow WebContents::StartDrag() arg from gin::Arguments* to v8::Isolate* * refactor: narrow NetLog::StopLogging() arg from gin::Arguments* to v8::Isolate* * refactor: narrow Protocol::IsProtocolHandled() arg from gin::Arguments* to v8::Isolate* --- shell/browser/api/electron_api_app.cc | 11 ++++---- shell/browser/api/electron_api_app.h | 2 +- shell/browser/api/electron_api_dialog.cc | 11 ++++---- shell/browser/api/electron_api_net_log.cc | 4 +-- shell/browser/api/electron_api_net_log.h | 2 +- shell/browser/api/electron_api_protocol.cc | 25 +++++++++---------- shell/browser/api/electron_api_protocol.h | 4 +-- .../browser/api/electron_api_web_contents.cc | 24 ++++++++---------- shell/browser/api/electron_api_web_contents.h | 6 ++--- .../api/electron_api_context_bridge.cc | 5 ++-- 10 files changed, 44 insertions(+), 50 deletions(-) diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc index 4fb59a5157ce6..dd5cfe93308d2 100644 --- a/shell/browser/api/electron_api_app.cc +++ b/shell/browser/api/electron_api_app.cc @@ -1241,14 +1241,13 @@ v8::Local<v8::Value> App::GetJumpListSettings() { return dict.GetHandle(); } -JumpListResult App::SetJumpList(v8::Local<v8::Value> val, - gin::Arguments* args) { +JumpListResult App::SetJumpList(v8::Isolate* const isolate, + v8::Local<v8::Value> val) { std::vector<JumpListCategory> categories; bool delete_jump_list = val->IsNull(); - if (!delete_jump_list && - !gin::ConvertFromV8(args->isolate(), val, &categories)) { - gin_helper::ErrorThrower(args->isolate()) - .ThrowTypeError("Argument must be null or an array of categories"); + if (!delete_jump_list && !gin::ConvertFromV8(isolate, val, &categories)) { + gin_helper::ErrorThrower{isolate}.ThrowTypeError( + "Argument must be null or an array of categories"); return JumpListResult::kArgumentError; } diff --git a/shell/browser/api/electron_api_app.h b/shell/browser/api/electron_api_app.h index 7e91e44eb76d6..b1e40cedb72de 100644 --- a/shell/browser/api/electron_api_app.h +++ b/shell/browser/api/electron_api_app.h @@ -258,7 +258,7 @@ class App final : public gin::Wrappable<App>, v8::Local<v8::Value> GetJumpListSettings(); // Set or remove a custom Jump List for the application. - JumpListResult SetJumpList(v8::Local<v8::Value> val, gin::Arguments* args); + JumpListResult SetJumpList(v8::Isolate* isolate, v8::Local<v8::Value> val); #endif // BUILDFLAG(IS_WIN) std::unique_ptr<ProcessSingleton> process_singleton_; diff --git a/shell/browser/api/electron_api_dialog.cc b/shell/browser/api/electron_api_dialog.cc index 9311c26e4d478..89b8ab09b597e 100644 --- a/shell/browser/api/electron_api_dialog.cc +++ b/shell/browser/api/electron_api_dialog.cc @@ -42,9 +42,8 @@ void ResolvePromiseObject(gin_helper::Promise<gin_helper::Dictionary> promise, } v8::Local<v8::Promise> ShowMessageBox( - const electron::MessageBoxSettings& settings, - gin::Arguments* args) { - v8::Isolate* isolate = args->isolate(); + v8::Isolate* const isolate, + const electron::MessageBoxSettings& settings) { gin_helper::Promise<gin_helper::Dictionary> promise(isolate); v8::Local<v8::Promise> handle = promise.GetHandle(); @@ -62,9 +61,9 @@ void ShowOpenDialogSync(const file_dialog::DialogSettings& settings, } v8::Local<v8::Promise> ShowOpenDialog( - const file_dialog::DialogSettings& settings, - gin::Arguments* args) { - gin_helper::Promise<gin_helper::Dictionary> promise(args->isolate()); + v8::Isolate* const isolate, + const file_dialog::DialogSettings& settings) { + gin_helper::Promise<gin_helper::Dictionary> promise{isolate}; v8::Local<v8::Promise> handle = promise.GetHandle(); file_dialog::ShowOpenDialog(settings, std::move(promise)); return handle; diff --git a/shell/browser/api/electron_api_net_log.cc b/shell/browser/api/electron_api_net_log.cc index 29c04d585ea29..0a6059e51f0a9 100644 --- a/shell/browser/api/electron_api_net_log.cc +++ b/shell/browser/api/electron_api_net_log.cc @@ -194,8 +194,8 @@ bool NetLog::IsCurrentlyLogging() const { return !!net_log_exporter_; } -v8::Local<v8::Promise> NetLog::StopLogging(gin::Arguments* args) { - gin_helper::Promise<void> promise(args->isolate()); +v8::Local<v8::Promise> NetLog::StopLogging(v8::Isolate* const isolate) { + gin_helper::Promise<void> promise{isolate}; v8::Local<v8::Promise> handle = promise.GetHandle(); if (net_log_exporter_) { diff --git a/shell/browser/api/electron_api_net_log.h b/shell/browser/api/electron_api_net_log.h index d056ad3062e38..a03de704e2045 100644 --- a/shell/browser/api/electron_api_net_log.h +++ b/shell/browser/api/electron_api_net_log.h @@ -45,7 +45,7 @@ class NetLog final : public gin_helper::DeprecatedWrappable<NetLog> { v8::Local<v8::Promise> StartLogging(base::FilePath log_path, gin::Arguments* args); - v8::Local<v8::Promise> StopLogging(gin::Arguments* args); + v8::Local<v8::Promise> StopLogging(v8::Isolate* isolate); bool IsCurrentlyLogging() const; // gin_helper::Wrappable diff --git a/shell/browser/api/electron_api_protocol.cc b/shell/browser/api/electron_api_protocol.cc index a8afe13cfed5e..1e29412d0c094 100644 --- a/shell/browser/api/electron_api_protocol.cc +++ b/shell/browser/api/electron_api_protocol.cc @@ -251,24 +251,23 @@ bool Protocol::IsProtocolIntercepted(const std::string& scheme) { return protocol_registry_->FindIntercepted(scheme) != nullptr; } -v8::Local<v8::Promise> Protocol::IsProtocolHandled(const std::string& scheme, - gin::Arguments* args) { - util::EmitWarning(args->isolate(), +v8::Local<v8::Promise> Protocol::IsProtocolHandled(v8::Isolate* const isolate, + const std::string& scheme) { + util::EmitWarning(isolate, "The protocol.isProtocolHandled API is deprecated, " "use protocol.isProtocolRegistered " "or protocol.isProtocolIntercepted instead.", "ProtocolDeprecateIsProtocolHandled"); return gin_helper::Promise<bool>::ResolvedPromise( - args->isolate(), - IsProtocolRegistered(scheme) || IsProtocolIntercepted(scheme) || - // The |isProtocolHandled| should return true for builtin - // schemes, however with NetworkService it is impossible to - // know which schemes are registered until a real network - // request is sent. - // So we have to test against a hard-coded builtin schemes - // list make it work with old code. We should deprecate - // this API with the new |isProtocolRegistered| API. - base::Contains(kBuiltinSchemes, scheme)); + isolate, IsProtocolRegistered(scheme) || IsProtocolIntercepted(scheme) || + // The |isProtocolHandled| should return true for builtin + // schemes, however with NetworkService it is impossible to + // know which schemes are registered until a real network + // request is sent. + // So we have to test against a hard-coded builtin schemes + // list make it work with old code. We should deprecate + // this API with the new |isProtocolRegistered| API. + base::Contains(kBuiltinSchemes, scheme)); } void Protocol::HandleOptionalCallback(gin::Arguments* args, Error error) { diff --git a/shell/browser/api/electron_api_protocol.h b/shell/browser/api/electron_api_protocol.h index 63c395b98d738..372e646259925 100644 --- a/shell/browser/api/electron_api_protocol.h +++ b/shell/browser/api/electron_api_protocol.h @@ -89,8 +89,8 @@ class Protocol final : public gin_helper::DeprecatedWrappable<Protocol>, bool IsProtocolIntercepted(const std::string& scheme); // Old async version of IsProtocolRegistered. - v8::Local<v8::Promise> IsProtocolHandled(const std::string& scheme, - gin::Arguments* args); + v8::Local<v8::Promise> IsProtocolHandled(v8::Isolate* isolate, + const std::string& scheme); // Helper for converting old registration APIs to new RegisterProtocol API. template <ProtocolType type> diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 5e5797a3bc6b0..e4839a64a80ea 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -3259,21 +3259,19 @@ v8::Local<v8::Promise> WebContents::PrintToPDF(const base::Value& settings) { } #endif -void WebContents::AddWorkSpace(gin::Arguments* args, +void WebContents::AddWorkSpace(v8::Isolate* const isolate, const base::FilePath& path) { if (path.empty()) { - gin_helper::ErrorThrower(args->isolate()) - .ThrowError("path cannot be empty"); + gin_helper::ErrorThrower{isolate}.ThrowError("path cannot be empty"); return; } DevToolsAddFileSystem(std::string(), path); } -void WebContents::RemoveWorkSpace(gin::Arguments* args, +void WebContents::RemoveWorkSpace(v8::Isolate* const isolate, const base::FilePath& path) { if (path.empty()) { - gin_helper::ErrorThrower(args->isolate()) - .ThrowError("path cannot be empty"); + gin_helper::ErrorThrower{isolate}.ThrowError("path cannot be empty"); return; } DevToolsRemoveFileSystem(path); @@ -3508,8 +3506,8 @@ void WebContents::EndFrameSubscription() { frame_subscriber_.reset(); } -void WebContents::StartDrag(const gin_helper::Dictionary& item, - gin::Arguments* args) { +void WebContents::StartDrag(v8::Isolate* const isolate, + const gin_helper::Dictionary& item) { base::FilePath file; std::vector<base::FilePath> files; if (!item.Get("files", &files) && item.Get("file", &file)) { @@ -3518,13 +3516,13 @@ void WebContents::StartDrag(const gin_helper::Dictionary& item, v8::Local<v8::Value> icon_value; if (!item.Get("icon", &icon_value)) { - gin_helper::ErrorThrower(args->isolate()) - .ThrowError("'icon' parameter is required"); + gin_helper::ErrorThrower{isolate}.ThrowError( + "'icon' parameter is required"); return; } NativeImage* icon = nullptr; - if (!NativeImage::TryConvertNativeImage(args->isolate(), icon_value, &icon) || + if (!NativeImage::TryConvertNativeImage(isolate, icon_value, &icon) || icon->image().IsEmpty()) { return; } @@ -3534,8 +3532,8 @@ void WebContents::StartDrag(const gin_helper::Dictionary& item, base::CurrentThread::ScopedAllowApplicationTasksInNativeNestedLoop allow; DragFileItems(files, icon->image(), web_contents()->GetNativeView()); } else { - gin_helper::ErrorThrower(args->isolate()) - .ThrowError("Must specify either 'file' or 'files' option"); + gin_helper::ErrorThrower{isolate}.ThrowError( + "Must specify either 'file' or 'files' option"); } } diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h index 9e506880f6b57..084fd3e0f1e6f 100644 --- a/shell/browser/api/electron_api_web_contents.h +++ b/shell/browser/api/electron_api_web_contents.h @@ -267,8 +267,8 @@ class WebContents final : public ExclusiveAccessContext, void SetNextChildWebPreferences(const gin_helper::Dictionary); // DevTools workspace api. - void AddWorkSpace(gin::Arguments* args, const base::FilePath& path); - void RemoveWorkSpace(gin::Arguments* args, const base::FilePath& path); + void AddWorkSpace(v8::Isolate* isolate, const base::FilePath& path); + void RemoveWorkSpace(v8::Isolate* isolate, const base::FilePath& path); // Editing commands. void Undo(); @@ -303,7 +303,7 @@ class WebContents final : public ExclusiveAccessContext, void EndFrameSubscription(); // Dragging native items. - void StartDrag(const gin_helper::Dictionary& item, gin::Arguments* args); + void StartDrag(v8::Isolate* isolate, const gin_helper::Dictionary& item); // Captures the page with |rect|, |callback| would be called when capturing is // done. diff --git a/shell/renderer/api/electron_api_context_bridge.cc b/shell/renderer/api/electron_api_context_bridge.cc index 23b4d507a6ba5..3efed5f4d5dbe 100644 --- a/shell/renderer/api/electron_api_context_bridge.cc +++ b/shell/renderer/api/electron_api_context_bridge.cc @@ -875,8 +875,7 @@ bool OverrideGlobalPropertyFromIsolatedWorld( v8::Isolate* const isolate, const std::vector<std::string>& key_path, v8::Local<v8::Object> getter, - v8::Local<v8::Value> setter, - gin_helper::Arguments* args) { + v8::Local<v8::Value> setter) { if (key_path.empty()) return false; @@ -917,7 +916,7 @@ bool OverrideGlobalPropertyFromIsolatedWorld( v8::PropertyDescriptor desc(getter_proxy, setter_proxy); bool success = IsTrue(target_object->DefineProperty( - main_context, gin::StringToV8(args->isolate(), final_key), desc)); + main_context, gin::StringToV8(isolate, final_key), desc)); DCHECK(success); return success; } From 12159921cbdb0c2c093387fe0f148df25e46560d Mon Sep 17 00:00:00 2001 From: John Kleinschmidt <nilay2014@gmail.com> Date: Mon, 15 Sep 2025 16:31:49 -0400 Subject: [PATCH 074/268] ci: Use Local Execution, Remote Caching (LERC) for fork PRS (#48319) cleanup --- .github/actions/build-electron/action.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/actions/build-electron/action.yml b/.github/actions/build-electron/action.yml index 38e514a553403..76d0aed0eafdf 100644 --- a/.github/actions/build-electron/action.yml +++ b/.github/actions/build-electron/action.yml @@ -44,6 +44,14 @@ runs: - name: Add Clang problem matcher shell: bash run: echo "::add-matcher::src/electron/.github/problem-matchers/clang.json" + - name: Setup Siso for fork pull requests + if: ${{ github.event.pull_request.head.repo.full_name != github.repository }} + shell: bash + run: | + # Use Local Execution, Remote Caching (LERC). Checks the remote cache for action + # matches and uses existing results if a match is found. If not, execution of the + # action is performed locally. + echo "RBE_exec_strategy=local" >> $GITHUB_ENV - name: Build Electron ${{ inputs.step-suffix }} shell: bash run: | From 9da32bbbd6e9ea7b0bfcf4d39b8cfe4cf9c25020 Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Mon, 15 Sep 2025 23:00:58 +0200 Subject: [PATCH 075/268] feat: add `fileSystem` to `ses.setPermissionCheckHandler` (#48170) feat: add fileSystem to ses.setPermissionCheckHandler --- docs/api/session.md | 11 +- shell/browser/electron_permission_manager.cc | 8 + shell/browser/electron_permission_manager.h | 3 + .../file_system_access_permission_context.cc | 43 ++- spec/chromium-spec.ts | 271 +++++++++++++++++- spec/fixtures/file-system/persist.txt | 1 + .../{test-writable.html => test-perms.html} | 10 +- 7 files changed, 325 insertions(+), 22 deletions(-) create mode 100644 spec/fixtures/file-system/persist.txt rename spec/fixtures/file-system/{test-writable.html => test-perms.html} (59%) diff --git a/docs/api/session.md b/docs/api/session.md index 1d13094426a8c..96f0ab6e9a1b7 100644 --- a/docs/api/session.md +++ b/docs/api/session.md @@ -939,14 +939,18 @@ session.fromPartition('some-partition').setPermissionRequestHandler((webContents * `top-level-storage-access` - Allow top-level sites to request third-party cookie access on behalf of embedded content originating from another site in the same related website set using the [Storage Access API](https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API). * `usb` - Expose non-standard Universal Serial Bus (USB) compatible devices services to the web with the [WebUSB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API). * `deprecated-sync-clipboard-read` _Deprecated_ - Request access to run `document.execCommand("paste")` + * `fileSystem` - Access to read, write, and file management capabilities using the [File System API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API). * `requestingOrigin` string - The origin URL of the permission check * `details` Object - Some properties are only available on certain permission types. * `embeddingOrigin` string (optional) - The origin of the frame embedding the frame that made the permission check. Only set for cross-origin sub frames making permission checks. * `securityOrigin` string (optional) - The security origin of the `media` check. * `mediaType` string (optional) - The type of media access being requested, can be `video`, - `audio` or `unknown` + `audio` or `unknown`. * `requestingUrl` string (optional) - The last URL the requesting frame loaded. This is not provided for cross-origin sub frames making permission checks. - * `isMainFrame` boolean - Whether the frame making the request is the main frame + * `isMainFrame` boolean - Whether the frame making the request is the main frame. + * `filePath` string (optional) - The path of a `fileSystem` request. + * `isDirectory` boolean (optional) - Whether a `fileSystem` request is a directory. + * `fileAccessType` string (optional) - The access type of a `fileSystem` request. Can be `writable` or `readable`. Sets the handler which can be used to respond to permission checks for the `session`. Returning `true` will allow the permission and `false` will reject it. Please note that @@ -968,6 +972,9 @@ session.fromPartition('some-partition').setPermissionCheckHandler((webContents, }) ``` +> [!NOTE] +> `isMainFrame` will always be `false` for a `fileSystem` request as a result of Chromium limitations. + #### `ses.setDisplayMediaRequestHandler(handler[, opts])` * `handler` Function | null diff --git a/shell/browser/electron_permission_manager.cc b/shell/browser/electron_permission_manager.cc index 77b55f37bf851..d9ff4b666373a 100644 --- a/shell/browser/electron_permission_manager.cc +++ b/shell/browser/electron_permission_manager.cc @@ -146,6 +146,14 @@ void ElectronPermissionManager::SetBluetoothPairingHandler( bluetooth_pairing_handler_ = handler; } +bool ElectronPermissionManager::HasPermissionRequestHandler() const { + return !request_handler_.is_null(); +} + +bool ElectronPermissionManager::HasPermissionCheckHandler() const { + return !check_handler_.is_null(); +} + void ElectronPermissionManager::RequestPermissionWithDetails( blink::mojom::PermissionDescriptorPtr permission, content::RenderFrameHost* render_frame_host, diff --git a/shell/browser/electron_permission_manager.h b/shell/browser/electron_permission_manager.h index a1bb9172176f4..711064ab566fc 100644 --- a/shell/browser/electron_permission_manager.h +++ b/shell/browser/electron_permission_manager.h @@ -81,6 +81,9 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate { void SetProtectedUSBHandler(const ProtectedUSBHandler& handler); void SetBluetoothPairingHandler(const BluetoothPairingHandler& handler); + bool HasPermissionRequestHandler() const; + bool HasPermissionCheckHandler() const; + void CheckBluetoothDevicePair(gin_helper::Dictionary details, PairCallback pair_callback) const; diff --git a/shell/browser/file_system_access/file_system_access_permission_context.cc b/shell/browser/file_system_access/file_system_access_permission_context.cc index 654ce61d16e34..2dcbfcb95cf93 100644 --- a/shell/browser/file_system_access/file_system_access_permission_context.cc +++ b/shell/browser/file_system_access/file_system_access_permission_context.cc @@ -257,6 +257,28 @@ class FileSystemAccessPermissionContext::PermissionGrantImpl // FileSystemAccessPermissionGrant: PermissionStatus GetStatus() override { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + auto* permission_manager = + static_cast<electron::ElectronPermissionManager*>( + context_->browser_context()->GetPermissionControllerDelegate()); + if (permission_manager && permission_manager->HasPermissionCheckHandler()) { + base::Value::Dict details; + details.Set("filePath", base::FilePathToValue(path_info_.path)); + details.Set("isDirectory", handle_type_ == HandleType::kDirectory); + details.Set("fileAccessType", + type_ == GrantType::kWrite ? "writable" : "readable"); + + bool granted = permission_manager->CheckPermissionWithDetails( + blink::PermissionType::FILE_SYSTEM, nullptr, origin_.GetURL(), + std::move(details)); + return granted ? PermissionStatus::GRANTED : PermissionStatus::DENIED; + } + + return status_; + } + + PermissionStatus GetActivePermissionStatus() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return status_; } @@ -279,8 +301,8 @@ class FileSystemAccessPermissionContext::PermissionGrantImpl // Check if a permission request has already been processed previously. This // check is done first because we don't want to reset the status of a // permission if it has already been granted. - if (GetStatus() != PermissionStatus::ASK || !context_) { - if (GetStatus() == PermissionStatus::GRANTED) { + if (GetActivePermissionStatus() != PermissionStatus::ASK || !context_) { + if (GetActivePermissionStatus() == PermissionStatus::GRANTED) { SetStatus(PermissionStatus::GRANTED); } std::move(callback).Run(PermissionRequestOutcome::kRequestAborted); @@ -294,7 +316,7 @@ class FileSystemAccessPermissionContext::PermissionGrantImpl return; } - // Don't request permission for an inactive RenderFrameHost as the + // Don't request permission for an inactive RenderFrameHost as the // page might not distinguish properly between user denying the permission // and automatic rejection. if (rfh->IsInactiveAndDisallowActivation( @@ -347,7 +369,7 @@ class FileSystemAccessPermissionContext::PermissionGrantImpl permission_manager->RequestPermissionWithDetails( content::PermissionDescriptorUtil:: CreatePermissionDescriptorForPermissionType(type), - rfh, origin, false, std::move(details), + rfh, origin, rfh->HasTransientUserActivation(), std::move(details), base::BindOnce(&PermissionGrantImpl::OnPermissionRequestResult, this, std::move(callback))); } @@ -394,7 +416,8 @@ class FileSystemAccessPermissionContext::PermissionGrantImpl return; } - DCHECK_EQ(entry_it->second->GetStatus(), PermissionStatus::GRANTED); + DCHECK_EQ(entry_it->second->GetActivePermissionStatus(), + PermissionStatus::GRANTED); auto* const grant_impl = entry_it->second; grant_impl->SetPath(new_path); @@ -973,7 +996,8 @@ bool FileSystemAccessPermissionContext::OriginHasReadAccess( auto it = active_permissions_map_.find(origin); if (it != active_permissions_map_.end()) { return std::ranges::any_of(it->second.read_grants, [&](const auto& grant) { - return grant.second->GetStatus() == PermissionStatus::GRANTED; + return grant.second->GetActivePermissionStatus() == + PermissionStatus::GRANTED; }); } @@ -987,7 +1011,8 @@ bool FileSystemAccessPermissionContext::OriginHasWriteAccess( auto it = active_permissions_map_.find(origin); if (it != active_permissions_map_.end()) { return std::ranges::any_of(it->second.write_grants, [&](const auto& grant) { - return grant.second->GetStatus() == PermissionStatus::GRANTED; + return grant.second->GetActivePermissionStatus() == + PermissionStatus::GRANTED; }); } @@ -1041,7 +1066,7 @@ bool FileSystemAccessPermissionContext::AncestorHasActivePermission( parent = parent.DirName()) { auto i = relevant_grants.find(parent); if (i != relevant_grants.end() && i->second && - i->second->GetStatus() == PermissionStatus::GRANTED) { + i->second->GetActivePermissionStatus() == PermissionStatus::GRANTED) { return true; } } @@ -1064,7 +1089,7 @@ void FileSystemAccessPermissionContext::PermissionGrantDestroyed( // be granted but won't be visible in any UI because the permission context // isn't tracking them anymore. if (grant_it == grants.end()) { - DCHECK_EQ(PermissionStatus::DENIED, grant->GetStatus()); + DCHECK_EQ(PermissionStatus::DENIED, grant->GetActivePermissionStatus()); return; } diff --git a/spec/chromium-spec.ts b/spec/chromium-spec.ts index ec86015aa7077..4a32f9d9b9ab5 100644 --- a/spec/chromium-spec.ts +++ b/spec/chromium-spec.ts @@ -901,13 +901,15 @@ describe('chromium features', () => { }); describe('File System API,', () => { - afterEach(closeAllWindows); + let w: BrowserWindow | null = null; + afterEach(() => { session.defaultSession.setPermissionRequestHandler(null); + closeAllWindows(); }); it('allows access by default to reading an OPFS file', async () => { - const w = new BrowserWindow({ + w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, @@ -929,7 +931,7 @@ describe('chromium features', () => { }); it('fileHandle.queryPermission by default has permission to read and write to OPFS files', async () => { - const w = new BrowserWindow({ + w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, @@ -951,7 +953,8 @@ describe('chromium features', () => { }); it('fileHandle.requestPermission automatically grants permission to read and write to OPFS files', async () => { - const w = new BrowserWindow({ + w = new BrowserWindow({ + show: false, webPreferences: { nodeIntegration: true, partition: 'file-system-spec', @@ -971,8 +974,8 @@ describe('chromium features', () => { expect(status).to.equal('granted'); }); - it('requests permission when trying to create a writable file handle', (done) => { - const writablePath = path.join(fixturesPath, 'file-system', 'test-writable.html'); + it('allows permission when trying to create a writable file handle', (done) => { + const writablePath = path.join(fixturesPath, 'file-system', 'test-perms.html'); const testFile = path.join(fixturesPath, 'file-system', 'test.txt'); const w = new BrowserWindow({ @@ -1000,9 +1003,9 @@ describe('chromium features', () => { ipcMain.once('did-create-file-handle', async () => { const result = await w.webContents.executeJavaScript(` - new Promise((resolve, reject) => { + new Promise(async (resolve, reject) => { try { - const writable = fileHandle.createWritable(); + const writable = await handle.createWritable(); resolve(true); } catch { resolve(false); @@ -1021,6 +1024,258 @@ describe('chromium features', () => { w.webContents.paste(); }); }); + + it('denies permission when trying to create a writable file handle', (done) => { + const writablePath = path.join(fixturesPath, 'file-system', 'test-perms.html'); + const testFile = path.join(fixturesPath, 'file-system', 'test.txt'); + + const w = new BrowserWindow({ + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + sandbox: false + } + }); + + w.webContents.session.setPermissionRequestHandler((wc, permission, callback, details) => { + expect(permission).to.equal('fileSystem'); + + const { href } = url.pathToFileURL(writablePath); + expect(details).to.deep.equal({ + fileAccessType: 'writable', + isDirectory: false, + isMainFrame: true, + filePath: testFile, + requestingUrl: href + }); + + callback(false); + }); + + ipcMain.once('did-create-file-handle', async () => { + const result = await w.webContents.executeJavaScript(` + new Promise(async (resolve, reject) => { + try { + const writable = await handle.createWritable(); + resolve(true); + } catch { + resolve(false); + } + }) + `, true); + expect(result).to.be.false(); + done(); + }); + + w.loadFile(writablePath); + + w.webContents.once('did-finish-load', () => { + // @ts-expect-error Undocumented testing method. + clipboard._writeFilesForTesting([testFile]); + w.webContents.paste(); + }); + }); + + it('calls twice when trying to query a read/write file handle permissions', (done) => { + const writablePath = path.join(fixturesPath, 'file-system', 'test-perms.html'); + const testFile = path.join(fixturesPath, 'file-system', 'test.txt'); + + const w = new BrowserWindow({ + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + sandbox: false + } + }); + + let calls = 0; + w.webContents.session.setPermissionCheckHandler((wc, permission, origin, details) => { + if (permission === 'fileSystem') { + const { fileAccessType, isDirectory, filePath } = details; + expect(['writable', 'readable']).to.contain(fileAccessType); + expect(isDirectory).to.be.false(); + expect(filePath).to.equal(testFile); + calls++; + return true; + } + + return false; + }); + + ipcMain.once('did-create-file-handle', async () => { + const permission = await w.webContents.executeJavaScript(` + new Promise(async (resolve, reject) => { + try { + const permission = await handle.queryPermission({ mode: 'readwrite' }); + resolve(permission); + } catch { + resolve('denied'); + } + }) + `, true); + expect(permission).to.equal('granted'); + expect(calls).to.equal(2); + done(); + }); + + w.loadFile(writablePath); + + w.webContents.once('did-finish-load', () => { + // @ts-expect-error Undocumented testing method. + clipboard._writeFilesForTesting([testFile]); + w.webContents.paste(); + }); + }); + + it('correctly denies permissions after creating a readable directory handle', (done) => { + const permPath = path.join(fixturesPath, 'file-system', 'test-perms.html'); + const testDir = path.join(fixturesPath, 'file-system'); + + const w = new BrowserWindow({ + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + sandbox: false + } + }); + + w.webContents.session.setPermissionCheckHandler((wc, permission, origin, details) => { + expect(permission).to.equal('fileSystem'); + + const { fileAccessType, isDirectory, filePath } = details; + expect(fileAccessType).to.equal('readable'); + expect(isDirectory).to.be.true(); + expect(filePath).to.equal(testDir); + return false; + }); + + ipcMain.once('did-create-directory-handle', async () => { + const permission = await w.webContents.executeJavaScript(` + new Promise(async (resolve, reject) => { + try { + const permission = await handle.queryPermission({ mode: 'read' }); + resolve(permission); + } catch { + resolve('denied'); + } + }) + `, true); + expect(permission).to.equal('denied'); + done(); + }); + + w.loadFile(permPath); + + w.webContents.once('did-finish-load', () => { + // @ts-expect-error Undocumented testing method. + clipboard._writeFilesForTesting([testDir]); + w.webContents.paste(); + }); + }); + + it('correctly allows permissions after creating a readable directory handle', (done) => { + const permPath = path.join(fixturesPath, 'file-system', 'test-perms.html'); + const testDir = path.join(fixturesPath, 'file-system'); + + const w = new BrowserWindow({ + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + sandbox: false + } + }); + + w.webContents.session.setPermissionCheckHandler((wc, permission, origin, details) => { + if (permission === 'fileSystem') { + const { fileAccessType, isDirectory, filePath } = details; + expect(fileAccessType).to.equal('readable'); + expect(isDirectory).to.be.true(); + expect(filePath).to.equal(testDir); + return true; + } + return false; + }); + + ipcMain.once('did-create-directory-handle', async () => { + const permission = await w.webContents.executeJavaScript(` + new Promise(async (resolve, reject) => { + try { + const permission = await handle.queryPermission({ mode: 'read' }); + resolve(permission); + } catch { + resolve('denied'); + } + }) + `, true); + expect(permission).to.equal('granted'); + done(); + }); + + w.loadFile(permPath); + + w.webContents.once('did-finish-load', () => { + // @ts-expect-error Undocumented testing method. + clipboard._writeFilesForTesting([testDir]); + w.webContents.paste(); + }); + }); + + it('allows in-session persistence of granted file permissions', (done) => { + const writablePath = path.join(fixturesPath, 'file-system', 'test-perms.html'); + const testFile = path.join(fixturesPath, 'file-system', 'persist.txt'); + + const w = new BrowserWindow({ + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + sandbox: false + } + }); + + w.webContents.session.setPermissionRequestHandler((_wc, _permission, callback) => { + callback(true); + }); + + w.webContents.session.setPermissionCheckHandler((_wc, permission, _origin, details) => { + if (permission === 'fileSystem') { + const { fileAccessType, isDirectory, filePath } = details; + expect(fileAccessType).to.deep.equal('readable'); + expect(isDirectory).to.be.false(); + expect(filePath).to.equal(testFile); + return true; + } + return false; + }); + + let reload = true; + ipcMain.on('did-create-file-handle', async () => { + if (reload) { + w.webContents.reload(); + reload = false; + } else { + const permission = await w.webContents.executeJavaScript(` + new Promise(async (resolve, reject) => { + try { + const permission = await handle.queryPermission({ mode: 'read' }); + resolve(permission); + } catch { + resolve('denied'); + } + }) + `, true); + expect(permission).to.equal('granted'); + done(); + } + }); + + w.loadFile(writablePath); + + w.webContents.on('did-finish-load', () => { + // @ts-expect-error Undocumented testing method. + clipboard._writeFilesForTesting([testFile]); + w.webContents.paste(); + }); + }); }); describe('web workers', () => { diff --git a/spec/fixtures/file-system/persist.txt b/spec/fixtures/file-system/persist.txt new file mode 100644 index 0000000000000..4750e51cc1a56 --- /dev/null +++ b/spec/fixtures/file-system/persist.txt @@ -0,0 +1 @@ +hello persist \ No newline at end of file diff --git a/spec/fixtures/file-system/test-writable.html b/spec/fixtures/file-system/test-perms.html similarity index 59% rename from spec/fixtures/file-system/test-writable.html rename to spec/fixtures/file-system/test-perms.html index 6d7012192b143..24a4787d257cc 100644 --- a/spec/fixtures/file-system/test-writable.html +++ b/spec/fixtures/file-system/test-perms.html @@ -10,13 +10,17 @@ <script> const { ipcRenderer } = require('electron') - let fileHandle = null; + let handle = null; let sent = false; window.document.onpaste = async (event) => { const fileItem = event.clipboardData.items[0]; - fileHandle = await fileItem.getAsFileSystemHandle(); + handle = await fileItem.getAsFileSystemHandle(); if (!sent) { - ipcRenderer.send('did-create-file-handle'); + if (handle.kind === 'file') { + ipcRenderer.send('did-create-file-handle'); + } else { + ipcRenderer.send('did-create-directory-handle'); + } sent = true; } }; From 13f40d0fe6cb46c15a7f57cb6b2c0c75764fb52e Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Mon, 15 Sep 2025 16:29:46 -0500 Subject: [PATCH 076/268] refactor: make api::NetLog inherit from gin::Wrappable (#48308) * refactor: remove unused v8::Isolate* arg from NetLog ctor * refactor: allocate api::NetLog on cpp heap * refactor: make electron::api::Session::net_log_ a cppgc::Member<api::NetLog> * refactor: remove unnecessary EscapableHandleScope * chore: code style consistency --- ...ctron_objects_to_wrappablepointertag.patch | 5 +-- shell/browser/api/electron_api_net_log.cc | 27 ++++++++------ shell/browser/api/electron_api_net_log.h | 36 +++++++++---------- shell/browser/api/electron_api_session.cc | 11 +++--- shell/browser/api/electron_api_session.h | 4 ++- 5 files changed, 47 insertions(+), 36 deletions(-) diff --git a/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch b/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch index 807c2c461f6c0..c91b76f1e3a4b 100644 --- a/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch +++ b/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch @@ -8,10 +8,10 @@ electron objects that extend gin::Wrappable and gets allocated on the cpp heap diff --git a/gin/public/wrappable_pointer_tags.h b/gin/public/wrappable_pointer_tags.h -index 80ec409efe1635390887d1324be661643818abff..2b82f96d12715b6476c456b73dfd1a7342736f8e 100644 +index 80ec409efe1635390887d1324be661643818abff..2e20b63d1fca56efb43c18d0fa04b1e2b4cf339a 100644 --- a/gin/public/wrappable_pointer_tags.h +++ b/gin/public/wrappable_pointer_tags.h -@@ -66,7 +66,11 @@ enum WrappablePointerTag : uint16_t { +@@ -66,7 +66,12 @@ enum WrappablePointerTag : uint16_t { kTextInputControllerBindings, // content::TextInputControllerBindings kWebAXObjectProxy, // content::WebAXObjectProxy kWrappedExceptionHandler, // extensions::WrappedExceptionHandler @@ -19,6 +19,7 @@ index 80ec409efe1635390887d1324be661643818abff..2b82f96d12715b6476c456b73dfd1a73 + kElectronApp, // electron::api::App + kElectronDebugger, // electron::api::Debugger + kElectronEvent, // gin_helper::internal::Event ++ kElectronNetLog, // electron::api::NetLog + kElectronSession, // electron::api::Session + kLastPointerTag = kElectronEvent, }; diff --git a/shell/browser/api/electron_api_net_log.cc b/shell/browser/api/electron_api_net_log.cc index 0a6059e51f0a9..5d91452046581 100644 --- a/shell/browser/api/electron_api_net_log.cc +++ b/shell/browser/api/electron_api_net_log.cc @@ -22,6 +22,8 @@ #include "shell/common/gin_converters/file_path_converter.h" #include "shell/common/gin_helper/dictionary.h" #include "shell/common/gin_helper/handle.h" +#include "v8/include/cppgc/allocation.h" +#include "v8/include/v8-cppgc.h" namespace gin { @@ -79,9 +81,10 @@ void ResolvePromiseWithNetError(gin_helper::Promise<void> promise, namespace api { -gin::DeprecatedWrapperInfo NetLog::kWrapperInfo = {gin::kEmbedderNativeGin}; +gin::WrapperInfo NetLog::kWrapperInfo = {{gin::kEmbedderNativeGin}, + gin::kElectronNetLog}; -NetLog::NetLog(v8::Isolate* isolate, ElectronBrowserContext* browser_context) +NetLog::NetLog(ElectronBrowserContext* const browser_context) : browser_context_(browser_context) { file_task_runner_ = CreateFileTaskRunner(); } @@ -219,23 +222,25 @@ v8::Local<v8::Promise> NetLog::StopLogging(v8::Isolate* const isolate) { gin::ObjectTemplateBuilder NetLog::GetObjectTemplateBuilder( v8::Isolate* isolate) { - return gin_helper::DeprecatedWrappable<NetLog>::GetObjectTemplateBuilder( - isolate) + return gin::Wrappable<NetLog>::GetObjectTemplateBuilder(isolate) .SetProperty("currentlyLogging", &NetLog::IsCurrentlyLogging) .SetMethod("startLogging", &NetLog::StartLogging) .SetMethod("stopLogging", &NetLog::StopLogging); } -const char* NetLog::GetTypeName() { - return "NetLog"; +const gin::WrapperInfo* NetLog::wrapper_info() const { + return &kWrapperInfo; +} + +const char* NetLog::GetHumanReadableName() const { + return "Electron / NetLog"; } // static -gin_helper::Handle<NetLog> NetLog::Create( - v8::Isolate* isolate, - ElectronBrowserContext* browser_context) { - return gin_helper::CreateHandle(isolate, - new NetLog(isolate, browser_context)); +NetLog* NetLog::Create(v8::Isolate* isolate, + ElectronBrowserContext* browser_context) { + return cppgc::MakeGarbageCollected<NetLog>( + isolate->GetCppHeap()->GetAllocationHandle(), browser_context); } } // namespace api diff --git a/shell/browser/api/electron_api_net_log.h b/shell/browser/api/electron_api_net_log.h index a03de704e2045..108a867982ca9 100644 --- a/shell/browser/api/electron_api_net_log.h +++ b/shell/browser/api/electron_api_net_log.h @@ -10,11 +10,11 @@ #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "base/values.h" +#include "gin/wrappable.h" #include "mojo/public/cpp/bindings/remote.h" #include "net/log/net_log_capture_mode.h" #include "services/network/public/mojom/net_log.mojom.h" #include "shell/common/gin_helper/promise.h" -#include "shell/common/gin_helper/wrappable.h" namespace base { class FilePath; @@ -37,32 +37,32 @@ class ElectronBrowserContext; namespace api { // The code is referenced from the net_log::NetExportFileWriter class. -class NetLog final : public gin_helper::DeprecatedWrappable<NetLog> { +class NetLog final : public gin::Wrappable<NetLog> { public: - static gin_helper::Handle<NetLog> Create( - v8::Isolate* isolate, - ElectronBrowserContext* browser_context); + static NetLog* Create(v8::Isolate* isolate, + ElectronBrowserContext* browser_context); - v8::Local<v8::Promise> StartLogging(base::FilePath log_path, - gin::Arguments* args); - v8::Local<v8::Promise> StopLogging(v8::Isolate* isolate); - bool IsCurrentlyLogging() const; + // Make public for cppgc::MakeGarbageCollected. + explicit NetLog(ElectronBrowserContext* browser_context); + ~NetLog() override; + + // disable copy + NetLog(const NetLog&) = delete; + NetLog& operator=(const NetLog&) = delete; // gin_helper::Wrappable - static gin::DeprecatedWrapperInfo kWrapperInfo; + static gin::WrapperInfo kWrapperInfo; gin::ObjectTemplateBuilder GetObjectTemplateBuilder( v8::Isolate* isolate) override; - const char* GetTypeName() override; + const gin::WrapperInfo* wrapper_info() const override; + const char* GetHumanReadableName() const override; - // disable copy - NetLog(const NetLog&) = delete; - NetLog& operator=(const NetLog&) = delete; + v8::Local<v8::Promise> StartLogging(base::FilePath log_path, + gin::Arguments* args); + v8::Local<v8::Promise> StopLogging(v8::Isolate* isolate); + bool IsCurrentlyLogging() const; protected: - explicit NetLog(v8::Isolate* isolate, - ElectronBrowserContext* browser_context); - ~NetLog() override; - void OnConnectionError(); void StartNetLogAfterCreateFile(net::NetLogCaptureMode capture_mode, diff --git a/shell/browser/api/electron_api_session.cc b/shell/browser/api/electron_api_session.cc index 2bb6795d66d49..bd13edd376b56 100644 --- a/shell/browser/api/electron_api_session.cc +++ b/shell/browser/api/electron_api_session.cc @@ -1361,11 +1361,14 @@ v8::Local<v8::Value> Session::WebRequest(v8::Isolate* isolate) { } v8::Local<v8::Value> Session::NetLog(v8::Isolate* isolate) { - if (net_log_.IsEmptyThreadSafe()) { - auto handle = NetLog::Create(isolate, browser_context()); - net_log_.Reset(isolate, handle.ToV8()); + if (!net_log_) { + net_log_ = NetLog::Create(isolate, browser_context()); } - return net_log_.Get(isolate); + + v8::Local<v8::Object> wrapper; + return net_log_->GetWrapper(isolate).ToLocal(&wrapper) + ? wrapper.As<v8::Value>() + : v8::Null(isolate); } static void StartPreconnectOnUI(ElectronBrowserContext* browser_context, diff --git a/shell/browser/api/electron_api_session.h b/shell/browser/api/electron_api_session.h index 822603fa14ce6..c69e21e724f95 100644 --- a/shell/browser/api/electron_api_session.h +++ b/shell/browser/api/electron_api_session.h @@ -60,6 +60,8 @@ struct PreloadScript; namespace api { +class NetLog; + class Session final : public gin::Wrappable<Session>, public gin_helper::Constructible<Session>, public gin_helper::EventEmitterMixin<Session>, @@ -208,7 +210,7 @@ class Session final : public gin::Wrappable<Session>, v8::TracedReference<v8::Value> cookies_; v8::TracedReference<v8::Value> extensions_; v8::TracedReference<v8::Value> protocol_; - v8::TracedReference<v8::Value> net_log_; + cppgc::Member<api::NetLog> net_log_; v8::TracedReference<v8::Value> service_worker_context_; v8::TracedReference<v8::Value> web_request_; From d865e7a7e7ca75e0f6dbe0fc8f8930d80665a1fb Mon Sep 17 00:00:00 2001 From: Robo <nilay2014@gmail.com> Date: Tue, 16 Sep 2025 06:56:38 +0900 Subject: [PATCH 077/268] fix: remove unneeded handlescope from JS callbacks (#48318) fix: remove handlescope from JS callbacks --- shell/browser/api/electron_api_session.cc | 13 ++++--------- shell/browser/api/electron_api_web_contents.cc | 2 -- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/shell/browser/api/electron_api_session.cc b/shell/browser/api/electron_api_session.cc index bd13edd376b56..876fc93e821e8 100644 --- a/shell/browser/api/electron_api_session.cc +++ b/shell/browser/api/electron_api_session.cc @@ -1700,14 +1700,11 @@ Session* Session::CreateFrom(v8::Isolate* isolate, return nullptr; } - { - v8::HandleScope handle_scope(isolate); - v8::Local<v8::Object> wrapper; - if (!session->GetWrapper(isolate).ToLocal(&wrapper)) { - return nullptr; - } - App::Get()->EmitWithoutEvent("session-created", wrapper); + v8::Local<v8::Object> wrapper; + if (!session->GetWrapper(isolate).ToLocal(&wrapper)) { + return nullptr; } + App::Get()->EmitWithoutEvent("session-created", wrapper); return session; } @@ -1886,7 +1883,6 @@ v8::Local<v8::Value> FromPartition(const std::string& partition, Session::FromPartition(args->isolate(), partition, std::move(options)); if (session) { - v8::HandleScope handle_scope(args->isolate()); v8::Local<v8::Object> wrapper; if (!session->GetWrapper(args->isolate()).ToLocal(&wrapper)) { return v8::Null(args->isolate()); @@ -1908,7 +1904,6 @@ v8::Local<v8::Value> FromPath(const base::FilePath& path, Session* session = Session::FromPath(args, path, std::move(options)); if (session) { - v8::HandleScope handle_scope(args->isolate()); v8::Local<v8::Object> wrapper; if (!session->GetWrapper(args->isolate()).ToLocal(&wrapper)) { return v8::Null(args->isolate()); diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index e4839a64a80ea..194708bb7c953 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -3756,7 +3756,6 @@ v8::Local<v8::Value> WebContents::GetOwnerBrowserWindow( } v8::Local<v8::Value> WebContents::Session(v8::Isolate* isolate) { - v8::HandleScope handle_scope(isolate); v8::Local<v8::Object> wrapper; if (!session_->GetWrapper(isolate).ToLocal(&wrapper)) { return v8::Null(isolate); @@ -3806,7 +3805,6 @@ v8::Local<v8::Value> WebContents::Debugger(v8::Isolate* isolate) { debugger_ = electron::api::Debugger::Create(isolate, web_contents()); } - v8::HandleScope handle_scope{isolate}; v8::Local<v8::Object> wrapper; if (!debugger_->GetWrapper(isolate).ToLocal(&wrapper)) { return v8::Null(isolate); From 019ac290b657d015e91d5e88bf056d2b5d48fbaf Mon Sep 17 00:00:00 2001 From: Keeley Hammond <nilay2014@gmail.com> Date: Tue, 16 Sep 2025 19:08:15 -0700 Subject: [PATCH 078/268] chore: cherry-pick ec6c18478382 from v8 (#48335) * chore: cherry-pick ec6c18478382 from v8 * chore: update patches --- patches/v8/.patches | 1 + patches/v8/cherry-pick-ec6c18478382.patch | 45 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 patches/v8/cherry-pick-ec6c18478382.patch diff --git a/patches/v8/.patches b/patches/v8/.patches index dc98544242e85..19408f8045162 100644 --- a/patches/v8/.patches +++ b/patches/v8/.patches @@ -1 +1,2 @@ chore_allow_customizing_microtask_policy_per_context.patch +cherry-pick-ec6c18478382.patch diff --git a/patches/v8/cherry-pick-ec6c18478382.patch b/patches/v8/cherry-pick-ec6c18478382.patch new file mode 100644 index 0000000000000..3efa9c04d5ec0 --- /dev/null +++ b/patches/v8/cherry-pick-ec6c18478382.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Darius Mercadier <dmercadier@chromium.org> +Date: Tue, 16 Sep 2025 16:40:24 +0200 +Subject: Don't assume that upper 32-bit of Int32MulOvfCheck are 0 + +Because Arm64 doesn't have a flag-setting 32-bit multiplication, +which means that instead with use a 64-bit multiplication, and compare +result.X() and result.W() to check if an overflow happened. But this +leads to the upper 32-bit not being zeroed. + +Fixed: 445380761 +Change-Id: I31287faf37dc615695047021324e9d1d802cbec2 +Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6954290 +Auto-Submit: Darius Mercadier <dmercadier@chromium.org> +Commit-Queue: Leszek Swirski <leszeks@chromium.org> +Reviewed-by: Leszek Swirski <leszeks@chromium.org> +Cr-Commit-Position: refs/heads/main@{#102530} + +diff --git a/src/compiler/backend/arm64/instruction-selector-arm64.cc b/src/compiler/backend/arm64/instruction-selector-arm64.cc +index 60ff1ee97931edfcca28b6f5f7c4918d015af974..0212f4570750599bc266a1cd8c9efa19ea26e85c 100644 +--- a/src/compiler/backend/arm64/instruction-selector-arm64.cc ++++ b/src/compiler/backend/arm64/instruction-selector-arm64.cc +@@ -2958,9 +2958,19 @@ bool InstructionSelector::ZeroExtendsWord32ToWord64NoPhis(OpIndex node) { + return op.Cast<ShiftOp>().rep == WordRepresentation::Word32(); + case Opcode::kComparison: + return op.Cast<ComparisonOp>().rep == RegisterRepresentation::Word32(); +- case Opcode::kOverflowCheckedBinop: +- return op.Cast<OverflowCheckedBinopOp>().rep == +- WordRepresentation::Word32(); ++ case Opcode::kOverflowCheckedBinop: { ++ const OverflowCheckedBinopOp& binop = op.Cast<OverflowCheckedBinopOp>(); ++ if (binop.rep != WordRepresentation::Word32()) return false; ++ switch (binop.kind) { ++ case OverflowCheckedBinopOp::Kind::kSignedAdd: ++ case OverflowCheckedBinopOp::Kind::kSignedSub: ++ return true; ++ case OverflowCheckedBinopOp::Kind::kSignedMul: ++ // EmitInt32MulWithOverflow doesn't zero-extend because Arm64 doesn't ++ // have a flag-setting int32 multiplication. ++ return false; ++ } ++ } + case Opcode::kProjection: + return ZeroExtendsWord32ToWord64NoPhis(op.Cast<ProjectionOp>().input()); + case Opcode::kLoad: { From 1ca5bf8afb0072a01783dff507343b8f6a208e89 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt <nilay2014@gmail.com> Date: Thu, 18 Sep 2025 00:04:09 -0400 Subject: [PATCH 079/268] build: update build tools to get siso for forks fix (#48345) --- .github/actions/build-electron/action.yml | 8 -------- .github/actions/install-build-tools/action.yml | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/actions/build-electron/action.yml b/.github/actions/build-electron/action.yml index 76d0aed0eafdf..38e514a553403 100644 --- a/.github/actions/build-electron/action.yml +++ b/.github/actions/build-electron/action.yml @@ -44,14 +44,6 @@ runs: - name: Add Clang problem matcher shell: bash run: echo "::add-matcher::src/electron/.github/problem-matchers/clang.json" - - name: Setup Siso for fork pull requests - if: ${{ github.event.pull_request.head.repo.full_name != github.repository }} - shell: bash - run: | - # Use Local Execution, Remote Caching (LERC). Checks the remote cache for action - # matches and uses existing results if a match is found. If not, execution of the - # action is performed locally. - echo "RBE_exec_strategy=local" >> $GITHUB_ENV - name: Build Electron ${{ inputs.step-suffix }} shell: bash run: | diff --git a/.github/actions/install-build-tools/action.yml b/.github/actions/install-build-tools/action.yml index e3ebdd3e81bd7..9156c09384680 100644 --- a/.github/actions/install-build-tools/action.yml +++ b/.github/actions/install-build-tools/action.yml @@ -15,7 +15,7 @@ runs: git config --global core.preloadindex true git config --global core.longpaths true fi - export BUILD_TOOLS_SHA=fb34fbad068586d9a6e2bb4e4950bdcf9aaee862 + export BUILD_TOOLS_SHA=c13f4bdb50e65da46a4703f8f882079dd21fd99e npm i -g @electron/build-tools # Update depot_tools to ensure python e d update_depot_tools From 7c15940bb516bea972a723187fd2e0b62913e100 Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Mon, 22 Sep 2025 14:12:47 -0500 Subject: [PATCH 080/268] refactor: use gin::Arguments in api::Clipboard (#48354) * refactor: make api::Clipboard::GetClipboardBuffer() private * refactor: remove unused gin_helper::Arguments* arg from Clipboard::ReadBuffer() * refactor: remove unused gin_helper::Arguments* arg from Clipboard::ReadBookmark() * refactor: move GetClipboadBuffer() into anonymous namespace * refactor: use gin::Arguments in api::Clipboard --- shell/common/api/electron_api_clipboard.cc | 57 ++++++++++++---------- shell/common/api/electron_api_clipboard.h | 45 ++++++++--------- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/shell/common/api/electron_api_clipboard.cc b/shell/common/api/electron_api_clipboard.cc index 17563f1e1d704..2f810d4250aeb 100644 --- a/shell/common/api/electron_api_clipboard.cc +++ b/shell/common/api/electron_api_clipboard.cc @@ -22,18 +22,21 @@ #include "ui/gfx/codec/png_codec.h" #include "ui/gfx/image/image.h" -namespace electron::api { +namespace { -ui::ClipboardBuffer Clipboard::GetClipboardBuffer(gin_helper::Arguments* args) { +[[nodiscard]] ui::ClipboardBuffer GetClipboardBuffer(gin::Arguments* args) { std::string type; - if (args->GetNext(&type) && type == "selection") - return ui::ClipboardBuffer::kSelection; - else - return ui::ClipboardBuffer::kCopyPaste; + return args->GetNext(&type) && type == "selection" + ? ui::ClipboardBuffer::kSelection + : ui::ClipboardBuffer::kCopyPaste; } +} // namespace + +namespace electron::api { + std::vector<std::u16string> Clipboard::AvailableFormats( - gin_helper::Arguments* args) { + gin::Arguments* const args) { std::vector<std::u16string> format_types; ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); clipboard->ReadAvailableTypes(GetClipboardBuffer(args), @@ -42,7 +45,7 @@ std::vector<std::u16string> Clipboard::AvailableFormats( } bool Clipboard::Has(const std::string& format_string, - gin_helper::Arguments* args) { + gin::Arguments* const args) { ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); ui::ClipboardFormatType format = ui::ClipboardFormatType::CustomPlatformType(format_string); @@ -97,17 +100,17 @@ std::string Clipboard::Read(const std::string& format_string) { return data; } -v8::Local<v8::Value> Clipboard::ReadBuffer(const std::string& format_string, - gin_helper::Arguments* args) { +v8::Local<v8::Value> Clipboard::ReadBuffer(v8::Isolate* const isolate, + const std::string& format_string) { std::string data = Read(format_string); - return electron::Buffer::Copy(args->isolate(), data).ToLocalChecked(); + return electron::Buffer::Copy(isolate, data).ToLocalChecked(); } void Clipboard::WriteBuffer(const std::string& format, const v8::Local<v8::Value> buffer, - gin_helper::Arguments* args) { + gin::Arguments* const args) { if (!node::Buffer::HasInstance(buffer)) { - args->ThrowError("buffer must be a node Buffer"); + args->ThrowTypeError("buffer must be a node Buffer"); return; } @@ -124,7 +127,7 @@ void Clipboard::WriteBuffer(const std::string& format, } void Clipboard::Write(const gin_helper::Dictionary& data, - gin_helper::Arguments* args) { + gin::Arguments* const args) { ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); std::u16string text, html, bookmark; gfx::Image image; @@ -148,7 +151,7 @@ void Clipboard::Write(const gin_helper::Dictionary& data, writer.WriteImage(image.AsBitmap()); } -std::u16string Clipboard::ReadText(gin_helper::Arguments* args) { +std::u16string Clipboard::ReadText(gin::Arguments* const args) { std::u16string data; ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); auto type = GetClipboardBuffer(args); @@ -170,24 +173,24 @@ std::u16string Clipboard::ReadText(gin_helper::Arguments* args) { } void Clipboard::WriteText(const std::u16string& text, - gin_helper::Arguments* args) { + gin::Arguments* const args) { ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); writer.WriteText(text); } -std::u16string Clipboard::ReadRTF(gin_helper::Arguments* args) { +std::u16string Clipboard::ReadRTF(gin::Arguments* const args) { std::string data; ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); clipboard->ReadRTF(GetClipboardBuffer(args), /* data_dst = */ nullptr, &data); return base::UTF8ToUTF16(data); } -void Clipboard::WriteRTF(const std::string& text, gin_helper::Arguments* args) { +void Clipboard::WriteRTF(const std::string& text, gin::Arguments* const args) { ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); writer.WriteRTF(text); } -std::u16string Clipboard::ReadHTML(gin_helper::Arguments* args) { +std::u16string Clipboard::ReadHTML(gin::Arguments* const args) { std::u16string data; std::u16string html; std::string url; @@ -201,15 +204,15 @@ std::u16string Clipboard::ReadHTML(gin_helper::Arguments* args) { } void Clipboard::WriteHTML(const std::u16string& html, - gin_helper::Arguments* args) { + gin::Arguments* const args) { ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); writer.WriteHTML(html, std::string()); } -v8::Local<v8::Value> Clipboard::ReadBookmark(gin_helper::Arguments* args) { +v8::Local<v8::Value> Clipboard::ReadBookmark(v8::Isolate* const isolate) { std::u16string title; std::string url; - auto dict = gin_helper::Dictionary::CreateEmpty(args->isolate()); + auto dict = gin_helper::Dictionary::CreateEmpty(isolate); ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); clipboard->ReadBookmark(/* data_dst = */ nullptr, &title, &url); dict.Set("title", title); @@ -219,15 +222,15 @@ v8::Local<v8::Value> Clipboard::ReadBookmark(gin_helper::Arguments* args) { void Clipboard::WriteBookmark(const std::u16string& title, const std::string& url, - gin_helper::Arguments* args) { + gin::Arguments* const args) { ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); writer.WriteBookmark(title, url); } -gfx::Image Clipboard::ReadImage(gin_helper::Arguments* args) { +gfx::Image Clipboard::ReadImage(gin::Arguments* const args) { // The ReadPng uses thread pool which requires app ready. if (IsBrowserProcess() && !Browser::Get()->is_ready()) { - args->ThrowError( + gin_helper::ErrorThrower{args->isolate()}.ThrowError( "clipboard.readImage is available only after app ready in the main " "process"); return {}; @@ -256,7 +259,7 @@ gfx::Image Clipboard::ReadImage(gin_helper::Arguments* args) { } void Clipboard::WriteImage(const gfx::Image& image, - gin_helper::Arguments* args) { + gin::Arguments* const args) { ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); SkBitmap orig = image.AsBitmap(); SkBitmap bmp; @@ -274,7 +277,7 @@ std::u16string Clipboard::ReadFindText() { } #endif -void Clipboard::Clear(gin_helper::Arguments* args) { +void Clipboard::Clear(gin::Arguments* const args) { ui::Clipboard::GetForCurrentThread()->Clear(GetClipboardBuffer(args)); } diff --git a/shell/common/api/electron_api_clipboard.h b/shell/common/api/electron_api_clipboard.h index 74713c9a7baa8..d3c9c5a5ad032 100644 --- a/shell/common/api/electron_api_clipboard.h +++ b/shell/common/api/electron_api_clipboard.h @@ -16,8 +16,11 @@ namespace gfx { class Image; } // namespace gfx -namespace gin_helper { +namespace gin { class Arguments; +} // namespace gin + +namespace gin_helper { class Dictionary; } // namespace gin_helper @@ -29,44 +32,38 @@ class Clipboard { Clipboard(const Clipboard&) = delete; Clipboard& operator=(const Clipboard&) = delete; - static ui::ClipboardBuffer GetClipboardBuffer(gin_helper::Arguments* args); - static std::vector<std::u16string> AvailableFormats( - gin_helper::Arguments* args); - static bool Has(const std::string& format_string, - gin_helper::Arguments* args); - static void Clear(gin_helper::Arguments* args); + static std::vector<std::u16string> AvailableFormats(gin::Arguments* args); + static bool Has(const std::string& format_string, gin::Arguments* args); + static void Clear(gin::Arguments* args); static std::string Read(const std::string& format_string); - static void Write(const gin_helper::Dictionary& data, - gin_helper::Arguments* args); + static void Write(const gin_helper::Dictionary& data, gin::Arguments* args); - static std::u16string ReadText(gin_helper::Arguments* args); - static void WriteText(const std::u16string& text, - gin_helper::Arguments* args); + static std::u16string ReadText(gin::Arguments* args); + static void WriteText(const std::u16string& text, gin::Arguments* args); - static std::u16string ReadRTF(gin_helper::Arguments* args); - static void WriteRTF(const std::string& text, gin_helper::Arguments* args); + static std::u16string ReadRTF(gin::Arguments* args); + static void WriteRTF(const std::string& text, gin::Arguments* args); - static std::u16string ReadHTML(gin_helper::Arguments* args); - static void WriteHTML(const std::u16string& html, - gin_helper::Arguments* args); + static std::u16string ReadHTML(gin::Arguments* args); + static void WriteHTML(const std::u16string& html, gin::Arguments* args); - static v8::Local<v8::Value> ReadBookmark(gin_helper::Arguments* args); + static v8::Local<v8::Value> ReadBookmark(v8::Isolate* isolate); static void WriteBookmark(const std::u16string& title, const std::string& url, - gin_helper::Arguments* args); + gin::Arguments* args); - static gfx::Image ReadImage(gin_helper::Arguments* args); - static void WriteImage(const gfx::Image& image, gin_helper::Arguments* args); + static gfx::Image ReadImage(gin::Arguments* args); + static void WriteImage(const gfx::Image& image, gin::Arguments* args); static std::u16string ReadFindText(); static void WriteFindText(const std::u16string& text); - static v8::Local<v8::Value> ReadBuffer(const std::string& format_string, - gin_helper::Arguments* args); + static v8::Local<v8::Value> ReadBuffer(v8::Isolate* isolate, + const std::string& format_string); static void WriteBuffer(const std::string& format_string, const v8::Local<v8::Value> buffer, - gin_helper::Arguments* args); + gin::Arguments* args); static void WriteFilesForTesting(const std::vector<base::FilePath>& files); }; From 486d34455c2c306800fc1d034d966e44b7704472 Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Mon, 22 Sep 2025 20:16:27 -0700 Subject: [PATCH 081/268] chore: bump chromium to 142.0.7417.0 (main) (#48275) * chore: bump chromium in DEPS to 142.0.7401.0 * 6911185: Reland "Send touch moves async immediately after scroll starts." https://chromium-review.googlesource.com/c/chromium/src/+/6911185 * 6906887: mac: click through content area in main window https://chromium-review.googlesource.com/c/chromium/src/+/6906887 * 6916667: Expose helper to eliminate duplicate recipes. https://chromium-review.googlesource.com/c/chromium/src/+/6916667 * 6909842: Switch LegacyRenderWidgetHostHWND from atlcrack.h to msg_util.h. https://chromium-review.googlesource.com/c/chromium/src/+/6909842 * 6884056: Remove the SecKeychain implementation for the Keychain interface https://chromium-review.googlesource.com/c/chromium/src/+/6884056 * 6904906: Remove `WTF::` in renderer/core/[p-x].*/ https://chromium-review.googlesource.com/c/chromium/src/+/6904906 * 6556585: [persistent_cache]: PersistentCache for CodeCache https://chromium-review.googlesource.com/c/chromium/src/+/6556585 * 6904864: Layout: Support abort on the text placeholder layout https://chromium-review.googlesource.com/c/chromium/src/+/6904864 * chore: fixup patch indices * chore: bump chromium in DEPS to 142.0.7402.0 * fixup! 6556585: [persistent_cache]: PersistentCache for CodeCache * chore: fixup patch indices * 6905244: [api] Remove deprecated `GetIsolate` https://chromium-review.googlesource.com/c/v8/v8/+/6905244 * 6897694: Remove NativeTheme::UserHasContrastPreference(). https://chromium-review.googlesource.com/c/chromium/src/+/6897694 * 6897477: Remove GetPlatformHighContrastColorScheme() and enum. https://chromium-review.googlesource.com/c/chromium/src/+/6897477 * 6918198: Reland "Rename display::Screen::GetScreen() to display::Screen::Get()" https://chromium-review.googlesource.com/c/chromium/src/+/6918198 * 6907147: [LNA] add use counter for websocket mixed-content issues https://chromium-review.googlesource.com/c/chromium/src/+/6907147 * 6914538: Replace WTF::String with blink::String https://chromium-review.googlesource.com/c/website/+/6914538 * 6892538: [video pip] Allow touchscreen users to toggle live caption https://chromium-review.googlesource.com/c/chromium/src/+/6892538 * chore: fix patch * chore: bump chromium in DEPS to 142.0.7403.0 * build: remove ninja logs * chore: fixup patch indices * 6920670: [PDF] Change pdf_extension_util to return dictionaries https://chromium-review.googlesource.com/c/chromium/src/+/6920670 * 6917864: Devirtualize and inline various NativeTheme getters. https://chromium-review.googlesource.com/c/chromium/src/+/6917864 * 6920873: [PDF] Simplify PDFDocumentHelperClient::OnSaveURL() https://chromium-review.googlesource.com/c/chromium/src/+/6920873 * build: don't kill blink/web_tests * 6923655: Roll libc++ from 954086abf121 to b87b2bb112f8 (4 revisions) https://chromium-review.googlesource.com/c/chromium/src/+/6923655 * 6905242: Reland "[CSP] Clarify report-only console messages." https://chromium-review.googlesource.com/c/chromium/src/+/6905242 * fixup! 6897694: Remove NativeTheme::UserHasContrastPreference(). * chore: bump chromium in DEPS to 142.0.7405.0 * 6910012: [LNA] Enable LNA enforcement by default https://chromium-review.googlesource.com/c/chromium/src/+/6910012 * 6929444: Combine GetInstanceForXXX() implementations. https://chromium-review.googlesource.com/c/chromium/src/+/6929444 * 6927873: Rename native_widget_types.h -> native_ui_types.h https://chromium-review.googlesource.com/c/chromium/src/+/6927873 * 6853978: Init perfetto really early in WebView https://chromium-review.googlesource.com/c/chromium/src/+/6853978 * 6874886: Use only one picker observer to avoid getting duplicate notifications https://chromium-review.googlesource.com/c/chromium/src/+/6874886 * chore: fixup patch indices * fix: Protocol complex inline dtor * chore: bump chromium in DEPS to 142.0.7407.0 * chore: bump chromium in DEPS to 142.0.7409.0 * chore: bump chromium in DEPS to 142.0.7411.0 * chore: bump chromium in DEPS to 142.0.7413.0 * fixup! 6905242: Reland "[CSP] Clarify report-only console messages." * 6927233: Remove NativeTheme "use dark colors" bit. https://chromium-review.googlesource.com/c/chromium/src/+/6927233 * chore: fixup patch indices * 6899206: [PermissionOptions] Multi-state permission subscriptions & setting changes https://chromium-review.googlesource.com/c/chromium/src/+/6899206 * chore: bump chromium in DEPS to 142.0.7415.0 * 6936895: [headless] Remove headless flag from views::Widget class https://chromium-review.googlesource.com/c/chromium/src/+/6936895 We should probably followup on this to see if there is a way to do this without reverting this CL. * 6937023: Reland "Use new DBus type system in dbus_xdg::Request" https://chromium-review.googlesource.com/c/chromium/src/+/6937023 * chore: update patches * 6944749: Add GN visibility list to //components/os_crypt/sync https://chromium-review.googlesource.com/c/chromium/src/+/6944749 * Further replace sub_capture_target_version with CaptureVersion https://chromium-review.googlesource.com/c/chromium/src/+/6935455 * fixup for lint * chore: update filenames.libcxx.gni * chore: bump chromium in DEPS to 142.0.7417.0 * 6944136: Reorder NativeTheme headers/.cc files. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6944136 * 6939701: [DSSC][4] Make FSVCI objects aware of their capture-version-source Refs https://chromium-review.googlesource.com/c/chromium/src/+/6939701 * 6944404: Remove extraneous callback call Refs https://chromium-review.googlesource.com/c/chromium/src/+/6944404 * 6936124: [FPF-CI]: Introduce blink::NoiseToken for fingerprinting protection Refs https://chromium-review.googlesource.com/c/chromium/src/+/6936124 * chore: update patches * fixup! 6927233: Remove NativeTheme "use dark colors" bit. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6927233 * fixup! 6917864: Devirtualize and inline various NativeTheme getters. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6917864 * 6937588: Add initial OsSettingsProvider object, supplying caret blink interval. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6937588 * fixup! 6905242: Reland "[CSP] Clarify report-only console messages." Refs https://chromium-review.googlesource.com/c/chromium/src/+/6905242 * 6907515: Replace SingletonHwndObserver with a CallbackList on SingletonHwnd. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6907515 * 6910482: [Save to Drive] Implement retry functionality Refs https://chromium-review.googlesource.com/c/chromium/src/+/6910482 * fixup! 6927233: Remove NativeTheme "use dark colors" bit. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6927233 * Revert "build: remove ninja logs" This reverts commit 72874740fdfca4101404ce7855e976791cfc79ef. * test: fix flakey test picked from PR 48205 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Alice Zhao <alicelovescake@anthropic.com> --- .github/actions/checkout/action.yml | 1 - DEPS | 2 +- build/args/all.gn | 3 + filenames.libcxx.gni | 3 +- ...ack_ssl_error_zero_return_explicitly.patch | 6 +- patches/chromium/.patches | 1 + ...client_precreatemessageloop_callback.patch | 6 +- .../add_didinstallconditionalfeatures.patch | 4 +- ...pedcliboardwriter_writeunsaferawdata.patch | 8 +- ...adjust_accessibility_ui_for_electron.patch | 14 +- ..._scheduler_throttling_per_renderview.patch | 38 +- ...o_depend_on_components_os_crypt_sync.patch | 23 + ..._windows_to_have_different_web_prefs.patch | 10 +- patches/chromium/blink_local_frame.patch | 2 +- .../build_add_electron_tracing_category.patch | 4 +- ..._mojom_interfaces_to_depend_on_blink.patch | 4 +- .../chromium/build_disable_thin_lto_mac.patch | 12 +- ..._depend_on_packed_resource_integrity.patch | 12 +- patches/chromium/can_create_window.patch | 36 +- ...hore_add_electron_deps_to_gitignores.patch | 8 +- ...ameter_in_script_lifecycle_observers.patch | 12 +- ...ther_in_electron_views_and_delegates.patch | 6 +- ..._introduce_blocking_api_for_electron.patch | 2 +- ...fy_chromium_handling_of_mouse_events.patch | 18 +- .../chromium/chore_partial_revert_of.patch | 4 +- ...tition_attribute_dcheck_for_webviews.patch | 4 +- .../chore_patch_out_profile_methods.patch | 4 +- ...screationoverridden_with_full_params.patch | 40 +- ...e_reference_to_chrome_browser_themes.patch | 6 +- patches/chromium/command-ismediakey.patch | 8 +- ...e_browser_v8_snapshot_file_name_fuse.patch | 16 +- patches/chromium/desktop_media_list.patch | 10 +- .../disable_compositor_recycling.patch | 2 +- patches/chromium/disable_hidden.patch | 17 +- .../chromium/enable_reset_aspect_ratio.patch | 8 +- ...locator_for_usage_outside_of_the_gin.patch | 2 +- ...xpose_setuseragent_on_networkcontext.patch | 20 +- .../extend_apply_webpreferences.patch | 2 +- ...dd_set_theme_source_to_allow_apps_to.patch | 66 +- ...ing_dialog_features_to_shell_dialogs.patch | 25 +- ...t_allow_code_cache_in_custom_schemes.patch | 89 +- ...sharingpicker_on_supported_platforms.patch | 62 +- ...e_launch_options_for_service_process.patch | 18 +- ...moothing_css_rule_and_blink_painting.patch | 30 +- ...screen_rendering_with_viz_compositor.patch | 22 +- ...same_application_can_use_safestorage.patch | 67 +- ...etdefersloading_on_webdocumentloader.patch | 2 +- ..._raw_response_headers_from_urlloader.patch | 24 +- ...indows_in_the_current_application_in.patch | 4 +- ...allback_for_sync_and_async_clipboard.patch | 8 +- ..._exclusive_access_for_electron_needs.patch | 2 +- ...dless_mode_handling_in_native_widget.patch | 89 +- .../fix_aspect_ratio_with_max_size.patch | 4 +- ...ding_non-standard_schemes_in_iframes.patch | 10 +- ..._background_throttling_in_compositor.patch | 10 +- ...ingshelper_behind_branding_buildflag.patch | 2 +- ...king_and_message_bubbling_on_windows.patch | 32 +- ...board_hides_on_input_blur_in_webview.patch | 6 +- ...x_remove_caption-removing_style_call.patch | 4 +- ..._material_update_issue_on_windows_11.patch | 14 +- ...original_resize_performance_on_macos.patch | 4 +- ...from_localframe_requestexecutescript.patch | 14 +- ...t_menu_item_when_opened_via_keyboard.patch | 2 +- ...ated_generic_capturer_when_available.patch | 6 +- patches/chromium/frame_host_manager.patch | 6 +- .../chromium/gritsettings_resource_ids.patch | 2 +- .../load_v8_snapshot_in_browser_process.patch | 4 +- ..._avoid_private_macos_api_usage.patch.patch | 92 +- ...emote_certificate_verification_logic.patch | 14 +- .../chromium/notification_provenance.patch | 22 +- ...xture_remove_keyed_mutex_on_win_dxgi.patch | 2 +- patches/chromium/picture-in-picture.patch | 20 +- ...utofill_colors_to_the_color_pipeline.patch | 22 +- patches/chromium/printing.patch | 18 +- ...r_changes_to_the_webcontentsobserver.patch | 16 +- ...pose_hostimportmoduledynamically_and.patch | 14 +- ..._electron_permissiontypes_into_blink.patch | 8 +- ...efactor_unfilter_unresponsive_events.patch | 4 +- .../render_widget_host_view_mac.patch | 19 +- ...ean_up_stale_macwebcontentsocclusion.patch | 14 +- ...al_remove_unused_prehandlemouseevent.patch | 22 +- ...ssivethrottlingwithwebsocket_feature.patch | 6 +- ...windowtreehostwin_window_enlargement.patch | 28 +- patches/chromium/scroll_bounce_flag.patch | 4 +- .../support_mixed_sandbox_with_zygote.patch | 4 +- patches/chromium/web_contents.patch | 14 +- patches/chromium/webview_fullscreen.patch | 12 +- .../worker_context_will_destroy.patch | 12 +- ...feat_add_hook_to_notify_script_ready.patch | 12 +- ...i_to_allow_electron_to_set_dock_side.patch | 4 +- patches/node/.patches | 2 +- .../api_remove_deprecated_getisolate.patch | 908 ++++++++++++++++++ ...pi_advance_deprecation_of_getisolate.patch | 82 -- shell/browser/api/electron_api_menu_views.cc | 2 +- .../browser/api/electron_api_native_theme.cc | 20 +- shell/browser/api/electron_api_protocol.cc | 2 + shell/browser/api/electron_api_protocol.h | 2 +- shell/browser/api/electron_api_screen.cc | 2 +- .../api/electron_api_system_preferences.h | 6 +- .../electron_api_system_preferences_win.cc | 9 +- .../browser/api/electron_api_web_contents.cc | 6 +- shell/browser/api/frame_subscriber.h | 3 +- shell/browser/electron_browser_client.cc | 10 +- shell/browser/electron_browser_main_parts.cc | 2 +- .../electron_pdf_document_helper_client.h | 2 +- shell/browser/electron_permission_manager.cc | 40 +- shell/browser/electron_permission_manager.h | 6 +- .../pdf_viewer_private_api.cc | 92 ++ .../pdf_viewer_private_api.h | 28 + .../resources_private_api.cc | 13 +- ...on_component_extension_resource_manager.cc | 14 +- ...ron_component_extension_resource_manager.h | 3 +- shell/browser/feature_list.cc | 6 +- shell/browser/native_window_mac.mm | 4 +- shell/browser/native_window_views.cc | 12 +- .../browser/net/url_loader_network_observer.h | 1 + .../osr/osr_render_widget_host_view.cc | 2 +- shell/browser/osr/osr_video_consumer.h | 3 +- shell/browser/ui/drag_util_views.cc | 2 +- ...electron_desktop_window_tree_host_linux.cc | 2 +- shell/browser/ui/inspectable_web_contents.cc | 6 +- shell/browser/ui/win/notify_icon.cc | 11 +- shell/browser/ui/win/notify_icon_host.cc | 3 +- shell/browser/win/dark_mode.cc | 8 +- shell/common/api/electron_api_url_loader.h | 1 + shell/renderer/renderer_client_base.cc | 4 +- spec/api-web-contents-spec.ts | 2 +- spec/chromium-spec.ts | 6 +- 128 files changed, 1849 insertions(+), 867 deletions(-) create mode 100644 patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch create mode 100644 patches/node/api_remove_deprecated_getisolate.patch delete mode 100644 patches/node/reland_api_advance_deprecation_of_getisolate.patch diff --git a/.github/actions/checkout/action.yml b/.github/actions/checkout/action.yml index e7d41c566c67a..aa0baa6fac808 100644 --- a/.github/actions/checkout/action.yml +++ b/.github/actions/checkout/action.yml @@ -172,7 +172,6 @@ runs: run: | rm -rf src/android_webview rm -rf src/ios/chrome - rm -rf src/third_party/blink/web_tests rm -rf src/third_party/blink/perf_tests rm -rf src/chrome/test/data/xr/webvr_info rm -rf src/third_party/angle/third_party/VK-GL-CTS/src diff --git a/DEPS b/DEPS index 90e9130775e9b..ece4dac4bfbb5 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '141.0.7390.7', + '142.0.7417.0', 'node_version': 'v22.19.0', 'nan_version': diff --git a/build/args/all.gn b/build/args/all.gn index 80c3e44e9d6a1..b074e0ecb3c20 100644 --- a/build/args/all.gn +++ b/build/args/all.gn @@ -72,3 +72,6 @@ enterprise_cloud_content_analysis = false # We don't use anything from here, and it causes target collisions enable_linux_installer = false + +# Disable "Save to Drive" feature in PDF viewer +enable_pdf_save_to_drive = false diff --git a/filenames.libcxx.gni b/filenames.libcxx.gni index 2e8cacac37182..3142c0376f792 100644 --- a/filenames.libcxx.gni +++ b/filenames.libcxx.gni @@ -1365,7 +1365,6 @@ libcxx_headers = [ "//third_party/libc++/src/include/__tree", "//third_party/libc++/src/include/__tuple/find_index.h", "//third_party/libc++/src/include/__tuple/ignore.h", - "//third_party/libc++/src/include/__tuple/make_tuple_types.h", "//third_party/libc++/src/include/__tuple/sfinae_helpers.h", "//third_party/libc++/src/include/__tuple/tuple_element.h", "//third_party/libc++/src/include/__tuple/tuple_like.h", @@ -1499,6 +1498,7 @@ libcxx_headers = [ "//third_party/libc++/src/include/__utility/cmp.h", "//third_party/libc++/src/include/__utility/convert_to_integral.h", "//third_party/libc++/src/include/__utility/declval.h", + "//third_party/libc++/src/include/__utility/default_three_way_comparator.h", "//third_party/libc++/src/include/__utility/element_count.h", "//third_party/libc++/src/include/__utility/empty.h", "//third_party/libc++/src/include/__utility/exception_guard.h", @@ -1509,6 +1509,7 @@ libcxx_headers = [ "//third_party/libc++/src/include/__utility/integer_sequence.h", "//third_party/libc++/src/include/__utility/is_pointer_in_range.h", "//third_party/libc++/src/include/__utility/is_valid_range.h", + "//third_party/libc++/src/include/__utility/lazy_synth_three_way_comparator.h", "//third_party/libc++/src/include/__utility/move.h", "//third_party/libc++/src/include/__utility/no_destroy.h", "//third_party/libc++/src/include/__utility/pair.h", diff --git a/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch b/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch index 11fdd3d719b53..503305951370d 100644 --- a/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch +++ b/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch @@ -20,10 +20,10 @@ index 2cdcbc346175eeee69402ecee7f169e61c655199..f7226fe711e4214b216ea2c5173a0212 case ssl_open_record_error: diff --git a/ssl/ssl_lib.cc b/ssl/ssl_lib.cc -index 24c0d496f9d655f0f32634430e9c31d5592be939..b62418ba31927c5c4e2b424b993e40c63c868201 100644 +index 2e0db357135d54bc416bc94f4e3849267932c3b4..35f0430b5d1c1ed1676ea7a9e7e94e820126607b 100644 --- a/ssl/ssl_lib.cc +++ b/ssl/ssl_lib.cc -@@ -1207,7 +1207,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) { +@@ -1211,7 +1211,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) { } if (ret_code == 0) { @@ -32,7 +32,7 @@ index 24c0d496f9d655f0f32634430e9c31d5592be939..b62418ba31927c5c4e2b424b993e40c6 return SSL_ERROR_ZERO_RETURN; } // An EOF was observed which violates the protocol, and the underlying -@@ -2568,13 +2568,7 @@ void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx) { +@@ -2602,13 +2602,7 @@ void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx) { return CRYPTO_get_ex_data(&ctx->ex_data, idx); } diff --git a/patches/chromium/.patches b/patches/chromium/.patches index ef92669f4538b..3fdbc6350fe7e 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -140,3 +140,4 @@ chore_restore_some_deprecated_wrapper_utility_in_gin.patch chore_add_electron_objects_to_wrappablepointertag.patch chore_expose_isolate_parameter_in_script_lifecycle_observers.patch revert_partial_remove_unused_prehandlemouseevent.patch +allow_electron_to_depend_on_components_os_crypt_sync.patch diff --git a/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch b/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch index b925e0fd10dee..0644ba85b1823 100644 --- a/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch +++ b/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch @@ -10,10 +10,10 @@ Allows Electron to restore WER when ELECTRON_DEFAULT_ERROR_MODE is set. This should be upstreamed. diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc -index 558575cf06b10b59e114a9f53b90f01d8ecf63c4..0204ce5351a5190a20317f0cef6d3e8421541cac 100644 +index a827f072e72d76dd52378cca4368932a4b2f4f3d..cc1b6cca3009e876f84f48df942df02fddd91e80 100644 --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc -@@ -272,6 +272,10 @@ int GpuMain(MainFunctionParams parameters) { +@@ -273,6 +273,10 @@ int GpuMain(MainFunctionParams parameters) { // to the GpuProcessHost once the GpuServiceImpl has started. viz::GpuLogMessageManager::GetInstance()->InstallPreInitializeLogHandler(); @@ -24,7 +24,7 @@ index 558575cf06b10b59e114a9f53b90f01d8ecf63c4..0204ce5351a5190a20317f0cef6d3e84 // We are experiencing what appear to be memory-stomp issues in the GPU // process. These issues seem to be impacting the task executor and listeners // registered to it. Create the task executor on the heap to guard against -@@ -381,7 +385,6 @@ int GpuMain(MainFunctionParams parameters) { +@@ -382,7 +386,6 @@ int GpuMain(MainFunctionParams parameters) { #endif const bool dead_on_arrival = !init_success; diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index 2bfa03d84f90e..84e4c89162809 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -23,10 +23,10 @@ index 284da783658bec333be748941784d43b13f6f244..18714ce8fc27c8d56c5deac27ba33507 int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index bc2ec7491d7072be77307d7b8af06e5397e2bdfb..addef4de8a95f47964a895e1d1cc4763f565a028 100644 +index a0aa3ec64b54b99508d1ba9cd52e2fe0e53ed56c..f337d61906651359eeb5228c112ad948f4f7a752 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4679,6 +4679,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, +@@ -4678,6 +4678,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, observer.DidCreateScriptContext(context, world_id); } diff --git a/patches/chromium/add_ui_scopedcliboardwriter_writeunsaferawdata.patch b/patches/chromium/add_ui_scopedcliboardwriter_writeunsaferawdata.patch index 68a06fe5092c5..2c316f73b7d17 100644 --- a/patches/chromium/add_ui_scopedcliboardwriter_writeunsaferawdata.patch +++ b/patches/chromium/add_ui_scopedcliboardwriter_writeunsaferawdata.patch @@ -8,10 +8,10 @@ was removed as part of the Raw Clipboard API scrubbing. https://bugs.chromium.org/p/chromium/issues/detail?id=1217643 diff --git a/ui/base/clipboard/scoped_clipboard_writer.cc b/ui/base/clipboard/scoped_clipboard_writer.cc -index 0b457d0742b24381718092d6af11f396fda30436..e1619eeeb8f29e6745da282a33a3464ec97aefb0 100644 +index 2d612b3a8ceb61f02fbd96023140bc2c702db589..bb5b17fc884b78aa65c3885e11309a9c50f8e786 100644 --- a/ui/base/clipboard/scoped_clipboard_writer.cc +++ b/ui/base/clipboard/scoped_clipboard_writer.cc -@@ -236,6 +236,16 @@ void ScopedClipboardWriter::WriteData(std::u16string_view format, +@@ -246,6 +246,16 @@ void ScopedClipboardWriter::WriteData(std::u16string_view format, } } @@ -29,10 +29,10 @@ index 0b457d0742b24381718092d6af11f396fda30436..e1619eeeb8f29e6745da282a33a3464e objects_.clear(); raw_objects_.clear(); diff --git a/ui/base/clipboard/scoped_clipboard_writer.h b/ui/base/clipboard/scoped_clipboard_writer.h -index 939a99b2a086d5373f82fe96da73dabe02f6f9d8..fccc200b1b11076c8fcffde071a53598ffba9a12 100644 +index 8c2be540757856a3e704764fe56003205b24812f..e31fbc01f68c0e92284a72298cac878d7247e7fb 100644 --- a/ui/base/clipboard/scoped_clipboard_writer.h +++ b/ui/base/clipboard/scoped_clipboard_writer.h -@@ -87,6 +87,10 @@ class COMPONENT_EXPORT(UI_BASE_CLIPBOARD) ScopedClipboardWriter { +@@ -91,6 +91,10 @@ class COMPONENT_EXPORT(UI_BASE_CLIPBOARD) ScopedClipboardWriter { // This is only used to write custom format data. void WriteData(std::u16string_view format, mojo_base::BigBuffer data); diff --git a/patches/chromium/adjust_accessibility_ui_for_electron.patch b/patches/chromium/adjust_accessibility_ui_for_electron.patch index 004a322f11c0a..9afc9650d83db 100644 --- a/patches/chromium/adjust_accessibility_ui_for_electron.patch +++ b/patches/chromium/adjust_accessibility_ui_for_electron.patch @@ -10,7 +10,7 @@ usage of BrowserList and Browser as we subclass related methods and use our WindowList. diff --git a/chrome/browser/ui/webui/accessibility/accessibility_ui.cc b/chrome/browser/ui/webui/accessibility/accessibility_ui.cc -index 7f8d93e3637188280cc6e10c5c47a2cdbc0cc38f..7ccd2a61b45b3f864c1d8caefd3b235308986a8c 100644 +index 8f425bd66fac7b36cee201c3e23c126dd14edf07..6216ad30ed15f11501e1d154258862f57941969e 100644 --- a/chrome/browser/ui/webui/accessibility/accessibility_ui.cc +++ b/chrome/browser/ui/webui/accessibility/accessibility_ui.cc @@ -48,6 +48,7 @@ @@ -62,7 +62,7 @@ index 7f8d93e3637188280cc6e10c5c47a2cdbc0cc38f..7ccd2a61b45b3f864c1d8caefd3b2353 data.Set(kBrowsersField, std::move(browser_list)); #if BUILDFLAG(IS_WIN) -@@ -845,7 +846,8 @@ void AccessibilityUIMessageHandler::SetGlobalString( +@@ -844,7 +845,8 @@ void AccessibilityUIMessageHandler::SetGlobalString( const std::string value = CheckJSValue(data.FindString(kValueField)); if (string_name == kApiTypeField) { @@ -72,7 +72,7 @@ index 7f8d93e3637188280cc6e10c5c47a2cdbc0cc38f..7ccd2a61b45b3f864c1d8caefd3b2353 pref->SetString(prefs::kShownAccessibilityApiType, value); } } -@@ -899,7 +901,8 @@ void AccessibilityUIMessageHandler::RequestWebContentsTree( +@@ -898,7 +900,8 @@ void AccessibilityUIMessageHandler::RequestWebContentsTree( AXPropertyFilter::ALLOW_EMPTY); AddPropertyFilters(property_filters, deny, AXPropertyFilter::DENY); @@ -82,7 +82,7 @@ index 7f8d93e3637188280cc6e10c5c47a2cdbc0cc38f..7ccd2a61b45b3f864c1d8caefd3b2353 ui::AXApiType::Type api_type = ui::AXApiType::From(pref->GetString(prefs::kShownAccessibilityApiType)); std::string accessibility_contents = -@@ -926,6 +929,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( +@@ -925,6 +928,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( AXPropertyFilter::ALLOW_EMPTY); AddPropertyFilters(property_filters, deny, AXPropertyFilter::DENY); @@ -90,7 +90,7 @@ index 7f8d93e3637188280cc6e10c5c47a2cdbc0cc38f..7ccd2a61b45b3f864c1d8caefd3b2353 for (Browser* browser : *BrowserList::GetInstance()) { if (browser->session_id().id() == session_id) { base::Value::Dict result = BuildTargetDescriptor(browser); -@@ -938,6 +942,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( +@@ -937,6 +941,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( return; } } @@ -98,7 +98,7 @@ index 7f8d93e3637188280cc6e10c5c47a2cdbc0cc38f..7ccd2a61b45b3f864c1d8caefd3b2353 #endif // !BUILDFLAG(IS_ANDROID) // No browser with the specified |session_id| was found. base::Value::Dict result; -@@ -981,11 +986,13 @@ void AccessibilityUIMessageHandler::StopRecording( +@@ -980,11 +985,13 @@ void AccessibilityUIMessageHandler::StopRecording( } ui::AXApiType::Type AccessibilityUIMessageHandler::GetRecordingApiType() { @@ -115,7 +115,7 @@ index 7f8d93e3637188280cc6e10c5c47a2cdbc0cc38f..7ccd2a61b45b3f864c1d8caefd3b2353 // Check to see if it is in the supported types list. if (std::find(supported_types.begin(), supported_types.end(), api_type) == supported_types.end()) { -@@ -1055,10 +1062,13 @@ void AccessibilityUIMessageHandler::RequestAccessibilityEvents( +@@ -1054,10 +1061,13 @@ void AccessibilityUIMessageHandler::RequestAccessibilityEvents( // static void AccessibilityUIMessageHandler::RegisterProfilePrefs( user_prefs::PrefRegistrySyncable* registry) { diff --git a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch index 73e17def58161..00d2c96c9ef4c 100644 --- a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -6,11 +6,11 @@ Subject: allow disabling blink scheduler throttling per RenderView This allows us to disable throttling for hidden windows. diff --git a/content/browser/renderer_host/navigation_controller_impl_unittest.cc b/content/browser/renderer_host/navigation_controller_impl_unittest.cc -index 1d002528ba2b90d9c361c77ab00aeb1ccd000177..77f3b011f9c3710ac93ad20a92eafea0d35bb9a7 100644 +index 318031e17f212b0e9a651dcc0e86e16af957ed8e..e68dcdc8039217ec59a60ef02c27b4f80f661d2a 100644 --- a/content/browser/renderer_host/navigation_controller_impl_unittest.cc +++ b/content/browser/renderer_host/navigation_controller_impl_unittest.cc @@ -168,6 +168,12 @@ class MockPageBroadcast : public blink::mojom::PageBroadcast { - (const std::optional<uint64_t> canvas_noise_token), + (std::optional<blink::NoiseToken> canvas_noise_token), (override)); + MOCK_METHOD( @@ -23,10 +23,10 @@ index 1d002528ba2b90d9c361c77ab00aeb1ccd000177..77f3b011f9c3710ac93ad20a92eafea0 return receiver_.BindNewEndpointAndPassDedicatedRemote(); } diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc -index ac7638da0c0b360d21b88e4e458d3687949884fa..45d2fe002330cb4aa7c81defaa5004d5e62e369a 100644 +index 270750b9180a8ddab4f3cd2508fd398e07bf6377..20b2ae081a3710443ec919f1487dfbfe8f15de11 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc -@@ -786,6 +786,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) { +@@ -785,6 +785,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) { GetWidget()->GetAssociatedFrameWidget()->SetBackgroundOpaque(opaque); } @@ -51,10 +51,10 @@ index 7944fe64e0da112fc670358b75506bb199bb5e4a..0e3c16c6af2a078943e9f39808134ab2 void SendRendererPreferencesToRenderer( const blink::RendererPreferences& preferences); diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index e98d74fecf4275ef8e7c6d23e5ea5ec3af80b926..0927d69b56d064327f0659d8ffe6ceff98064947 100644 +index e95a313945397c6eff5514932ce15c5d4b6a8e1f..edb2638deb85dfd37651a00d4c370e51d94fcc6a 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -579,8 +579,8 @@ void RenderWidgetHostViewAura::ShowImpl(PageVisibilityState page_visibility) { +@@ -578,8 +578,8 @@ void RenderWidgetHostViewAura::ShowImpl(PageVisibilityState page_visibility) { // OnShowWithPageVisibility will not call NotifyHostAndDelegateOnWasShown, // which updates `visibility_`, unless the host is hidden. Make sure no update // is needed. @@ -66,10 +66,10 @@ index e98d74fecf4275ef8e7c6d23e5ea5ec3af80b926..0927d69b56d064327f0659d8ffe6ceff void RenderWidgetHostViewAura::EnsurePlatformVisibility( diff --git a/content/public/browser/render_view_host.h b/content/public/browser/render_view_host.h -index 20ca763ff7f55e8176b77349b41917b11e051ae6..a50c122064b5f0092f57e3d508fb19389b72203b 100644 +index a599bc306198de0e172134ce4623b32b8fcd72fa..4960c518d49f98b39873d166597bfb4b5619ee02 100644 --- a/content/public/browser/render_view_host.h +++ b/content/public/browser/render_view_host.h -@@ -75,6 +75,9 @@ class CONTENT_EXPORT RenderViewHost { +@@ -74,6 +74,9 @@ class CONTENT_EXPORT RenderViewHost { virtual void WriteIntoTrace( perfetto::TracedProto<TraceProto> context) const = 0; @@ -80,34 +80,34 @@ index 20ca763ff7f55e8176b77349b41917b11e051ae6..a50c122064b5f0092f57e3d508fb1938 // This interface should only be implemented inside content. friend class RenderViewHostImpl; diff --git a/content/test/test_page_broadcast.h b/content/test/test_page_broadcast.h -index 0dc1cd52dec74ede2117eb244e423d7f3ad322ea..352c64b3aec50546451a0033114e3a35dcf32136 100644 +index 82ae7ab6279427e492ead6d1d386608eb9d3d844..2b79149bfcc0de968ffb45e310d697c5393f0d43 100644 --- a/content/test/test_page_broadcast.h +++ b/content/test/test_page_broadcast.h @@ -53,6 +53,7 @@ class TestPageBroadcast : public blink::mojom::PageBroadcast { const blink::ColorProviderColorMaps& color_provider_colors) override; void UpdateCanvasNoiseToken( - std::optional<uint64_t> canvas_noise_token) override; + std::optional<blink::NoiseToken> canvas_noise_token) override; + void SetSchedulerThrottling(bool allowed) override {} mojo::AssociatedReceiver<blink::mojom::PageBroadcast> receiver_; }; diff --git a/third_party/blink/public/mojom/page/page.mojom b/third_party/blink/public/mojom/page/page.mojom -index bcf8559d759e73e4f3f00710d263fe24cc801828..556f990868b862452156cec2354a90ae75352251 100644 +index e7be05ec6dc5f517b4a6f849a262d12dc6c1ca3d..5f4f425c77c8aadf269edfaec658a8d2ad74b2cd 100644 --- a/third_party/blink/public/mojom/page/page.mojom +++ b/third_party/blink/public/mojom/page/page.mojom -@@ -180,4 +180,7 @@ interface PageBroadcast { +@@ -182,4 +182,7 @@ interface PageBroadcast { // the noise token at ReadyToCommit time and update blink::WebViews that // were made at request time. - UpdateCanvasNoiseToken(uint64? canvas_noise_token); + UpdateCanvasNoiseToken(blink.mojom.NoiseToken? canvas_noise_token); + + // Whether to enable the Renderer scheduler background throttling. + SetSchedulerThrottling(bool allowed); }; diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h -index b3553c0783a7b00e055f82ef0b72bd866284473d..c91e49807ec0b56d867504831118269116024626 100644 +index 9c0fe6ad62872f05cfb1179b4b979139008976d2..6aca43e61ef7f1caea74c30e5c3ce4496d4c4188 100644 --- a/third_party/blink/public/web/web_view.h +++ b/third_party/blink/public/web/web_view.h -@@ -365,6 +365,7 @@ class BLINK_EXPORT WebView { +@@ -366,6 +366,7 @@ class BLINK_EXPORT WebView { // Scheduling ----------------------------------------------------------- virtual PageScheduler* Scheduler() const = 0; @@ -116,10 +116,10 @@ index b3553c0783a7b00e055f82ef0b72bd866284473d..c91e49807ec0b56d8675048311182691 // Visibility ----------------------------------------------------------- diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index 714b713cd466ac289b3d172ac484ddfd2b46190b..be43ac07eb6563dcb72374dfc4f3bd34913e98c3 100644 +index cd57d63a452cb4444d5d0b11b06c65c5bc11f5f1..68a102327e22302587f7cc402cb26ef2f02b261e 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -2500,6 +2500,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( +@@ -2504,6 +2504,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( TRACE_EVENT2("navigation", "WebViewImpl::SetPageLifecycleStateInternal", "old_state", old_state, "new_state", new_state); @@ -130,7 +130,7 @@ index 714b713cd466ac289b3d172ac484ddfd2b46190b..be43ac07eb6563dcb72374dfc4f3bd34 bool storing_in_bfcache = new_state->is_in_back_forward_cache && !old_state->is_in_back_forward_cache; bool restoring_from_bfcache = !new_state->is_in_back_forward_cache && -@@ -4009,10 +4013,23 @@ PageScheduler* WebViewImpl::Scheduler() const { +@@ -4012,10 +4016,23 @@ PageScheduler* WebViewImpl::Scheduler() const { return GetPage()->GetPageScheduler(); } @@ -155,7 +155,7 @@ index 714b713cd466ac289b3d172ac484ddfd2b46190b..be43ac07eb6563dcb72374dfc4f3bd34 // Do not throttle if the page should be painting. bool is_visible = diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h -index 883269126ff93c26765ab62013035c6193f8adbb..f821da879a6b6b04d33ef60037a053f3a5c0851d 100644 +index 7879bd064e9ef324e12b5c2f522f9c8a4fa29ad5..950df20815a607b678e0e67a19d22d37b579b85d 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h @@ -450,6 +450,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, diff --git a/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch b/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch new file mode 100644 index 0000000000000..9b228c21fb2af --- /dev/null +++ b/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: John Kleinschmidt <jkleinsc@electronjs.org> +Date: Mon, 15 Sep 2025 15:52:55 -0400 +Subject: Allow electron to depend on components/os_crypt/sync. + +This is necessary after +https://chromium-review.googlesource.com/c/chromium/src/+/6944749 +landed. That CL notes that "new code should use os_crypt async", +so we can remove this patch once we migrate our code to use +os_crypt async. + +diff --git a/components/os_crypt/sync/BUILD.gn b/components/os_crypt/sync/BUILD.gn +index 81fc444043b67858371142075f98ad9aff162fc3..7ab1c6d1422e19afa603d9b3eeeb30044fb9c7b3 100644 +--- a/components/os_crypt/sync/BUILD.gn ++++ b/components/os_crypt/sync/BUILD.gn +@@ -10,6 +10,7 @@ import("//components/os_crypt/sync/features.gni") + component("sync") { + # New code should use os_crypt async. + visibility = [ ++ "//electron:*", + "//chrome/browser", + "//chrome/browser/prefs:impl", + "//chrome/browser/ui", diff --git a/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch b/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch index 2657586719699..201eb52e84772 100644 --- a/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch +++ b/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch @@ -8,7 +8,7 @@ WebPreferences of in-process child windows, rather than relying on process-level command line switches, as before. diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc -index e66a1b104fbcb6ac81b745a28588a994533745ff..08abd32cebf89d434bf60b4fd420430e88540adc 100644 +index c0362530043cdaffc008d0c90d55cb9522db1557..3eb37d797feccdbb2a9d4b4f26e222b6f837b802 100644 --- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc +++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc @@ -148,6 +148,19 @@ bool StructTraits<blink::mojom::WebPreferencesDataView, @@ -32,7 +32,7 @@ index e66a1b104fbcb6ac81b745a28588a994533745ff..08abd32cebf89d434bf60b4fd420430e out->accelerated_video_decode_enabled = data.accelerated_video_decode_enabled(); diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h -index 39eefd4970a93bef42487d51e9c0bdfd76a001a0..a76da90ca59e07ad57ae85ee765b90875b82819c 100644 +index 30572628d5d221e58159391f6bfd8e01525291bd..6020cce84810b9515298b65880091ebb97559688 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences.h +++ b/third_party/blink/public/common/web_preferences/web_preferences.h @@ -9,6 +9,7 @@ @@ -43,7 +43,7 @@ index 39eefd4970a93bef42487d51e9c0bdfd76a001a0..a76da90ca59e07ad57ae85ee765b9087 #include "build/build_config.h" #include "net/nqe/effective_connection_type.h" #include "third_party/blink/public/common/common_export.h" -@@ -462,6 +463,19 @@ struct BLINK_COMMON_EXPORT WebPreferences { +@@ -464,6 +465,19 @@ struct BLINK_COMMON_EXPORT WebPreferences { bool increment_local_surface_id_for_mainframe_same_doc_navigation = true; #endif // BUILDFLAG(IS_ANDROID) @@ -64,7 +64,7 @@ index 39eefd4970a93bef42487d51e9c0bdfd76a001a0..a76da90ca59e07ad57ae85ee765b9087 // chrome, except for the cases where it would require lots of extra work for // the embedder to use the same default value. diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h -index 36e04a5f887fd9102b3d74a4230132ecee780c1b..8e53242f1be83920ca64c95c31aa674e04d2bb81 100644 +index ccba9b7353c87d2e2bced7770920c976865c0d65..4d93ef8c1976cf533c32bc9c17dbf6b81f2b59c6 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h +++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h @@ -8,6 +8,7 @@ @@ -129,7 +129,7 @@ index 36e04a5f887fd9102b3d74a4230132ecee780c1b..8e53242f1be83920ca64c95c31aa674e return r.cookie_enabled; } diff --git a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom -index dd6185b0eacf942d902505ac23bf88059bf2786a..f3f1c71f241db0a90144909971412009e5510b6e 100644 +index 9827715ad3cd306a0ec18fb6b2936ecf8677af21..66cbaf3a5b19a38295cad04d0e978de417984370 100644 --- a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom +++ b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom @@ -8,9 +8,11 @@ import "third_party/blink/public/mojom/css/preferred_color_scheme.mojom"; diff --git a/patches/chromium/blink_local_frame.patch b/patches/chromium/blink_local_frame.patch index e629898e85d45..441d2bee5cecb 100644 --- a/patches/chromium/blink_local_frame.patch +++ b/patches/chromium/blink_local_frame.patch @@ -49,7 +49,7 @@ index cdb5b9246087b5678cf6a0f2713f6238dafc13de..7efbe7524c5ddd3785fff0e2d8901f93 // its owning reference back to our owning LocalFrame. client_->Detached(type); diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index 7d0f966131a4e91efd4652e23dec8287e98b82a9..75975a8d48b05ba25b169b93b62bb7d34eb3f5b7 100644 +index 72f642cb098bb6bbb445b49823663a7deb316842..902f472c8c52dd4fe52f46fbb97034b041153f65 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc @@ -751,10 +751,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { diff --git a/patches/chromium/build_add_electron_tracing_category.patch b/patches/chromium/build_add_electron_tracing_category.patch index 7828a1d8f7fd0..3a5d014862c14 100644 --- a/patches/chromium/build_add_electron_tracing_category.patch +++ b/patches/chromium/build_add_electron_tracing_category.patch @@ -8,10 +8,10 @@ categories in use are known / declared. This patch is required for us to introduce a new Electron category for Electron-specific tracing. diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h -index 28d3c301465335cc664dad51e41133cd04fa8a62..290363dfa65a3207e5ade788825d470122a4afc8 100644 +index 67b5911d7815b47aafe1df1030c96a903e495df1..4813b0dc361219ad30a7e745a7906fa396c3950c 100644 --- a/base/trace_event/builtin_categories.h +++ b/base/trace_event/builtin_categories.h -@@ -126,6 +126,7 @@ PERFETTO_DEFINE_CATEGORIES_IN_NAMESPACE_WITH_ATTRS( +@@ -128,6 +128,7 @@ PERFETTO_DEFINE_CATEGORIES_IN_NAMESPACE_WITH_ATTRS( perfetto::Category("drm"), perfetto::Category("drmcursor"), perfetto::Category("dwrite"), diff --git a/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch b/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch index 5bbfd22399d33..b3ab1bac45d53 100644 --- a/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch +++ b/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch @@ -10,10 +10,10 @@ Needed for: 2) //electron/shell/common:web_contents_utility diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn -index 981abc2963aaaa8f4cf283cdc0807907500b65eb..4be2f078f0c9890d0bcca635a82711386abae077 100644 +index 8e91c465c68bec818253820ecaeeb7c3feb180a2..fea8bb9f87c007775a2bb6e1abe1ec498a8b19b4 100644 --- a/content/public/common/BUILD.gn +++ b/content/public/common/BUILD.gn -@@ -382,6 +382,8 @@ mojom("interfaces") { +@@ -371,6 +371,8 @@ mojom("interfaces") { "//content/common/*", "//extensions/common:mojom", "//extensions/common:mojom_blink", diff --git a/patches/chromium/build_disable_thin_lto_mac.patch b/patches/chromium/build_disable_thin_lto_mac.patch index 63e03add5f03e..7633c53f6ca59 100644 --- a/patches/chromium/build_disable_thin_lto_mac.patch +++ b/patches/chromium/build_disable_thin_lto_mac.patch @@ -11,15 +11,15 @@ This patch can (and should) be removed when we can prevent those symbols from being stripped in the release build. diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni -index 0611cd47ef35d3b137a3278896a9174ae2fc3c31..a076c0f461b50fea86679a148b857739f7ec2c3d 100644 +index 21bd22896d7bca4d4a133677286f7f8ad1b224f2..53654e4467fa4ae57ce42bd971b1be3a11654aaf 100644 --- a/build/config/compiler/compiler.gni +++ b/build/config/compiler/compiler.gni -@@ -88,7 +88,7 @@ declare_args() { - # have the same LLVM revisions as us, making bitcode useless to them. +@@ -85,7 +85,7 @@ declare_args() { + # Chrome's clang. crbug.com/1033839 use_thin_lto = is_cfi || (is_clang && is_official_build && chrome_pgo_phase != 1 && -- (is_linux || is_win || is_mac || -+ (is_linux || is_win || - (is_ios && use_lld && !is_cronet_build) || +- (is_linux || is_win || is_mac || (is_ios && use_lld) || ++ (is_linux || is_win || (is_ios && use_lld) || (is_android && target_os != "chromeos") || (is_chromeos && is_chromeos_device))) + diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index ac9e6aa7a1cc7..87522628ff215 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -33,10 +33,10 @@ index e648bb4ed2ff72441faa8773e449e0b6174f5af5..fd2c1d3ac575d10de7d5c09e4418d172 "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index f2f0b13a9b96b906d39cfad4236a7e72b9439e06..7a2dc270b8c19f4418074ad23dd793d15223b33a 100644 +index 790764062094479f25b33a0dfa3e143472e0a077..a9997872138b2d58d279103e4cac3c92f2091f0a 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4811,7 +4811,7 @@ static_library("browser") { +@@ -4807,7 +4807,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index f2f0b13a9b96b906d39cfad4236a7e72b9439e06..7a2dc270b8c19f4418074ad23dd793d1 # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index c60cdd5bf0b3327b5495238c9296b99413c7c226..433a20d22a4df2355d6d407963047491bf3f3b2b 100644 +index 8bcc85cfd507f23c9651ea0a006fd6464ecd134f..92e88e0c8f764a779d7c899b423b589a0302b4bd 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7515,9 +7515,12 @@ test("unit_tests") { +@@ -7516,9 +7516,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index c60cdd5bf0b3327b5495238c9296b99413c7c226..433a20d22a4df2355d6d407963047491 "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8447,6 +8450,10 @@ test("unit_tests") { +@@ -8430,6 +8433,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index c60cdd5bf0b3327b5495238c9296b99413c7c226..433a20d22a4df2355d6d407963047491 sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8503,7 +8510,6 @@ test("unit_tests") { +@@ -8486,7 +8493,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 3826c494fc235..50b6f011f1f4f 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,10 +9,10 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 666ed8890f60cd0477b814b4b44571002eca9bff..73f730ff05a22938a834921d4842bf1f9faaca67 100644 +index 25bc5fd2f2158b95a7d6dff6a9a30c967c052149..ff0406154e44a3b12ec732e836fc1e65dadfd326 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -9823,6 +9823,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -9826,6 +9826,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To<Referrer>(), params->frame_name, params->disposition, *params->features, @@ -21,10 +21,10 @@ index 666ed8890f60cd0477b814b4b44571002eca9bff..73f730ff05a22938a834921d4842bf1f &no_javascript_access); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 3677a957465f59ab80ac059bfcb5afdf98513b48..7a6760e0efdf6972eb497407b68202c5bfffd006 100644 +index 29597a3a6f01fcff65de5624e583b03a1e34dd6f..6c067803c35a4e98ec99df6e28015f3b36e67e4f 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5298,6 +5298,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5319,6 +5319,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( create_params.initially_hidden = renderer_started_hidden; create_params.initial_popup_url = params.target_url; @@ -35,7 +35,7 @@ index 3677a957465f59ab80ac059bfcb5afdf98513b48..7a6760e0efdf6972eb497407b68202c5 // Even though all codepaths leading here are in response to a renderer // trying to open a new window, if the new window ends up in a different // browsing instance, then the RenderViewHost, RenderWidgetHost, -@@ -5353,6 +5357,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5373,6 +5377,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( // Sets the newly created WebContents WindowOpenDisposition. new_contents_impl->original_window_open_disposition_ = params.disposition; @@ -48,7 +48,7 @@ index 3677a957465f59ab80ac059bfcb5afdf98513b48..7a6760e0efdf6972eb497407b68202c5 // If the new frame has a name, make sure any SiteInstances that can find // this named frame have proxies for it. Must be called after // SetSessionStorageNamespace, since this calls CreateRenderView, which uses -@@ -5394,12 +5404,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5414,12 +5424,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( AddWebContentsDestructionObserver(new_contents_impl); } @@ -62,10 +62,10 @@ index 3677a957465f59ab80ac059bfcb5afdf98513b48..7a6760e0efdf6972eb497407b68202c5 new_contents_impl, opener, params.target_url, params.referrer.To<Referrer>(), params.disposition, diff --git a/content/common/frame.mojom b/content/common/frame.mojom -index 90cc84198b7f23c6a07ab503f60a577fdfba5baa..722b27b8adaf86624058ace5f9b5871ff0ede627 100644 +index 15a83f61ed4e31ba34cbc19995cd9d68b1599f1d..9cf9fefad46a6c2ead4085adc76e0c07369f641a 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom -@@ -661,6 +661,10 @@ struct CreateNewWindowParams { +@@ -662,6 +662,10 @@ struct CreateNewWindowParams { pending_associated_remote<blink.mojom.Widget> widget; pending_associated_receiver<blink.mojom.FrameWidgetHost> frame_widget_host; pending_associated_remote<blink.mojom.FrameWidget> frame_widget; @@ -77,10 +77,10 @@ index 90cc84198b7f23c6a07ab503f60a577fdfba5baa..722b27b8adaf86624058ace5f9b5871f // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 750edc0c6767ab6a59d010b4f3f02770e50450b0..60e7eebb4f40df18e3fa28f57b7bbb20733477e7 100644 +index 9d950e48dca63c6ec6899674cdfa98b1b4847542..fd15151cbe0c67164f07a730668f9b5ad0af2f40 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -884,6 +884,8 @@ bool ContentBrowserClient::CanCreateWindow( +@@ -885,6 +885,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -90,7 +90,7 @@ index 750edc0c6767ab6a59d010b4f3f02770e50450b0..60e7eebb4f40df18e3fa28f57b7bbb20 bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index eb7b1fdf7c3b3373201db40f03fc498c4ee08d25..f27b387da5ff4e4f20d28d80043151ad2f2e9d51 100644 +index 6dbfa4f14a5a610b49e58193f50d7337c998e7e1..f93858d6cb4cb89075e9ed7ee50f4e86df37c279 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -201,6 +201,7 @@ class NetworkService; @@ -101,7 +101,7 @@ index eb7b1fdf7c3b3373201db40f03fc498c4ee08d25..f27b387da5ff4e4f20d28d80043151ad } // namespace network namespace sandbox { -@@ -1449,6 +1450,8 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -1458,6 +1459,8 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -111,10 +111,10 @@ index eb7b1fdf7c3b3373201db40f03fc498c4ee08d25..f27b387da5ff4e4f20d28d80043151ad bool opener_suppressed, bool* no_javascript_access); diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index a8c0f1c63847f814b6e71fe24ae9aed24b26ba19..80d004eb9060e33af9e60b31a862a7dcecb254e8 100644 +index 87e310a5473bec20b1326f3202cf2bf603227c04..968cddc769e2bf0bb56359b36bc03cbce6539da1 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc -@@ -33,6 +33,17 @@ namespace content { +@@ -34,6 +34,17 @@ namespace content { WebContentsDelegate::WebContentsDelegate() = default; @@ -133,7 +133,7 @@ index a8c0f1c63847f814b6e71fe24ae9aed24b26ba19..80d004eb9060e33af9e60b31a862a7dc WebContents* source, const OpenURLParams& params, diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 1af915fcc91ae29bb9a6e2fc51f788178365ee4c..6a43f8c30857bfb32867e63d570ad26459af9ae8 100644 +index 16ce42f605513b641cc2ac07e34bfe3a017c5a7a..23b9c84175fd44f0da2ef398c8bf68cf6e3d3ef8 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -18,6 +18,7 @@ @@ -152,7 +152,7 @@ index 1af915fcc91ae29bb9a6e2fc51f788178365ee4c..6a43f8c30857bfb32867e63d570ad264 #include "content/public/common/window_container_type.mojom-forward.h" #include "third_party/blink/public/common/input/web_mouse_event.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" -@@ -381,6 +383,16 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -388,6 +390,16 @@ class CONTENT_EXPORT WebContentsDelegate { const StoragePartitionConfig& partition_config, SessionStorageNamespace* session_storage_namespace); @@ -170,10 +170,10 @@ index 1af915fcc91ae29bb9a6e2fc51f788178365ee4c..6a43f8c30857bfb32867e63d570ad264 // typically happens when popups are created. virtual void WebContentsCreated(WebContents* source_contents, diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index a8d472bb78f3a9478b70cf3d98c35affec7caf39..bc2ec7491d7072be77307d7b8af06e5397e2bdfb 100644 +index 12047149fcd73050b5ee6645fa269153daf1836f..a0aa3ec64b54b99508d1ba9cd52e2fe0e53ed56c 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -6772,6 +6772,10 @@ WebView* RenderFrameImpl::CreateNewWindow( +@@ -6776,6 +6776,10 @@ WebView* RenderFrameImpl::CreateNewWindow( request.HasUserGesture(), GetWebFrame()->IsAdFrame(), GetWebFrame()->IsAdScriptInStack()); diff --git a/patches/chromium/chore_add_electron_deps_to_gitignores.patch b/patches/chromium/chore_add_electron_deps_to_gitignores.patch index 4444651135106..95dcb3362dede 100644 --- a/patches/chromium/chore_add_electron_deps_to_gitignores.patch +++ b/patches/chromium/chore_add_electron_deps_to_gitignores.patch @@ -18,10 +18,10 @@ index 5eb6e4d1815a7a56c7fff1d6f095e6c7e8127b84..808d897ba80abb9cced32a02cb702630 /google_apis/gcm/gcm.xml /googleurl diff --git a/third_party/.gitignore b/third_party/.gitignore -index a750ba32fa50d4367682bf11b88e6a8a4700dc46..c3188f418a6368b35adfdcb2cd96de1614826d39 100644 +index 21adf9c5bd1887e765659a81192338de49028c71..1e64aca78c8609dd9de22d023622f14f58489364 100644 --- a/third_party/.gitignore +++ b/third_party/.gitignore -@@ -46,7 +46,9 @@ +@@ -45,7 +45,9 @@ /directxsdk /dragonbox/src /edk2 @@ -31,7 +31,7 @@ index a750ba32fa50d4367682bf11b88e6a8a4700dc46..c3188f418a6368b35adfdcb2cd96de16 /espresso/lib/ /eyesfree/src /fast_float/src -@@ -94,6 +96,7 @@ +@@ -93,6 +95,7 @@ /mocha /mockito/src /nacl_sdk_binaries/ @@ -39,7 +39,7 @@ index a750ba32fa50d4367682bf11b88e6a8a4700dc46..c3188f418a6368b35adfdcb2cd96de16 /ninja /node/*.tar.gz /node/linux/ -@@ -139,7 +142,7 @@ +@@ -138,7 +141,7 @@ /spirv-cross/src /spirv-headers/src /spirv-tools/src diff --git a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch index 3d3e0677f1662..542b72f1693fc 100644 --- a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch +++ b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch @@ -34,10 +34,10 @@ index 18714ce8fc27c8d56c5deac27ba335078c452d0a..263405c605a0477b7a39bc274d7ee03b virtual void DidClearWindowObject() {} virtual void DidChangeScrollOffset() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index addef4de8a95f47964a895e1d1cc4763f565a028..8bef2220b9a416011cebf4da672c15d117a34efa 100644 +index f337d61906651359eeb5228c112ad948f4f7a752..82cbd10f0817a85d1275519a3f93c687c0314aaa 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4685,10 +4685,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( +@@ -4684,10 +4684,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( observer.DidInstallConditionalFeatures(context, world_id); } @@ -103,10 +103,10 @@ index 1f5e24bc38d6ced52e4773236522e9520efc6f6d..a22ca5968fce5e6a0c436ec9b40f0e2f void WillInitializeWorkerContext() override; void WillDestroyWorkerContext(v8::Local<v8::Context> context) override; diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc -index 37fc43bfc6804c2abb0cf107e2575c72cfca9023..9f3c88be38b9c8960a38649c7f3bf71dff182383 100644 +index 22fdb490c7803f3bf864d9e0e6dc618e4d83480b..3f3367b5039e28b07acd1b326724958d764171c2 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc -@@ -612,6 +612,7 @@ void Dispatcher::DidInitializeServiceWorkerContextOnWorkerThread( +@@ -615,6 +615,7 @@ void Dispatcher::DidInitializeServiceWorkerContextOnWorkerThread( void Dispatcher::WillEvaluateServiceWorkerOnWorkerThread( blink::WebServiceWorkerContextProxy* context_proxy, @@ -259,10 +259,10 @@ index d8f3b11c98fd58baa9995762a29847b9fd760c84..5a9c9356a2098dfa9d28a5d30b19b492 bool AllowScriptExtensions() override { return false; } diff --git a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.cc b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.cc -index eff817cda59a7b6e746813d5c42911d80547b5bd..217c4f76d62dd4910e89d4cb4cff4206fc84cfb1 100644 +index 17860c80651c526e03fd06e4b644c3332b241be7..741a8587e95789038168eb500d3995724e11b47d 100644 --- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.cc +++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_proxy.cc -@@ -180,6 +180,7 @@ void ServiceWorkerGlobalScopeProxy::WillEvaluateScript() { +@@ -181,6 +181,7 @@ void ServiceWorkerGlobalScopeProxy::WillEvaluateScript() { ScriptState::Scope scope( WorkerGlobalScope()->ScriptController()->GetScriptState()); Client().WillEvaluateScript( diff --git a/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch b/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch index de836c49fec8e..85ceeb9344017 100644 --- a/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch +++ b/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch @@ -10,10 +10,10 @@ Subject: chore: "grandfather in" Electron Views and Delegates 6448510: Lock further access to View::set_owned_by_client(). | https://chromium-review.googlesource.com/c/chromium/src/+/6448510 diff --git a/ui/views/view.h b/ui/views/view.h -index ee028fccef7dcc9c3522d09e503d2ac49ffd329a..a56c2f87ee21a2bba2cb65acd426cb192124fa85 100644 +index 7f70b4f6062e369e2198fc12ff507786283a13c7..22cae8f202357d848bd57aff1ee22abfcc6efed6 100644 --- a/ui/views/view.h +++ b/ui/views/view.h -@@ -80,6 +80,19 @@ class ArcNotificationContentView; +@@ -81,6 +81,19 @@ class ArcNotificationContentView; class WideFrameView; } // namespace ash @@ -33,7 +33,7 @@ index ee028fccef7dcc9c3522d09e503d2ac49ffd329a..a56c2f87ee21a2bba2cb65acd426cb19 namespace exo { class ShellSurfaceBase; } -@@ -324,6 +337,14 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, +@@ -325,6 +338,14 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, public: class OwnedByClientPassKey { private: diff --git a/patches/chromium/chore_introduce_blocking_api_for_electron.patch b/patches/chromium/chore_introduce_blocking_api_for_electron.patch index 66a7b369fe02c..758369dec45b7 100644 --- a/patches/chromium/chore_introduce_blocking_api_for_electron.patch +++ b/patches/chromium/chore_introduce_blocking_api_for_electron.patch @@ -7,7 +7,7 @@ This patch comes after Chromium removed the ScopedAllowIO API in favor of explicitly adding ScopedAllowBlocking calls as friends. diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h -index 5625973d8cb18de3c77fbf001e02fdf2827f60fb..5d50a77051a9d2d906ec547796469d980eb42a35 100644 +index 71850795591e1a479620f1348c6adc705db9e839..8821ee4429727630e6600d7f85f0999d3f4b2270 100644 --- a/base/threading/thread_restrictions.h +++ b/base/threading/thread_restrictions.h @@ -133,6 +133,7 @@ class KeyStorageLinux; diff --git a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch index 280ef69ab5cb1..b5342d88212d0 100644 --- a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch +++ b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch @@ -34,10 +34,10 @@ index 2dc44d4787d5198cff7be2cf98ad5acf2d3a9a0b..27a0335aac2bd4239616cf71f5d015c9 class ScrollEvent; diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 7dd0e38866576389d59aecdd5a9ecc712996a597..4c626e026e5b19db737533607957d0ff2fbeae28 100644 +index c60e51f4e1a789caf5ad9c54e496f3e72a327b51..f4fa30c1621e2eb78913ea97a993eb0a3528f36c 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -@@ -1367,6 +1367,10 @@ HBRUSH DesktopWindowTreeHostWin::GetBackgroundPaintBrush() { +@@ -1363,6 +1363,10 @@ HBRUSH DesktopWindowTreeHostWin::GetBackgroundPaintBrush() { return background_paint_brush_; } @@ -49,10 +49,10 @@ index 7dd0e38866576389d59aecdd5a9ecc712996a597..4c626e026e5b19db737533607957d0ff DesktopWindowTreeHostWin::GetSingletonDesktopNativeCursorManager() { return new DesktopNativeCursorManagerWin(); diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -index dcda976f4c3cc0ba6bcf015d5bf7435df009ae30..13cfa18bf406f244ec361a1230ccce440ad9785a 100644 +index baee602a2ce7207ba937c4e46ad8b896bec7ca92..cef7afbf408e38798c398c23dc3e964bd1d95d17 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -@@ -273,6 +273,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin +@@ -272,6 +272,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin void HandleWindowScaleFactorChanged(float window_scale_factor) override; void HandleHeadlessWindowBoundsChanged(const gfx::Rect& bounds) override; HBRUSH GetBackgroundPaintBrush() override; @@ -61,10 +61,10 @@ index dcda976f4c3cc0ba6bcf015d5bf7435df009ae30..13cfa18bf406f244ec361a1230ccce44 Widget* GetWidget(); const Widget* GetWidget() const; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 76893d462786eaff21838614a8251b97bec92a79..72474adfb09f85118b4f752a22d121ab2b4c588a 100644 +index 8c70c5ecef8c352e7cd5b9a986bd45d670760069..b06c3ac425bb1f20b890447ed3315127195ed253 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -3239,15 +3239,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -3244,15 +3244,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, } // We must let Windows handle the caption buttons if it's drawing them, or // they won't work. @@ -86,7 +86,7 @@ index 76893d462786eaff21838614a8251b97bec92a79..72474adfb09f85118b4f752a22d121ab return 0; } } -@@ -3270,6 +3274,7 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -3275,6 +3279,7 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, // handle alt-space, or in the frame itself. is_right_mouse_pressed_on_caption_ = false; ReleaseCapture(); @@ -94,7 +94,7 @@ index 76893d462786eaff21838614a8251b97bec92a79..72474adfb09f85118b4f752a22d121ab // |point| is in window coordinates, but WM_NCHITTEST and TrackPopupMenu() // expect screen coordinates. POINT screen_point = CR_POINT_INITIALIZER_FROM_LPARAM(l_param); -@@ -3277,7 +3282,17 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -3282,7 +3287,17 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, w_param = static_cast<WPARAM>(SendMessage( hwnd(), WM_NCHITTEST, 0, MAKELPARAM(screen_point.x, screen_point.y))); if (w_param == HTCAPTION || w_param == HTSYSMENU) { @@ -114,7 +114,7 @@ index 76893d462786eaff21838614a8251b97bec92a79..72474adfb09f85118b4f752a22d121ab } } else if (message == WM_NCLBUTTONDOWN && diff --git a/ui/views/win/hwnd_message_handler_delegate.h b/ui/views/win/hwnd_message_handler_delegate.h -index 15e8cde9508170addec55290c859c91224bb2c33..a34948b9a42f030c71e453f1c534215fc2e671fa 100644 +index 5e075296a09099e419fcbf7af2772767592edcd8..459339a4c0f0534f4c0ca8ddcb087fc75465beca 100644 --- a/ui/views/win/hwnd_message_handler_delegate.h +++ b/ui/views/win/hwnd_message_handler_delegate.h @@ -256,6 +256,10 @@ class VIEWS_EXPORT HWNDMessageHandlerDelegate { diff --git a/patches/chromium/chore_partial_revert_of.patch b/patches/chromium/chore_partial_revert_of.patch index d8c50995d229b..1dfc25fe46250 100644 --- a/patches/chromium/chore_partial_revert_of.patch +++ b/patches/chromium/chore_partial_revert_of.patch @@ -14,10 +14,10 @@ track down the source of this problem & figure out if we can fix it by changing something in Electron. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 2fd9e3ce15869b284ff8716c02ce8dc6392b2a7b..7bda1bd1d7c34e369c27e4ec283888fe4d50458d 100644 +index d30a9d94cfc30035b39d510ded65f271c9c51bb1..705e848acfc76a6b2e3a4dffb9e8ae8f86d54cbc 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5269,7 +5269,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5290,7 +5290,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( : IsGuest(); // While some guest types do not have a guest SiteInstance, the ones that // don't all override WebContents creation above. diff --git a/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch b/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch index 3fa8f8278ac4c..c3d02ba0c34f2 100644 --- a/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch +++ b/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch @@ -14,10 +14,10 @@ This change patches it out to prevent the DCHECK. It can be removed once/if we see a better solution to the problem. diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc -index 354a5870ef5b07a5903a1b40fcbb00462bf4a64b..bf3af2152ff7ca54412442b275ec7eedd60110ba 100644 +index 19a127d46584ece213442b24beaa6ec45bf3fa14..d8045edd0a207b41e60dbae66a0f50eec31b2d8a 100644 --- a/content/browser/site_instance_impl.cc +++ b/content/browser/site_instance_impl.cc -@@ -225,7 +225,7 @@ scoped_refptr<SiteInstanceImpl> SiteInstanceImpl::CreateForGuest( +@@ -226,7 +226,7 @@ scoped_refptr<SiteInstanceImpl> SiteInstanceImpl::CreateForGuest( BrowserContext* browser_context, const StoragePartitionConfig& partition_config) { DCHECK(browser_context); diff --git a/patches/chromium/chore_patch_out_profile_methods.patch b/patches/chromium/chore_patch_out_profile_methods.patch index 61f52aa913d67..0ac846aec6f25 100644 --- a/patches/chromium/chore_patch_out_profile_methods.patch +++ b/patches/chromium/chore_patch_out_profile_methods.patch @@ -27,10 +27,10 @@ index c390a83277f564f1a67a7dcffa36b9d77a35bc0b..b13273a4b194ad5e8ca2d1639ebca831 // When the enterprise policy is not set, use finch/feature flag choice. return base::FeatureList::IsEnabled( diff --git a/chrome/browser/pdf/pdf_extension_util.cc b/chrome/browser/pdf/pdf_extension_util.cc -index 32e9d7e81ee8008b7e8fd491ec16afc01b5ff35e..51213f193cc5977f9f30dd39548eaf012a4857fa 100644 +index 8f124aa7a67717f3efc52d22dfcef0776ff4cad3..d21e5b49f3a06c5f78e38b45e8be89530fdfd435 100644 --- a/chrome/browser/pdf/pdf_extension_util.cc +++ b/chrome/browser/pdf/pdf_extension_util.cc -@@ -234,10 +234,13 @@ bool IsPrintingEnabled(content::BrowserContext* context) { +@@ -245,10 +245,13 @@ bool IsPrintingEnabled(content::BrowserContext* context) { #if BUILDFLAG(ENABLE_PDF_INK2) bool IsPdfAnnotationsEnabledByPolicy(content::BrowserContext* context) { diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index 551abdb8de19b..a2e92157eb6f6 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -7,10 +7,10 @@ Pending upstream patch, this gives us fuller access to the window.open params so that we will be able to decide whether to cancel it or not. diff --git a/chrome/browser/media/offscreen_tab.cc b/chrome/browser/media/offscreen_tab.cc -index 7a9effeec99682ef063ebe71f209e6ed9fc4cad4..71ef44be47a8665ee36449a38333ddf9cff33ad4 100644 +index 047f1258f951f763df2ca0ba355b19d19337826b..9fc7114312212fbe38ddec740b4aebbcd72cb0f8 100644 --- a/chrome/browser/media/offscreen_tab.cc +++ b/chrome/browser/media/offscreen_tab.cc -@@ -287,8 +287,7 @@ bool OffscreenTab::IsWebContentsCreationOverridden( +@@ -285,8 +285,7 @@ bool OffscreenTab::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -80,10 +80,10 @@ index b6582b4013d9682d32bd524b4053b443a4df00f8..afcbce72e0f247b4d5a637b27c9f25d9 content::WebContents* source, const content::OpenURLParams& params, diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index 00cea7307c68c3d8ae93f5ed6df33cef9065fe7b..c2a3892b0ade29d59b06753fdc84f44dc0890f39 100644 +index 2b9d9a80fb34b5083b6b038ff12714ad6bd363d7..85197b1500bbcdfbd2286b32a0188c0ca2436e07 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc -@@ -2359,7 +2359,8 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2386,7 +2386,8 @@ bool Browser::IsWebContentsCreationOverridden( content::mojom::WindowContainerType window_container_type, const GURL& opener_url, const std::string& frame_name, @@ -93,7 +93,7 @@ index 00cea7307c68c3d8ae93f5ed6df33cef9065fe7b..c2a3892b0ade29d59b06753fdc84f44d if (actor::IsActorOperatingOnWebContents( profile(), content::WebContents::FromRenderFrameHost(opener))) { // If an ExecutionEngine is acting on the opener, prevent it from creating -@@ -2371,7 +2372,7 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2398,7 +2399,7 @@ bool Browser::IsWebContentsCreationOverridden( return (window_container_type == content::mojom::WindowContainerType::BACKGROUND && ShouldCreateBackgroundContents(source_site_instance, opener_url, @@ -103,10 +103,10 @@ index 00cea7307c68c3d8ae93f5ed6df33cef9065fe7b..c2a3892b0ade29d59b06753fdc84f44d WebContents* Browser::CreateCustomWebContents( diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h -index 636b265a6813b01a44930ae73655523b739cafd2..23dad43a14673966af3002263b03bb0cfb91e8f6 100644 +index b4ed72663324d359109813a5b22b6796568097f5..86153748bc72142aafc0b0b53d922e2d22d4d372 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h -@@ -946,8 +946,7 @@ class Browser : public TabStripModelObserver, +@@ -954,8 +954,7 @@ class Browser : public TabStripModelObserver, content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -145,7 +145,7 @@ index 3fc06be01f20e8cd314d95d73a3f58c2f0742fe9..c07910ae59a185442f37ea6e7b96fdf3 // The profile used for the presentation. raw_ptr<Profile, DanglingUntriaged> otr_profile_; diff --git a/chrome/browser/ui/views/hats/hats_next_web_dialog.cc b/chrome/browser/ui/views/hats/hats_next_web_dialog.cc -index 08b9f7ad8544011ee1cbb9bc9857ea06e2fa2c0b..69f666bdc05662bc40e133022b5364cbbbbbdb39 100644 +index 46382dbe43df6abb75ca7825de116d7ed2d1cea6..b07cfad74ec54ad251012dca57c8f44760ba13c1 100644 --- a/chrome/browser/ui/views/hats/hats_next_web_dialog.cc +++ b/chrome/browser/ui/views/hats/hats_next_web_dialog.cc @@ -103,8 +103,7 @@ class HatsNextWebDialog::HatsWebView : public views::WebView { @@ -159,10 +159,10 @@ index 08b9f7ad8544011ee1cbb9bc9857ea06e2fa2c0b..69f666bdc05662bc40e133022b5364cb } content::WebContents* CreateCustomWebContents( diff --git a/components/embedder_support/android/delegate/web_contents_delegate_android.cc b/components/embedder_support/android/delegate/web_contents_delegate_android.cc -index a560d65e113ba4fad4c56d9a2a19df1772079d07..4f621733276141248169b7f5ecc5b6f09140f774 100644 +index 73008c08f2b4fd31636b0df232fc7cd66a69fcaf..a09bfe9af4cb4cd7e1e70b4df4900901a8336894 100644 --- a/components/embedder_support/android/delegate/web_contents_delegate_android.cc +++ b/components/embedder_support/android/delegate/web_contents_delegate_android.cc -@@ -204,14 +204,13 @@ bool WebContentsDelegateAndroid::IsWebContentsCreationOverridden( +@@ -205,14 +205,13 @@ bool WebContentsDelegateAndroid::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -180,7 +180,7 @@ index a560d65e113ba4fad4c56d9a2a19df1772079d07..4f621733276141248169b7f5ecc5b6f0 java_gurl); } diff --git a/components/embedder_support/android/delegate/web_contents_delegate_android.h b/components/embedder_support/android/delegate/web_contents_delegate_android.h -index a13f342976cb57b091ebfc95538f9ef91bb9e6fa..40506e913c0506e38cd141a46468a7669d6c2093 100644 +index fb21bd2cd47618838fb449df5fcf63ee28206146..b0faf6ee23fdc3b104e780e445202350fa155946 100644 --- a/components/embedder_support/android/delegate/web_contents_delegate_android.h +++ b/components/embedder_support/android/delegate/web_contents_delegate_android.h @@ -84,8 +84,7 @@ class WebContentsDelegateAndroid : public content::WebContentsDelegate { @@ -222,10 +222,10 @@ index b969f1d97b7e3396119b579cfbe61e19ff7d2dd4..b8d6169652da28266a514938b45b39c5 content::WebContents* AddNewContents( content::WebContents* source, diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 4e2e910c62534106209758a0e5aeb329cfbaa529..b7967a4ab1c9d2c7b2a49a610af10190bcd6e0f0 100644 +index d7cf36715b036c29d881c84a07c0d3b7f73d609f..11c0124b6f3f1599b5a56ba7817e946a871316cc 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5232,8 +5232,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5253,8 +5253,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( if (delegate_ && delegate_->IsWebContentsCreationOverridden( opener, source_site_instance, params.window_container_type, @@ -236,10 +236,10 @@ index 4e2e910c62534106209758a0e5aeb329cfbaa529..b7967a4ab1c9d2c7b2a49a610af10190 static_cast<WebContentsImpl*>(delegate_->CreateCustomWebContents( opener, source_site_instance, is_new_browsing_instance, diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index 80d004eb9060e33af9e60b31a862a7dcecb254e8..ea179bdf3e702fb1d5be55affe3958f77901cd08 100644 +index 968cddc769e2bf0bb56359b36bc03cbce6539da1..08c983ac6a8e5733431ba00e1288f6d6b087eee6 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc -@@ -155,8 +155,7 @@ bool WebContentsDelegate::IsWebContentsCreationOverridden( +@@ -160,8 +160,7 @@ bool WebContentsDelegate::IsWebContentsCreationOverridden( SiteInstance* source_site_instance, mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -250,10 +250,10 @@ index 80d004eb9060e33af9e60b31a862a7dcecb254e8..ea179bdf3e702fb1d5be55affe3958f7 } diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 6a43f8c30857bfb32867e63d570ad26459af9ae8..97def739ec2418286b76c0039c61b501293c8f5d 100644 +index 23b9c84175fd44f0da2ef398c8bf68cf6e3d3ef8..2e8e60c8ebe837fc68318bd5c13dbd0c873c4292 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h -@@ -361,8 +361,7 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -368,8 +368,7 @@ class CONTENT_EXPORT WebContentsDelegate { SiteInstance* source_site_instance, mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -384,10 +384,10 @@ index 756d4192271d6a65cfe8e1511737c565b543cb1f..5688f6f745056565c3c01947f741c4d1 int opener_render_process_id, int opener_render_frame_id, diff --git a/headless/lib/browser/headless_web_contents_impl.cc b/headless/lib/browser/headless_web_contents_impl.cc -index 1d95f5b521d7ab586fcecda6d6f822b432480367..b534327a8bd5b2c31522339b30caf123734c5cc3 100644 +index 64ecdeb50b861825c9b55a930ff18c36818cad0b..e037d5607f8e1f3acb4ed018080de1b3357647be 100644 --- a/headless/lib/browser/headless_web_contents_impl.cc +++ b/headless/lib/browser/headless_web_contents_impl.cc -@@ -208,8 +208,7 @@ class HeadlessWebContentsImpl::Delegate : public content::WebContentsDelegate { +@@ -206,8 +206,7 @@ class HeadlessWebContentsImpl::Delegate : public content::WebContentsDelegate { content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -398,7 +398,7 @@ index 1d95f5b521d7ab586fcecda6d6f822b432480367..b534327a8bd5b2c31522339b30caf123 ->options() ->block_new_web_contents(); diff --git a/ui/views/controls/webview/web_dialog_view.cc b/ui/views/controls/webview/web_dialog_view.cc -index 3a6d0c589ee634b68e929c17ee912a6b1c19b4f6..b13d80623d1fd0d0798cec33cb92f73ed5947ffa 100644 +index 0e0f67908ca8c97bd0dfe4c4a8e008c74010c623..27ecb428739e2548a42f1485f8b7279a84f7190c 100644 --- a/ui/views/controls/webview/web_dialog_view.cc +++ b/ui/views/controls/webview/web_dialog_view.cc @@ -490,8 +490,7 @@ bool WebDialogView::IsWebContentsCreationOverridden( diff --git a/patches/chromium/chore_remove_reference_to_chrome_browser_themes.patch b/patches/chromium/chore_remove_reference_to_chrome_browser_themes.patch index 870942fa3ee50..9442d50485bba 100644 --- a/patches/chromium/chore_remove_reference_to_chrome_browser_themes.patch +++ b/patches/chromium/chore_remove_reference_to_chrome_browser_themes.patch @@ -11,10 +11,10 @@ not need this dependency. refs https://chromium-review.googlesource.com/c/chromium/src/+/5573603 diff --git a/chrome/browser/ui/color/BUILD.gn b/chrome/browser/ui/color/BUILD.gn -index fffee1ca3d0ab493c616e18ecdc0a4fb6525f974..11816e864deb4244c4a2d87ccd89c0a5f632a024 100644 +index db1a2f393af2b561cb7d13861bc37f81ab3227c8..d371808e1e59e2dbb2da8790a2212cc001caa772 100644 --- a/chrome/browser/ui/color/BUILD.gn +++ b/chrome/browser/ui/color/BUILD.gn -@@ -85,9 +85,6 @@ source_set("mixers") { +@@ -87,9 +87,6 @@ source_set("mixers") { ] } @@ -23,4 +23,4 @@ index fffee1ca3d0ab493c616e18ecdc0a4fb6525f974..11816e864deb4244c4a2d87ccd89c0a5 - } } - if (!is_ios && !is_android) { + if (!is_android) { diff --git a/patches/chromium/command-ismediakey.patch b/patches/chromium/command-ismediakey.patch index c8a7504f742ff..d4a2145be0e61 100644 --- a/patches/chromium/command-ismediakey.patch +++ b/patches/chromium/command-ismediakey.patch @@ -39,10 +39,10 @@ index e87c180342b967756efeb701c73207fcee8754f1..42e37564e585987d367921568f0f1d2b NOTREACHED(); } diff --git a/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_ozone.cc b/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_ozone.cc -index b6985bd63a34c55154fcfae601add6ce6c451704..fb44cc65b1a15c8b69410a2a2cb925a0326bb438 100644 +index ac62aeecad617ce559d3248a61f3e19220d2e6bc..9e6b5b1c84ee1289fd3978fc7430f86b03165521 100644 --- a/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_ozone.cc +++ b/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_ozone.cc -@@ -147,7 +147,8 @@ bool GlobalAcceleratorListenerOzone::StartListeningForAccelerator( +@@ -145,7 +145,8 @@ bool GlobalAcceleratorListenerOzone::StartListeningForAccelerator( const bool registered = platform_global_shortcut_listener_->RegisterAccelerator( accelerator.key_code(), accelerator.IsAltDown(), @@ -52,7 +52,7 @@ index b6985bd63a34c55154fcfae601add6ce6c451704..fb44cc65b1a15c8b69410a2a2cb925a0 if (registered) { registered_hot_keys_.insert(accelerator); } -@@ -162,14 +163,15 @@ void GlobalAcceleratorListenerOzone::StopListeningForAccelerator( +@@ -160,14 +161,15 @@ void GlobalAcceleratorListenerOzone::StopListeningForAccelerator( platform_global_shortcut_listener_->UnregisterAccelerator( accelerator.key_code(), accelerator.IsAltDown(), accelerator.IsCtrlDown(), @@ -70,7 +70,7 @@ index b6985bd63a34c55154fcfae601add6ce6c451704..fb44cc65b1a15c8b69410a2a2cb925a0 int modifiers = 0; if (is_alt_down) { modifiers |= ui::EF_ALT_DOWN; -@@ -180,6 +182,9 @@ void GlobalAcceleratorListenerOzone::OnKeyPressed(ui::KeyboardCode key_code, +@@ -178,6 +180,9 @@ void GlobalAcceleratorListenerOzone::OnKeyPressed(ui::KeyboardCode key_code, if (is_shift_down) { modifiers |= ui::EF_SHIFT_DOWN; } diff --git a/patches/chromium/create_browser_v8_snapshot_file_name_fuse.patch b/patches/chromium/create_browser_v8_snapshot_file_name_fuse.patch index 4f84a3819f3e4..b462c65f603cf 100644 --- a/patches/chromium/create_browser_v8_snapshot_file_name_fuse.patch +++ b/patches/chromium/create_browser_v8_snapshot_file_name_fuse.patch @@ -7,10 +7,10 @@ By default, chromium sets up one v8 snapshot to be used in all v8 contexts. This to have a dedicated browser process v8 snapshot defined by the file `browser_v8_context_snapshot.bin`. diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc -index 46c7c57b5ff40b0e40d66bbeb8ec3f2b7f86cea0..46d144563983dee5a793948d9fd11852fb311088 100644 +index 9240e8485a8dc895eb455b1418fc7559e52a5dd5..e9444e765ac8ac595b799be7feeb6a483c6acf9f 100644 --- a/content/app/content_main_runner_impl.cc +++ b/content/app/content_main_runner_impl.cc -@@ -272,8 +272,13 @@ void AsanProcessInfoCB(const char*, bool*) { +@@ -273,8 +273,13 @@ void AsanProcessInfoCB(const char*, bool*) { } #endif // defined(ADDRESS_SANITIZER) @@ -25,7 +25,7 @@ index 46c7c57b5ff40b0e40d66bbeb8ec3f2b7f86cea0..46d144563983dee5a793948d9fd11852 #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) base::FileDescriptorStore& file_descriptor_store = base::FileDescriptorStore::GetInstance(); -@@ -302,11 +307,12 @@ bool ShouldLoadV8Snapshot(const base::CommandLine& command_line, +@@ -303,11 +308,12 @@ bool ShouldLoadV8Snapshot(const base::CommandLine& command_line, #endif // V8_USE_EXTERNAL_STARTUP_DATA @@ -40,7 +40,7 @@ index 46c7c57b5ff40b0e40d66bbeb8ec3f2b7f86cea0..46d144563983dee5a793948d9fd11852 #endif // V8_USE_EXTERNAL_STARTUP_DATA } -@@ -950,7 +956,7 @@ int ContentMainRunnerImpl::Initialize(ContentMainParams params) { +@@ -951,7 +957,7 @@ int ContentMainRunnerImpl::Initialize(ContentMainParams params) { return TerminateForFatalInitializationError(); #endif // BUILDFLAG(IS_ANDROID) && (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE) @@ -50,7 +50,7 @@ index 46c7c57b5ff40b0e40d66bbeb8ec3f2b7f86cea0..46d144563983dee5a793948d9fd11852 blink::TrialTokenValidator::SetOriginTrialPolicyGetter( base::BindRepeating([]() -> blink::OriginTrialPolicy* { diff --git a/content/public/app/content_main_delegate.cc b/content/public/app/content_main_delegate.cc -index 8b02f553e2fc29da88c3e14c05a7ee82210eab51..14f2e66d5ecda6e860724a3ab946eaaffba33d6d 100644 +index fee2fab8ab33a3829f055b0408e9e763443016cc..678c636c9ca08f8113dc67aafaf9761f33a7f0e5 100644 --- a/content/public/app/content_main_delegate.cc +++ b/content/public/app/content_main_delegate.cc @@ -5,6 +5,7 @@ @@ -73,7 +73,7 @@ index 8b02f553e2fc29da88c3e14c05a7ee82210eab51..14f2e66d5ecda6e860724a3ab946eaaf return new ContentClient(); } diff --git a/content/public/app/content_main_delegate.h b/content/public/app/content_main_delegate.h -index db611d99a6c0f18f39967b38791822fda7d175b5..cc150475de655d5ef20a107ae3ef80c08af8c7fb 100644 +index 8151396412bf6981f3424526386ad6257b8c895d..ac5041c1666ac968251768f604f92434d92e374d 100644 --- a/content/public/app/content_main_delegate.h +++ b/content/public/app/content_main_delegate.h @@ -9,6 +9,7 @@ @@ -84,8 +84,8 @@ index db611d99a6c0f18f39967b38791822fda7d175b5..cc150475de655d5ef20a107ae3ef80c0 #include <vector> #include "base/notreached.h" -@@ -174,6 +175,8 @@ class CONTENT_EXPORT ContentMainDelegate { - virtual bool ShouldHandleConsoleControlEvents(); +@@ -181,6 +182,8 @@ class CONTENT_EXPORT ContentMainDelegate { + virtual bool ShouldInitializePerfetto(InvokedIn invoked_in); #endif + virtual std::string_view GetBrowserV8SnapshotFilename(); diff --git a/patches/chromium/desktop_media_list.patch b/patches/chromium/desktop_media_list.patch index c03a58c52825e..97a8dbdc8a476 100644 --- a/patches/chromium/desktop_media_list.patch +++ b/patches/chromium/desktop_media_list.patch @@ -82,10 +82,10 @@ index 786c526588d81b8b5b1b5dd3760719a53e005995..f66b7d0b4dfcbb8ed3dde5a9ff463ae2 const Source& GetSource(int index) const override; DesktopMediaList::Type GetMediaListType() const override; diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.cc b/chrome/browser/media/webrtc/native_desktop_media_list.cc -index 4383a2dd4a132e3012c206404399d73ac2d40ad4..912921c2b448e2badac50e8a7ed527aeb8f433a9 100644 +index 1f5672f1aae610f2511a5a40885750f987871c8c..199a69a9c45e066a50f48298dae2dbcd06560d5b 100644 --- a/chrome/browser/media/webrtc/native_desktop_media_list.cc +++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc -@@ -214,9 +214,13 @@ content::DesktopMediaID::Id GetUpdatedWindowId( +@@ -216,9 +216,13 @@ content::DesktopMediaID::Id GetUpdatedWindowId( } } #elif BUILDFLAG(IS_MAC) @@ -99,7 +99,7 @@ index 4383a2dd4a132e3012c206404399d73ac2d40ad4..912921c2b448e2badac50e8a7ed527ae #endif return window_id; -@@ -319,7 +323,7 @@ class NativeDesktopMediaList::Worker +@@ -321,7 +325,7 @@ class NativeDesktopMediaList::Worker base::WeakPtr<NativeDesktopMediaList> media_list_; DesktopMediaID::Type source_type_; @@ -108,7 +108,7 @@ index 4383a2dd4a132e3012c206404399d73ac2d40ad4..912921c2b448e2badac50e8a7ed527ae const ThumbnailCapturer::FrameDeliveryMethod frame_delivery_method_; const bool add_current_process_windows_; const bool auto_show_delegated_source_list_; -@@ -601,6 +605,12 @@ void NativeDesktopMediaList::Worker::RefreshNextThumbnail() { +@@ -603,6 +607,12 @@ void NativeDesktopMediaList::Worker::RefreshNextThumbnail() { FROM_HERE, base::BindOnce(&NativeDesktopMediaList::UpdateNativeThumbnailsFinished, media_list_)); @@ -121,7 +121,7 @@ index 4383a2dd4a132e3012c206404399d73ac2d40ad4..912921c2b448e2badac50e8a7ed527ae } void NativeDesktopMediaList::Worker::OnCaptureResult( -@@ -1008,6 +1018,11 @@ void NativeDesktopMediaList::RefreshForVizFrameSinkWindows( +@@ -1009,6 +1019,11 @@ void NativeDesktopMediaList::RefreshForVizFrameSinkWindows( FROM_HERE, base::BindOnce(&Worker::RefreshThumbnails, base::Unretained(worker_.get()), std::move(native_ids), thumbnail_size_)); diff --git a/patches/chromium/disable_compositor_recycling.patch b/patches/chromium/disable_compositor_recycling.patch index 3376fea14a257..b0cdd8d495be7 100644 --- a/patches/chromium/disable_compositor_recycling.patch +++ b/patches/chromium/disable_compositor_recycling.patch @@ -6,7 +6,7 @@ Subject: fix: disabling compositor recycling Compositor recycling is useful for Chrome because there can be many tabs and spinning up a compositor for each one would be costly. In practice, Chrome uses the parent compositor code path of browser_compositor_view_mac.mm; the NSView of each tab is detached when it's hidden and attached when it's shown. For Electron, there is no parent compositor, so we're forced into the "own compositor" code path, which seems to be non-optimal and pretty ruthless in terms of the release of resources. Electron has no real concept of multiple tabs per window, so it should be okay to disable this ruthless recycling altogether in Electron. diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index 57103054e874017bf9926dcdf71786c679f9aac0..571f4cfd4882f048268ebadf00d05ad3c034fedc 100644 +index 3798a24ce4aedb6aa2954d8f99b603bf08f1179d..3f466acfb286b44a8d1ecc7ffd4faf4635a66643 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -558,7 +558,11 @@ diff --git a/patches/chromium/disable_hidden.patch b/patches/chromium/disable_hidden.patch index 173975a40193a..2305c35b534ee 100644 --- a/patches/chromium/disable_hidden.patch +++ b/patches/chromium/disable_hidden.patch @@ -6,10 +6,10 @@ Subject: disable_hidden.patch Electron uses this to disable background throttling for hidden windows. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 817b5da3f10faf0770274f3e03a3a0cd3400f135..27131371845a81c0af16d59334a98656095f4aeb 100644 +index b70623b56267fb7df71519a2c19a04a658f766e2..0bae000a3491e03196bbba033621d389c6150225 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -847,6 +847,10 @@ void RenderWidgetHostImpl::WasHidden() { +@@ -840,6 +840,10 @@ void RenderWidgetHostImpl::WasHidden() { return; } @@ -21,24 +21,23 @@ index 817b5da3f10faf0770274f3e03a3a0cd3400f135..27131371845a81c0af16d59334a98656 // Prompts should remain open and functional across tab switches. if (!delegate_ || !delegate_->IsWaitingForPointerLockPrompt(this)) { diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h -index 43c840283b1f7ac39c2ecec5741cc206c64a064e..c8b2a66eccc2ca0b2be1f338f6c77b906db69faa 100644 +index 636f09a8ac86e7c3f7b8dcdc285792f18f5c5989..276852573eade86f1bc9690e3c78a6279e9ff5af 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h -@@ -1029,6 +1029,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl - // cpu-priority boosted to run discard logic. - void SetIsDiscarding(bool is_discarding); +@@ -1031,6 +1031,8 @@ class CONTENT_EXPORT RenderWidgetHostImpl + return synthetic_gesture_controller_.get(); + } + // Electron: Prevents the widget from getting hidden. + bool disable_hidden_ = false; -+ protected: // |routing_id| must not be IPC::mojom::kRoutingIdNone. // If this object outlives |delegate|, DetachDelegate() must be called when diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index 1ae2c9328679f12cfe7068c6ea0f1589314bc6f0..e98d74fecf4275ef8e7c6d23e5ea5ec3af80b926 100644 +index 7b6b19812f5f1989e39d9c33b387159380beb544..e95a313945397c6eff5514932ce15c5d4b6a8e1f 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -643,7 +643,7 @@ void RenderWidgetHostViewAura::HideImpl() { +@@ -642,7 +642,7 @@ void RenderWidgetHostViewAura::HideImpl() { CHECK(visibility_ == Visibility::HIDDEN || visibility_ == Visibility::OCCLUDED); diff --git a/patches/chromium/enable_reset_aspect_ratio.patch b/patches/chromium/enable_reset_aspect_ratio.patch index d68274c38c61a..9e002370e7856 100644 --- a/patches/chromium/enable_reset_aspect_ratio.patch +++ b/patches/chromium/enable_reset_aspect_ratio.patch @@ -6,10 +6,10 @@ Subject: feat: enable setting aspect ratio to 0 Make SetAspectRatio accept 0 as valid input, which would reset to null. diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 5d0c67f54a321ecb945b04f4981e93ea1e4c8d84..7dd0e38866576389d59aecdd5a9ecc712996a597 100644 +index 86592f9197fa84cbce782ed237cdac74f60e77e1..c60e51f4e1a789caf5ad9c54e496f3e72a327b51 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -@@ -619,7 +619,7 @@ void DesktopWindowTreeHostWin::SetOpacity(float opacity) { +@@ -615,7 +615,7 @@ void DesktopWindowTreeHostWin::SetOpacity(float opacity) { void DesktopWindowTreeHostWin::SetAspectRatio( const gfx::SizeF& aspect_ratio, const gfx::Size& excluded_margin) { @@ -19,10 +19,10 @@ index 5d0c67f54a321ecb945b04f4981e93ea1e4c8d84..7dd0e38866576389d59aecdd5a9ecc71 excluded_margin); } diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 7f4aac3aed53b53d8b8d6bc9b5c507e63906060d..aa5b34fa3fdef76b9bb7afd26ecaeda785e25824 100644 +index 0477bf1b33e5cd17e6d16ccd63f4bc53e303042f..f3f42f2c3ae4b185b0647902a2409bc9b25a152f 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -1050,8 +1050,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen, +@@ -1049,8 +1049,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen, void HWNDMessageHandler::SetAspectRatio(float aspect_ratio, const gfx::Size& excluded_margin) { diff --git a/patches/chromium/export_gin_v8platform_pageallocator_for_usage_outside_of_the_gin.patch b/patches/chromium/export_gin_v8platform_pageallocator_for_usage_outside_of_the_gin.patch index 9d478cd3aeddc..dec2581a04626 100644 --- a/patches/chromium/export_gin_v8platform_pageallocator_for_usage_outside_of_the_gin.patch +++ b/patches/chromium/export_gin_v8platform_pageallocator_for_usage_outside_of_the_gin.patch @@ -21,7 +21,7 @@ index 9dac402705385087ced2df2db757a07246984a94..cb49b4f085026658e920699ed285d524 ThreadIsolatedAllocator* GetThreadIsolatedAllocator() override; #endif diff --git a/gin/v8_platform.cc b/gin/v8_platform.cc -index 698b29e9c31a2695cac30bf85c97a216ff8a6257..dbc38d0d87803496ce122da62e639f2a0334e0f6 100644 +index 43a2543499c1f21eb8d1e9a559466edbe15af9f5..dd4399819ef62187e038af40caff3e8018cba8dd 100644 --- a/gin/v8_platform.cc +++ b/gin/v8_platform.cc @@ -205,6 +205,10 @@ ThreadIsolatedAllocator* V8Platform::GetThreadIsolatedAllocator() { diff --git a/patches/chromium/expose_setuseragent_on_networkcontext.patch b/patches/chromium/expose_setuseragent_on_networkcontext.patch index df940e2987b81..ab63a0a553d84 100644 --- a/patches/chromium/expose_setuseragent_on_networkcontext.patch +++ b/patches/chromium/expose_setuseragent_on_networkcontext.patch @@ -33,10 +33,10 @@ index 0ab8187b0db8ae6db46d81738f653a2bc4c566f6..de3d55e85c22317f7f9375eb94d0d5d4 } // namespace net diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index 3998bb0849cd5bec52c6148ccf1e1a30511b32fb..5b588c510e1e4d551aaf1a0eef2ec7500fcc326c 100644 +index 95822f635b61da7c63b5a1babf93bb61cb786293..892fa1d8d340906d359685894da6553377cda73b 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc -@@ -1892,6 +1892,13 @@ void NetworkContext::EnableDurableMessageCollector( +@@ -1907,6 +1907,13 @@ void NetworkContext::EnableDurableMessageCollector( it->second->AddReceiver(std::move(receiver)); } @@ -51,10 +51,10 @@ index 3998bb0849cd5bec52c6148ccf1e1a30511b32fb..5b588c510e1e4d551aaf1a0eef2ec750 // This may only be called on NetworkContexts created with the constructor // that calls MakeURLRequestContext(). diff --git a/services/network/network_context.h b/services/network/network_context.h -index f7831633a286f7c4aec2dd269b02561275b008c7..799688c0fc662845b1ff75ff472ee667674ab74e 100644 +index 56f1eec94a33c2c9a6289b12ac20323b4bef13d9..1b99211c9c96efba0713e953e708712d6c3714a6 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h -@@ -333,6 +333,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext +@@ -335,6 +335,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext const base::UnguessableToken& throttling_profile_id, mojo::PendingReceiver<network::mojom::DurableMessageCollector> receiver) override; @@ -63,12 +63,12 @@ index f7831633a286f7c4aec2dd269b02561275b008c7..799688c0fc662845b1ff75ff472ee667 void SetEnableReferrers(bool enable_referrers) override; #if BUILDFLAG(IS_CT_SUPPORTED) diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index 6885ff48db5ddfb8e8ec09e91a4c01231261f8e5..4d674a226ff1ccb0c8288177ce6d55f77d4f8116 100644 +index 840eff6ece73983a3b98673adbbb3cfd825565fe..5159d804c493bf2ae08d2786187c614efc96cf23 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -1317,6 +1317,9 @@ interface NetworkContext { - mojo_base.mojom.UnguessableToken throttling_profile_id, - pending_receiver<DurableMessageCollector> receiver); +@@ -1337,6 +1337,9 @@ interface NetworkContext { + mojo_base.mojom.UnguessableToken throttling_profile_id, + pending_receiver<DurableMessageCollector> receiver); + // Updates the user agent to be used for requests. + SetUserAgent(string new_user_agent); @@ -77,10 +77,10 @@ index 6885ff48db5ddfb8e8ec09e91a4c01231261f8e5..4d674a226ff1ccb0c8288177ce6d55f7 SetAcceptLanguage(string new_accept_language); diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h -index cfd21ce01b7db6a4912de8e4ce0799825fd27e77..def5a1f569d480e95053ca54e117eeae64f28057 100644 +index 6f0fe6423e8be903d4e38b783d31443c6ce89db5..9a5d7ad5d6e84e8b824c1614ee006c4984817929 100644 --- a/services/network/test/test_network_context.h +++ b/services/network/test/test_network_context.h -@@ -159,6 +159,7 @@ class TestNetworkContext : public mojom::NetworkContext { +@@ -161,6 +161,7 @@ class TestNetworkContext : public mojom::NetworkContext { void CloseIdleConnections(CloseIdleConnectionsCallback callback) override {} void SetNetworkConditions(const base::UnguessableToken& throttling_profile_id, mojom::NetworkConditionsPtr conditions) override {} diff --git a/patches/chromium/extend_apply_webpreferences.patch b/patches/chromium/extend_apply_webpreferences.patch index 6153035f5ead1..90b0ae0108100 100644 --- a/patches/chromium/extend_apply_webpreferences.patch +++ b/patches/chromium/extend_apply_webpreferences.patch @@ -15,7 +15,7 @@ Ideally we could add an embedder observer pattern here but that can be done in future work. diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index be43ac07eb6563dcb72374dfc4f3bd34913e98c3..099297e6fac7962eb731ba50cb51b868fa7070ac 100644 +index 68a102327e22302587f7cc402cb26ef2f02b261e..ccdbf101d07b9f8baa043894ea7f48a56e7d3ecb 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc @@ -1900,6 +1900,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, diff --git a/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch b/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch index e3d012f5b2160..247d46d373d86 100644 --- a/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch +++ b/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch @@ -12,28 +12,23 @@ uses internally for things like menus and devtools. We can remove this patch once it has in some shape been upstreamed. -diff --git a/ui/native_theme/native_theme.cc b/ui/native_theme/native_theme.cc -index e761050d9afbbc6d1c25dd8ec6a2a90d548c1195..fc28431861f2499095ecedfd1ffb8c4d43545ea4 100644 ---- a/ui/native_theme/native_theme.cc -+++ b/ui/native_theme/native_theme.cc -@@ -240,6 +240,8 @@ void NativeTheme::PaintMenuItemBackground( - } - - bool NativeTheme::ShouldUseDarkColors() const { -+ if (theme_source() == ThemeSource::kForcedLight) return false; -+ if (theme_source() == ThemeSource::kForcedDark) return true; - return should_use_dark_colors_; - } - diff --git a/ui/native_theme/native_theme.h b/ui/native_theme/native_theme.h -index cbe76bbc68692228072fa69a8562c290e571505e..a9fd486a77b7edcba63ee889d583dc4e99f008f4 100644 +index 8391cd1469516e83b2cc1466e121bfeed5497c8e..6bed02855d0917805a43fab111d41702af94368e 100644 --- a/ui/native_theme/native_theme.h +++ b/ui/native_theme/native_theme.h -@@ -460,6 +460,23 @@ class COMPONENT_EXPORT(NATIVE_THEME) NativeTheme { - scoped_refptr<ColorProviderKey::ThemeInitializerSupplier> custom_theme, - bool use_custom_frame = true) const; +@@ -493,6 +493,8 @@ class COMPONENT_EXPORT(NATIVE_THEME) NativeTheme { + void set_page_colors(PageColors page_colors) { page_colors_ = page_colors; } + + PreferredColorScheme preferred_color_scheme() const { ++ if (theme_source() == ThemeSource::kForcedLight) return PreferredColorScheme::kLight; ++ if (theme_source() == ThemeSource::kForcedDark) return PreferredColorScheme::kDark; + return preferred_color_scheme_; + } + void set_preferred_color_scheme(PreferredColorScheme preferred_color_scheme) { +@@ -536,6 +538,24 @@ class COMPONENT_EXPORT(NATIVE_THEME) NativeTheme { + // Whether dark mode is forced via command-line flag. + static bool IsForcedDarkMode(); -+ + enum ThemeSource { + kSystem, + kForcedDark, @@ -45,32 +40,21 @@ index cbe76bbc68692228072fa69a8562c290e571505e..a9fd486a77b7edcba63ee889d583dc4e + } + + void set_theme_source(ThemeSource theme_source) { -+ bool original = ShouldUseDarkColors(); ++ bool was_dark = preferred_color_scheme() == PreferredColorScheme::kDark; + theme_source_ = theme_source; -+ if (ShouldUseDarkColors() != original) NotifyOnNativeThemeUpdated(); ++ if ((preferred_color_scheme() == PreferredColorScheme::kDark) != was_dark) { ++ NotifyOnNativeThemeUpdated(); ++ } + } + - // Returns a shared instance of the native theme that should be used for web - // rendering. Do not use it in a normal application context (i.e. browser). - // The returned object should not be deleted by the caller. This function is -@@ -701,6 +718,7 @@ class COMPONENT_EXPORT(NATIVE_THEME) NativeTheme { - PreferredContrast preferred_contrast_ = PreferredContrast::kNoPreference; - std::optional<base::TimeDelta> caret_blink_interval_; - bool use_overlay_scrollbars_ = false; + protected: + explicit NativeTheme( + ui::SystemTheme system_theme = ui::SystemTheme::kDefault); +@@ -590,6 +610,7 @@ class COMPONENT_EXPORT(NATIVE_THEME) NativeTheme { + std::optional<ui::ColorProviderKey::SchemeVariant> scheme_variant_; + bool should_use_system_accent_color_ = true; + base::TimeDelta caret_blink_interval_; + ThemeSource theme_source_ = ThemeSource::kSystem; - SEQUENCE_CHECKER(sequence_checker_); - }; -diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc -index 0ca923fb1b402ce7a5b112600b86e79b02d96168..5362243aa69bf1a64f860c5757d15298101cde74 100644 ---- a/ui/native_theme/native_theme_win.cc -+++ b/ui/native_theme/native_theme_win.cc -@@ -678,6 +678,8 @@ bool NativeThemeWin::ShouldUseDarkColors() const { - if (InForcedColorsMode() && !IsForcedDarkMode()) { - return false; - } -+ if (theme_source() == ThemeSource::kForcedLight) return false; -+ if (theme_source() == ThemeSource::kForcedDark) return true; - return NativeTheme::ShouldUseDarkColors(); - } + raw_ptr<NativeTheme> associated_web_instance_ = nullptr; diff --git a/patches/chromium/feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch b/patches/chromium/feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch index 659446d75a94d..8c81618244583 100644 --- a/patches/chromium/feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch +++ b/patches/chromium/feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch @@ -173,7 +173,7 @@ index 213eaa5ec6d657a659726cb38103e8bd671fe907..f497447c598198bf690758b1d1c5c6fe void OnFileChooserDestroy(GtkWidget* dialog); diff --git a/ui/shell_dialogs/select_file_dialog.h b/ui/shell_dialogs/select_file_dialog.h -index eb3d997598631b220c3566748f23a5cdac3e4692..b4b2f7294ce6e9349a4a8a05f614e93359eca25a 100644 +index b0f4b3df0a4f10b306ba2d25e5fd51440a25bcd4..4ac06587203d2d2adf1390d9256e537e8cf7b21d 100644 --- a/ui/shell_dialogs/select_file_dialog.h +++ b/ui/shell_dialogs/select_file_dialog.h @@ -224,6 +224,21 @@ class SHELL_DIALOGS_EXPORT SelectFileDialog @@ -262,7 +262,7 @@ index 61683d0eddb04c494ca5e650e7d556b44968ec49..5492456a9138b250e97a5479838bb443 } // namespace ui diff --git a/ui/shell_dialogs/select_file_dialog_linux_portal.cc b/ui/shell_dialogs/select_file_dialog_linux_portal.cc -index 54cefe5b6236b24cd9c4625d603fe9a7205676f5..1f70697a2f9ddba8151b4c4f497fbc007ee5fed8 100644 +index 37e3d53abeca3a90649064053100cf9938b1f406..87dfa1e1c230f3aba90ba9520684828e958de093 100644 --- a/ui/shell_dialogs/select_file_dialog_linux_portal.cc +++ b/ui/shell_dialogs/select_file_dialog_linux_portal.cc @@ -25,6 +25,7 @@ @@ -272,7 +272,7 @@ index 54cefe5b6236b24cd9c4625d603fe9a7205676f5..1f70697a2f9ddba8151b4c4f497fbc00 +#include "electron/shell/browser/ui/file_dialog.h" #include "ui/aura/window_tree_host.h" #include "ui/base/l10n/l10n_util.h" - #include "ui/gfx/native_widget_types.h" + #include "ui/gfx/native_ui_types.h" @@ -96,7 +97,7 @@ void OnGetPropertyReply(dbus::Response* response) { : ServiceAvailability::kNotAvailable; } @@ -294,8 +294,8 @@ index 54cefe5b6236b24cd9c4625d603fe9a7205676f5..1f70697a2f9ddba8151b4c4f497fbc00 + file_dialog::StartPortalAvailabilityTestInBackground(); } - DbusByteArray PathToByteArray(const base::FilePath& path) { -@@ -170,17 +174,20 @@ void SelectFileDialogLinuxPortal::StartAvailabilityTestInBackground() { + std::vector<uint8_t> PathToByteArray(const base::FilePath& path) { +@@ -171,17 +175,20 @@ void SelectFileDialogLinuxPortal::StartAvailabilityTestInBackground() { GetMainTaskRunner() = base::SequencedTaskRunner::GetCurrentDefault(); dbus_xdg::SetSystemdScopeUnitNameForXdgPortal( @@ -318,17 +318,17 @@ index 54cefe5b6236b24cd9c4625d603fe9a7205676f5..1f70697a2f9ddba8151b4c4f497fbc00 } bool SelectFileDialogLinuxPortal::IsRunning( -@@ -385,11 +392,14 @@ DbusDictionary SelectFileDialogLinuxPortal::BuildOptionsDictionary( +@@ -386,11 +393,14 @@ dbus_xdg::Dictionary SelectFileDialogLinuxPortal::BuildOptionsDictionary( const PortalFilterSet& filter_set) { - DbusDictionary dict; + dbus_xdg::Dictionary dict; + std::string accept_label = button_label().empty() ? "" : button_label(); + switch (type_) { case SelectFileDialog::SELECT_UPLOAD_FOLDER: -- dict.PutAs(kFileChooserOptionAcceptLabel, -- DbusString(l10n_util::GetStringUTF8( -- IDS_SELECT_UPLOAD_FOLDER_DIALOG_UPLOAD_BUTTON))); +- dict[kFileChooserOptionAcceptLabel] = +- dbus_utils::Variant::Wrap<"s">(l10n_util::GetStringUTF8( +- IDS_SELECT_UPLOAD_FOLDER_DIALOG_UPLOAD_BUTTON)); + if (accept_label.empty()) { + accept_label = l10n_util::GetStringUTF8( + IDS_SELECT_UPLOAD_FOLDER_DIALOG_UPLOAD_BUTTON); @@ -336,12 +336,13 @@ index 54cefe5b6236b24cd9c4625d603fe9a7205676f5..1f70697a2f9ddba8151b4c4f497fbc00 [[fallthrough]]; case SelectFileDialog::SELECT_FOLDER: case SelectFileDialog::Type::SELECT_EXISTING_FOLDER: -@@ -402,6 +412,10 @@ DbusDictionary SelectFileDialogLinuxPortal::BuildOptionsDictionary( +@@ -403,6 +413,11 @@ dbus_xdg::Dictionary SelectFileDialogLinuxPortal::BuildOptionsDictionary( break; } + if (!accept_label.empty()) { -+ dict.PutAs(kFileChooserOptionAcceptLabel, DbusString(accept_label)); ++ dict[kFileChooserOptionAcceptLabel] = ++ dbus_utils::Variant::Wrap<"s">(accept_label); + } + if (!default_path.empty() && base::IsStringUTF8(default_path.value())) { diff --git a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch index 8481e0f6e5e81..303ecee624a8f 100644 --- a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch +++ b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch @@ -9,7 +9,7 @@ embedders to make custom schemes allow V8 code cache. Chromium CL: https://chromium-review.googlesource.com/c/chromium/src/+/5019665 diff --git a/content/browser/code_cache/generated_code_cache.cc b/content/browser/code_cache/generated_code_cache.cc -index 1673dd4966365f31f1073a4c90743e6fe73880b6..cb3d3da5bc9da99c950521d18f28aa438467fdf4 100644 +index b798ae06446d68fe74e7fef3ade515e9c77f1f73..0b0ecebef9e34986a95e4d9f3b52fcce19f2d686 100644 --- a/content/browser/code_cache/generated_code_cache.cc +++ b/content/browser/code_cache/generated_code_cache.cc @@ -8,6 +8,7 @@ @@ -28,21 +28,11 @@ index 1673dd4966365f31f1073a4c90743e6fe73880b6..cb3d3da5bc9da99c950521d18f28aa43 using storage::BigIOBuffer; -@@ -43,7 +45,7 @@ constexpr char kSeparator[] = " \n"; - - // We always expect to receive valid URLs that can be used as keys to the code - // cache. The relevant checks (for ex: resource_url is valid, origin_lock is --// not opque etc.,) must be done prior to requesting the code cache. -+// not opaque etc.,) must be done prior to requesting the code cache. - // - // This function doesn't enforce anything in the production code. It is here - // to make the assumptions explicit and to catch any errors when DCHECKs are -@@ -53,33 +55,55 @@ void CheckValidKeys(const GURL& resource_url, - GeneratedCodeCache::CodeCacheType cache_type) { +@@ -53,39 +55,55 @@ void CheckValidResource(const GURL& resource_url, + GeneratedCodeCache::CodeCacheType cache_type) { // If the resource url is invalid don't cache the code. DCHECK(resource_url.is_valid()); - bool resource_url_is_chrome_or_chrome_untrusted = -+ + // There are 3 kind of URL scheme compatible for the `resource_url`. + // 1. http: and https: URLs. + // 2. chrome: and chrome-untrusted: URLs. @@ -55,16 +45,22 @@ index 1673dd4966365f31f1073a4c90743e6fe73880b6..cb3d3da5bc9da99c950521d18f28aa43 - resource_url_is_chrome_or_chrome_untrusted || - blink::CommonSchemeRegistry::IsExtensionScheme(resource_url.scheme())); - +- // The chrome and chrome-untrusted schemes are only used with the WebUI +- // code cache type. +- DCHECK_EQ(resource_url_is_chrome_or_chrome_untrusted, +- cache_type == GeneratedCodeCache::kWebUIJavaScript); ++ const bool resource_url_embedder = ++ base::Contains(url::GetCodeCacheSchemes(), resource_url.scheme()); ++ DCHECK(resource_url_http || resource_url_webui || resource_url_embedder); + } + + void CheckValidContext(const GURL& origin_lock, + GeneratedCodeCache::CodeCacheType cache_type) { - // |origin_lock| should be either empty or should have - // Http/Https/chrome/chrome-untrusted schemes and it should not be a URL with - // opaque origin. Empty origin_locks are allowed when the renderer is not - // locked to an origin. - bool origin_lock_is_chrome_or_chrome_untrusted = -+ -+ const bool resource_url_embedder = -+ base::Contains(url::GetCodeCacheSchemes(), resource_url.scheme()); -+ DCHECK(resource_url_http || resource_url_webui || resource_url_embedder); -+ + // |origin_lock| should be either empty or should have code cache allowed + // schemes (http/https/chrome/chrome-untrusted or other custom schemes added + // by url::AddCodeCacheScheme), and it should not be a URL with opaque @@ -86,8 +82,7 @@ index 1673dd4966365f31f1073a4c90743e6fe73880b6..cb3d3da5bc9da99c950521d18f28aa43 - // code cache type. - DCHECK_EQ(origin_lock_is_chrome_or_chrome_untrusted, - cache_type == GeneratedCodeCache::kWebUIJavaScript); -- DCHECK_EQ(resource_url_is_chrome_or_chrome_untrusted, -- cache_type == GeneratedCodeCache::kWebUIJavaScript); ++ + const bool origin_lock_for_embedder = + base::Contains(url::GetCodeCacheSchemes(), origin_lock.scheme()); + @@ -100,16 +95,14 @@ index 1673dd4966365f31f1073a4c90743e6fe73880b6..cb3d3da5bc9da99c950521d18f28aa43 + case GeneratedCodeCache::kJavaScript: + case GeneratedCodeCache::kWebAssembly: + DCHECK(!origin_lock_for_webui); -+ DCHECK(!resource_url_webui); + break; + case GeneratedCodeCache::kWebUIJavaScript: + DCHECK(origin_lock_for_webui); -+ DCHECK(resource_url_webui); + break; + } + + // The custom schemes share the cache type with http(s). -+ if (origin_lock_for_embedder || resource_url_embedder) { ++ if (origin_lock_for_embedder) { + DCHECK(cache_type == GeneratedCodeCache::kJavaScript || + cache_type == GeneratedCodeCache::kWebAssembly); + } @@ -117,7 +110,7 @@ index 1673dd4966365f31f1073a4c90743e6fe73880b6..cb3d3da5bc9da99c950521d18f28aa43 // Generates the cache key for the given |resource_url|, |origin_lock| and diff --git a/content/browser/code_cache/generated_code_cache.h b/content/browser/code_cache/generated_code_cache.h -index 94602e2319d3f7ed557da98e0598c9f96d986260..0a9a856d8bd9d702eb49e45a54c141a39f5ec622 100644 +index a01f0d96ef33ce9460a851b072b7ceed5227dee3..f7e39b28cc0ba2251123925c01083a7935f46f56 100644 --- a/content/browser/code_cache/generated_code_cache.h +++ b/content/browser/code_cache/generated_code_cache.h @@ -51,12 +51,14 @@ class CONTENT_EXPORT GeneratedCodeCache { @@ -259,28 +252,28 @@ index 28556e56f2fd591c46ce6f48d39eb907876a499d..f5737ba60fb9e182459066ffa62c7c58 + } // namespace content diff --git a/content/browser/renderer_host/code_cache_host_impl.cc b/content/browser/renderer_host/code_cache_host_impl.cc -index 404ff1e48a990570dc411a714e570d4f8e1a9ef1..916c5d350cfabae0bfd3da97d6a058f2fb93530d 100644 +index 7b4408f3480bd062ab9221f524633c177a212790..8d283d84b0817a937845b221bb13c6ed12bfade6 100644 --- a/content/browser/renderer_host/code_cache_host_impl.cc +++ b/content/browser/renderer_host/code_cache_host_impl.cc -@@ -6,6 +6,7 @@ - +@@ -7,6 +7,7 @@ + #include <string_view> #include <utility> +#include "base/containers/contains.h" + #include "base/feature_list.h" #include "base/functional/bind.h" #include "base/functional/callback_helpers.h" - #include "base/metrics/histogram_functions.h" -@@ -29,6 +30,7 @@ - #include "third_party/blink/public/common/scheme_registry.h" +@@ -36,6 +37,7 @@ + #include "third_party/blink/public/mojom/loader/code_cache.mojom-data-view.h" #include "url/gurl.h" #include "url/origin.h" +#include "url/url_util.h" using blink::mojom::CacheStorageError; -@@ -36,6 +38,11 @@ namespace content { - - namespace { +@@ -55,6 +57,11 @@ GeneratedCodeCache::CodeCacheType MojoCacheTypeToCodeCacheType( + } + } +bool ProcessLockURLIsCodeCacheScheme(const ProcessLock& process_lock) { + return base::Contains(url::GetCodeCacheSchemes(), @@ -290,7 +283,7 @@ index 404ff1e48a990570dc411a714e570d4f8e1a9ef1..916c5d350cfabae0bfd3da97d6a058f2 bool CheckSecurityForAccessingCodeCacheData( const GURL& resource_url, int render_process_id, -@@ -46,39 +53,57 @@ bool CheckSecurityForAccessingCodeCacheData( +@@ -65,39 +72,56 @@ bool CheckSecurityForAccessingCodeCacheData( // Code caching is only allowed for http(s) and chrome/chrome-untrusted // scripts. Furthermore, there is no way for http(s) pages to load chrome or @@ -303,9 +296,17 @@ index 404ff1e48a990570dc411a714e570d4f8e1a9ef1..916c5d350cfabae0bfd3da97d6a058f2 // chrome-untrusted scripts, so any http(s) page attempting to store data // about a chrome or chrome-untrusted script would be an indication of // suspicious activity. +- if (resource_url.SchemeIs(content::kChromeUIScheme) || +- resource_url.SchemeIs(content::kChromeUIUntrustedScheme)) { +- if (!process_lock.IsLockedToSite()) { +- // We can't tell for certain whether this renderer is doing something +- // malicious, but we don't trust it enough to store data. +- return false; +- } + if (resource_url.SchemeIsHTTPOrHTTPS()) { -+ if (process_lock.MatchesScheme(url::kHttpScheme) || -+ process_lock.MatchesScheme(url::kHttpsScheme)) { + if (process_lock.MatchesScheme(url::kHttpScheme) || + process_lock.MatchesScheme(url::kHttpsScheme)) { +- if (operation == CodeCacheHostImpl::Operation::kWrite) { + return true; + } + // Pages in custom schemes like isolated-app: are allowed to load http(s) @@ -319,19 +320,12 @@ index 404ff1e48a990570dc411a714e570d4f8e1a9ef1..916c5d350cfabae0bfd3da97d6a058f2 + return false; + } + - if (resource_url.SchemeIs(content::kChromeUIScheme) || - resource_url.SchemeIs(content::kChromeUIUntrustedScheme)) { -- if (!process_lock.IsLockedToSite()) { -- // We can't tell for certain whether this renderer is doing something -- // malicious, but we don't trust it enough to store data. -- return false; ++ if (resource_url.SchemeIs(content::kChromeUIScheme) || ++ resource_url.SchemeIs(content::kChromeUIUntrustedScheme)) { + if (process_lock.MatchesScheme(content::kChromeUIScheme) || + process_lock.MatchesScheme(content::kChromeUIUntrustedScheme)) { + return true; - } -- if (process_lock.MatchesScheme(url::kHttpScheme) || -- process_lock.MatchesScheme(url::kHttpsScheme)) { -- if (operation == CodeCacheHostImpl::Operation::kWrite) { ++ } + if (operation == CodeCacheHostImpl::Operation::kWrite) { + if (process_lock.MatchesScheme(url::kHttpScheme) || + process_lock.MatchesScheme(url::kHttpsScheme)) { @@ -362,13 +356,12 @@ index 404ff1e48a990570dc411a714e570d4f8e1a9ef1..916c5d350cfabae0bfd3da97d6a058f2 - return false; - } - return true; -+ + if (base::Contains(url::GetCodeCacheSchemes(), resource_url.scheme())) { + return ProcessLockURLIsCodeCacheScheme(process_lock); } if (operation == CodeCacheHostImpl::Operation::kWrite) { -@@ -433,6 +458,7 @@ std::optional<GURL> CodeCacheHostImpl::GetSecondaryKeyForCodeCache( +@@ -530,6 +554,7 @@ std::optional<GURL> CodeCacheHostImpl::GetSecondaryKeyForCodeCache( process_lock.MatchesScheme(url::kHttpsScheme) || process_lock.MatchesScheme(content::kChromeUIScheme) || process_lock.MatchesScheme(content::kChromeUIUntrustedScheme) || diff --git a/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch b/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch index a04f37e424bbc..22584e3475f9e 100644 --- a/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch +++ b/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch @@ -7,10 +7,10 @@ This is implemented as a magic "window id" that instead of pulling an SCStream m instead farms out to the screen picker. diff --git a/content/browser/media/capture/desktop_capture_device_mac.cc b/content/browser/media/capture/desktop_capture_device_mac.cc -index afb657b7c9e1ede1273532b16428d37cc5d75c59..16707cf516cd34682c84ea2ccebddaa0f84e01f8 100644 +index 120590a93bbc5a47e73c5d5515b7ad07b2364eb6..50a8b0dfe5400d1ab9da2893088583e4f815a140 100644 --- a/content/browser/media/capture/desktop_capture_device_mac.cc +++ b/content/browser/media/capture/desktop_capture_device_mac.cc -@@ -29,7 +29,7 @@ class DesktopCaptureDeviceMac : public IOSurfaceCaptureDeviceBase { +@@ -28,7 +28,7 @@ class DesktopCaptureDeviceMac : public IOSurfaceCaptureDeviceBase { ~DesktopCaptureDeviceMac() override = default; // IOSurfaceCaptureDeviceBase: @@ -46,7 +46,7 @@ index e2771b7b281274cdcb601a5bc78a948ad592087b..48d116823a28213e50775f378e6ce04c // OnStop is called by StopAndDeAllocate. virtual void OnStop() = 0; diff --git a/content/browser/media/capture/screen_capture_kit_device_mac.mm b/content/browser/media/capture/screen_capture_kit_device_mac.mm -index 86128a6555798e8380ffebd635e02329ccb96a12..7733e2d70b604efd41ce42638dd3472cba0b78ad 100644 +index c2d8bbafa39c05f25641f2fd3491ef7f84f4f6a1..5506583824e10d664f32c71d63fda1aabccbdd31 100644 --- a/content/browser/media/capture/screen_capture_kit_device_mac.mm +++ b/content/browser/media/capture/screen_capture_kit_device_mac.mm @@ -27,6 +27,61 @@ @@ -134,19 +134,16 @@ index 86128a6555798e8380ffebd635e02329ccb96a12..7733e2d70b604efd41ce42638dd3472c _errorCallback = errorCallback; } return self; -@@ -210,29 +269,53 @@ + (SCStreamConfiguration*)streamConfigurationWithFrameSize:(gfx::Size)frameSize +@@ -224,28 +283,50 @@ class API_AVAILABLE(macos(12.3)) ScreenCaptureKitDeviceMac + base::OnceCallback<void(content::DesktopMediaID::Id, SCStream*)>; - class API_AVAILABLE(macos(12.3)) ScreenCaptureKitDeviceMac - : public IOSurfaceCaptureDeviceBase, -- public ScreenCaptureKitResetStreamInterface { -+ public ScreenCaptureKitResetStreamInterface -+ { - public: explicit ScreenCaptureKitDeviceMac(const DesktopMediaID& source, -- SCContentFilter* filter) -+ [[maybe_unused]] SCContentFilter* filter) +- SCContentFilter* filter, ++ [[maybe_unused]] SCContentFilter* filter, + StreamCallback stream_created_callback) : source_(source), - filter_(filter), + stream_created_callback_(std::move(stream_created_callback)), device_task_runner_(base::SingleThreadTaskRunner::GetCurrentDefault()) { SampleCallback sample_callback = base::BindPostTask( device_task_runner_, @@ -164,7 +161,6 @@ index 86128a6555798e8380ffebd635e02329ccb96a12..7733e2d70b604efd41ce42638dd3472c initWithSampleCallback:sample_callback + cancelCallback:cancel_callback errorCallback:error_callback]; -+ + if (@available(macOS 15.0, *)) { + auto picker_callback = base::BindPostTask( + device_task_runner_, @@ -192,7 +188,7 @@ index 86128a6555798e8380ffebd635e02329ccb96a12..7733e2d70b604efd41ce42638dd3472c void OnShareableContentCreated(SCShareableContent* content) { DCHECK(device_task_runner_->RunsTasksInCurrentSequence()); -@@ -300,7 +383,7 @@ void CreateStream(SCContentFilter* filter) { +@@ -313,7 +394,7 @@ void CreateStream(SCContentFilter* filter) { return; } @@ -201,7 +197,7 @@ index 86128a6555798e8380ffebd635e02329ccb96a12..7733e2d70b604efd41ce42638dd3472c // Update the content size. This step is neccessary when used together // with SCContentSharingPicker. If the Chrome picker is used, it will // change to retina resolution if applicable. -@@ -309,6 +392,9 @@ void CreateStream(SCContentFilter* filter) { +@@ -322,6 +403,9 @@ void CreateStream(SCContentFilter* filter) { filter.contentRect.size.height * filter.pointPixelScale); } @@ -211,7 +207,7 @@ index 86128a6555798e8380ffebd635e02329ccb96a12..7733e2d70b604efd41ce42638dd3472c gfx::RectF dest_rect_in_frame; actual_capture_format_ = capture_params().requested_format; actual_capture_format_.pixel_format = media::PIXEL_FORMAT_NV12; -@@ -322,6 +408,7 @@ void CreateStream(SCContentFilter* filter) { +@@ -335,6 +419,7 @@ void CreateStream(SCContentFilter* filter) { stream_ = [[SCStream alloc] initWithFilter:filter configuration:config delegate:helper_]; @@ -219,7 +215,7 @@ index 86128a6555798e8380ffebd635e02329ccb96a12..7733e2d70b604efd41ce42638dd3472c { NSError* error = nil; bool add_stream_output_result = -@@ -479,7 +566,7 @@ void OnStreamError() { +@@ -495,7 +580,7 @@ void OnStreamError() { if (fullscreen_module_) { fullscreen_module_->Reset(); } @@ -228,7 +224,7 @@ index 86128a6555798e8380ffebd635e02329ccb96a12..7733e2d70b604efd41ce42638dd3472c } else { client()->OnError(media::VideoCaptureError::kScreenCaptureKitStreamError, FROM_HERE, "Stream delegate called didStopWithError"); -@@ -502,23 +589,41 @@ void OnUpdateConfigurationError() { +@@ -518,23 +603,41 @@ void OnUpdateConfigurationError() { } // IOSurfaceCaptureDeviceBase: @@ -285,18 +281,16 @@ index 86128a6555798e8380ffebd635e02329ccb96a12..7733e2d70b604efd41ce42638dd3472c } void OnStop() override { DCHECK(device_task_runner_->RunsTasksInCurrentSequence()); -@@ -576,8 +681,9 @@ void ResetStreamTo(SCWindow* window) override { - } +@@ -593,7 +696,7 @@ void ResetStreamTo(SCWindow* window) override { private: -+ static int active_streams_; -+ const DesktopMediaID source_; - SCContentFilter* const filter_; ++ static int active_streams_; + StreamCallback stream_created_callback_; const scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; - // The actual format of the video frames that are sent to `client`. -@@ -593,6 +699,10 @@ void ResetStreamTo(SCWindow* window) override { +@@ -610,6 +713,10 @@ void ResetStreamTo(SCWindow* window) override { // Helper class that acts as output and delegate for `stream_`. ScreenCaptureKitDeviceHelper* __strong helper_; @@ -307,7 +301,7 @@ index 86128a6555798e8380ffebd635e02329ccb96a12..7733e2d70b604efd41ce42638dd3472c // This is used to detect when a captured presentation enters fullscreen mode. // If this happens, the module will call the ResetStreamTo function. std::unique_ptr<ScreenCaptureKitFullscreenModule> fullscreen_module_; -@@ -605,6 +715,8 @@ void ResetStreamTo(SCWindow* window) override { +@@ -622,6 +729,8 @@ void ResetStreamTo(SCWindow* window) override { base::WeakPtrFactory<ScreenCaptureKitDeviceMac> weak_factory_{this}; }; @@ -317,10 +311,10 @@ index 86128a6555798e8380ffebd635e02329ccb96a12..7733e2d70b604efd41ce42638dd3472c // Although ScreenCaptureKit is available in 12.3 there were some bugs that diff --git a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc -index 7c8f4b60a9299114ac5e71ede6f602643326507a..203422ff6ab9cf98c3e76820e230321c3cafb5ef 100644 +index 77f6994c9963b57f7e9334bce6fefabdc6ee63e7..a02ca47ea5dea272640737cfffedc8529087c12e 100644 --- a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc +++ b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc -@@ -322,8 +322,16 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( +@@ -321,8 +321,16 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( break; } @@ -338,7 +332,7 @@ index 7c8f4b60a9299114ac5e71ede6f602643326507a..203422ff6ab9cf98c3e76820e230321c // For the other capturers, when a bug reports the type of capture it's // easy enough to determine which capturer was used, but it's a little // fuzzier with window capture. -@@ -339,13 +347,15 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( +@@ -338,13 +346,15 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( } #endif // defined(USE_AURA) || BUILDFLAG(IS_MAC) @@ -356,7 +350,7 @@ index 7c8f4b60a9299114ac5e71ede6f602643326507a..203422ff6ab9cf98c3e76820e230321c kMaxNumberOfBuffers, std::move(receiver), std::move(receiver_on_io_thread)), diff --git a/content/public/browser/desktop_media_id.h b/content/public/browser/desktop_media_id.h -index 294b5f79955ba72976f8ba127fd19556c81e322c..27553e51b281575c5cb7a4ba4dab06d19704388e 100644 +index b90a88a115247bd0c62abb18771220e37a441d2f..f908a95727633e903bd56d2bc8608bba167de4e7 100644 --- a/content/public/browser/desktop_media_id.h +++ b/content/public/browser/desktop_media_id.h @@ -27,6 +27,8 @@ struct CONTENT_EXPORT DesktopMediaID { @@ -369,13 +363,13 @@ index 294b5f79955ba72976f8ba127fd19556c81e322c..27553e51b281575c5cb7a4ba4dab06d1 #if defined(USE_AURA) || BUILDFLAG(IS_MAC) // Assigns integer identifier to the |window| and returns its DesktopMediaID. diff --git a/media/capture/video_capture_types.h b/media/capture/video_capture_types.h -index accd52db0cf7cb043d7d767b778079b5d1160cfb..357ee6111471405d1f860ea6d5000ac65f4ecb9a 100644 +index 949af1a45ab1b0180a767d89f8837df531041dfe..81d0550107f1d5f38b5ef7d658099ea2ca35d3a6 100644 --- a/media/capture/video_capture_types.h +++ b/media/capture/video_capture_types.h -@@ -358,6 +358,8 @@ struct CAPTURE_EXPORT VideoCaptureParams { - // Flag indicating whether HiDPI mode should be enabled for tab capture - // sessions. - bool is_high_dpi_enabled = true; +@@ -364,6 +364,8 @@ struct CAPTURE_EXPORT VideoCaptureParams { + // of the capture is dynamically changed, as for example when using + // share-this-tab-instead. + uint32_t capture_version_source = 0; + + std::optional<bool> use_native_picker; }; diff --git a/patches/chromium/feat_configure_launch_options_for_service_process.patch b/patches/chromium/feat_configure_launch_options_for_service_process.patch index e618525ba9ef0..c560798b2a4c1 100644 --- a/patches/chromium/feat_configure_launch_options_for_service_process.patch +++ b/patches/chromium/feat_configure_launch_options_for_service_process.patch @@ -19,7 +19,7 @@ to STDOUT_FILENO/STD_OUTPUT_HANDLE and STDERR_FILENO/STD_ERROR_HANDLE allowing t parent process to read from the pipe. diff --git a/content/browser/child_process_launcher.h b/content/browser/child_process_launcher.h -index 0a7e292f77a30f76eb413785551d7fa57acf1799..091628a0dd3ca9b4bdf06d484595342bc70e4427 100644 +index 4490b007072cbdb5d5d42bc74ad1eb3c183e86ed..0f365510982d897bc089ab3c97643109a4fcc8af 100644 --- a/content/browser/child_process_launcher.h +++ b/content/browser/child_process_launcher.h @@ -33,6 +33,7 @@ @@ -707,10 +707,10 @@ index c5fee4ad8b246bc1113a383794c6101bade24df3..61f0a0f62795b30105c42da363205284 #if BUILDFLAG(IS_MAC) // Whether or not to disclaim TCC responsibility for the process, defaults to diff --git a/sandbox/policy/win/sandbox_win.cc b/sandbox/policy/win/sandbox_win.cc -index 7f67a828fc76765fa88c1be4d5eed08637c1bae3..b16b7e56efedeb1c10b0b33a569ad2e02505ebf3 100644 +index 23b090edef2457e0dbe96a58b392d03bde05f5c1..545805a97fa4c7fa9318f243588da6a59a58a837 100644 --- a/sandbox/policy/win/sandbox_win.cc +++ b/sandbox/policy/win/sandbox_win.cc -@@ -588,11 +588,9 @@ base::win::ScopedHandle CreateUnsandboxedJob() { +@@ -592,11 +592,9 @@ base::win::ScopedHandle CreateUnsandboxedJob() { // command line flag. ResultCode LaunchWithoutSandbox( const base::CommandLine& cmd_line, @@ -723,7 +723,7 @@ index 7f67a828fc76765fa88c1be4d5eed08637c1bae3..b16b7e56efedeb1c10b0b33a569ad2e0 options.feedback_cursor_off = true; // Network process runs in a job even when unsandboxed. This is to ensure it // does not outlive the browser, which could happen if there is a lot of I/O -@@ -895,7 +893,7 @@ bool SandboxWin::InitTargetServices(TargetServices* target_services) { +@@ -899,7 +897,7 @@ bool SandboxWin::InitTargetServices(TargetServices* target_services) { // static ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( const base::CommandLine& cmd_line, @@ -732,7 +732,7 @@ index 7f67a828fc76765fa88c1be4d5eed08637c1bae3..b16b7e56efedeb1c10b0b33a569ad2e0 SandboxDelegate* delegate, TargetPolicy* policy) { const base::CommandLine& launcher_process_command_line = -@@ -909,7 +907,7 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( +@@ -913,7 +911,7 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( } // Add any handles to be inherited to the policy. @@ -741,7 +741,7 @@ index 7f67a828fc76765fa88c1be4d5eed08637c1bae3..b16b7e56efedeb1c10b0b33a569ad2e0 policy->AddHandleToShare(handle); if (!policy->GetConfig()->IsConfigured()) { -@@ -924,6 +922,13 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( +@@ -928,6 +926,13 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( // have no effect. These calls can fail with SBOX_ERROR_BAD_PARAMS. policy->SetStdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE)); policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE)); @@ -755,7 +755,7 @@ index 7f67a828fc76765fa88c1be4d5eed08637c1bae3..b16b7e56efedeb1c10b0b33a569ad2e0 #endif if (!delegate->PreSpawnTarget(policy)) -@@ -935,7 +940,7 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( +@@ -939,7 +944,7 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( // static ResultCode SandboxWin::StartSandboxedProcess( const base::CommandLine& cmd_line, @@ -764,7 +764,7 @@ index 7f67a828fc76765fa88c1be4d5eed08637c1bae3..b16b7e56efedeb1c10b0b33a569ad2e0 SandboxDelegate* delegate, StartSandboxedProcessCallback result_callback) { SandboxLaunchTimer timer; -@@ -945,7 +950,7 @@ ResultCode SandboxWin::StartSandboxedProcess( +@@ -949,7 +954,7 @@ ResultCode SandboxWin::StartSandboxedProcess( *base::CommandLine::ForCurrentProcess())) { base::Process process; ResultCode result = @@ -773,7 +773,7 @@ index 7f67a828fc76765fa88c1be4d5eed08637c1bae3..b16b7e56efedeb1c10b0b33a569ad2e0 DWORD last_error = GetLastError(); std::move(result_callback).Run(std::move(process), last_error, result); return SBOX_ALL_OK; -@@ -955,7 +960,7 @@ ResultCode SandboxWin::StartSandboxedProcess( +@@ -959,7 +964,7 @@ ResultCode SandboxWin::StartSandboxedProcess( timer.OnPolicyCreated(); ResultCode result = GeneratePolicyForSandboxedProcess( diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index 39151eadcac37..3823a5d079d62 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -20,7 +20,7 @@ making three primary changes to Blink: * Controls whether the CSS rule is available. diff --git a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom -index c5fa337dd4dc80e6dd5e8485ad9ba68ee051ae68..716b487b85d44afe3cf940078983d461375fe556 100644 +index 55b9d698a53e8cc7bc4422b0dbe8a5df71e23e11..b0ce80b13c8f214db027765048170bd40851f68a 100644 --- a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom +++ b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom @@ -48,6 +48,7 @@ enum CSSSampleId { @@ -45,10 +45,10 @@ index e189d584f05f2ce6354c03a9b19f56985df8a15e..41b430e8f2416be098494f5c49fb97ca 'internal-forced-visited-'): internal_visited_order = 0 diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 -index 3d8de3b51b474f8c10b93e042c7a6f989aec6076..b39d90de9e740b8d908645a1c46b0aa234225903 100644 +index 2df4e7b0d00dacfe0b31640da59f4d4a4aa951bd..446853fbb199c1dbe321f0a3652c57e609aed11f 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5 -@@ -8976,6 +8976,26 @@ +@@ -9010,6 +9010,26 @@ property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], }, @@ -76,7 +76,7 @@ index 3d8de3b51b474f8c10b93e042c7a6f989aec6076..b39d90de9e740b8d908645a1c46b0aa2 { name: "-internal-visited-color", diff --git a/third_party/blink/renderer/core/css/css_property_equality.cc b/third_party/blink/renderer/core/css/css_property_equality.cc -index fc3d725bcff1921756e9c4956dbe1e611bb00ba3..27462de749a760418b5c1457d786e95bf892f9c3 100644 +index 4f2eff535fe0a74f612fa67ba0c88442350a0473..b4c8bfe3cf2652b4f9b79ff7b13bf22c1a5880db 100644 --- a/third_party/blink/renderer/core/css/css_property_equality.cc +++ b/third_party/blink/renderer/core/css/css_property_equality.cc @@ -354,6 +354,8 @@ bool CSSPropertyEquality::PropertiesEqual(const PropertyHandle& property, @@ -89,10 +89,10 @@ index fc3d725bcff1921756e9c4956dbe1e611bb00ba3..27462de749a760418b5c1457d786e95b return a.EmptyCells() == b.EmptyCells(); case CSSPropertyID::kFill: diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -index 0ba66a67636d75ed8677f66ba8c6f80645f378bb..ef9ce49a3ca4f7760effe09c8619f49f1575c362 100644 +index ca097bf7d6334fe281f0af2015701b0af7036194..9c5bca32a5ebbfc666e1f941ac99b25fb59fa0c3 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -@@ -12292,5 +12292,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( +@@ -12367,5 +12367,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( CSSValueID::kNone>(stream); } @@ -130,10 +130,10 @@ index 0ba66a67636d75ed8677f66ba8c6f80645f378bb..ef9ce49a3ca4f7760effe09c8619f49f } // namespace css_longhand } // namespace blink diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc -index d5754172748072b522c73e3071effd8206befda6..31ff0e8df2e30d0d46d6d117154b9b4313a76848 100644 +index b6968dd7370614c4a32e015da09b22db55b4143b..53ddeac758bfb89b4a77039a5e2d583e5d600f73 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc -@@ -4022,6 +4022,15 @@ PositionTryFallback StyleBuilderConverter::ConvertSinglePositionTryFallback( +@@ -4049,6 +4049,15 @@ PositionTryFallback StyleBuilderConverter::ConvertSinglePositionTryFallback( return PositionTryFallback(scoped_name, tactic_list); } @@ -150,10 +150,10 @@ index d5754172748072b522c73e3071effd8206befda6..31ff0e8df2e30d0d46d6d117154b9b43 const CSSValue& value) { const auto& list = To<CSSValueList>(value); diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.h b/third_party/blink/renderer/core/css/resolver/style_builder_converter.h -index 6b801bce099cf7311d487e3fae5065cb11529ca7..4e1c37274e29144a769a5a4916b07d4fa8b86e1d 100644 +index 1f98f1086257c02f653f7e6acafc32a165668f52..9a1a436607a3d8c91a49e99d3eabef971e2fea9f 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.h +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.h -@@ -434,6 +434,7 @@ class StyleBuilderConverter { +@@ -441,6 +441,7 @@ class StyleBuilderConverter { static PositionTryFallback ConvertSinglePositionTryFallback( StyleResolverState&, const CSSValue&); @@ -201,10 +201,10 @@ index 0802c73aa4aaf4e1fb5efd367758f19c36691f71..5f06c0af277a7c937e694470beac707a return result; } diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn -index ad5d60eae0f2e451ebe82ce3d86a9d0417d1c2c7..93e1ebc69a605d23985045962210ad4061eb2f1e 100644 +index 09065ad3e03dddb25863ad7ef2e0e8e51af56a9d..08853e8624545824bade5061f6b8394f6309ecb7 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn -@@ -1671,6 +1671,8 @@ component("platform") { +@@ -1673,6 +1673,8 @@ component("platform") { "widget/widget_base.h", "widget/widget_base_client.h", "windows_keyboard_codes.h", @@ -312,7 +312,7 @@ index 7e3d46902fbf736b4240eb3fcb89975a7b222197..57fdc89fc265ad70cb0bff8443cc1026 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index 8325c24ea4549b6e1ba5404f4756aaf3d9408e2f..9e25ca9f0fbcc3819149c10c6bfd8a5e5ea5acf3 100644 +index 9ecc66cab0d9640835b1075ead0f4ae12bb92937..3cbdebcfcb0b6b30a1cd55e45121d77f8c32220f 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ @@ -324,5 +324,5 @@ index 8325c24ea4549b6e1ba5404f4756aaf3d9408e2f..9e25ca9f0fbcc3819149c10c6bfd8a5e + status: "stable", + }, { - name: "Accelerated2dCanvas", - settable_from_internals: true, + // crbug.com/439682405 + name: "AbortByPlaceholderLayout", diff --git a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch index 9abbcbbd896bf..2bc014ec1e312 100644 --- a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch +++ b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch @@ -39,7 +39,7 @@ index aed835411f5728c5685baa43eda2dd1585119b18..0e66085b1c457c1f1f6be241c7d331d7 gpu::SurfaceHandle child_window) { NOTREACHED(); diff --git a/components/viz/host/host_display_client.h b/components/viz/host/host_display_client.h -index 7236eee85fdbb285a9873138075183d37c129666..2ecb1a92fb3216211e8d429254f5b18e3dcc7346 100644 +index 07fe1ea0e8e5f28428a164eedc28d4e5150ab13b..1a20c4b5765ce504c64c0dabfe3080fb65dbc03d 100644 --- a/components/viz/host/host_display_client.h +++ b/components/viz/host/host_display_client.h @@ -39,6 +39,9 @@ class VIZ_HOST_EXPORT HostDisplayClient : public mojom::DisplayClient { @@ -90,11 +90,11 @@ index 8af69cac78b7488d28f1f05ccb174793fe5148cd..9f74e511c263d147b5fbe81fe100d217 private: const HWND hwnd_; diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn -index de0ed691367bda45e5310b1f132171e3a1f2dd3f..53848189bc02cd73446409667ad918e456727ce9 100644 +index 88b4d3e2d965ee6930b4d5dd49c75af079c1bcff..17846f135a333b0f0a2755ad55d2492a4fd33693 100644 --- a/components/viz/service/BUILD.gn +++ b/components/viz/service/BUILD.gn -@@ -174,6 +174,8 @@ viz_component("service") { - "display_embedder/skia_output_surface_impl_on_gpu_debug_capture.h", +@@ -176,6 +176,8 @@ viz_component("service") { + "display_embedder/skia_output_surface_shared_image_interface.h", "display_embedder/skia_render_copy_results.cc", "display_embedder/skia_render_copy_results.h", + "display_embedder/software_output_device_proxy.cc", @@ -564,10 +564,10 @@ index 399fba1a3d4e601dc2cdd5f1f4def8b7fd7a3011..8bcbe0d26c80323155d536c0d3a177a1 gpu::SyncPointManager* GetSyncPointManager() override; gpu::Scheduler* GetGpuScheduler() override; diff --git a/content/browser/compositor/viz_process_transport_factory.cc b/content/browser/compositor/viz_process_transport_factory.cc -index 0c9dabd7e85042499b60d0a27a506745771bea6f..5f1896f4494b86c8385d3f5415863f5a7167715a 100644 +index d8f825a29c50f47a35ef2ff4dc03c0a8d27d877d..4dba804d04626183c749b75b317fd26ee6d57f54 100644 --- a/content/browser/compositor/viz_process_transport_factory.cc +++ b/content/browser/compositor/viz_process_transport_factory.cc -@@ -386,8 +386,14 @@ void VizProcessTransportFactory::OnEstablishedGpuChannel( +@@ -381,8 +381,14 @@ void VizProcessTransportFactory::OnEstablishedGpuChannel( mojo::AssociatedRemote<viz::mojom::DisplayPrivate> display_private; root_params->display_private = display_private.BindNewEndpointAndPassReceiver(); @@ -585,10 +585,10 @@ index 0c9dabd7e85042499b60d0a27a506745771bea6f..5f1896f4494b86c8385d3f5415863f5a compositor_data.display_client->GetBoundRemote(resize_task_runner_); mojo::AssociatedRemote<viz::mojom::ExternalBeginFrameController> diff --git a/services/viz/privileged/mojom/compositing/display_private.mojom b/services/viz/privileged/mojom/compositing/display_private.mojom -index e063835e87f08e6a2359886a96d7b78954e3d5b2..34bcf67726f64466d11a56d7a315ce7e05a0cb3d 100644 +index 78a96bff9ba9e24dababf758ba38f9b430b39a14..7b46e68f52e3c13f731ce486706004423c871eb1 100644 --- a/services/viz/privileged/mojom/compositing/display_private.mojom +++ b/services/viz/privileged/mojom/compositing/display_private.mojom -@@ -119,7 +119,6 @@ interface DisplayClient { +@@ -120,7 +120,6 @@ interface DisplayClient { // Creates a LayeredWindowUpdater implementation to draw into a layered // window. @@ -597,7 +597,7 @@ index e063835e87f08e6a2359886a96d7b78954e3d5b2..34bcf67726f64466d11a56d7a315ce7e // Sends the created child window to the browser process so that it can be diff --git a/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom b/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom -index 4f1e9c6c4aad3a4c3d52d57f1234841471a4649e..cda1963ca4119db70c94b64365ab67fea89e9255 100644 +index ad6f66db209484678e74807f091f03683307e7ce..73a5100e4e2f321f88829ba9a311f1c2f04823c6 100644 --- a/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom +++ b/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom @@ -39,6 +39,7 @@ struct RootCompositorFrameSinkParams { @@ -620,7 +620,7 @@ index 2f462f0deb5fc8a637457243fb5d5849fc214d14..695869b83cefaa24af93a2e11b39de05 + Draw(gfx.mojom.Rect damage_rect) => (); }; diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h -index 0d1fd44c615041039579691802012b8ef96dc9b5..11e6186b8e06008564246e8034b780a09a498838 100644 +index 986569ff285a2a5be21e715dacf6072de92ebe79..2544d15677ac20c83118d5552c94eed103ac1eaa 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h @@ -87,6 +87,7 @@ class DisplayPrivate; @@ -657,7 +657,7 @@ index 0d1fd44c615041039579691802012b8ef96dc9b5..11e6186b8e06008564246e8034b780a0 // Sets the root of the layer tree drawn by this Compositor. The root layer // must have no parent. The compositor's root layer is reset if the root layer // is destroyed. NULL can be passed to reset the root layer, in which case the -@@ -636,6 +649,8 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, +@@ -635,6 +648,8 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, simple_begin_frame_observers_; std::unique_ptr<ui::HostBeginFrameObserver> host_begin_frame_observer_; diff --git a/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch b/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch index f1c39be91ad79..e518f43f3d998 100644 --- a/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch +++ b/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch @@ -82,7 +82,7 @@ index 3bcbb33700b2b9349795c05c12e44b4fafcc0370..b55c72e236f05591d41b7146eab16621 } diff --git a/crypto/apple/keychain.h b/crypto/apple/keychain.h -index 2438c3947f330fb496886b85c8eaf49767c68413..dc7da2fd2819eb64f2083de722a1b2771380abd5 100644 +index b5e604c525d66c172c80f65f38cdb23dccd4259d..7f48d66c83cf41d6d097eb43e271dd5ab43d01e9 100644 --- a/crypto/apple/keychain.h +++ b/crypto/apple/keychain.h @@ -18,6 +18,14 @@ @@ -97,10 +97,10 @@ index 2438c3947f330fb496886b85c8eaf49767c68413..dc7da2fd2819eb64f2083de722a1b277 +using AppleSecKeychainItemRef = SecKeychainItemRef; +#endif + - // DEPRECATED: use `KeychainV2` instead. // Wraps the KeychainServices API in a very thin layer, to allow it to be // mocked out for testing. -@@ -46,13 +54,18 @@ class CRYPTO_EXPORT Keychain { + +@@ -45,13 +53,18 @@ class CRYPTO_EXPORT Keychain { // std::vector<uint8_t> arm is populated instead. virtual base::expected<std::vector<uint8_t>, OSStatus> FindGenericPassword( std::string_view service_name, @@ -170,63 +170,6 @@ index d2b9526f9a0bfa9d12a594c35c71499810cb6bb0..aef0eb3508fc37e3a0e9e1c27a71e1aa +} +#endif + - } // namespace crypto::apple -diff --git a/crypto/apple/keychain_seckeychain.cc b/crypto/apple/keychain_seckeychain.cc -index a737276cb146fdb51433be8ca81947edb54f626e..3adf18cc0f0eb40e88691ba2f5a4b11073f86820 100644 ---- a/crypto/apple/keychain_seckeychain.cc -+++ b/crypto/apple/keychain_seckeychain.cc -@@ -25,14 +25,15 @@ KeychainSecKeychain::~KeychainSecKeychain() = default; - - base::expected<std::vector<uint8_t>, OSStatus> - KeychainSecKeychain::FindGenericPassword(std::string_view service_name, -- std::string_view account_name) const { -+ std::string_view account_name, -+ AppleSecKeychainItemRef* item) const { - base::AutoLock lock(GetSecurityFrameworkLock()); - uint32_t password_length = 0; - void* password_data = nullptr; - OSStatus status = SecKeychainFindGenericPassword( - nullptr, service_name.length(), service_name.data(), - account_name.length(), account_name.data(), &password_length, -- &password_data, nullptr); -+ &password_data, item); - if (status != noErr) { - return base::unexpected(status); - } -@@ -58,6 +59,11 @@ OSStatus KeychainSecKeychain::AddGenericPassword( - password.data(), nullptr); - } - -+OSStatus KeychainSecKeychain::ItemDelete(AppleSecKeychainItemRef item) const { -+ base::AutoLock lock(GetSecurityFrameworkLock()); -+ return SecKeychainItemDelete(item); -+} -+ - #pragma clang diagnostic pop - - } // namespace crypto::apple -diff --git a/crypto/apple/keychain_seckeychain.h b/crypto/apple/keychain_seckeychain.h -index 991b2c8debaa1812812fb04e7ab6bf437c874691..191ea7532d269eae7a975229b12227cd32b56ede 100644 ---- a/crypto/apple/keychain_seckeychain.h -+++ b/crypto/apple/keychain_seckeychain.h -@@ -20,12 +20,17 @@ class CRYPTO_EXPORT KeychainSecKeychain : public Keychain { - - base::expected<std::vector<uint8_t>, OSStatus> FindGenericPassword( - std::string_view service_name, -- std::string_view account_name) const override; -+ std::string_view account_name, -+ AppleSecKeychainItemRef* item) const override; - - OSStatus AddGenericPassword( - std::string_view service_name, - std::string_view account_name, - base::span<const uint8_t> password) const override; -+ -+#if !BUILDFLAG(IS_IOS) -+ OSStatus ItemDelete(SecKeychainItemRef itemRef) const override; -+#endif // !BUILDFLAG(IS_IOS) - }; - } // namespace crypto::apple diff --git a/crypto/apple/mock_keychain.cc b/crypto/apple/mock_keychain.cc index 080806aaf3fc10548b160850ad36ef3519ea2b6f..21f04059d67ba41118face6ee9327aa05e854362 100644 @@ -254,10 +197,10 @@ index 080806aaf3fc10548b160850ad36ef3519ea2b6f..21f04059d67ba41118face6ee9327aa0 IncrementKeychainAccessHistogram(); return kPassword; diff --git a/crypto/apple/mock_keychain.h b/crypto/apple/mock_keychain.h -index 40fb4e1f75a2b7f021a8a20b01d63c7e3b8c5fa3..3c3f41e7ffcaeb74aaff872ce3b54027312ec0dd 100644 +index 680efe0312c81449e069c19d9c6ef146da7834db..b49c2ba5f639344ab57e9f14c098effc38729d1f 100644 --- a/crypto/apple/mock_keychain.h +++ b/crypto/apple/mock_keychain.h -@@ -37,13 +37,18 @@ class CRYPTO_EXPORT MockKeychain : public Keychain { +@@ -36,13 +36,18 @@ class CRYPTO_EXPORT MockKeychain : public Keychain { // Keychain implementation. base::expected<std::vector<uint8_t>, OSStatus> FindGenericPassword( std::string_view service_name, diff --git a/patches/chromium/feat_expose_documentloader_setdefersloading_on_webdocumentloader.patch b/patches/chromium/feat_expose_documentloader_setdefersloading_on_webdocumentloader.patch index 221bd48845ca5..036ac4ed36904 100644 --- a/patches/chromium/feat_expose_documentloader_setdefersloading_on_webdocumentloader.patch +++ b/patches/chromium/feat_expose_documentloader_setdefersloading_on_webdocumentloader.patch @@ -28,7 +28,7 @@ index 33e23680b927d417b0882c7572fe32dc2d2b90c3..9413492f8e0fd6c5371c66329e1ad6d4 // Returns the http referrer of original request which initited this load. diff --git a/third_party/blink/renderer/core/loader/document_loader.h b/third_party/blink/renderer/core/loader/document_loader.h -index a41f344dca8ec3a9004874f4820b742c27999738..222c1d749174e434878cc762625ac8aabe10f5e6 100644 +index 054d0d7e9f62c197ab4e1db82e67eadced3f815d..578fccb657443110d6da486d31afe38c57ac00e3 100644 --- a/third_party/blink/renderer/core/loader/document_loader.h +++ b/third_party/blink/renderer/core/loader/document_loader.h @@ -322,7 +322,7 @@ class CORE_EXPORT DocumentLoader : public GarbageCollected<DocumentLoader>, diff --git a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch index 823196d3be1fd..60ff89c4a1c68 100644 --- a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch +++ b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch @@ -37,10 +37,10 @@ index 4c6da7daa167e8e687d43b6c59948fdc694052f7..1f9a142462146f1cef675455a782996b allow_cookies_from_browser == other.allow_cookies_from_browser && include_request_cookies_with_response == diff --git a/services/network/public/cpp/resource_request.h b/services/network/public/cpp/resource_request.h -index 3137a61cba8ea72aaa422fadaf4f530b22832aa5..3bb07ad3981e21563debfab1d8080767fd349c72 100644 +index 759539fe29d5599936254e1ddf50ff54b4fa8c46..6fba963f21ac5a3b4bb1e140e5120ccdee1720bc 100644 --- a/services/network/public/cpp/resource_request.h +++ b/services/network/public/cpp/resource_request.h -@@ -91,6 +91,7 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ResourceRequest { +@@ -99,6 +99,7 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ResourceRequest { bool has_user_activation = false; bool allow_cookies_from_browser = false; bool include_request_cookies_with_response = false; @@ -49,10 +49,10 @@ index 3137a61cba8ea72aaa422fadaf4f530b22832aa5..3bb07ad3981e21563debfab1d8080767 mojo::PendingRemote<mojom::CookieAccessObserver> cookie_observer; mojo::PendingRemote<mojom::TrustTokenAccessObserver> trust_token_observer; diff --git a/services/network/public/cpp/url_request_mojom_traits.cc b/services/network/public/cpp/url_request_mojom_traits.cc -index 1d4476c7a6d75bf1a02dc874c971068ab99345bd..4b5113ce912bdbe8eb75482bb9d5361272a3a628 100644 +index 828d1d573b4710cddacf84a5cc16058831c7a4d4..fb7dc02e15863212d705a60eeab665e0833b1e4a 100644 --- a/services/network/public/cpp/url_request_mojom_traits.cc +++ b/services/network/public/cpp/url_request_mojom_traits.cc -@@ -64,6 +64,7 @@ bool StructTraits<network::mojom::TrustedUrlRequestParamsDataView, +@@ -67,6 +67,7 @@ bool StructTraits<network::mojom::TrustedUrlRequestParamsDataView, out->allow_cookies_from_browser = data.allow_cookies_from_browser(); out->include_request_cookies_with_response = data.include_request_cookies_with_response(); @@ -61,10 +61,10 @@ index 1d4476c7a6d75bf1a02dc874c971068ab99345bd..4b5113ce912bdbe8eb75482bb9d53612 return false; } diff --git a/services/network/public/cpp/url_request_mojom_traits.h b/services/network/public/cpp/url_request_mojom_traits.h -index 933a3ccdbea3182035a6626f6c288719ce46ab62..5fdc6cd9539ed4501bc577b7eefb629e0d8912f0 100644 +index 3a028b9a2ff0cac114bca857f3a87c4ed331e0a1..e53ed3ceef61961bce7b9ce45098f83c82ea23ce 100644 --- a/services/network/public/cpp/url_request_mojom_traits.h +++ b/services/network/public/cpp/url_request_mojom_traits.h -@@ -101,6 +101,10 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE) +@@ -108,6 +108,10 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE) const network::ResourceRequest::TrustedParams& trusted_params) { return trusted_params.include_request_cookies_with_response; } @@ -76,10 +76,10 @@ index 933a3ccdbea3182035a6626f6c288719ce46ab62..5fdc6cd9539ed4501bc577b7eefb629e network::ResourceRequest::TrustedParams::EnabledClientHints>& enabled_client_hints( diff --git a/services/network/public/mojom/url_request.mojom b/services/network/public/mojom/url_request.mojom -index 02651c7b3b0cb0ab8fd3a4c84ab5b39b0e773536..0cbf060b11cc47c24e5cde0d36edb88cd50d5c98 100644 +index 950d6e0fa3e5304b2d28db0e284f9697d0c9f45c..048900b092875f3dd01b8a3cd813f5a44d1355e1 100644 --- a/services/network/public/mojom/url_request.mojom +++ b/services/network/public/mojom/url_request.mojom -@@ -103,6 +103,9 @@ struct TrustedUrlRequestParams { +@@ -111,6 +111,9 @@ struct TrustedUrlRequestParams { // client which should not be able to see them. bool include_request_cookies_with_response = false; @@ -112,10 +112,10 @@ index 3a5fbaea905e7c01caee3659ff3be06e8def5615..89da9461e8290b8099456e5222f27877 string mime_type; diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc -index a130ee693ca02585a03ee1806d811db81e4e64c7..38a0bf930ad98de932865a871856e615631dbc12 100644 +index 9c6f41c82539ec428defa5e093b8a2d780f6e0ee..5214e695c71ccdaf995bc21f30bf1a16d4f5082c 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc -@@ -400,6 +400,9 @@ URLLoader::URLLoader( +@@ -403,6 +403,9 @@ URLLoader::URLLoader( mojo::SimpleWatcher::ArmingPolicy::MANUAL, TaskRunner(request.priority)), per_factory_orb_state_(context.GetMutableOrbState()), @@ -125,7 +125,7 @@ index a130ee693ca02585a03ee1806d811db81e4e64c7..38a0bf930ad98de932865a871856e615 devtools_request_id_(request.devtools_request_id), options_(PopulateOptions(options, factory_params_->is_orb_enabled, -@@ -539,7 +542,7 @@ void URLLoader::SetUpUrlRequestCallbacks( +@@ -542,7 +545,7 @@ void URLLoader::SetUpUrlRequestCallbacks( &URLLoader::IsSharedDictionaryReadAllowed, base::Unretained(this))); } @@ -134,7 +134,7 @@ index a130ee693ca02585a03ee1806d811db81e4e64c7..38a0bf930ad98de932865a871856e615 url_request_->SetResponseHeadersCallback(base::BindRepeating( &URLLoader::SetRawResponseHeaders, base::Unretained(this))); } -@@ -1154,6 +1157,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) { +@@ -1161,6 +1164,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) { } response_ = BuildResponseHead(); diff --git a/patches/chromium/feat_filter_out_non-shareable_windows_in_the_current_application_in.patch b/patches/chromium/feat_filter_out_non-shareable_windows_in_the_current_application_in.patch index dd00d6888dc0d..c052fef3c9a29 100644 --- a/patches/chromium/feat_filter_out_non-shareable_windows_in_the_current_application_in.patch +++ b/patches/chromium/feat_filter_out_non-shareable_windows_in_the_current_application_in.patch @@ -7,10 +7,10 @@ Subject: feat: filter out non-shareable windows in the current application in This patch ensures that windows protected via win.setContentProtection(true) do not appear in full display captures via desktopCapturer. This patch could be upstreamed but as the check is limited to in-process windows it doesn't make a lot of sense for Chromium itself. This patch currently has a limitation that it only function for windows created / protected BEFORE the stream is started. There is theoretical future work we can do via polling / observers to automatically update the SCContentFilter when new windows are made but for now this will solve 99+% of the problem and folks can re-order their logic a bit to get it working for their use cases. diff --git a/content/browser/media/capture/screen_capture_kit_device_mac.mm b/content/browser/media/capture/screen_capture_kit_device_mac.mm -index 2b90b268dcc43202f5c01ac5a65b4bdfb79235e5..86128a6555798e8380ffebd635e02329ccb96a12 100644 +index 404085d1ccf3ea7f4d11941efa64dc1a193552e0..c2d8bbafa39c05f25641f2fd3491ef7f84f4f6a1 100644 --- a/content/browser/media/capture/screen_capture_kit_device_mac.mm +++ b/content/browser/media/capture/screen_capture_kit_device_mac.mm -@@ -253,8 +253,17 @@ void OnShareableContentCreated(SCShareableContent* content) { +@@ -266,8 +266,17 @@ void OnShareableContentCreated(SCShareableContent* content) { // fallback. See https://crbug.com/325530044. if (source_.id == display.displayID || source_.id == webrtc::kFullDesktopScreenId) { diff --git a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch index 80aaa9daf8fbe..28fe09fe3784b 100644 --- a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch +++ b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch @@ -20,7 +20,7 @@ This patch will be removed when the deprecated sync api support is removed. diff --git a/components/permissions/permission_util.cc b/components/permissions/permission_util.cc -index 2b132446e1e384de0e51355a44fab38dbaf64f53..83b0237a56d5ea7555ae989bd7bd13886f0c8f13 100644 +index a82088f96079c3d5ddfbd35df98b2ebb2c0e62a4..668012a5e422059f52815fadf3c7d1d99af55032 100644 --- a/components/permissions/permission_util.cc +++ b/components/permissions/permission_util.cc @@ -536,6 +536,7 @@ ContentSettingsType PermissionUtil::PermissionTypeToContentSettingsTypeSafe( @@ -32,10 +32,10 @@ index 2b132446e1e384de0e51355a44fab38dbaf64f53..83b0237a56d5ea7555ae989bd7bd1388 break; } diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc -index 8af9381691776fd7968cab890e32546c285979e4..d92f15f9ff1bf8dc23361e668f6d48199540c4e6 100644 +index 17a10ffc53c5700bb907f68142a6d6f403415099..dda07e1d45bf49b1fc3970a34a17bf65abc79e60 100644 --- a/content/browser/permissions/permission_controller_impl.cc +++ b/content/browser/permissions/permission_controller_impl.cc -@@ -88,6 +88,7 @@ PermissionToSchedulingFeature(PermissionType permission_name) { +@@ -89,6 +89,7 @@ PermissionToSchedulingFeature(PermissionType permission_name) { case PermissionType::AUTOMATIC_FULLSCREEN: case PermissionType::WEB_APP_INSTALLATION: case PermissionType::LOCAL_NETWORK_ACCESS: @@ -91,7 +91,7 @@ index 5c82a641538802bc459782ea422a1186045b054a..c286d87043ec4cb2e51ec9d82d08e4c8 // Always keep this at the end. NUM, diff --git a/third_party/blink/public/mojom/permissions/permission.mojom b/third_party/blink/public/mojom/permissions/permission.mojom -index 66270fa219491e0b9f09113e45452cd8c2890b52..47c73522cbd7c1d12dabfecf6f55a74690ebc189 100644 +index 1591cba375920ef3bdaa5698658ac386cbed248c..6fc349a2f4633d1338fbfcf8d0d0fb6fa3180b0d 100644 --- a/third_party/blink/public/mojom/permissions/permission.mojom +++ b/third_party/blink/public/mojom/permissions/permission.mojom @@ -43,7 +43,8 @@ enum PermissionName { diff --git a/patches/chromium/fix_adapt_exclusive_access_for_electron_needs.patch b/patches/chromium/fix_adapt_exclusive_access_for_electron_needs.patch index d537ad8fd8ba4..01ae732adbc8b 100644 --- a/patches/chromium/fix_adapt_exclusive_access_for_electron_needs.patch +++ b/patches/chromium/fix_adapt_exclusive_access_for_electron_needs.patch @@ -16,7 +16,7 @@ Linux or Windows to un-fullscreen in some circumstances without this change. diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc -index 52ab5b76078ac160162c6781d886c5466db5f037..0ee6e12a3194d9c99dd7d884afd33f58dad07d09 100644 +index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0669f2517 100644 --- a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc @@ -47,7 +47,7 @@ diff --git a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch index 6ae5e9a32cef2..d5be2ad823819 100644 --- a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch +++ b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch @@ -14,10 +14,23 @@ input list). We also need to ensure that an initial paint is scheduled when the compositor is unsuspended in headles mode. +Additionally, this patch reverts +https://chromium-review.googlesource.com/c/chromium/src/+/6936895 +as we depend on the removed functionality in this patch. + diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -index eafa32f62cac0627a4e32aa2301c2cbe0b18ede9..8e20b757a1d6d15e5ab2d633b2c8fd65a6cb88b3 100644 +index 7befaf18ae9c922ccd8d36a006b9105cb55b1a32..953a683a7057e3be8181be197486709a55d04e9a 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm +@@ -464,7 +464,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, + if (!is_tooltip) { + tooltip_manager_ = std::make_unique<TooltipManagerMac>(GetNSWindowMojo()); + } +- is_headless_mode_window_ = display::Screen::Get()->IsHeadless(); ++ is_headless_mode_window_ = params.ShouldInitAsHeadless(); + + if (params.workspace.length()) { + std::string restoration_data; @@ -664,9 +664,10 @@ void HandleAccelerator(const ui::Accelerator& accelerator, // case it will never become visible but we want its compositor to produce // frames for screenshooting and screencasting. @@ -30,16 +43,82 @@ index eafa32f62cac0627a4e32aa2301c2cbe0b18ede9..8e20b757a1d6d15e5ab2d633b2c8fd65 } // Register the CGWindowID (used to identify this window for video capture) +diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc +index d24b78b50700f9f627c12cd5f339c7dcc0c173e5..77fd8b2f409e8f9151eb81c6a0da786babcdee6b 100644 +--- a/ui/views/widget/widget.cc ++++ b/ui/views/widget/widget.cc +@@ -222,6 +222,18 @@ ui::ZOrderLevel Widget::InitParams::EffectiveZOrderLevel() const { + } + } + ++bool Widget::InitParams::ShouldInitAsHeadless() const { ++ if (headless_mode) { ++ return true; ++ } ++ ++ if (Widget* top_level_widget = GetTopLevelWidgetForNativeView(parent)) { ++ return top_level_widget->is_headless(); ++ } ++ ++ return false; ++} ++ + void Widget::InitParams::SetParent(Widget* parent_widget) { + SetParent(parent_widget->GetNativeView()); + } +@@ -469,6 +481,7 @@ void Widget::Init(InitParams params) { + + params.child |= (params.type == InitParams::TYPE_CONTROL); + is_top_level_ = !params.child; ++ is_headless_ = params.ShouldInitAsHeadless(); + is_autosized_ = params.autosize; + + if (params.opacity == views::Widget::InitParams::WindowOpacity::kInferred && diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h -index 31709448e70a4213d1e9dedcb26ac27c4829a32c..3b9da80b4673faae16d8ef7722cd7804e3fac82e 100644 +index 89e00e8d2a456634beee8c72fcb753ab67e16c9e..473240be0c9168dc7a5fe771f1d473d9e2a9d978 100644 --- a/ui/views/widget/widget.h +++ b/ui/views/widget/widget.h -@@ -1302,6 +1302,8 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, - // True if widget was created in headless mode. - bool is_headless() const { return is_headless_; } +@@ -324,6 +324,11 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, + // case where |activatable| is |kDefault|. + bool CanActivate() const; ++ // Returns whether the widget should be initialized as headless by checking ++ // if |headless_mode| or the associated top level widget's |is_headless_| ++ // are set. ++ bool ShouldInitAsHeadless() const; ++ + // Returns the z-order level, based on the overriding |z_order| but also + // taking into account special levels due to |type|. + ui::ZOrderLevel EffectiveZOrderLevel() const; +@@ -504,6 +509,9 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, + // If true then the widget uses software compositing. + bool force_software_compositing = false; + ++ // If set, the widget was created in headless mode. ++ bool headless_mode = false; ++ + // If set, the window size will follow the content preferred size. + bool autosize = false; + +@@ -1291,6 +1299,11 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, + // with it. TYPE_CONTROL and TYPE_TOOLTIP is not considered top level. + bool is_top_level() const { return is_top_level_; } + ++ // True if widget was created in headless mode. ++ bool is_headless() const { return is_headless_; } ++ + void DisableHeadlessMode() { is_headless_ = false; } + // True if the window size will follow the content preferred size. bool is_autosized() const { return is_autosized_; } +@@ -1718,6 +1731,9 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, + // If true, the mouse is currently down. + bool is_mouse_button_pressed_ = false; + ++ // If set, the widget was created in headless mode. ++ bool is_headless_ = false; ++ + // If set, the window size will follow the content preferred size. + bool is_autosized_ = false; + diff --git a/patches/chromium/fix_aspect_ratio_with_max_size.patch b/patches/chromium/fix_aspect_ratio_with_max_size.patch index c64a82c51e4a7..1b2e61f538ce9 100644 --- a/patches/chromium/fix_aspect_ratio_with_max_size.patch +++ b/patches/chromium/fix_aspect_ratio_with_max_size.patch @@ -11,10 +11,10 @@ enlarge window above dimensions set during creation of the BrowserWindow. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index aa5b34fa3fdef76b9bb7afd26ecaeda785e25824..76893d462786eaff21838614a8251b97bec92a79 100644 +index f3f42f2c3ae4b185b0647902a2409bc9b25a152f..8c70c5ecef8c352e7cd5b9a986bd45d670760069 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -3843,15 +3843,30 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param, +@@ -3848,15 +3848,30 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param, delegate_->GetMinMaxSize(&min_window_size, &max_window_size); min_window_size = delegate_->DIPToScreenSize(min_window_size); max_window_size = delegate_->DIPToScreenSize(max_window_size); diff --git a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch index ca5718a72fccd..0d456b6702209 100644 --- a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch +++ b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch @@ -28,10 +28,10 @@ The patch should be removed in favor of either: Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397. diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index ed42146d41ed88133780217cea15ab068ca77745..f151330a55443f9e4518265ccc2c1368a38474ae 100644 +index 9dd046c064cf127846913deb0ce4582b291ffde9..d9dbaa5819e35a9fde95449ad2968fb2d940a015 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc -@@ -11316,6 +11316,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { +@@ -11354,6 +11354,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { target_rph_id); } @@ -44,10 +44,10 @@ index ed42146d41ed88133780217cea15ab068ca77745..f151330a55443f9e4518265ccc2c1368 // origin of |common_params.url| and/or |common_params.initiator_origin|. url::Origin resolved_origin = url::Origin::Resolve( diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc -index 24ca17c2cf3e633f5609d13cebfc521991e9aabf..8e34fadf2cb21e561d6a4d3b0c7e8c384e33cc73 100644 +index 061d87450ce7a157dff622eda112df7fd94fd9a4..e4b12b1327da816c3015d98ec93c6922417d5d1a 100644 --- a/third_party/blink/renderer/core/loader/document_loader.cc +++ b/third_party/blink/renderer/core/loader/document_loader.cc -@@ -2322,6 +2322,10 @@ Frame* DocumentLoader::CalculateOwnerFrame() { +@@ -2337,6 +2337,10 @@ Frame* DocumentLoader::CalculateOwnerFrame() { scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin( Document* owner_document) { scoped_refptr<SecurityOrigin> origin; @@ -58,7 +58,7 @@ index 24ca17c2cf3e633f5609d13cebfc521991e9aabf..8e34fadf2cb21e561d6a4d3b0c7e8c38 // Whether the origin is newly created within this call, instead of copied // from an existing document's origin or from `origin_to_commit_`. If this is // true, we won't try to compare the nonce of this origin (if it's opaque) to -@@ -2358,6 +2362,9 @@ scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin( +@@ -2373,6 +2377,9 @@ scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin( // non-renderer only origin bits will be the same, which will be asserted at // the end of this function. origin = origin_to_commit_; diff --git a/patches/chromium/fix_disabling_background_throttling_in_compositor.patch b/patches/chromium/fix_disabling_background_throttling_in_compositor.patch index e61b1144adbce..75dbbf623d7db 100644 --- a/patches/chromium/fix_disabling_background_throttling_in_compositor.patch +++ b/patches/chromium/fix_disabling_background_throttling_in_compositor.patch @@ -12,7 +12,7 @@ invisible state of the `viz::DisplayScheduler` owned by the `ui::Compositor`. diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc -index 57cac208e943687226348b427c3d80b2cc9288a7..c2794daaa48af44f9cfd374bac45c64b315a6817 100644 +index a0e6ea08b4918c057d69f15acad717f71d49747d..39e54cff7e13bddda0f37a4b87cbae2adc7d6170 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc @@ -358,7 +358,8 @@ void Compositor::SetLayerTreeFrameSink( @@ -36,7 +36,7 @@ index 57cac208e943687226348b427c3d80b2cc9288a7..c2794daaa48af44f9cfd374bac45c64b if (changed) { observer_list_.Notify(&CompositorObserver::OnCompositorVisibilityChanged, -@@ -1079,6 +1082,15 @@ void Compositor::MaybeUpdateObserveBeginFrame() { +@@ -1075,6 +1078,15 @@ void Compositor::MaybeUpdateObserveBeginFrame() { host_begin_frame_observer_->GetBoundRemote()); } @@ -53,10 +53,10 @@ index 57cac208e943687226348b427c3d80b2cc9288a7..c2794daaa48af44f9cfd374bac45c64b void Compositor::SetSeamlessRefreshRates( const std::vector<float>& seamless_refresh_rates) { diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h -index 11e6186b8e06008564246e8034b780a09a498838..902c14d3d88fd6e65332ea05c566793cce569089 100644 +index 2544d15677ac20c83118d5552c94eed103ac1eaa..6a556d339b89f4ff6fc94f4f659219ea5b5a6a63 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h -@@ -520,6 +520,10 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, +@@ -519,6 +519,10 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, const cc::LayerTreeSettings& GetLayerTreeSettings() const; @@ -67,7 +67,7 @@ index 11e6186b8e06008564246e8034b780a09a498838..902c14d3d88fd6e65332ea05c566793c size_t saved_events_metrics_count_for_testing() const { return host_->saved_events_metrics_count_for_testing(); } -@@ -730,6 +734,12 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, +@@ -729,6 +733,12 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, // See go/report-ux-metrics-at-painting for details. bool animation_started_ = false; diff --git a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch index 4df73711b0cbb..ac2379859e70e 100644 --- a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch +++ b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch @@ -83,7 +83,7 @@ index 387a75ac7b0c7be1e38c3ba2b357f729f1e09229..fecf72a6d434f7c22159420c1cbbf34a PictureInPictureOcclusionTracker* diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -index fea71317b41429dd3bbd50947673124f7c230394..ddfd48582869c6285274d241b5d876e9c4fbe555 100644 +index c5552aa0dedf6adbe10409f32c6eeca28f11c0b6..be2b51295d08f468b416aa5755e6498942878de8 100644 --- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc @@ -471,11 +471,13 @@ std::unique_ptr<VideoOverlayWindowViews> VideoOverlayWindowViews::Create( diff --git a/patches/chromium/fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch b/patches/chromium/fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch index 1fa8621a09e87..6ae3218c31b0e 100644 --- a/patches/chromium/fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch +++ b/patches/chromium/fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch @@ -13,13 +13,13 @@ messages in the legacy window handle layer. These conditions are regularly hit with WCO-enabled windows on Windows. diff --git a/content/browser/renderer_host/legacy_render_widget_host_win.cc b/content/browser/renderer_host/legacy_render_widget_host_win.cc -index 475629d48e8807547e0c79f6fa00d458bac3416c..97f4520fbf7797b19747b5101097d93cf475fb5c 100644 +index adf8545f5690223df73d61918dc3022fe63b6b8f..35ad59782691d2d254907df1d4f07788c927a37a 100644 --- a/content/browser/renderer_host/legacy_render_widget_host_win.cc +++ b/content/browser/renderer_host/legacy_render_widget_host_win.cc -@@ -375,12 +375,12 @@ LRESULT LegacyRenderWidgetHostHWND::OnMouseRange(UINT message, +@@ -376,12 +376,12 @@ LRESULT LegacyRenderWidgetHostHWND::OnKeyboardRange(UINT message, + LRESULT LegacyRenderWidgetHostHWND::OnMouseRange(UINT message, WPARAM w_param, - LPARAM l_param, - BOOL& handled) { + LPARAM l_param) { - if (message == WM_MOUSEMOVE) { + if (message == WM_MOUSEMOVE || message == WM_NCMOUSEMOVE) { if (!mouse_tracking_enabled_) { @@ -31,27 +31,27 @@ index 475629d48e8807547e0c79f6fa00d458bac3416c..97f4520fbf7797b19747b5101097d93c tme.hwndTrack = hwnd(); tme.dwHoverTime = 0; TrackMouseEvent(&tme); -@@ -413,7 +413,10 @@ LRESULT LegacyRenderWidgetHostHWND::OnMouseRange(UINT message, +@@ -414,7 +414,10 @@ LRESULT LegacyRenderWidgetHostHWND::OnMouseRange(UINT message, // the picture. - if (!handled && + if (!msg_handled && (message >= WM_NCMOUSEMOVE && message <= WM_NCXBUTTONDBLCLK)) { - ret = ::DefWindowProc(GetParent(), message, w_param, l_param); + // Send WM_NCMOUSEMOVE messages using the LegacyRenderWidgetHostHWND's + // handle so mouse tracking on non-client areas doesn't break. + HWND target = message == WM_NCMOUSEMOVE ? hwnd() : GetParent(); + ret = ::DefWindowProc(target, message, w_param, l_param); - handled = TRUE; + SetMsgHandled(TRUE); } return ret; diff --git a/content/browser/renderer_host/legacy_render_widget_host_win.h b/content/browser/renderer_host/legacy_render_widget_host_win.h -index f9699ff0abf9036e9e1cabf626aa6395584cf896..94a8a50cb630182103c4256352d7a8a2acc8c76a 100644 +index 28600fe212930c2b9833cb10e1fcc209a38d5a20..b004858bc2ba14cc417ed81d191d874e62bfe0fa 100644 --- a/content/browser/renderer_host/legacy_render_widget_host_win.h +++ b/content/browser/renderer_host/legacy_render_widget_host_win.h -@@ -105,6 +105,7 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND - MESSAGE_HANDLER_EX(WM_VSCROLL, OnScroll) - MESSAGE_HANDLER_EX(WM_NCHITTEST, OnNCHitTest) - MESSAGE_RANGE_HANDLER(WM_NCMOUSEMOVE, WM_NCXBUTTONDBLCLK, OnMouseRange) -+ MESSAGE_HANDLER_EX(WM_NCMOUSELEAVE, OnMouseLeave) - MESSAGE_HANDLER_EX(WM_NCCALCSIZE, OnNCCalcSize) - MESSAGE_HANDLER_EX(WM_SIZE, OnSize) - MESSAGE_HANDLER_EX(WM_DESTROY, OnDestroy) +@@ -106,6 +106,7 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND + CR_MESSAGE_HANDLER_EX(WM_NCHITTEST, OnNCHitTest) + CR_MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE, WM_NCXBUTTONDBLCLK, + OnMouseRange) ++ CR_MESSAGE_HANDLER_EX(WM_NCMOUSELEAVE, OnMouseLeave) + CR_MESSAGE_HANDLER_EX(WM_NCCALCSIZE, OnNCCalcSize) + CR_MESSAGE_HANDLER_EX(WM_SIZE, OnSize) + CR_MESSAGE_HANDLER_EX(WM_CREATE, OnCreate) diff --git a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch index 18acfffe06e07..9c75b688323b9 100644 --- a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch +++ b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch @@ -9,7 +9,7 @@ focus node change via TextInputManager. chromium-bug: https://crbug.com/1369605 diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index 0927d69b56d064327f0659d8ffe6ceff98064947..c64efad51c18254f957dd0b5b89f3d6ee25bac13 100644 +index edb2638deb85dfd37651a00d4c370e51d94fcc6a..224694b638df5fa4c1498c7d010b4613459f0a40 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -3247,6 +3247,12 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( @@ -87,10 +87,10 @@ index 75df43e3cd2721a92c90c18154d53d5c203e2465..ce42c75c8face36d21f53f44c0201ac4 // The view with active text input state, i.e., a focused <input> element. // It will be nullptr if no such view exists. Note that the active view diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 7f49174c2e0121ddde50250a38b4ac4fcc43d125..2fd9e3ce15869b284ff8716c02ce8dc6392b2a7b 100644 +index b97e039449bc43233c0388f9ae277341d6fde967..d30a9d94cfc30035b39d510ded65f271c9c51bb1 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10083,7 +10083,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( +@@ -10115,7 +10115,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( "WebContentsImpl::OnFocusedElementChangedInFrame", "render_frame_host", frame); RenderWidgetHostViewBase* root_view = diff --git a/patches/chromium/fix_remove_caption-removing_style_call.patch b/patches/chromium/fix_remove_caption-removing_style_call.patch index 182db09dbc700..f85c6bd3618ef 100644 --- a/patches/chromium/fix_remove_caption-removing_style_call.patch +++ b/patches/chromium/fix_remove_caption-removing_style_call.patch @@ -18,10 +18,10 @@ or resizing, but Electron does not seem to run into that issue for opaque frameless windows even with that block commented out. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 72474adfb09f85118b4f752a22d121ab2b4c588a..fa4912943171789f6f326a245185885a4e74c0bb 100644 +index b06c3ac425bb1f20b890447ed3315127195ed253..efbc967ef5f7501e3cccfbc084b60b3fd73dfc8e 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -1857,7 +1857,23 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) { +@@ -1856,7 +1856,23 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) { SendMessage(hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0); diff --git a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch index 4c8b39ab34213..82e84992d8e10 100644 --- a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch +++ b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch @@ -8,7 +8,7 @@ such as the background turning black when maximizing the window and dynamic background material settings not taking effect. diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 7d899eef72721c6f3e27c9892ba963fd6b5aaeef..7c61f1f8d57a04cb5c0151c134b4b3d617159032 100644 +index f142ce65c5c0e22b968c98082d11d9922e3a0cfa..52f39a8ecb21a10aff991cc9072756d11472d55f 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -183,6 +183,10 @@ void DesktopWindowTreeHostWin::FinishTouchDrag(gfx::Point screen_point) { @@ -23,7 +23,7 @@ index 7d899eef72721c6f3e27c9892ba963fd6b5aaeef..7c61f1f8d57a04cb5c0151c134b4b3d6 void DesktopWindowTreeHostWin::Init(const Widget::InitParams& params) { diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -index d8be4dffee3947e7ac6dc09cb8e1f2a6a834789b..8eb539af74c1934a55f9b14ad97dd93bca828d34 100644 +index 74f0f6e485f4cc6be2c292f4b364d9796d9ce20b..f02c82befc140bda5b5c54f6577472190cbaae15 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h @@ -93,6 +93,8 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin @@ -36,10 +36,10 @@ index d8be4dffee3947e7ac6dc09cb8e1f2a6a834789b..8eb539af74c1934a55f9b14ad97dd93b // Overridden from DesktopWindowTreeHost: void Init(const Widget::InitParams& params) override; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index fa4912943171789f6f326a245185885a4e74c0bb..f8832efce276c6dfc520cab2870697aa4d88eff5 100644 +index efbc967ef5f7501e3cccfbc084b60b3fd73dfc8e..55ba3b459ac57a453464f0dbb4681f4afb51eefe 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -994,13 +994,13 @@ void HWNDMessageHandler::FrameTypeChanged() { +@@ -993,13 +993,13 @@ void HWNDMessageHandler::FrameTypeChanged() { void HWNDMessageHandler::PaintAsActiveChanged() { if (!delegate_->HasNonClientView() || !delegate_->CanActivate() || @@ -55,7 +55,7 @@ index fa4912943171789f6f326a245185885a4e74c0bb..f8832efce276c6dfc520cab2870697aa } void HWNDMessageHandler::SetWindowIcons(const gfx::ImageSkia& window_icon, -@@ -1084,7 +1084,14 @@ void HWNDMessageHandler::SizeConstraintsChanged() { +@@ -1083,7 +1083,14 @@ void HWNDMessageHandler::SizeConstraintsChanged() { // allowing ui::GetResizableFrameThickness() to be used consistently when // removing the visible system frame. const bool had_caption_on_init = window_style() & WS_CAPTION; @@ -71,7 +71,7 @@ index fa4912943171789f6f326a245185885a4e74c0bb..f8832efce276c6dfc520cab2870697aa const bool can_maximize = can_resize && delegate_->CanMaximize(); auto set_style_func = [&style](LONG bit, bool should_set) { -@@ -1679,11 +1686,16 @@ void HWNDMessageHandler::ResetWindowRegion(bool force, bool redraw) { +@@ -1678,11 +1685,16 @@ void HWNDMessageHandler::ResetWindowRegion(bool force, bool redraw) { // through, but that isn't the case when using Direct3D to draw transparent // windows. So we route translucent windows throught to the delegate to // allow for a custom hit mask. @@ -89,7 +89,7 @@ index fa4912943171789f6f326a245185885a4e74c0bb..f8832efce276c6dfc520cab2870697aa return; } -@@ -2415,17 +2427,18 @@ LRESULT HWNDMessageHandler::OnNCActivate(UINT message, +@@ -2420,17 +2432,18 @@ LRESULT HWNDMessageHandler::OnNCActivate(UINT message, delegate_->SchedulePaint(); } diff --git a/patches/chromium/fix_restore_original_resize_performance_on_macos.patch b/patches/chromium/fix_restore_original_resize_performance_on_macos.patch index 3288015f37ac9..82dd01df611e4 100644 --- a/patches/chromium/fix_restore_original_resize_performance_on_macos.patch +++ b/patches/chromium/fix_restore_original_resize_performance_on_macos.patch @@ -11,10 +11,10 @@ This patch should be upstreamed as a conditional revert of the logic in desktop vs mobile runtimes. i.e. restore the old logic only on desktop platforms diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 9cccc151a7c1b7d11a88545e168fd878276a91ea..349d591b0b35421f91e70dde257a726341e94ad9 100644 +index a6abe25611c82da8c55998f74c9822746d87875c..d211d8dc92c16e8ad2e9b1b37cb25dd05bf7e3e1 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -2160,9 +2160,8 @@ RenderWidgetHostImpl::GetWidgetInputHandler() { +@@ -2153,9 +2153,8 @@ RenderWidgetHostImpl::GetWidgetInputHandler() { void RenderWidgetHostImpl::NotifyScreenInfoChanged() { // The resize message (which may not happen immediately) will carry with it // the screen info as well as the new size (if the screen has changed scale diff --git a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch index eaef507146c58..2c95ae9b4c4e1 100644 --- a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch +++ b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch @@ -59,7 +59,7 @@ index cba373664bec3a32abad6fe0396bd67b53b7e67f..a54f1b3351efd2d8f324436f7f35cd43 #endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_SCRIPT_EXECUTION_CALLBACK_H_ diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index 75975a8d48b05ba25b169b93b62bb7d34eb3f5b7..31a876e234f4228220ab6cf5b41c22de31779c84 100644 +index 902f472c8c52dd4fe52f46fbb97034b041153f65..bebd52c6868b78588ded811b621e9c30b0152ad2 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc @@ -3194,6 +3194,7 @@ void LocalFrame::RequestExecuteScript( @@ -248,15 +248,3 @@ index a2850434615d5439fa25bcb75c8d23811564d1bc..2be52adcae8ec252a1274ccf0ca21838 BackForwardCacheAware back_forward_cache_aware, mojom::blink::WantResultOption, mojom::blink::PromiseResultOption) override; -diff --git a/third_party/blink/renderer/core/scheduler_integration_tests/virtual_time_test.cc b/third_party/blink/renderer/core/scheduler_integration_tests/virtual_time_test.cc -index 5e66719cf6d8170039c011ad03d56ea55ee8f2cb..5a71dd5172c88aed1498dea02f790a7f278ac174 100644 ---- a/third_party/blink/renderer/core/scheduler_integration_tests/virtual_time_test.cc -+++ b/third_party/blink/renderer/core/scheduler_integration_tests/virtual_time_test.cc -@@ -59,6 +59,7 @@ class VirtualTimeTest : public SimTest { - mojom::blink::LoadEventBlockingOption::kDoNotBlock, - WTF::BindOnce(&ScriptExecutionCallbackHelper::Completed, - base::Unretained(&callback_helper)), -+ base::NullCallback(), - BackForwardCacheAware::kAllow, - mojom::blink::WantResultOption::kWantResult, - mojom::blink::PromiseResultOption::kDoNotWait); diff --git a/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch b/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch index 668267c67b1bd..c3f5a46ed96c5 100644 --- a/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch +++ b/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch @@ -6,7 +6,7 @@ Subject: fix: select the first menu item when opened via keyboard This fixes an accessibility issue where the root view is 'focused' to the screen reader instead of the first menu item as with all other native menus. This patch will be upstreamed. diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc -index a4b272aa24dc59e68451d72adaf08df4d1657925..aaf13673d2b934638f467bb070fb96aa823c51a1 100644 +index 6228ee44dfceacdbe2b176bd28fb8e89d4acdd41..9679a94d76dd0d6dd820268a210fe20bf47bb12d 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc @@ -740,6 +740,16 @@ void MenuController::Run(Widget* parent, diff --git a/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch b/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch index dc9eef1e26e5f..553812f7e4a50 100644 --- a/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch +++ b/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch @@ -15,10 +15,10 @@ capturer was window or screen-specific, as the IDs remain valid for generic capturer as well. diff --git a/content/browser/media/capture/desktop_capture_device.cc b/content/browser/media/capture/desktop_capture_device.cc -index d076c0f19c51c9f5aced0a6db0474089ce153496..e871d1ceff47c16fdd98d85f8ff8169041c63a79 100644 +index 963110fef8f60e23cd5b6b13fd39b1e10dd7e854..05e366456689e7d3c43df96fdf40d913bb770fe9 100644 --- a/content/browser/media/capture/desktop_capture_device.cc +++ b/content/browser/media/capture/desktop_capture_device.cc -@@ -939,9 +939,16 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( +@@ -954,9 +954,16 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( switch (source.type) { case DesktopMediaID::TYPE_SCREEN: { @@ -38,7 +38,7 @@ index d076c0f19c51c9f5aced0a6db0474089ce153496..e871d1ceff47c16fdd98d85f8ff81690 if (screen_capturer && screen_capturer->SelectSource(source.id)) { capturer = std::make_unique<webrtc::DesktopAndCursorComposer>( std::move(screen_capturer), options); -@@ -954,8 +961,15 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( +@@ -969,8 +976,15 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( } case DesktopMediaID::TYPE_WINDOW: { diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index 5b2d633c8eff3..d420fb4077252 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -6,10 +6,10 @@ Subject: frame_host_manager.patch Allows embedder to intercept site instances created by chromium. diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc -index f365208f46749cd7cc08e55f8ddf3187afef64c9..51869cc02beb6b4eca6b2e24e6e3e05fa8c78e50 100644 +index 376fa172533f3d421aced54df992e1e60a5fa317..b51214da88e8c7c046abfe8d251b411bd5997ed3 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc -@@ -4801,6 +4801,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -4789,6 +4789,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( request->ResetStateForSiteInstanceChange(); } @@ -20,7 +20,7 @@ index f365208f46749cd7cc08e55f8ddf3187afef64c9..51869cc02beb6b4eca6b2e24e6e3e05f } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index f27b387da5ff4e4f20d28d80043151ad2f2e9d51..21720c0734155eca8110ae84b937f9cf0291cfb5 100644 +index f93858d6cb4cb89075e9ed7ee50f4e86df37c279..d996356ed060e2762c8008c2376a00bdc88481ba 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -339,6 +339,11 @@ class CONTENT_EXPORT ContentBrowserClient { diff --git a/patches/chromium/gritsettings_resource_ids.patch b/patches/chromium/gritsettings_resource_ids.patch index b1b4ab1b0c47c..95de66eab6b3f 100644 --- a/patches/chromium/gritsettings_resource_ids.patch +++ b/patches/chromium/gritsettings_resource_ids.patch @@ -6,7 +6,7 @@ Subject: gritsettings_resource_ids.patch Add electron resources file to the list of resource ids generation. diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec -index bba1bed7b351171434d9b6d8170f6b015f5acb6c..83004f00857a8d260756443f1675228336926896 100644 +index 36f9760734818c6769d20d97c01f7058617bc7d0..2d7b422c31b0d849e2c07c62d186a71d393ea9f2 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec @@ -1575,6 +1575,11 @@ diff --git a/patches/chromium/load_v8_snapshot_in_browser_process.patch b/patches/chromium/load_v8_snapshot_in_browser_process.patch index 98f952b6b6f8f..38fb822adf1ba 100644 --- a/patches/chromium/load_v8_snapshot_in_browser_process.patch +++ b/patches/chromium/load_v8_snapshot_in_browser_process.patch @@ -9,10 +9,10 @@ but due to the nature of electron, we need to load the v8 snapshot in the browser process. diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc -index 733dfb4b06214f7dfe084c2ef945cad9f914eabb..46c7c57b5ff40b0e40d66bbeb8ec3f2b7f86cea0 100644 +index 86bb51dbba93f87b09b5c0003e9d700a277615dc..9240e8485a8dc895eb455b1418fc7559e52a5dd5 100644 --- a/content/app/content_main_runner_impl.cc +++ b/content/app/content_main_runner_impl.cc -@@ -293,11 +293,8 @@ void LoadV8SnapshotFile(const base::CommandLine& command_line) { +@@ -294,11 +294,8 @@ void LoadV8SnapshotFile(const base::CommandLine& command_line) { bool ShouldLoadV8Snapshot(const base::CommandLine& command_line, const std::string& process_type) { diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index 6b0f6d03393fd..bfa1c74492470 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -35,10 +35,10 @@ system font by checking if it's kCTFontPriorityAttribute is set to system priority. diff --git a/base/BUILD.gn b/base/BUILD.gn -index c835d9ea235070abaca36b38dc5f573da98fd469..a8d867b18c73abfe55da053a93696eb43c848dde 100644 +index 7f98c195c12b141a792913b3e9888d8eeabc74ed..901119f3fdc81800592b6f5a987054c3c62374c6 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn -@@ -1058,6 +1058,7 @@ component("base") { +@@ -1059,6 +1059,7 @@ component("base") { "//build:ios_buildflags", "//build/config/compiler:compiler_buildflags", "//third_party/modp_b64", @@ -195,10 +195,10 @@ index e12c1d078147d956a1d9b1bc498c1b1d6fe7b974..233362259dc4e728ed37435e65041764 } // namespace base diff --git a/components/os_crypt/sync/BUILD.gn b/components/os_crypt/sync/BUILD.gn -index ff1e356ff696d3830d02644969c36a71fdf32ff6..b39c716c52524b95f2d3417a98e60c0c41147c93 100644 +index bbaf1143e725a1b6c49eef705b1e62c4133bfa27..81fc444043b67858371142075f98ad9aff162fc3 100644 --- a/components/os_crypt/sync/BUILD.gn +++ b/components/os_crypt/sync/BUILD.gn -@@ -38,6 +38,8 @@ component("sync") { +@@ -75,6 +75,8 @@ component("sync") { "os_crypt_mac.mm", ] deps += [ "//crypto:mock_apple_keychain" ] @@ -385,7 +385,7 @@ index 71158ca9a7101911bb76f0c1b5300b0ff0e326b3..1441b9d4f9560c8b26d4beffe31449ed // The NSWindow used by BridgedNativeWidget. Provides hooks into AppKit that // can only be accomplished by overriding methods. diff --git a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm -index 0f65c4272547f31890b872dc208cd01d02848e20..2634fddf9b7b71cd4b97e9ecb5de06bff7217355 100644 +index 433f12928857e288b6b0d4f4dd3d1f29da08cf6c..bb95aabec2e0d5c7b3a5d315c9a3f8cb3a45c8d2 100644 --- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm +++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm @@ -21,6 +21,7 @@ @@ -452,7 +452,7 @@ index 0f65c4272547f31890b872dc208cd01d02848e20..2634fddf9b7b71cd4b97e9ecb5de06bf bool shouldShowWindowTitle = YES; if (_bridge) diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm -index 6ea211c221d74f26be924334ac8b5b007f38e7a3..c5171b3f1a0b25825dded8828ed683282c06e151 100644 +index e90c5a7cbb852ba33df47209cfb7890472f1fbb1..53881e0efdf8f868245dbca7040cd6aac899d50c 100644 --- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm +++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm @@ -42,6 +42,7 @@ @@ -477,10 +477,10 @@ index 6ea211c221d74f26be924334ac8b5b007f38e7a3..c5171b3f1a0b25825dded8828ed68328 // Beware: This view was briefly removed (in favor of a bare CALayer) in // https://crrev.com/c/1236675. The ordering of unassociated layers relative diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn -index 4017fef63c549b535c1eedd3571e69b7fac6f3e2..de0ed691367bda45e5310b1f132171e3a1f2dd3f 100644 +index 9f487674f174e69c749c93e030de66e954947a73..88b4d3e2d965ee6930b4d5dd49c75af079c1bcff 100644 --- a/components/viz/service/BUILD.gn +++ b/components/viz/service/BUILD.gn -@@ -383,6 +383,7 @@ viz_component("service") { +@@ -385,6 +385,7 @@ viz_component("service") { "frame_sinks/external_begin_frame_source_mac.h", ] } @@ -488,7 +488,7 @@ index 4017fef63c549b535c1eedd3571e69b7fac6f3e2..de0ed691367bda45e5310b1f132171e3 } if (is_ios) { -@@ -706,6 +707,7 @@ viz_source_set("unit_tests") { +@@ -708,6 +709,7 @@ viz_source_set("unit_tests") { "display_embedder/software_output_device_mac_unittest.mm", ] frameworks = [ "IOSurface.framework" ] @@ -548,7 +548,7 @@ index 010c713090e5038dc90db131c8f621422d30c03b..20c35e887a0496ee609c077e3b0494bd void ForwardKeyboardEvent(const input::NativeWebKeyboardEvent& key_event, diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -index e5b59a9d364dd5a8f847d9543b19fdc068098754..86abd01371ce8a9c21d020f1a69a5d33b656d72b 100644 +index d3f833904a7a056235d4bd4b3e7c5297a60861f5..8986ec2405541a43ca34d47f9ac0ffbf875ae63a 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -34,6 +34,7 @@ @@ -559,7 +559,7 @@ index e5b59a9d364dd5a8f847d9543b19fdc068098754..86abd01371ce8a9c21d020f1a69a5d33 #include "skia/ext/skia_utils_mac.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/mojom/input/input_handler.mojom.h" -@@ -2086,15 +2087,21 @@ - (NSAccessibilityRole)accessibilityRole { +@@ -2095,15 +2096,21 @@ - (NSAccessibilityRole)accessibilityRole { // Since this implementation doesn't have to wait any IPC calls, this doesn't // make any key-typing jank. --hbono 7/23/09 // @@ -582,10 +582,10 @@ index e5b59a9d364dd5a8f847d9543b19fdc068098754..86abd01371ce8a9c21d020f1a69a5d33 return kAttributes; } diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index c92c7110c747cc575c94cf941cf9131987ef4fd6..08bd7dc0663b7d3a7fa327e8795db13129e891de 100644 +index bb12a1600ddda11abb6485f685564e2d5a7a5837..a1bcbbaca764ae901dad961c94a8a33432a92bd2 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn -@@ -344,6 +344,7 @@ source_set("browser") { +@@ -347,6 +347,7 @@ source_set("browser") { "//ui/webui/resources", "//v8", "//v8:v8_version", @@ -594,7 +594,7 @@ index c92c7110c747cc575c94cf941cf9131987ef4fd6..08bd7dc0663b7d3a7fa327e8795db131 public_deps = [ diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h -index e7007a9a7788cbc89a0bbb2387ff2c62bb7d2c79..c2b672a3bd1e61089b411d139f7083714a345a9c 100644 +index 319e58e5c3cad4ec47fca2c7cb0d59d4c5fd460c..d17bdb51081cee80f6f43199057de557063ecf1a 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.h +++ b/content/browser/renderer_host/render_widget_host_view_mac.h @@ -24,6 +24,7 @@ @@ -615,7 +615,7 @@ index e7007a9a7788cbc89a0bbb2387ff2c62bb7d2c79..c2b672a3bd1e61089b411d139f708371 @class RenderWidgetHostViewCocoa; namespace content { -@@ -671,9 +674,11 @@ class CONTENT_EXPORT RenderWidgetHostViewMac +@@ -675,9 +678,11 @@ class CONTENT_EXPORT RenderWidgetHostViewMac // EnsureSurfaceSynchronizedForWebTest(). uint32_t latest_capture_sequence_number_ = 0u; @@ -628,7 +628,7 @@ index e7007a9a7788cbc89a0bbb2387ff2c62bb7d2c79..c2b672a3bd1e61089b411d139f708371 // Used to force the NSApplication's focused accessibility element to be the // content::BrowserAccessibilityCocoa accessibility tree when the NSView for diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index d667fdd34ba42be6a7d6486bb9add2bd65953101..57103054e874017bf9926dcdf71786c679f9aac0 100644 +index 8b53385eacb73bbafa1a095bd2db833ecfd930bb..3798a24ce4aedb6aa2954d8f99b603bf08f1179d 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -52,6 +52,7 @@ @@ -650,7 +650,7 @@ index d667fdd34ba42be6a7d6486bb9add2bd65953101..57103054e874017bf9926dcdf71786c6 // Reset `ns_view_` before resetting `remote_ns_view_` to avoid dangling // pointers. `ns_view_` gets reinitialized later in this method. -@@ -1630,10 +1633,12 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1638,10 +1641,12 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, gfx::NativeViewAccessible RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() { @@ -663,7 +663,7 @@ index d667fdd34ba42be6a7d6486bb9add2bd65953101..57103054e874017bf9926dcdf71786c6 return gfx::NativeViewAccessible([GetInProcessNSView() window]); } -@@ -1685,9 +1690,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1693,9 +1698,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, } void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) { @@ -675,7 +675,7 @@ index d667fdd34ba42be6a7d6486bb9add2bd65953101..57103054e874017bf9926dcdf71786c6 } bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame( -@@ -2190,20 +2197,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -2198,20 +2205,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, void RenderWidgetHostViewMac::GetRenderWidgetAccessibilityToken( GetRenderWidgetAccessibilityTokenCallback callback) { base::ProcessId pid = getpid(); @@ -703,7 +703,7 @@ index d667fdd34ba42be6a7d6486bb9add2bd65953101..57103054e874017bf9926dcdf71786c6 /////////////////////////////////////////////////////////////////////////////// diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn -index 733ae2d15c3ff85faa06db70dc24fdc611113fa4..2424410cc68fe14db6024b6ec41aa73da02fc120 100644 +index 8c293f5bb0e859f438a7ab50b70b4d5449dc1358..d58c73427935127fdec173224bcb970964a9f14d 100644 --- a/content/common/BUILD.gn +++ b/content/common/BUILD.gn @@ -275,6 +275,7 @@ source_set("common") { @@ -797,7 +797,7 @@ index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbe } // namespace content diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn -index 8e939c6c74a016779cc2a9da2ce68f3ebb11a05a..4c4fb37276f58ba32baaddb5b9e61b95eab8336f 100644 +index 6232ce7ac3676b0b7e15e5a3f41e2e44c4dab787..21d29e74a9c3a5d085bf451b2b5ae2fdae165c50 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn @@ -673,6 +673,7 @@ static_library("test_support") { @@ -817,7 +817,7 @@ index 8e939c6c74a016779cc2a9da2ce68f3ebb11a05a..4c4fb37276f58ba32baaddb5b9e61b95 } mojom("content_test_mojo_bindings") { -@@ -2029,6 +2032,7 @@ test("content_browsertests") { +@@ -2030,6 +2033,7 @@ test("content_browsertests") { "//ui/shell_dialogs", "//ui/snapshot", "//ui/webui:test_support", @@ -825,7 +825,7 @@ index 8e939c6c74a016779cc2a9da2ce68f3ebb11a05a..4c4fb37276f58ba32baaddb5b9e61b95 ] if (!(is_chromeos && target_cpu == "arm64" && current_cpu == "arm")) { -@@ -3354,6 +3358,7 @@ test("content_unittests") { +@@ -3356,6 +3360,7 @@ test("content_unittests") { "//ui/shell_dialogs", "//ui/webui:test_support", "//url", @@ -986,10 +986,10 @@ index 5eda5e58b30b84795ec3827aad7ce97171400097..60bf6c34e8d824ea6d4e02b295156860 } // namespace #endif diff --git a/net/dns/BUILD.gn b/net/dns/BUILD.gn -index 7f9f28b70a4cf5323fdbb01567170e8856113031..ba1da643abd8ba9db6f144e24b927116233dabc1 100644 +index 4428896957be15908ce992189db2a0fe95ba3bbd..07987fad41d194bf38a6f4265ccbd853c1273689 100644 --- a/net/dns/BUILD.gn +++ b/net/dns/BUILD.gn -@@ -193,6 +193,8 @@ source_set("dns") { +@@ -195,6 +195,8 @@ source_set("dns") { ":host_resolver_manager", ":mdns_client", ] @@ -1428,10 +1428,10 @@ index c771cee7be34f36521de34ef893ee578b648a8c8..b0bd447b848bfdb7a9ff9cd98ba95574 blink_core_sources_editing += [ "kill_ring_none.cc" ] } diff --git a/ui/accelerated_widget_mac/BUILD.gn b/ui/accelerated_widget_mac/BUILD.gn -index 4a2e4211864cd93cdf3f1e065fedd01d0ddd18f2..8c8916f2a424fea3508a3c0c8266d73c539b16fd 100644 +index 0f8a6f75b7f01029adc2f5fd23559bacce19cf72..cf66c2f4f02a8e21cc83c3b7389fc5156bcd93ba 100644 --- a/ui/accelerated_widget_mac/BUILD.gn +++ b/ui/accelerated_widget_mac/BUILD.gn -@@ -85,6 +85,7 @@ component("accelerated_widget_mac") { +@@ -83,6 +83,7 @@ component("accelerated_widget_mac") { "//ui/gfx", "//ui/gfx/geometry", "//ui/gl", @@ -1472,7 +1472,7 @@ index ce6a061b57cce101c103527dbbbe5ed47b2ecaf8..616922c34e1f3bc50584c0417129b78e // The root CALayer to display the current frame. This does not change // over the lifetime of the object. diff --git a/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm b/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm -index 54651172993f7d07f21a395511f773bff40115d8..295d8bef6e9ec966db570d7537abfc049324512d 100644 +index e1b1b0965669cae54565719f9ad6ba808416c2f7..ef7e6fd0d23626db303199ae5c79c8fd55ebba71 100644 --- a/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm +++ b/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm @@ -10,6 +10,7 @@ @@ -1483,7 +1483,7 @@ index 54651172993f7d07f21a395511f773bff40115d8..295d8bef6e9ec966db570d7537abfc04 #include "ui/base/cocoa/animation_utils.h" #include "ui/base/cocoa/remote_layer_api.h" #include "ui/gfx/ca_layer_params.h" -@@ -32,6 +33,7 @@ +@@ -31,6 +32,7 @@ allow_av_sample_buffer_display_layer), buffer_presented_callback_(buffer_presented_callback), metal_device_(metal_device) { @@ -1491,7 +1491,7 @@ index 54651172993f7d07f21a395511f773bff40115d8..295d8bef6e9ec966db570d7537abfc04 if (allow_remote_layers_) { root_ca_layer_ = [[CALayer alloc] init]; #if BUILDFLAG(IS_MAC) -@@ -60,6 +62,7 @@ +@@ -59,6 +61,7 @@ #endif ca_context_.layer = root_ca_layer_; } @@ -1499,7 +1499,7 @@ index 54651172993f7d07f21a395511f773bff40115d8..295d8bef6e9ec966db570d7537abfc04 } CALayerTreeCoordinator::~CALayerTreeCoordinator() = default; -@@ -163,9 +166,13 @@ +@@ -162,9 +165,13 @@ TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffers", TRACE_EVENT_SCOPE_THREAD, "GLImpl", static_cast<int>(gl::GetGLImplementation()), "width", pixel_size_.width()); @@ -1722,10 +1722,10 @@ index 59dc2f82214cfd883b6ebef3b0fb25af6387a9cd..912c5252d1b30d943a1552739b9eef9a // This function will check if all of the interfaces listed above are supported diff --git a/ui/base/cocoa/remote_layer_api.mm b/ui/base/cocoa/remote_layer_api.mm -index fc25ba79d2b0e1acdb7ba54b89e7d6e16f94771b..de771ef414b9a69e331261524f08e9a12145ec60 100644 +index 93e90c4eba9bc9b93d68e834eb6baabeb2d0ecf0..1b90f41d05f847a94adf2f4da827b1d0143b7bcf 100644 --- a/ui/base/cocoa/remote_layer_api.mm +++ b/ui/base/cocoa/remote_layer_api.mm -@@ -5,11 +5,13 @@ +@@ -5,18 +5,22 @@ #include "ui/base/cocoa/remote_layer_api.h" #include "base/feature_list.h" @@ -1739,9 +1739,7 @@ index fc25ba79d2b0e1acdb7ba54b89e7d6e16f94771b..de771ef414b9a69e331261524f08e9a1 namespace { // Control use of cross-process CALayers to display content directly from the // GPU process on Mac. -@@ -17,8 +19,10 @@ - "RemoteCoreAnimationAPI", - base::FEATURE_ENABLED_BY_DEFAULT); + BASE_FEATURE(kRemoteCoreAnimationAPI, base::FEATURE_ENABLED_BY_DEFAULT); } // namespace +#endif @@ -1750,7 +1748,7 @@ index fc25ba79d2b0e1acdb7ba54b89e7d6e16f94771b..de771ef414b9a69e331261524f08e9a1 if (!base::FeatureList::IsEnabled(kRemoteCoreAnimationAPI)) return false; -@@ -55,6 +59,9 @@ bool RemoteLayerAPISupported() { +@@ -53,6 +57,9 @@ bool RemoteLayerAPISupported() { // If everything is there, we should be able to use the API. return true; @@ -1761,10 +1759,10 @@ index fc25ba79d2b0e1acdb7ba54b89e7d6e16f94771b..de771ef414b9a69e331261524f08e9a1 } // namespace diff --git a/ui/display/BUILD.gn b/ui/display/BUILD.gn -index 5c78ec26210044b8c556431212e9b201dbf0fd8b..a23edba020ca7cd34f7f806d923ad5f1464061b2 100644 +index ca9b2b6f9a4e070d2fd40a6fec672d612ff757e0..87eee402eb38270690b798b67a368e113008d8cc 100644 --- a/ui/display/BUILD.gn +++ b/ui/display/BUILD.gn -@@ -129,6 +129,12 @@ component("display") { +@@ -131,6 +131,12 @@ component("display") { "//ui/gfx/geometry", ] @@ -1778,7 +1776,7 @@ index 5c78ec26210044b8c556431212e9b201dbf0fd8b..a23edba020ca7cd34f7f806d923ad5f1 deps += [ "//build:ios_buildflags" ] } diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm -index 85d9170ae8de43ec0fa18c033d66c0583c26ec2f..c4f76301818404ce853583adf01af85cddd6a6e5 100644 +index a76d09dd2a2a71d0b8397f4abe30fe7bbb6e513d..eba69f4c6e72b36e799ce902cdffd2dd1f2387d6 100644 --- a/ui/display/mac/screen_mac.mm +++ b/ui/display/mac/screen_mac.mm @@ -33,6 +33,7 @@ @@ -1808,10 +1806,10 @@ index 85d9170ae8de43ec0fa18c033d66c0583c26ec2f..c4f76301818404ce853583adf01af85c // Query the display's refresh rate. double refresh_rate = 1.0 / screen.minimumRefreshInterval; diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn -index 6f09aea6a492f44f5771c635b8d766bb1868938c..bd82e70622e04d83d5d07a9f5e08a1ddacb568e4 100644 +index 300079ed71ff990396d419ed55755f128dda6695..464682fd86764adbef54faaa5894a55be87ee5cf 100644 --- a/ui/gfx/BUILD.gn +++ b/ui/gfx/BUILD.gn -@@ -337,6 +337,12 @@ component("gfx") { +@@ -335,6 +335,12 @@ component("gfx") { "//ui/base:ui_data_pack", ] @@ -1825,7 +1823,7 @@ index 6f09aea6a492f44f5771c635b8d766bb1868938c..bd82e70622e04d83d5d07a9f5e08a1dd sources += [ "platform_font_skia.cc", diff --git a/ui/gfx/platform_font_mac.mm b/ui/gfx/platform_font_mac.mm -index fe3f85073e31de487a08e57d7f9b07aa4eccf8f3..cf5b07203c8bd559a404600cc98cc8eccdefd4d7 100644 +index bbe355cf69f160866188216cc274d75bd35603db..06ee100d7ea2e892dbf3c0b1adc96c5013ef678a 100644 --- a/ui/gfx/platform_font_mac.mm +++ b/ui/gfx/platform_font_mac.mm @@ -19,6 +19,7 @@ @@ -1863,7 +1861,7 @@ index fe3f85073e31de487a08e57d7f9b07aa4eccf8f3..cf5b07203c8bd559a404600cc98cc8ec // enough. return PlatformFontMac::SystemFontType::kGeneral; diff --git a/ui/views/BUILD.gn b/ui/views/BUILD.gn -index a7ba817422eb2b82f7a722e8e5df886acd4012aa..1fd81ae13caefbc0950a6c5d87d959455fbf9ce9 100644 +index f4651d57e9f1ac76c0e93ce3859f4169cd689200..d07439f78ac914d6daeb54dbc5beea80f1fb11bd 100644 --- a/ui/views/BUILD.gn +++ b/ui/views/BUILD.gn @@ -720,6 +720,8 @@ component("views") { @@ -1875,7 +1873,7 @@ index a7ba817422eb2b82f7a722e8e5df886acd4012aa..1fd81ae13caefbc0950a6c5d87d95945 } if (is_win) { -@@ -1151,6 +1153,8 @@ source_set("test_support") { +@@ -1150,6 +1152,8 @@ source_set("test_support") { "//ui/base/mojom:ui_base_types", ] @@ -1920,7 +1918,7 @@ index 4cc9db3ae1ef2443b1ecf923c9c572b7d0e85662..f7bf6a6bb63f9c38cc21c03da1c884d6 // Used to force the NSApplication's focused accessibility element to be the // views::Views accessibility tree when the NSView for this is focused. diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -index 4c83545e75535469ccdf2bdf7ec3266f4acd64c4..eafa32f62cac0627a4e32aa2301c2cbe0b18ede9 100644 +index 5fc62f87b842f6aca7082b3957f2adb9f44e2114..7befaf18ae9c922ccd8d36a006b9105cb55b1a32 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm @@ -21,6 +21,7 @@ @@ -1999,7 +1997,7 @@ index 4c83545e75535469ccdf2bdf7ec3266f4acd64c4..eafa32f62cac0627a4e32aa2301c2cbe } diff --git a/ui/views/controls/webview/BUILD.gn b/ui/views/controls/webview/BUILD.gn -index 7f4eff1017119fc90107c2d86436f7bbf596ac72..688d8a17625765c63151117554933627427829f1 100644 +index 50bb38a38dca67f9f393c48efe123f7dd7ca2594..2062e479581d63325de3c3398844acca0601c86c 100644 --- a/ui/views/controls/webview/BUILD.gn +++ b/ui/views/controls/webview/BUILD.gn @@ -46,6 +46,12 @@ component("webview") { diff --git a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch index f3be51653253c..91b9908b2bb44 100644 --- a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch +++ b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch @@ -7,7 +7,7 @@ This adds a callback from the network service that's used to implement session.setCertificateVerifyCallback. diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index 26019db9116d02a3ef4899ff697b7d1060eba046..3998bb0849cd5bec52c6148ccf1e1a30511b32fb 100644 +index c2f19cf408ebcd0bc5311cf221acde09ab558ed4..95822f635b61da7c63b5a1babf93bb61cb786293 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc @@ -166,6 +166,11 @@ @@ -148,7 +148,7 @@ index 26019db9116d02a3ef4899ff697b7d1060eba046..3998bb0849cd5bec52c6148ccf1e1a30 void NetworkContext::CreateURLLoaderFactory( mojo::PendingReceiver<mojom::URLLoaderFactory> receiver, mojom::URLLoaderFactoryParamsPtr params) { -@@ -2662,6 +2779,10 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( +@@ -2679,6 +2796,10 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( cert_verifier = std::make_unique<net::CachingCertVerifier>( std::make_unique<net::CoalescingCertVerifier>( std::move(cert_verifier))); @@ -160,7 +160,7 @@ index 26019db9116d02a3ef4899ff697b7d1060eba046..3998bb0849cd5bec52c6148ccf1e1a30 builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier( diff --git a/services/network/network_context.h b/services/network/network_context.h -index c8d877b36343d10b0ba7fe75f15ee91851e43f59..f7831633a286f7c4aec2dd269b02561275b008c7 100644 +index 5998b6a64a0bbfa22723d57a9fe1f31afd6e7435..56f1eec94a33c2c9a6289b12ac20323b4bef13d9 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h @@ -117,6 +117,7 @@ class URLMatcher; @@ -180,7 +180,7 @@ index c8d877b36343d10b0ba7fe75f15ee91851e43f59..f7831633a286f7c4aec2dd269b025612 void ResetURLLoaderFactories() override; void GetViaObliviousHttp( mojom::ObliviousHttpRequestPtr request, -@@ -987,6 +990,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext +@@ -988,6 +991,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext std::vector<base::OnceClosure> dismount_closures_; #endif // BUILDFLAG(IS_DIRECTORY_TRANSFER_REQUIRED) @@ -190,7 +190,7 @@ index c8d877b36343d10b0ba7fe75f15ee91851e43f59..f7831633a286f7c4aec2dd269b025612 std::unique_ptr<HostResolver> internal_host_resolver_; std::set<std::unique_ptr<HostResolver>, base::UniquePtrComparator> diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index a28ff5cd43ef84d3b0d24d2828b7fdad628f8d27..6885ff48db5ddfb8e8ec09e91a4c01231261f8e5 100644 +index 422024e12926ea70450b43253fbb60c2ce217c11..840eff6ece73983a3b98673adbbb3cfd825565fe 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom @@ -317,6 +317,17 @@ struct SocketBrokerRemotes { @@ -211,7 +211,7 @@ index a28ff5cd43ef84d3b0d24d2828b7fdad628f8d27..6885ff48db5ddfb8e8ec09e91a4c0123 // Parameters for constructing a network context. struct NetworkContextParams { // The user agent string. -@@ -985,6 +996,9 @@ interface NetworkContext { +@@ -992,6 +1003,9 @@ interface NetworkContext { // Sets a client for this network context. SetClient(pending_remote<NetworkContextClient> client); @@ -222,7 +222,7 @@ index a28ff5cd43ef84d3b0d24d2828b7fdad628f8d27..6885ff48db5ddfb8e8ec09e91a4c0123 CreateURLLoaderFactory( pending_receiver<URLLoaderFactory> url_loader_factory, diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h -index e0289f9f74fc9e9b4480dd8ecae45fcde66bed61..cfd21ce01b7db6a4912de8e4ce0799825fd27e77 100644 +index 9139ca8b0139b19804bc2efe866f2019e8ef5652..6f0fe6423e8be903d4e38b783d31443c6ce89db5 100644 --- a/services/network/test/test_network_context.h +++ b/services/network/test/test_network_context.h @@ -63,6 +63,8 @@ class TestNetworkContext : public mojom::NetworkContext { diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index 03258207e27f9..171caa4562326 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -31,7 +31,7 @@ index ec5ca87810d590fc95eda2006b8653bb12711b8e..203cd9645523c4f0adf90e78fa3d8f3d const GURL& origin, const GURL& document_url, diff --git a/content/browser/notifications/blink_notification_service_impl.cc b/content/browser/notifications/blink_notification_service_impl.cc -index 1b3d77e66432b1f7b8c6f87634644776cd9ccb5b..147da7ad0c830c2c8e0f62f9df0e365a14764280 100644 +index e06d4785c3bdc6567447ec6cb6f9bb6cf940c9cc..ce786b2271c997cd66213db9fc444757d00a6d9b 100644 --- a/content/browser/notifications/blink_notification_service_impl.cc +++ b/content/browser/notifications/blink_notification_service_impl.cc @@ -85,12 +85,14 @@ BlinkNotificationServiceImpl::BlinkNotificationServiceImpl( @@ -49,7 +49,7 @@ index 1b3d77e66432b1f7b8c6f87634644776cd9ccb5b..147da7ad0c830c2c8e0f62f9df0e365a browser_context_(browser_context), service_worker_context_(std::move(service_worker_context)), render_process_host_id_(render_process_host->GetDeprecatedID()), -@@ -182,7 +184,7 @@ void BlinkNotificationServiceImpl::DisplayNonPersistentNotification( +@@ -190,7 +192,7 @@ void BlinkNotificationServiceImpl::DisplayNonPersistentNotification( creator_type_); browser_context_->GetPlatformNotificationService()->DisplayNotification( @@ -59,7 +59,7 @@ index 1b3d77e66432b1f7b8c6f87634644776cd9ccb5b..147da7ad0c830c2c8e0f62f9df0e365a } diff --git a/content/browser/notifications/blink_notification_service_impl.h b/content/browser/notifications/blink_notification_service_impl.h -index e7cc73f375ada7ee8715d331c3d372e0f59a0cdf..c0a142bea4a9a30c10dbb30c72fedce9ab4d1e62 100644 +index 89edc47028e80170bcc0f11a0f27d30067d1ef6c..313bbe4f1815c7e2042d4a4600f922031727d274 100644 --- a/content/browser/notifications/blink_notification_service_impl.h +++ b/content/browser/notifications/blink_notification_service_impl.h @@ -44,6 +44,7 @@ class CONTENT_EXPORT BlinkNotificationServiceImpl @@ -70,7 +70,7 @@ index e7cc73f375ada7ee8715d331c3d372e0f59a0cdf..c0a142bea4a9a30c10dbb30c72fedce9 const blink::StorageKey& storage_key, const GURL& document_url, const WeakDocumentPtr& weak_document_ptr, -@@ -113,6 +114,7 @@ class CONTENT_EXPORT BlinkNotificationServiceImpl +@@ -119,6 +120,7 @@ class CONTENT_EXPORT BlinkNotificationServiceImpl raw_ptr<PlatformNotificationContextImpl, DanglingUntriaged> notification_context_; @@ -79,7 +79,7 @@ index e7cc73f375ada7ee8715d331c3d372e0f59a0cdf..c0a142bea4a9a30c10dbb30c72fedce9 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; diff --git a/content/browser/notifications/blink_notification_service_impl_unittest.cc b/content/browser/notifications/blink_notification_service_impl_unittest.cc -index 33e28b6b05a56ba621b982c6263c89506625172a..329edb751d675b2de8cb6250cf16d6bf98ac925f 100644 +index 8ccff8edf6c45a96978fea0b02a8d7ebd8768578..264af7461226718ff300faa22ba4587594b79ae4 100644 --- a/content/browser/notifications/blink_notification_service_impl_unittest.cc +++ b/content/browser/notifications/blink_notification_service_impl_unittest.cc @@ -135,7 +135,7 @@ class BlinkNotificationServiceImplTest : public ::testing::Test { @@ -92,10 +92,10 @@ index 33e28b6b05a56ba621b982c6263c89506625172a..329edb751d675b2de8cb6250cf16d6bf contents_.get()->GetPrimaryMainFrame()->GetWeakDocumentPtr(), RenderProcessHost::NotificationServiceCreatorType::kDocument, diff --git a/content/browser/notifications/platform_notification_context_impl.cc b/content/browser/notifications/platform_notification_context_impl.cc -index b09a71544475f5810e26006d9a2f975176b28bb8..e6c77f27d6a71d1d065e292963072186a257aca6 100644 +index 2c9e6225d0085c67dc1ae51cca2614b2c74120a7..ad194578a06e74488a853cb8f3f042fd339eefea 100644 --- a/content/browser/notifications/platform_notification_context_impl.cc +++ b/content/browser/notifications/platform_notification_context_impl.cc -@@ -281,6 +281,7 @@ void PlatformNotificationContextImpl::Shutdown() { +@@ -286,6 +286,7 @@ void PlatformNotificationContextImpl::Shutdown() { void PlatformNotificationContextImpl::CreateService( RenderProcessHost* render_process_host, @@ -103,7 +103,7 @@ index b09a71544475f5810e26006d9a2f975176b28bb8..e6c77f27d6a71d1d065e292963072186 const blink::StorageKey& storage_key, const GURL& document_url, const WeakDocumentPtr& weak_document_ptr, -@@ -289,7 +290,7 @@ void PlatformNotificationContextImpl::CreateService( +@@ -294,7 +295,7 @@ void PlatformNotificationContextImpl::CreateService( DCHECK_CURRENTLY_ON(BrowserThread::UI); services_.push_back(std::make_unique<BlinkNotificationServiceImpl>( this, browser_context_, service_worker_context_, render_process_host, @@ -133,10 +133,10 @@ index 5be62a3fb27e37f3c1db6b811172f6dfebe18f61..34349f9832fe4b9a3d48db613a789afb const GURL& document_url, const WeakDocumentPtr& weak_document_ptr, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 8e2c92d1cef7f76ec8e2fadb2be7c0e0aa288a15..9d5c6428a0f35d678f8723dd0b959fa34e8fc32c 100644 +index 0496f406bf0083fc75cf4d9cc3560a30155ea2e0..a76db23484dabda64b7eaf2e8b6c6f22faf2719f 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -2249,7 +2249,7 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2267,7 +2267,7 @@ void RenderProcessHostImpl::CreateNotificationService( case RenderProcessHost::NotificationServiceCreatorType::kSharedWorker: case RenderProcessHost::NotificationServiceCreatorType::kDedicatedWorker: { storage_partition_impl_->GetPlatformNotificationContext()->CreateService( @@ -145,7 +145,7 @@ index 8e2c92d1cef7f76ec8e2fadb2be7c0e0aa288a15..9d5c6428a0f35d678f8723dd0b959fa3 creator_type, std::move(receiver)); break; } -@@ -2257,7 +2257,7 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2275,7 +2275,7 @@ void RenderProcessHostImpl::CreateNotificationService( CHECK(rfh); storage_partition_impl_->GetPlatformNotificationContext()->CreateService( diff --git a/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch b/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch index bc6f440cbea0b..6174775d5d0f4 100644 --- a/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch +++ b/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch @@ -36,7 +36,7 @@ index bb33e469e2d38ee4a23b19acfa52f962a5e9c854..6e83c65334f1ce0134dc4efc1dc40eb7 Microsoft::WRL::ComPtr<ID3D11Texture2D> d3d11_texture; diff --git a/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc b/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc -index 4de36674acee427da3a43891f780102d7e08d9cb..d32bf712107f02991717da626b5dd25c6e6973d3 100644 +index 5e025cfae4ac056791fab1b7016b5f7da3204239..ac428cffba7854c28c5e71fefa67c51bbeb34248 100644 --- a/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc +++ b/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc @@ -209,6 +209,23 @@ bool FrameResources::Initialize(VideoPixelFormat format, diff --git a/patches/chromium/picture-in-picture.patch b/patches/chromium/picture-in-picture.patch index 661672d074f70..3010b6c0107e8 100644 --- a/patches/chromium/picture-in-picture.patch +++ b/patches/chromium/picture-in-picture.patch @@ -38,7 +38,7 @@ index 85df555841ac0d32d2f097547c9991cecf0f4b1a..7a108339448fad3105e87c9d9af678c2 ui::ImageModel::FromVectorIcon(*icon, kColorPipWindowForeground, kCloseButtonIconSize)); diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -index fcb7d2c18f39acb174fc456362de51c484de398c..fea71317b41429dd3bbd50947673124f7c230394 100644 +index 5c978e3dcc862456d129e85e82236d899dbb5504..c5552aa0dedf6adbe10409f32c6eeca28f11c0b6 100644 --- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc @@ -18,12 +18,16 @@ @@ -76,7 +76,7 @@ index fcb7d2c18f39acb174fc456362de51c484de398c..fea71317b41429dd3bbd50947673124f std::wstring app_user_model_id; Browser* browser = chrome::FindBrowserWithTab(controller->GetWebContents()); if (browser) { -@@ -1270,11 +1274,13 @@ void VideoOverlayWindowViews::SetUpViews() { +@@ -1271,11 +1275,13 @@ void VideoOverlayWindowViews::SetUpViews() { &VideoOverlayWindowViews::OnLiveCaptionButtonPressed, base::Unretained(this))); live_caption_button->SetSize(kActionButtonSize); @@ -90,7 +90,19 @@ index fcb7d2c18f39acb174fc456362de51c484de398c..fea71317b41429dd3bbd50947673124f toggle_microphone_button = std::make_unique<ToggleMicrophoneButton>(base::BindRepeating( [](VideoOverlayWindowViews* overlay) { -@@ -2561,6 +2567,7 @@ gfx::Rect VideoOverlayWindowViews::GetLiveCaptionDialogBounds() { +@@ -2412,9 +2418,10 @@ void VideoOverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) { + event->SetHandled(); + return; + } +- ++#if 0 + // Otherwise, let the live caption dialog handle the gesture. + live_caption_dialog_->OnGestureTapEvent(event); ++#endif + return; + } + +@@ -2573,6 +2580,7 @@ gfx::Rect VideoOverlayWindowViews::GetLiveCaptionDialogBounds() { bool VideoOverlayWindowViews::HasHighMediaEngagement( const url::Origin& origin) const { @@ -98,7 +110,7 @@ index fcb7d2c18f39acb174fc456362de51c484de398c..fea71317b41429dd3bbd50947673124f MediaEngagementService* service = MediaEngagementService::Get(Profile::FromBrowserContext( GetController()->GetWebContents()->GetBrowserContext())); -@@ -2569,6 +2576,8 @@ bool VideoOverlayWindowViews::HasHighMediaEngagement( +@@ -2581,6 +2589,8 @@ bool VideoOverlayWindowViews::HasHighMediaEngagement( } return service->HasHighEngagement(origin); diff --git a/patches/chromium/port_autofill_colors_to_the_color_pipeline.patch b/patches/chromium/port_autofill_colors_to_the_color_pipeline.patch index 27656b0881fb1..2f7af1c5ad11e 100644 --- a/patches/chromium/port_autofill_colors_to_the_color_pipeline.patch +++ b/patches/chromium/port_autofill_colors_to_the_color_pipeline.patch @@ -31,10 +31,10 @@ index b6fe461a04dfabab9b114b4a0c0c6cc08718cdaf..e57d928023a2defe5c2586aa6bd8385b /* ui::NativeThemeBase::ControlColorId. */ \ E_CPONLY(kColorWebNativeControlAccent) \ diff --git a/ui/color/ui_color_mixer.cc b/ui/color/ui_color_mixer.cc -index f606d2a058ed9ebf86b5f020b6897be718a40b68..003e95ca8bb6364fb6b937871b2c78b9ec798bd0 100644 +index 8817142344cc9abed442f07b5cbe759b82901c06..edf6d4ca1bfce93f8dcbeb2585c9ec07e3ff7f76 100644 --- a/ui/color/ui_color_mixer.cc +++ b/ui/color/ui_color_mixer.cc -@@ -180,6 +180,17 @@ void AddUiColorMixer(ColorProvider* provider, const ColorProviderKey& key) { +@@ -181,6 +181,17 @@ void AddUiColorMixer(ColorProvider* provider, const ColorProviderKey& key) { mixer[kColorProgressBarPaused] = {kColorDisabledForeground}; mixer[kColorRadioButtonForegroundChecked] = {kColorButtonForeground}; mixer[kColorRadioButtonForegroundUnchecked] = {kColorSecondaryForeground}; @@ -52,19 +52,19 @@ index f606d2a058ed9ebf86b5f020b6897be718a40b68..003e95ca8bb6364fb6b937871b2c78b9 mixer[kColorSeparator] = {kColorMidground}; mixer[kColorShadowBase] = {dark_mode ? SK_ColorBLACK : gfx::kGoogleGrey800}; mixer[kColorShadowValueAmbientShadowElevationThree] = -@@ -276,6 +287,7 @@ void AddUiColorMixer(ColorProvider* provider, const ColorProviderKey& key) { +@@ -277,6 +288,7 @@ void AddUiColorMixer(ColorProvider* provider, const ColorProviderKey& key) { mixer[kColorTreeNodeForegroundSelectedFocused] = {kColorTreeNodeForeground}; mixer[kColorTreeNodeForegroundSelectedUnfocused] = { kColorTreeNodeForegroundSelectedFocused}; + mixer[kColorUnfocusedBorder] = {kColorMidground}; - mixer[kColorWebNativeControlAccent] = {dark_mode - ? SkColorSetRGB(0x99, 0xC8, 0xFF) - : SkColorSetRGB(0x00, 0x75, 0xFF)}; + mixer[kColorWindowBackground] = {kColorPrimaryBackground}; + CompleteDefaultWebNativeRendererColorIdsDefinition( + mixer, dark_mode, diff --git a/ui/color/win/native_color_mixers_win.cc b/ui/color/win/native_color_mixers_win.cc -index 179dc53711ed96421a66cb6c1651983af5f49c6a..686661965ebb56d2de7ff5279669491d95f81cca 100644 +index f18031fa9ff490edc690cb3a79654ddfde4f1000..58e49a832b64dd45ff08775021e6f049c5679833 100644 --- a/ui/color/win/native_color_mixers_win.cc +++ b/ui/color/win/native_color_mixers_win.cc -@@ -146,6 +146,10 @@ void AddNativeUiColorMixer(ColorProvider* provider, +@@ -145,6 +145,10 @@ void AddNativeUiColorMixer(ColorProvider* provider, SetAlpha(kColorNotificationInputForeground, gfx::kGoogleGreyAlpha700); mixer[kColorSliderTrack] = AlphaBlend( kColorNativeHighlight, kColorNativeWindow, gfx::kGoogleGreyAlpha400); @@ -75,7 +75,7 @@ index 179dc53711ed96421a66cb6c1651983af5f49c6a..686661965ebb56d2de7ff5279669491d // Window Background mixer[kColorBubbleFooterBackground] = {kColorNativeWindow}; -@@ -154,6 +158,7 @@ void AddNativeUiColorMixer(ColorProvider* provider, +@@ -153,6 +157,7 @@ void AddNativeUiColorMixer(ColorProvider* provider, mixer[kColorFrameInactive] = {kColorNativeWindow}; mixer[kColorPrimaryBackground] = {kColorNativeWindow}; mixer[kColorTooltipBackground] = {kColorNativeWindow}; @@ -83,7 +83,7 @@ index 179dc53711ed96421a66cb6c1651983af5f49c6a..686661965ebb56d2de7ff5279669491d // Window Text mixer[kColorAlertLowSeverity] = {kColorNativeWindowText}; -@@ -167,6 +172,7 @@ void AddNativeUiColorMixer(ColorProvider* provider, +@@ -166,6 +171,7 @@ void AddNativeUiColorMixer(ColorProvider* provider, mixer[kColorTableGroupingIndicator] = {kColorNativeWindowText}; mixer[kColorThrobber] = {kColorNativeWindowText}; mixer[kColorTooltipForeground] = {kColorNativeWindowText}; @@ -91,7 +91,7 @@ index 179dc53711ed96421a66cb6c1651983af5f49c6a..686661965ebb56d2de7ff5279669491d // Hyperlinks mixer[kColorLinkForegroundDefault] = {kColorNativeHotlight}; -@@ -209,6 +215,7 @@ void AddNativeUiColorMixer(ColorProvider* provider, +@@ -208,6 +214,7 @@ void AddNativeUiColorMixer(ColorProvider* provider, mixer[kColorTextfieldForeground] = {kColorNativeBtnText}; mixer[kColorTextfieldForegroundPlaceholder] = {kColorNativeBtnText}; mixer[kColorTextfieldForegroundDisabled] = {kColorNativeBtnText}; diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch index e77bf1cabefed..4089e87653a53 100644 --- a/patches/chromium/printing.patch +++ b/patches/chromium/printing.patch @@ -666,7 +666,7 @@ index ac2f719be566020d9f41364560c12e6d6d0fe3d8..16d758a6936f66148a196761cfb875f6 PrintingFailed(int32 cookie, PrintFailureReason reason); diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc -index d7555d8c33ca05525454eb6583b4b37a4bcae558..ebddc2487818388675cc14c789b8b67e62cb2cc4 100644 +index 5fc3803e0cc9e41d508c5752a5a9b5bee4eee0d9..810847718a808418e171939e9b8203098ddf19cd 100644 --- a/components/printing/renderer/print_render_frame_helper.cc +++ b/components/printing/renderer/print_render_frame_helper.cc @@ -53,6 +53,7 @@ @@ -677,7 +677,7 @@ index d7555d8c33ca05525454eb6583b4b37a4bcae558..ebddc2487818388675cc14c789b8b67e #include "printing/units.h" #include "services/metrics/public/cpp/ukm_source_id.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" -@@ -1246,14 +1247,14 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { +@@ -1245,14 +1246,14 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { } print_in_progress_ = true; @@ -694,7 +694,7 @@ index d7555d8c33ca05525454eb6583b4b37a4bcae558..ebddc2487818388675cc14c789b8b67e if (!weak_this) { return; } -@@ -1284,12 +1285,14 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver( +@@ -1283,12 +1284,14 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver( receivers_.Add(this, std::move(receiver)); } @@ -712,7 +712,7 @@ index d7555d8c33ca05525454eb6583b4b37a4bcae558..ebddc2487818388675cc14c789b8b67e ScopedIPC scoped_ipc(weak_ptr_factory_.GetWeakPtr()); if (ipc_nesting_level_ > kAllowedIpcDepthForPrint) { return; -@@ -1306,9 +1309,10 @@ void PrintRenderFrameHelper::PrintRequestedPagesInternal( +@@ -1305,9 +1308,10 @@ void PrintRenderFrameHelper::PrintRequestedPagesInternal( is_loading_ = frame->WillPrintSoon(); if (is_loading_) { @@ -726,7 +726,7 @@ index d7555d8c33ca05525454eb6583b4b37a4bcae558..ebddc2487818388675cc14c789b8b67e SetupOnStopLoadingTimeout(); return; } -@@ -1318,7 +1322,7 @@ void PrintRenderFrameHelper::PrintRequestedPagesInternal( +@@ -1317,7 +1321,7 @@ void PrintRenderFrameHelper::PrintRequestedPagesInternal( // plugin node and print that instead. auto plugin = delegate_->GetPdfElement(frame); @@ -735,7 +735,7 @@ index d7555d8c33ca05525454eb6583b4b37a4bcae558..ebddc2487818388675cc14c789b8b67e if (render_frame_gone_) { return; -@@ -1474,6 +1478,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) { +@@ -1473,6 +1477,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) { if (ipc_nesting_level_ > kAllowedIpcDepthForPrint) return; @@ -744,7 +744,7 @@ index d7555d8c33ca05525454eb6583b4b37a4bcae558..ebddc2487818388675cc14c789b8b67e print_preview_context_.OnPrintPreview(); #if BUILDFLAG(IS_CHROMEOS) -@@ -2086,17 +2092,25 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { +@@ -2085,17 +2091,25 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, const blink::WebNode& node, @@ -773,7 +773,7 @@ index d7555d8c33ca05525454eb6583b4b37a4bcae558..ebddc2487818388675cc14c789b8b67e DidFinishPrinting(PrintingResult::kFailPrintInit); return; } -@@ -2117,8 +2131,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, +@@ -2116,8 +2130,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, print_pages_params_->params->print_scaling_option; auto self = weak_ptr_factory_.GetWeakPtr(); @@ -790,7 +790,7 @@ index d7555d8c33ca05525454eb6583b4b37a4bcae558..ebddc2487818388675cc14c789b8b67e // Check if `this` is still valid. if (!self) return; -@@ -2385,29 +2406,43 @@ void PrintRenderFrameHelper::IPCProcessed() { +@@ -2384,29 +2405,43 @@ void PrintRenderFrameHelper::IPCProcessed() { } bool PrintRenderFrameHelper::InitPrintSettings(blink::WebLocalFrame* frame, diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index 604ff06be8a9b..1b6bb761fc821 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -8,7 +8,7 @@ Chrome moved the SetCursor IPC message to mojo, which we use to tell OSR about ` Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2172779 diff --git a/content/browser/renderer_host/render_widget_host_delegate.h b/content/browser/renderer_host/render_widget_host_delegate.h -index 27b51f78f4676071a8fdc2340f650cb7df1d883b..7db3a07ff9e0f52f1232c25f8e4e72d3c299e623 100644 +index 9a4195a3e53353342c75d6c4372ed4c27ef13fd3..ce071c6acd6027ad27cee597f56e865f0d5172f9 100644 --- a/content/browser/renderer_host/render_widget_host_delegate.h +++ b/content/browser/renderer_host/render_widget_host_delegate.h @@ -27,6 +27,7 @@ @@ -16,7 +16,7 @@ index 27b51f78f4676071a8fdc2340f650cb7df1d883b..7db3a07ff9e0f52f1232c25f8e4e72d3 #include "ui/base/ui_base_types.h" #include "ui/gfx/mojom/delegated_ink_point_renderer.mojom.h" +#include "ui/base/cursor/cursor.h" - #include "ui/gfx/native_widget_types.h" + #include "ui/gfx/native_ui_types.h" namespace blink { @@ -293,6 +294,9 @@ class CONTENT_EXPORT RenderWidgetHostDelegate { @@ -30,10 +30,10 @@ index 27b51f78f4676071a8fdc2340f650cb7df1d883b..7db3a07ff9e0f52f1232c25f8e4e72d3 // RenderWidgetHost on the primary main frame, and false otherwise. virtual bool IsWidgetForPrimaryMainFrame(RenderWidgetHostImpl*); diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 27131371845a81c0af16d59334a98656095f4aeb..9cccc151a7c1b7d11a88545e168fd878276a91ea 100644 +index 0bae000a3491e03196bbba033621d389c6150225..a6abe25611c82da8c55998f74c9822746d87875c 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -2079,6 +2079,9 @@ void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) { +@@ -2072,6 +2072,9 @@ void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) { if (view_) { view_->UpdateCursor(cursor); } @@ -44,10 +44,10 @@ index 27131371845a81c0af16d59334a98656095f4aeb..9cccc151a7c1b7d11a88545e168fd878 void RenderWidgetHostImpl::ShowContextMenuAtPoint( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 7a6760e0efdf6972eb497407b68202c5bfffd006..4e2e910c62534106209758a0e5aeb329cfbaa529 100644 +index 6c067803c35a4e98ec99df6e28015f3b36e67e4f..d7cf36715b036c29d881c84a07c0d3b7f73d609f 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -6110,6 +6110,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { +@@ -6130,6 +6130,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { return text_input_manager_.get(); } @@ -60,10 +60,10 @@ index 7a6760e0efdf6972eb497407b68202c5bfffd006..4e2e910c62534106209758a0e5aeb329 RenderWidgetHostImpl* render_widget_host) { return render_widget_host == GetPrimaryMainFrame()->GetRenderWidgetHost(); diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index 8bad6ba62f98732676920f334c49fe46aad42bf2..9dfd229af26127dee8e21c77fcedef5285f3aafa 100644 +index 342a5f984838eba5aef7a535c3758bb96c0f89a3..034797826196560ab6b71f885d52c8e1c94c1a67 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -1178,6 +1178,7 @@ class CONTENT_EXPORT WebContentsImpl +@@ -1179,6 +1179,7 @@ class CONTENT_EXPORT WebContentsImpl void SendScreenRects() override; void SendActiveState(bool active) override; TextInputManager* GetTextInputManager() override; diff --git a/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch b/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch index 7e15e0e027bff..4997ec510e339 100644 --- a/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch +++ b/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch @@ -7,11 +7,11 @@ Subject: refactor: expose HostImportModuleDynamically and This is so that Electron can blend Blink's and Node's implementations of these isolate handlers. diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -index 1fac8bc97292767149887ff77ebb425124a77f95..2137de2f69cec918c5651292cd79c0ad26a86ae9 100644 +index bab63bdebc0c52a45adbeb86b391898f944703a5..cd2cb4bb15349273719c366795fc4d9a1c6e9e89 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -@@ -644,8 +644,9 @@ bool WasmJSPromiseIntegrationEnabledCallback(v8::Local<v8::Context> context) { - return RuntimeEnabledFeatures::WebAssemblyJSPromiseIntegrationEnabled( +@@ -635,8 +635,9 @@ bool WasmCustomDescriptorsEnabledCallback(v8::Local<v8::Context> context) { + return RuntimeEnabledFeatures::WebAssemblyCustomDescriptorsEnabled( execution_context); } +} // namespace @@ -21,7 +21,7 @@ index 1fac8bc97292767149887ff77ebb425124a77f95..2137de2f69cec918c5651292cd79c0ad v8::Local<v8::Context> context, v8::Local<v8::Data> v8_host_defined_options, v8::Local<v8::Value> v8_referrer_resource_url, -@@ -723,20 +724,23 @@ v8::MaybeLocal<v8::Promise> HostImportModuleWithPhaseDynamically( +@@ -714,20 +715,23 @@ v8::MaybeLocal<v8::Promise> HostImportModuleWithPhaseDynamically( return resolver->Promise().V8Promise(); } @@ -47,7 +47,7 @@ index 1fac8bc97292767149887ff77ebb425124a77f95..2137de2f69cec918c5651292cd79c0ad v8::Local<v8::Module> module, v8::Local<v8::Object> meta) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); -@@ -763,6 +767,7 @@ void HostGetImportMetaProperties(v8::Local<v8::Context> context, +@@ -754,6 +758,7 @@ void HostGetImportMetaProperties(v8::Local<v8::Context> context, meta->CreateDataProperty(context, resolve_key, resolve_value).ToChecked(); } @@ -55,7 +55,7 @@ index 1fac8bc97292767149887ff77ebb425124a77f95..2137de2f69cec918c5651292cd79c0ad bool IsDOMExceptionWrapper(v8::Isolate* isolate, v8::Local<v8::Object> object) { return V8DOMException::HasInstance(isolate, object); } -@@ -793,7 +798,6 @@ void EmitDevToolsEvent(v8::Isolate* isolate) { +@@ -784,7 +789,6 @@ void EmitDevToolsEvent(v8::Isolate* isolate) { } // namespace @@ -63,7 +63,7 @@ index 1fac8bc97292767149887ff77ebb425124a77f95..2137de2f69cec918c5651292cd79c0ad void V8Initializer::InitializeV8Common(v8::Isolate* isolate) { // Set up garbage collection before setting up anything else as V8 may trigger // GCs during Blink setup. -@@ -810,9 +814,9 @@ void V8Initializer::InitializeV8Common(v8::Isolate* isolate) { +@@ -800,9 +804,9 @@ void V8Initializer::InitializeV8Common(v8::Isolate* isolate) { SharedArrayBufferConstructorEnabledCallback); isolate->SetHostImportModuleDynamicallyCallback(HostImportModuleDynamically); isolate->SetHostImportModuleWithPhaseDynamicallyCallback( diff --git a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch index 4aff3cf4bb374..0382a646ed3c0 100644 --- a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch +++ b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch @@ -6,7 +6,7 @@ Subject: refactor: patch electron PermissionTypes into blink 6387077: [PermissionOptions] Generalize PermissionRequestDescription | https://chromium-review.googlesource.com/c/chromium/src/+/6387077 diff --git a/components/permissions/permission_util.cc b/components/permissions/permission_util.cc -index 83b0237a56d5ea7555ae989bd7bd13886f0c8f13..0377c8c0c3a112ec40132b8441747652b0c15870 100644 +index 668012a5e422059f52815fadf3c7d1d99af55032..753e519eb3ca094205b3e280b381960d805b3e24 100644 --- a/components/permissions/permission_util.cc +++ b/components/permissions/permission_util.cc @@ -536,7 +536,17 @@ ContentSettingsType PermissionUtil::PermissionTypeToContentSettingsTypeSafe( @@ -28,10 +28,10 @@ index 83b0237a56d5ea7555ae989bd7bd13886f0c8f13..0377c8c0c3a112ec40132b8441747652 break; } diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc -index d92f15f9ff1bf8dc23361e668f6d48199540c4e6..aa13c5e85fef3de67e41889b0ea1c751c5144f85 100644 +index dda07e1d45bf49b1fc3970a34a17bf65abc79e60..0e75eff7a65fc4eb921d41d0c4689b0157308ff6 100644 --- a/content/browser/permissions/permission_controller_impl.cc +++ b/content/browser/permissions/permission_controller_impl.cc -@@ -88,7 +88,15 @@ PermissionToSchedulingFeature(PermissionType permission_name) { +@@ -89,7 +89,15 @@ PermissionToSchedulingFeature(PermissionType permission_name) { case PermissionType::AUTOMATIC_FULLSCREEN: case PermissionType::WEB_APP_INSTALLATION: case PermissionType::LOCAL_NETWORK_ACCESS: @@ -164,7 +164,7 @@ index c286d87043ec4cb2e51ec9d82d08e4c84f5a270c..164a2a446947dae687922363d324a6d3 // Always keep this at the end. NUM, diff --git a/third_party/blink/public/mojom/permissions/permission.mojom b/third_party/blink/public/mojom/permissions/permission.mojom -index 47c73522cbd7c1d12dabfecf6f55a74690ebc189..6b8ed935e8c440cbf655d122a398d33e3e4ad89b 100644 +index 6fc349a2f4633d1338fbfcf8d0d0fb6fa3180b0d..ebb5d84848cee735990f06f6add2b38ebd8734ef 100644 --- a/third_party/blink/public/mojom/permissions/permission.mojom +++ b/third_party/blink/public/mojom/permissions/permission.mojom @@ -44,7 +44,15 @@ enum PermissionName { diff --git a/patches/chromium/refactor_unfilter_unresponsive_events.patch b/patches/chromium/refactor_unfilter_unresponsive_events.patch index b2f62f9650f71..c79917f3d8315 100644 --- a/patches/chromium/refactor_unfilter_unresponsive_events.patch +++ b/patches/chromium/refactor_unfilter_unresponsive_events.patch @@ -15,10 +15,10 @@ This CL removes these filters so the unresponsive event can still be accessed from our JS event. The filtering is moved into Electron's code. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 7bda1bd1d7c34e369c27e4ec283888fe4d50458d..7ec8dea94a9f97f0938f57743a35e8de09efb8c9 100644 +index 705e848acfc76a6b2e3a4dffb9e8ae8f86d54cbc..87a3fc1ff0fdd3e25595b539b7f09b5b3e403beb 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10220,25 +10220,13 @@ void WebContentsImpl::RendererUnresponsive( +@@ -10252,25 +10252,13 @@ void WebContentsImpl::RendererUnresponsive( base::RepeatingClosure hang_monitor_restarter) { OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RendererUnresponsive", "render_widget_host", render_widget_host); diff --git a/patches/chromium/render_widget_host_view_mac.patch b/patches/chromium/render_widget_host_view_mac.patch index 8500564343ee8..b22966a9e9fad 100644 --- a/patches/chromium/render_widget_host_view_mac.patch +++ b/patches/chromium/render_widget_host_view_mac.patch @@ -8,7 +8,7 @@ respond to the first mouse click in their window, which is desirable for some kinds of utility windows. Similarly for `disableAutoHideCursor`. diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -index b1064aff3a47ee475ccd449bbf89bf419a7d59cc..e5b59a9d364dd5a8f847d9543b19fdc068098754 100644 +index 2bf102472783b7d41419f2de301af048955c691c..d3f833904a7a056235d4bd4b3e7c5297a60861f5 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -167,6 +167,15 @@ void ExtractUnderlines(NSAttributedString* string, @@ -27,28 +27,27 @@ index b1064aff3a47ee475ccd449bbf89bf419a7d59cc..e5b59a9d364dd5a8f847d9543b19fdc0 // RenderWidgetHostViewCocoa --------------------------------------------------- // Private methods: -@@ -781,6 +790,9 @@ - (AcceptMouseEvents)acceptsMouseEventsOption { +@@ -781,6 +790,10 @@ - (AcceptMouseEvents)acceptsMouseEventsOption { } - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent { + if ([self.window respondsToSelector:@selector(acceptsFirstMouse)] && + [self.window acceptsFirstMouse]) + return YES; - // Enable "click-through" if mouse clicks are accepted in inactive windows. - return - [self acceptsMouseEventsOption] > AcceptMouseEvents::kWhenInActiveWindow; -@@ -933,6 +945,10 @@ - (BOOL)shouldIgnoreMouseEvent:(NSEvent*)theEvent { ++ + switch ([self acceptsMouseEventsOption]) { + case AcceptMouseEvents::kWhenInActiveWindow: + // It is important to accept clicks when this window is the main window. +@@ -943,6 +956,8 @@ - (BOOL)shouldIgnoreMouseEvent:(NSEvent*)theEvent { // its parent view. BOOL hitSelf = NO; while (view) { -+ if ([view respondsToSelector:@selector(shouldIgnoreMouseEvent)] && ![view shouldIgnoreMouseEvent]) { ++ if ([view respondsToSelector:@selector(shouldIgnoreMouseEvent)] && ![view shouldIgnoreMouseEvent]) + return NO; -+ } -+ if (view == self) hitSelf = YES; if ([view isKindOfClass:[self class]] && ![view isEqual:self] && -@@ -1267,6 +1283,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv { +@@ -1277,6 +1292,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv { eventType == NSEventTypeKeyDown && !(modifierFlags & NSEventModifierFlagCommand); diff --git a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch index f9395adb2f8a1..ace4468e5e331 100644 --- a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch +++ b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch @@ -233,11 +233,11 @@ index d8167e854a3264b19a07544039fd01aba45e27a1..2e5a4ae715529e3b7b5c8fbb7195c7ce } diff --git a/content/common/features.cc b/content/common/features.cc -index 1ff501a5ea3aa1591957ba6d13b7a264542f5ff9..5cc21f1b1a58df0892491feee5c7042f6ab79951 100644 +index 97f8f8088a149a6c20ea5cf0193cb48034a4d7fb..3e5ed6c1e9df1f6e56076b80c8be2b016f242635 100644 --- a/content/common/features.cc +++ b/content/common/features.cc -@@ -324,6 +324,14 @@ BASE_FEATURE(kIOSurfaceCapturer, - base::FEATURE_ENABLED_BY_DEFAULT); +@@ -276,6 +276,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); + BASE_FEATURE(kIOSurfaceCapturer, base::FEATURE_ENABLED_BY_DEFAULT); #endif +// Feature that controls whether WebContentsOcclusionChecker should handle @@ -249,13 +249,13 @@ index 1ff501a5ea3aa1591957ba6d13b7a264542f5ff9..5cc21f1b1a58df0892491feee5c7042f +#endif + // When enabled, child process will not terminate itself when IPC is reset. - BASE_FEATURE(kKeepChildProcessAfterIPCReset, - "KeepChildProcessAfterIPCReset", + BASE_FEATURE(kKeepChildProcessAfterIPCReset, base::FEATURE_DISABLED_BY_DEFAULT); + diff --git a/content/common/features.h b/content/common/features.h -index 5ad549904c7797e770e0ac08c02e60595f387fe9..5dbe417669d8c267c7b7dbcaa7784147bc756e08 100644 +index 933536411d1f1c2f2b7dec6dacd75a1c940a68aa..797937ce2d58d95a8aa5003323b5af8bd714ff01 100644 --- a/content/common/features.h +++ b/content/common/features.h -@@ -101,6 +101,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); +@@ -103,6 +103,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); #if BUILDFLAG(IS_MAC) CONTENT_EXPORT BASE_DECLARE_FEATURE(kIOSurfaceCapturer); #endif diff --git a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch index f2f463edb6c23..b4bae7da6c9cc 100644 --- a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch +++ b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch @@ -22,7 +22,7 @@ index 74fea36ea7f9a345b3474ea18be00704831a685e..c75785d5a26fa52a39d1a3552da9a762 const input::NativeWebKeyboardEvent& event) { return KeyboardEventProcessingResult::NOT_HANDLED; diff --git a/content/browser/renderer_host/render_widget_host_delegate.h b/content/browser/renderer_host/render_widget_host_delegate.h -index 7db3a07ff9e0f52f1232c25f8e4e72d3c299e623..af763ad4e441e54556854cd40c4cb9098f84bb58 100644 +index ce071c6acd6027ad27cee597f56e865f0d5172f9..be4eb55837d2b9bda96b1408f84f646d7da18e59 100644 --- a/content/browser/renderer_host/render_widget_host_delegate.h +++ b/content/browser/renderer_host/render_widget_host_delegate.h @@ -103,6 +103,12 @@ class CONTENT_EXPORT RenderWidgetHostDelegate { @@ -39,10 +39,10 @@ index 7db3a07ff9e0f52f1232c25f8e4e72d3c299e623..af763ad4e441e54556854cd40c4cb909 // event before sending it to the renderer. See enum for details on return // value. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 349d591b0b35421f91e70dde257a726341e94ad9..6b0bbda767d547cf8365a240692904b3c0e50985 100644 +index d211d8dc92c16e8ad2e9b1b37cb25dd05bf7e3e1..1756d5e81e9bf5ba20fc596901bb3cfe244ff903 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -1595,6 +1595,10 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( +@@ -1588,6 +1588,10 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( CHECK_GE(mouse_event.GetType(), WebInputEvent::Type::kMouseTypeFirst); CHECK_LE(mouse_event.GetType(), WebInputEvent::Type::kMouseTypeLast); @@ -54,10 +54,10 @@ index 349d591b0b35421f91e70dde257a726341e94ad9..6b0bbda767d547cf8365a240692904b3 if (mouse_event_callback.Run(mouse_event)) { return; diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 7ec8dea94a9f97f0938f57743a35e8de09efb8c9..81eabc6be87037a54a8c9b000ce374cc2d87794f 100644 +index 87a3fc1ff0fdd3e25595b539b7f09b5b3e403beb..20112cfa786e487811453947d0e2c797962484cb 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4426,6 +4426,12 @@ void WebContentsImpl::RenderWidgetWasResized( +@@ -4447,6 +4447,12 @@ void WebContentsImpl::RenderWidgetWasResized( width_changed); } @@ -71,10 +71,10 @@ index 7ec8dea94a9f97f0938f57743a35e8de09efb8c9..81eabc6be87037a54a8c9b000ce374cc const gfx::PointF& client_pt) { if (delegate_) { diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index 9dfd229af26127dee8e21c77fcedef5285f3aafa..63a38ac602ae00e6df40e4c883937bc57d513ead 100644 +index 034797826196560ab6b71f885d52c8e1c94c1a67..55db63b3f99e465d2c77bb25dca5d50005df5ce7 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -1109,6 +1109,7 @@ class CONTENT_EXPORT WebContentsImpl +@@ -1110,6 +1110,7 @@ class CONTENT_EXPORT WebContentsImpl double GetPendingZoomLevel(RenderWidgetHostImpl* rwh) override; @@ -83,10 +83,10 @@ index 9dfd229af26127dee8e21c77fcedef5285f3aafa..63a38ac602ae00e6df40e4c883937bc5 const gfx::PointF& client_pt); void PreHandleDragExit(); diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index ea179bdf3e702fb1d5be55affe3958f77901cd08..4b99edf823034115387c19cf1a8df9284e674d9b 100644 +index 08c983ac6a8e5733431ba00e1288f6d6b087eee6..3e2a9fb6a768c57ddb813c5c7a1df8bb3c2f8ddd 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc -@@ -121,6 +121,12 @@ bool WebContentsDelegate::HandleContextMenu(RenderFrameHost& render_frame_host, +@@ -126,6 +126,12 @@ bool WebContentsDelegate::HandleContextMenu(RenderFrameHost& render_frame_host, return false; } @@ -100,10 +100,10 @@ index ea179bdf3e702fb1d5be55affe3958f77901cd08..4b99edf823034115387c19cf1a8df928 WebContents* source, const input::NativeWebKeyboardEvent& event) { diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 97def739ec2418286b76c0039c61b501293c8f5d..23acbc47f2c2e5b56b674a675e5ea92a643c4715 100644 +index 2e8e60c8ebe837fc68318bd5c13dbd0c873c4292..7bd26bc9460a11d717deb596722942ba55830c5d 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h -@@ -306,6 +306,13 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -313,6 +313,13 @@ class CONTENT_EXPORT WebContentsDelegate { virtual bool HandleContextMenu(RenderFrameHost& render_frame_host, const ContextMenuParams& params); diff --git a/patches/chromium/revert_remove_the_allowaggressivethrottlingwithwebsocket_feature.patch b/patches/chromium/revert_remove_the_allowaggressivethrottlingwithwebsocket_feature.patch index 8110506f35f42..b2e7b56240b45 100644 --- a/patches/chromium/revert_remove_the_allowaggressivethrottlingwithwebsocket_feature.patch +++ b/patches/chromium/revert_remove_the_allowaggressivethrottlingwithwebsocket_feature.patch @@ -6,10 +6,10 @@ Subject: Revert "Remove the AllowAggressiveThrottlingWithWebSocket feature." This reverts commit 615c1810a187840ffeb04096087efff86edb37de. diff --git a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc -index 6c3d01cfba017bee1dc7bc96f2707f80358923e9..d771cd323529f2e80d71ca20ef37c71c1f356b7c 100644 +index 485ae01ebe560b118624706c8ca415e43e1b7d8f..71c95266bd982168c7b1929f0455335574d54169 100644 --- a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc +++ b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc -@@ -101,6 +101,17 @@ enum WebSocketOpCode { +@@ -102,6 +102,17 @@ enum WebSocketOpCode { kOpCodeBinary = 0x2, }; @@ -27,7 +27,7 @@ index 6c3d01cfba017bee1dc7bc96f2707f80358923e9..d771cd323529f2e80d71ca20ef37c71c } // namespace WebSocketChannelImpl::MessageDataDeleter::MessageDataDeleter( -@@ -294,7 +305,10 @@ bool WebSocketChannelImpl::Connect(const KURL& url, const String& protocol) { +@@ -297,7 +308,10 @@ bool WebSocketChannelImpl::Connect(const KURL& url, const String& protocol) { // even if the `WebSocketChannel` is closed. feature_handle_for_scheduler_ = scheduler->RegisterFeature( SchedulingPolicy::Feature::kWebSocket, diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index dbca60b9d1be5..167e865b0351f 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index 64da47969f25d5ba71f850e85cdb96eb0d66a5d7..056991b98af53190f0229e3ce84a22b2aa0f55f7 100644 +index 051104ddca1a1dbc89199a74d08b94b1134a6e60..378056aaa1e84125d8a2a8b464e2bdf226655722 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25306,6 +25306,21 @@ +@@ -25209,6 +25209,21 @@ ] } ], @@ -36,12 +36,12 @@ index 64da47969f25d5ba71f850e85cdb96eb0d66a5d7..056991b98af53190f0229e3ce84a22b2 { "platforms": [ diff --git a/ui/views/views_features.cc b/ui/views/views_features.cc -index 52c03930806efdb180d45bb68d4b6cd72cb8bec7..8307938f271c46b57aeceb6e4faaad88f45add5e 100644 +index 88ca7f0b1fc025ee41653004dc10ed48cbd59d32..b8ec7177ced38773b96f7d44277bba383d0ff8ca 100644 --- a/ui/views/views_features.cc +++ b/ui/views/views_features.cc -@@ -31,6 +31,14 @@ BASE_FEATURE(kEnableTouchDragCursorSync, - "EnableTouchDragCursorSync", - base::FEATURE_ENABLED_BY_DEFAULT); +@@ -27,6 +27,14 @@ BASE_FEATURE(kEnablePlatformHighContrastInkDrop, + // crbug.com/370856871. + BASE_FEATURE(kEnableTouchDragCursorSync, base::FEATURE_ENABLED_BY_DEFAULT); +// Enables enlargement of HWNDs to a minimum size of 64x64 to handle reported +// graphical glitches on certain hardware. @@ -67,7 +67,7 @@ index 58063f2452dc484a97c79b382067d9b34875e344..d586436498263c595a17454f54644d2d } // namespace views::features diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 4c626e026e5b19db737533607957d0ff2fbeae28..7d899eef72721c6f3e27c9892ba963fd6b5aaeef 100644 +index f4fa30c1621e2eb78913ea97a993eb0a3528f36c..f142ce65c5c0e22b968c98082d11d9922e3a0cfa 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -84,6 +84,23 @@ namespace { @@ -94,7 +94,7 @@ index 4c626e026e5b19db737533607957d0ff2fbeae28..7d899eef72721c6f3e27c9892ba963fd // Updates the cursor clip region. Used for mouse locking. void UpdateMouseLockRegion(aura::Window* window, bool locked) { if (!locked) { -@@ -333,9 +350,14 @@ bool DesktopWindowTreeHostWin::IsVisible() const { +@@ -329,9 +346,14 @@ bool DesktopWindowTreeHostWin::IsVisible() const { } void DesktopWindowTreeHostWin::SetSize(const gfx::Size& size) { @@ -111,7 +111,7 @@ index 4c626e026e5b19db737533607957d0ff2fbeae28..7d899eef72721c6f3e27c9892ba963fd } void DesktopWindowTreeHostWin::StackAbove(aura::Window* window) { -@@ -350,30 +372,40 @@ void DesktopWindowTreeHostWin::StackAtTop() { +@@ -346,30 +368,40 @@ void DesktopWindowTreeHostWin::StackAtTop() { } void DesktopWindowTreeHostWin::CenterWindow(const gfx::Size& size) { @@ -154,7 +154,7 @@ index 4c626e026e5b19db737533607957d0ff2fbeae28..7d899eef72721c6f3e27c9892ba963fd return display::win::GetScreenWin()->ScreenToDIPRect(GetHWND(), pixel_bounds); } -@@ -682,37 +714,44 @@ void DesktopWindowTreeHostWin::HideImpl() { +@@ -678,37 +710,44 @@ void DesktopWindowTreeHostWin::HideImpl() { // other get/set methods work in DIP. gfx::Rect DesktopWindowTreeHostWin::GetBoundsInPixels() const { @@ -219,7 +219,7 @@ index 4c626e026e5b19db737533607957d0ff2fbeae28..7d899eef72721c6f3e27c9892ba963fd } gfx::Rect -@@ -922,21 +961,29 @@ int DesktopWindowTreeHostWin::GetNonClientComponent( +@@ -918,21 +957,29 @@ int DesktopWindowTreeHostWin::GetNonClientComponent( void DesktopWindowTreeHostWin::GetWindowMask(const gfx::Size& size_px, SkPath* path) { @@ -264,10 +264,10 @@ index 4c626e026e5b19db737533607957d0ff2fbeae28..7d899eef72721c6f3e27c9892ba963fd } diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -index 13cfa18bf406f244ec361a1230ccce440ad9785a..d8be4dffee3947e7ac6dc09cb8e1f2a6a834789b 100644 +index cef7afbf408e38798c398c23dc3e964bd1d95d17..74f0f6e485f4cc6be2c292f4b364d9796d9ce20b 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -@@ -176,7 +176,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin +@@ -175,7 +175,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin void ShowImpl() override; void HideImpl() override; gfx::Rect GetBoundsInPixels() const override; @@ -276,7 +276,7 @@ index 13cfa18bf406f244ec361a1230ccce440ad9785a..d8be4dffee3947e7ac6dc09cb8e1f2a6 gfx::Rect GetBoundsInAcceleratedWidgetPixelCoordinates() override; gfx::Point GetLocationOnScreenInPixels() const override; void SetCapture() override; -@@ -328,6 +328,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin +@@ -327,6 +327,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin gfx::Vector2d window_expansion_top_left_delta_; gfx::Vector2d window_expansion_bottom_right_delta_; diff --git a/patches/chromium/scroll_bounce_flag.patch b/patches/chromium/scroll_bounce_flag.patch index f7d2e57413f13..ec7f6a5b827f8 100644 --- a/patches/chromium/scroll_bounce_flag.patch +++ b/patches/chromium/scroll_bounce_flag.patch @@ -6,10 +6,10 @@ Subject: scroll_bounce_flag.patch Patch to make scrollBounce option work. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc -index dbc0224b59409d6a602f3af6d8378d86181b57d9..0d0857f801be22dfffd937e02865b1a90f75917c 100644 +index ccfd37cc73dff797166eb0e675d430d7abade835..2c2ceb5535ff5bfceab6e7a5af61e96b5f92e011 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc -@@ -1231,7 +1231,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { +@@ -1217,7 +1217,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { } bool RenderThreadImpl::IsElasticOverscrollEnabled() { diff --git a/patches/chromium/support_mixed_sandbox_with_zygote.patch b/patches/chromium/support_mixed_sandbox_with_zygote.patch index 748825f2f77a0..62c7e5849b534 100644 --- a/patches/chromium/support_mixed_sandbox_with_zygote.patch +++ b/patches/chromium/support_mixed_sandbox_with_zygote.patch @@ -22,10 +22,10 @@ However, the patch would need to be reviewed by the security team, as it does touch a security-sensitive class. diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 9d5c6428a0f35d678f8723dd0b959fa34e8fc32c..26a8f384897c2a60f60f441decc3f4f895c9c049 100644 +index a76db23484dabda64b7eaf2e8b6c6f22faf2719f..004bfd9456a1b235fd6d6abcd5d2a7ca5e070807 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -1864,6 +1864,10 @@ bool RenderProcessHostImpl::Init() { +@@ -1870,6 +1870,10 @@ bool RenderProcessHostImpl::Init() { std::unique_ptr<SandboxedProcessLauncherDelegate> sandbox_delegate = std::make_unique<RendererSandboxedProcessLauncherDelegateWin>( *cmd_line, IsPdf(), IsJitDisabled()); diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index bdd029052f25a..d9e705f7860e3 100644 --- a/patches/chromium/web_contents.patch +++ b/patches/chromium/web_contents.patch @@ -9,10 +9,10 @@ is needed for OSR. Originally landed in https://github.com/electron/libchromiumcontent/pull/226. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index b7967a4ab1c9d2c7b2a49a610af10190bcd6e0f0..d6b188a6fd5f3a591b4651db40ca258bb03e7a17 100644 +index 11c0124b6f3f1599b5a56ba7817e946a871316cc..b45610acc74a069c12cec3d0e9e737923ba059b2 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4160,6 +4160,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -4181,6 +4181,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, params.main_frame_name, GetOpener(), primary_main_frame_policy, base::UnguessableToken::Create()); @@ -26,7 +26,7 @@ index b7967a4ab1c9d2c7b2a49a610af10190bcd6e0f0..d6b188a6fd5f3a591b4651db40ca258b std::unique_ptr<WebContentsViewDelegate> delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -4170,6 +4177,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -4191,6 +4198,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, view_ = CreateWebContentsView(this, std::move(delegate), &render_view_host_delegate_view_); } @@ -35,10 +35,10 @@ index b7967a4ab1c9d2c7b2a49a610af10190bcd6e0f0..d6b188a6fd5f3a591b4651db40ca258b CHECK(view_.get()); diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index 37c2351c8a286327e2f6f352e7255e09a5a484dd..780a2d8e05665a6deea26a5e29a392bc058d4202 100644 +index c7efc2aba74899b239140c77126666f571c127c3..e620d4c33e95c247495f3ed78952b8fc365cfb99 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h -@@ -128,11 +128,14 @@ class PrerenderHandle; +@@ -130,11 +130,14 @@ class PrerenderHandle; class RenderFrameHost; class RenderViewHost; class RenderWidgetHost; @@ -52,8 +52,8 @@ index 37c2351c8a286327e2f6f352e7255e09a5a484dd..780a2d8e05665a6deea26a5e29a392bc +class WebContentsView; class WebUI; struct DropData; - struct MHTMLGenerationParams; -@@ -289,6 +292,10 @@ class WebContents : public PageNavigator, public base::SupportsUserData { + struct GlobalRenderFrameHostId; +@@ -292,6 +295,10 @@ class WebContents : public PageNavigator, public base::SupportsUserData { network::mojom::WebSandboxFlags starting_sandbox_flags = network::mojom::WebSandboxFlags::kNone; diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index d4c462237ac46..95e2cd758ccb6 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,10 +15,10 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 73f730ff05a22938a834921d4842bf1f9faaca67..dbd436cafbb0c1d49e76bcd569bca5e04ed89b44 100644 +index ff0406154e44a3b12ec732e836fc1e65dadfd326..8694b6dc3d3afe018830427ce07fe740f0d08e51 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -8929,6 +8929,17 @@ void RenderFrameHostImpl::EnterFullscreen( +@@ -8932,6 +8932,17 @@ void RenderFrameHostImpl::EnterFullscreen( } } @@ -37,10 +37,10 @@ index 73f730ff05a22938a834921d4842bf1f9faaca67..dbd436cafbb0c1d49e76bcd569bca5e0 if (had_fullscreen_token && !GetView()->HasFocus()) GetView()->Focus(); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index d6b188a6fd5f3a591b4651db40ca258bb03e7a17..7f49174c2e0121ddde50250a38b4ac4fcc43d125 100644 +index b45610acc74a069c12cec3d0e9e737923ba059b2..b97e039449bc43233c0388f9ae277341d6fde967 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4443,21 +4443,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( +@@ -4464,21 +4464,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( const input::NativeWebKeyboardEvent& event) { OPTIONAL_TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("content.verbose"), "WebContentsImpl::PreHandleKeyboardEvent"); @@ -80,7 +80,7 @@ index d6b188a6fd5f3a591b4651db40ca258bb03e7a17..7f49174c2e0121ddde50250a38b4ac4f } bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) { -@@ -4616,7 +4620,7 @@ void WebContentsImpl::EnterFullscreenMode( +@@ -4637,7 +4641,7 @@ void WebContentsImpl::EnterFullscreenMode( OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::EnterFullscreenMode"); DCHECK(CanEnterFullscreenMode(requesting_frame)); DCHECK(requesting_frame->IsActive()); @@ -90,7 +90,7 @@ index d6b188a6fd5f3a591b4651db40ca258bb03e7a17..7f49174c2e0121ddde50250a38b4ac4f // inactive when sites request fullscreen via capability delegation, consume // transient activation from a gesture made before another window was focused, diff --git a/third_party/blink/renderer/core/fullscreen/fullscreen.cc b/third_party/blink/renderer/core/fullscreen/fullscreen.cc -index 4bfea29fb8bcdf8af69fa686d1474c3530e2d3f9..d4d5f89452f0199c8833cb5f644fa4e85bec1660 100644 +index 951bbda2e7b4845606899e123a3b12fed80cbb3d..5e3aea39804bd519a26ad9dddfe3a209a2955631 100644 --- a/third_party/blink/renderer/core/fullscreen/fullscreen.cc +++ b/third_party/blink/renderer/core/fullscreen/fullscreen.cc @@ -105,7 +105,6 @@ void FullscreenElementChanged(Document& document, diff --git a/patches/chromium/worker_context_will_destroy.patch b/patches/chromium/worker_context_will_destroy.patch index 669d0e9d3e9a8..cf81e18e91bb4 100644 --- a/patches/chromium/worker_context_will_destroy.patch +++ b/patches/chromium/worker_context_will_destroy.patch @@ -26,10 +26,10 @@ index d794a461eedde1003c72f47af0517249ab20806d..6d2033d2023a7c4c936933a050d2372c // An empty URL is returned if the URL is not overriden. virtual GURL OverrideFlashEmbedWithHTML(const GURL& url); diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index b3fe9e1bfa0976b438ddf8ab0cec6394faca98fd..10c50e675f50025da7dee5f992458605c2b944e6 100644 +index 915bc8e9e05b875b7d86437b9992ca6753b516f5..08c3dda56e706174dab4661d4e7c15350ddfd5cf 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -926,6 +926,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { +@@ -901,6 +901,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread(); } @@ -43,10 +43,10 @@ index b3fe9e1bfa0976b438ddf8ab0cec6394faca98fd..10c50e675f50025da7dee5f992458605 const v8::Local<v8::Context>& worker) { GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h -index 8b684e0e2a43bed314822a4107820aa29eacfae3..8666fbfed28d4138d2c16baebe97912b68481803 100644 +index e5ae92156ff264aed1ba7c6903083fe1dbba5781..4f399015a3290e8b0151f89096c53832553cb9b1 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h -@@ -205,6 +205,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -206,6 +206,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { void DidStartWorkerThread() override; void WillStopWorkerThread() override; void WorkerContextCreated(const v8::Local<v8::Context>& worker) override; @@ -55,10 +55,10 @@ index 8b684e0e2a43bed314822a4107820aa29eacfae3..8666fbfed28d4138d2c16baebe97912b const blink::WebSecurityOrigin& script_origin) override; blink::ProtocolHandlerSecurityLevel GetProtocolHandlerSecurityLevel( diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h -index 2462293cb1099c0edd47134bd835641820cf34b4..d3baf3f488179d82e91d012043d6ccc517a858f5 100644 +index 58a179c48a3fa98d4e7dc2ae5fe37a68ab356989..b8acfdf8859f3ac7672a26e769c4adf7265d8d0a 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -664,6 +664,7 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -672,6 +672,7 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void DidStartWorkerThread() {} virtual void WillStopWorkerThread() {} virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {} diff --git a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch index 7865ef6ca04b1..c25c5692a4857 100644 --- a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch +++ b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch @@ -35,10 +35,10 @@ index 6d2033d2023a7c4c936933a050d2372cf490eb44..79d59c3f4d3d2d5ff39bd65ded489183 // from the worker thread. virtual void WillDestroyWorkerContextOnWorkerThread( diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index 10c50e675f50025da7dee5f992458605c2b944e6..bdba9ca63b81485e21aa1d2bb048c721c7895e47 100644 +index 08c3dda56e706174dab4661d4e7c15350ddfd5cf..3550e6aadd0a279630b83f678e9f1820cde9dafa 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -938,6 +938,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated( +@@ -913,6 +913,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated( worker); } @@ -52,10 +52,10 @@ index 10c50e675f50025da7dee5f992458605c2b944e6..bdba9ca63b81485e21aa1d2bb048c721 const blink::WebSecurityOrigin& script_origin) { return GetContentClient()->renderer()->AllowScriptExtensionForServiceWorker( diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h -index 8666fbfed28d4138d2c16baebe97912b68481803..7f639364ecff5506d414aedf0537d87e54d5fef1 100644 +index 4f399015a3290e8b0151f89096c53832553cb9b1..f4977b8e092bbd6fda87b74c8f53bfc7116ea469 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h -@@ -205,6 +205,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -206,6 +206,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { void DidStartWorkerThread() override; void WillStopWorkerThread() override; void WorkerContextCreated(const v8::Local<v8::Context>& worker) override; @@ -65,10 +65,10 @@ index 8666fbfed28d4138d2c16baebe97912b68481803..7f639364ecff5506d414aedf0537d87e bool AllowScriptExtensionForServiceWorker( const blink::WebSecurityOrigin& script_origin) override; diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h -index d3baf3f488179d82e91d012043d6ccc517a858f5..a3288c6229116ed71f16f9f9cde3a8121a603580 100644 +index b8acfdf8859f3ac7672a26e769c4adf7265d8d0a..feef07df8489e502beb9b80dd8e2fb01468fd708 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -664,6 +664,8 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -672,6 +672,8 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void DidStartWorkerThread() {} virtual void WillStopWorkerThread() {} virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {} diff --git a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch index 219c5bcc94db8..8b96f3e551e09 100644 --- a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch +++ b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch @@ -10,10 +10,10 @@ to handle this without patching, but this is fairly clean for now and no longer patching legacy devtools code. diff --git a/front_end/entrypoints/main/MainImpl.ts b/front_end/entrypoints/main/MainImpl.ts -index c1880f1d379d4999f595f34bdb34695010919a0a..42196f67953736db9e005c041ddf7e65bd98e2ed 100644 +index a8fc444e89afc0ecc169e055ccab117c140d86a1..9fde1c092ff80ce2719ad920e4e885459f7b2e6c 100644 --- a/front_end/entrypoints/main/MainImpl.ts +++ b/front_end/entrypoints/main/MainImpl.ts -@@ -736,6 +736,8 @@ export class MainImpl { +@@ -740,6 +740,8 @@ export class MainImpl { globalThis.Main = globalThis.Main || {}; // @ts-expect-error Exported for Tests.js globalThis.Main.Main = MainImpl; diff --git a/patches/node/.patches b/patches/node/.patches index 9c882f7339bcc..925963526a7ef 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -49,4 +49,4 @@ fix_array_out-of-bounds_read_in_boyer-moore_search.patch chore_add_missing_include_of_iterator.patch test_accomodate_v8_thenable_stack_trace_change_in_snapshot.patch chore_exclude_electron_node_folder_from_exit-time-destructors.patch -reland_api_advance_deprecation_of_getisolate.patch +api_remove_deprecated_getisolate.patch diff --git a/patches/node/api_remove_deprecated_getisolate.patch b/patches/node/api_remove_deprecated_getisolate.patch new file mode 100644 index 0000000000000..54a87160c8be2 --- /dev/null +++ b/patches/node/api_remove_deprecated_getisolate.patch @@ -0,0 +1,908 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: deepak1556 <hop2deep@gmail.com> +Date: Mon, 1 Sep 2025 03:13:53 +0900 +Subject: Remove deprecated `GetIsolate` + +https://chromium-review.googlesource.com/c/v8/v8/+/6905244 + +diff --git a/src/api/environment.cc b/src/api/environment.cc +index 244d747f010c51366e44dec705ae304423038a85..796be2ce65af31af20994cad63a9ec4843caf89a 100644 +--- a/src/api/environment.cc ++++ b/src/api/environment.cc +@@ -620,7 +620,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create( + + MaybeLocal<Object> GetPerContextExports(Local<Context> context, + IsolateData* isolate_data) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + EscapableHandleScope handle_scope(isolate); + + Local<Object> global = context->Global(); +@@ -666,7 +666,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) { + // This runs at runtime, regardless of whether the context + // is created from a snapshot. + Maybe<void> InitializeContextRuntime(Local<Context> context) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + HandleScope handle_scope(isolate); + + // When `IsCodeGenerationFromStringsAllowed` is true, V8 takes the fast path +@@ -745,7 +745,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) { + } + + Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + HandleScope handle_scope(isolate); + + // Delete `Intl.v8BreakIterator` +@@ -770,7 +770,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) { + } + + Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + HandleScope handle_scope(isolate); + + // Initialize the default values. +@@ -788,7 +788,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) { + MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context, + IsolateData* isolate_data) { + CHECK(isolate_data); +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + EscapableHandleScope scope(isolate); + Context::Scope context_scope(context); + +@@ -812,7 +812,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context, + MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context, + IsolateData* isolate_data) { + CHECK(isolate_data); +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + EscapableHandleScope scope(isolate); + Context::Scope context_scope(context); + +@@ -838,7 +838,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context, + Maybe<void> InitializePrimordials(Local<Context> context, + IsolateData* isolate_data) { + // Run per-context JS files. +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + Context::Scope context_scope(context); + Local<Object> exports; + +diff --git a/src/base_object-inl.h b/src/base_object-inl.h +index 6f731b17fe0b84dd3d2c9bc9cfef1f8062a2c5f7..71a1072ed2decbee08d40eda7c47456be5093bc2 100644 +--- a/src/base_object-inl.h ++++ b/src/base_object-inl.h +@@ -55,7 +55,6 @@ v8::Local<v8::Object> BaseObject::object() const { + v8::Local<v8::Object> BaseObject::object(v8::Isolate* isolate) const { + v8::Local<v8::Object> handle = object(); + +- DCHECK_EQ(handle->GetCreationContextChecked()->GetIsolate(), isolate); + DCHECK_EQ(env()->isolate(), isolate); + + return handle; +diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc +index ea5179ad5155cb599891d7421cd61df719ac4cae..ee5380fd055663e5d58491943532ec1dfa11a3c3 100644 +--- a/src/crypto/crypto_context.cc ++++ b/src/crypto/crypto_context.cc +@@ -946,7 +946,7 @@ bool ArrayOfStringsToX509s(Local<Context> context, + Local<Array> cert_array, + std::vector<X509*>* certs) { + ClearErrorOnReturn clear_error_on_return; +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + Environment* env = Environment::GetCurrent(context); + uint32_t array_length = cert_array->Length(); + +diff --git a/src/crypto/crypto_x509.cc b/src/crypto/crypto_x509.cc +index eb6dad44a49d997097c8fb5009eeb60a7305da27..fd29d17de195017970856ce30d7a9c5785b0b8ee 100644 +--- a/src/crypto/crypto_x509.cc ++++ b/src/crypto/crypto_x509.cc +@@ -97,7 +97,7 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, BIOPointer&& bio) { + if (!bio) return {}; + BUF_MEM* mem = bio; + Local<Value> ret; +- if (!String::NewFromUtf8(context->GetIsolate(), ++ if (!String::NewFromUtf8(Isolate::GetCurrent(), + mem->data, + NewStringType::kNormal, + mem->length) +@@ -121,7 +121,7 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, const ASN1_OBJECT* obj) { + } + + Local<Value> result; +- if (!String::NewFromUtf8(context->GetIsolate(), str).ToLocal(&result)) { ++ if (!String::NewFromUtf8(Isolate::GetCurrent(), str).ToLocal(&result)) { + return {}; + } + return result; +@@ -136,12 +136,12 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, const ASN1_STRING* str) { + unsigned char* value_str; + int value_str_size = ASN1_STRING_to_UTF8(&value_str, str); + if (value_str_size < 0) { +- return Undefined(context->GetIsolate()); ++ return Undefined(Isolate::GetCurrent()); + } + DataPointer free_value_str(value_str, value_str_size); + + Local<Value> result; +- if (!String::NewFromUtf8(context->GetIsolate(), ++ if (!String::NewFromUtf8(Isolate::GetCurrent(), + reinterpret_cast<const char*>(value_str), + NewStringType::kNormal, + value_str_size) +@@ -155,7 +155,7 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, const BIOPointer& bio) { + if (!bio) return {}; + BUF_MEM* mem = bio; + Local<Value> ret; +- if (!String::NewFromUtf8(context->GetIsolate(), ++ if (!String::NewFromUtf8(Isolate::GetCurrent(), + mem->data, + NewStringType::kNormal, + mem->length) +diff --git a/src/encoding_binding.cc b/src/encoding_binding.cc +index 31ed995714bb99ab534f26ba9ebc6051c258a1c9..5ace688bb7ffc86eedf5aff11ab0ab487ad9440e 100644 +--- a/src/encoding_binding.cc ++++ b/src/encoding_binding.cc +@@ -73,7 +73,7 @@ void BindingData::Deserialize(Local<Context> context, + int index, + InternalFieldInfoBase* info) { + DCHECK_IS_SNAPSHOT_SLOT(index); +- v8::HandleScope scope(context->GetIsolate()); ++ v8::HandleScope scope(Isolate::GetCurrent()); + Realm* realm = Realm::GetCurrent(context); + // Recreate the buffer in the constructor. + InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info); +diff --git a/src/env.cc b/src/env.cc +index 8cdfbac602796cabbd8a2f673385b93bea9bd7cc..a0097a4af25f760ba4b31865d9a800d1974a454c 100644 +--- a/src/env.cc ++++ b/src/env.cc +@@ -1744,10 +1744,10 @@ void AsyncHooks::Deserialize(Local<Context> context) { + context->GetDataFromSnapshotOnce<Array>( + info_->js_execution_async_resources).ToLocalChecked(); + } else { +- js_execution_async_resources = Array::New(context->GetIsolate()); ++ js_execution_async_resources = Array::New(Isolate::GetCurrent()); + } + js_execution_async_resources_.Reset( +- context->GetIsolate(), js_execution_async_resources); ++ Isolate::GetCurrent(), js_execution_async_resources); + + // The native_execution_async_resources_ field requires v8::Local<> instances + // for async calls whose resources were on the stack as JS objects when they +@@ -1787,7 +1787,7 @@ AsyncHooks::SerializeInfo AsyncHooks::Serialize(Local<Context> context, + info.async_id_fields = async_id_fields_.Serialize(context, creator); + if (!js_execution_async_resources_.IsEmpty()) { + info.js_execution_async_resources = creator->AddData( +- context, js_execution_async_resources_.Get(context->GetIsolate())); ++ context, js_execution_async_resources_.Get(Isolate::GetCurrent())); + CHECK_NE(info.js_execution_async_resources, 0); + } else { + info.js_execution_async_resources = 0; +diff --git a/src/inspector/network_agent.cc b/src/inspector/network_agent.cc +index 3b5d9615021101ad03d9dfef83e0c56b462b59ad..823e7b8d3d07eb2afa1cc62d3d9e2af20f4e2e89 100644 +--- a/src/inspector/network_agent.cc ++++ b/src/inspector/network_agent.cc +@@ -29,31 +29,31 @@ using v8::Value; + Maybe<protocol::String> ObjectGetProtocolString(v8::Local<v8::Context> context, + Local<Object> object, + Local<v8::String> property) { +- HandleScope handle_scope(context->GetIsolate()); ++ HandleScope handle_scope(v8::Isolate::GetCurrent()); + Local<Value> value; + if (!object->Get(context, property).ToLocal(&value) || !value->IsString()) { + return Nothing<protocol::String>(); + } + Local<v8::String> str = value.As<v8::String>(); +- return Just(ToProtocolString(context->GetIsolate(), str)); ++ return Just(ToProtocolString(v8::Isolate::GetCurrent(), str)); + } + + // Get a protocol string property from the object. + Maybe<protocol::String> ObjectGetProtocolString(v8::Local<v8::Context> context, + Local<Object> object, + const char* property) { +- HandleScope handle_scope(context->GetIsolate()); ++ HandleScope handle_scope(v8::Isolate::GetCurrent()); + return ObjectGetProtocolString( +- context, object, OneByteString(context->GetIsolate(), property)); ++ context, object, OneByteString(v8::Isolate::GetCurrent(), property)); + } + + // Get a protocol double property from the object. + Maybe<double> ObjectGetDouble(v8::Local<v8::Context> context, + Local<Object> object, + const char* property) { +- HandleScope handle_scope(context->GetIsolate()); ++ HandleScope handle_scope(v8::Isolate::GetCurrent()); + Local<Value> value; +- if (!object->Get(context, OneByteString(context->GetIsolate(), property)) ++ if (!object->Get(context, OneByteString(v8::Isolate::GetCurrent(), property)) + .ToLocal(&value) || + !value->IsNumber()) { + return Nothing<double>(); +@@ -65,9 +65,9 @@ Maybe<double> ObjectGetDouble(v8::Local<v8::Context> context, + Maybe<int> ObjectGetInt(v8::Local<v8::Context> context, + Local<Object> object, + const char* property) { +- HandleScope handle_scope(context->GetIsolate()); ++ HandleScope handle_scope(v8::Isolate::GetCurrent()); + Local<Value> value; +- if (!object->Get(context, OneByteString(context->GetIsolate(), property)) ++ if (!object->Get(context, OneByteString(v8::Isolate::GetCurrent(), property)) + .ToLocal(&value) || + !value->IsInt32()) { + return Nothing<int>(); +@@ -79,9 +79,9 @@ Maybe<int> ObjectGetInt(v8::Local<v8::Context> context, + Maybe<bool> ObjectGetBool(v8::Local<v8::Context> context, + Local<Object> object, + const char* property) { +- HandleScope handle_scope(context->GetIsolate()); ++ HandleScope handle_scope(v8::Isolate::GetCurrent()); + Local<Value> value; +- if (!object->Get(context, OneByteString(context->GetIsolate(), property)) ++ if (!object->Get(context, OneByteString(v8::Isolate::GetCurrent(), property)) + .ToLocal(&value) || + !value->IsBoolean()) { + return Nothing<bool>(); +@@ -93,9 +93,9 @@ Maybe<bool> ObjectGetBool(v8::Local<v8::Context> context, + MaybeLocal<v8::Object> ObjectGetObject(v8::Local<v8::Context> context, + Local<Object> object, + const char* property) { +- EscapableHandleScope handle_scope(context->GetIsolate()); ++ EscapableHandleScope handle_scope(v8::Isolate::GetCurrent()); + Local<Value> value; +- if (!object->Get(context, OneByteString(context->GetIsolate(), property)) ++ if (!object->Get(context, OneByteString(v8::Isolate::GetCurrent(), property)) + .ToLocal(&value) || + !value->IsObject()) { + return {}; +@@ -106,7 +106,7 @@ MaybeLocal<v8::Object> ObjectGetObject(v8::Local<v8::Context> context, + // Create a protocol::Network::Headers from the v8 object. + std::unique_ptr<protocol::Network::Headers> createHeadersFromObject( + v8::Local<v8::Context> context, Local<Object> headers_obj) { +- HandleScope handle_scope(context->GetIsolate()); ++ HandleScope handle_scope(v8::Isolate::GetCurrent()); + + std::unique_ptr<protocol::DictionaryValue> dict = + protocol::DictionaryValue::create(); +@@ -127,7 +127,7 @@ std::unique_ptr<protocol::Network::Headers> createHeadersFromObject( + .To(&property_value)) { + return {}; + } +- dict->setString(ToProtocolString(context->GetIsolate(), property_name), ++ dict->setString(ToProtocolString(v8::Isolate::GetCurrent(), property_name), + property_value); + } + +@@ -137,7 +137,7 @@ std::unique_ptr<protocol::Network::Headers> createHeadersFromObject( + // Create a protocol::Network::Request from the v8 object. + std::unique_ptr<protocol::Network::Request> createRequestFromObject( + v8::Local<v8::Context> context, Local<Object> request) { +- HandleScope handle_scope(context->GetIsolate()); ++ HandleScope handle_scope(v8::Isolate::GetCurrent()); + protocol::String url; + if (!ObjectGetProtocolString(context, request, "url").To(&url)) { + return {}; +@@ -169,7 +169,7 @@ std::unique_ptr<protocol::Network::Request> createRequestFromObject( + // Create a protocol::Network::Response from the v8 object. + std::unique_ptr<protocol::Network::Response> createResponseFromObject( + v8::Local<v8::Context> context, Local<Object> response) { +- HandleScope handle_scope(context->GetIsolate()); ++ HandleScope handle_scope(v8::Isolate::GetCurrent()); + protocol::String url; + if (!ObjectGetProtocolString(context, response, "url").To(&url)) { + return {}; +diff --git a/src/js_native_api_v8.h b/src/js_native_api_v8.h +index 27aeac589b19cd681923fb848ce5f36c66fc05e2..5f2900869763f40cac54e3cb3fe2e24eda615410 100644 +--- a/src/js_native_api_v8.h ++++ b/src/js_native_api_v8.h +@@ -53,7 +53,7 @@ class RefTracker { + struct napi_env__ { + explicit napi_env__(v8::Local<v8::Context> context, + int32_t module_api_version) +- : isolate(context->GetIsolate()), ++ : isolate(v8::Isolate::GetCurrent()), + context_persistent(isolate, context), + module_api_version(module_api_version) { + napi_clear_last_error(this); +diff --git a/src/module_wrap.cc b/src/module_wrap.cc +index e3880111172363feafb53b51deb08c93596cd4f4..6ab85bb74d708037274e08df343559a37db384dc 100644 +--- a/src/module_wrap.cc ++++ b/src/module_wrap.cc +@@ -859,7 +859,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback( + Local<String> specifier, + Local<FixedArray> import_attributes, + Local<Module> referrer) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + Environment* env = Environment::GetCurrent(context); + if (env == nullptr) { + THROW_ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE(isolate); +@@ -901,7 +901,7 @@ MaybeLocal<Promise> ImportModuleDynamically( + Local<Value> resource_name, + Local<String> specifier, + Local<FixedArray> import_attributes) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + Environment* env = Environment::GetCurrent(context); + if (env == nullptr) { + THROW_ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE(isolate); +@@ -1125,7 +1125,7 @@ MaybeLocal<Module> LinkRequireFacadeWithOriginal( + Local<FixedArray> import_attributes, + Local<Module> referrer) { + Environment* env = Environment::GetCurrent(context); +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + CHECK(specifier->Equals(context, env->original_string()).ToChecked()); + CHECK(!env->temporary_required_module_facade_original.IsEmpty()); + return env->temporary_required_module_facade_original.Get(isolate); +diff --git a/src/node.h b/src/node.h +index 4335c7cf53b7e08c95dcee3461384ac12c8ebe41..16ba26ff9babd719b6807bc01339183866c8cf33 100644 +--- a/src/node.h ++++ b/src/node.h +@@ -1034,7 +1034,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly", + + #define NODE_DEFINE_CONSTANT(target, constant) \ + do { \ +- v8::Isolate* isolate = target->GetIsolate(); \ ++ v8::Isolate* isolate = v8::Isolate::GetCurrent(); \ + v8::Local<v8::Context> context = isolate->GetCurrentContext(); \ + v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \ + isolate, #constant, v8::NewStringType::kInternalized); \ +@@ -1050,7 +1050,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly", + + #define NODE_DEFINE_HIDDEN_CONSTANT(target, constant) \ + do { \ +- v8::Isolate* isolate = target->GetIsolate(); \ ++ v8::Isolate* isolate = v8::Isolate::GetCurrent(); \ + v8::Local<v8::Context> context = isolate->GetCurrentContext(); \ + v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \ + isolate, #constant, v8::NewStringType::kInternalized); \ +diff --git a/src/node_blob.cc b/src/node_blob.cc +index 9b9956f5ee3150a80f040cd0dbb9ef6589295600..14de0dad25fbf854ea23eb25abd6f9f2179e0dad 100644 +--- a/src/node_blob.cc ++++ b/src/node_blob.cc +@@ -554,7 +554,7 @@ void BlobBindingData::Deserialize(Local<Context> context, + int index, + InternalFieldInfoBase* info) { + DCHECK_IS_SNAPSHOT_SLOT(index); +- HandleScope scope(context->GetIsolate()); ++ HandleScope scope(Isolate::GetCurrent()); + Realm* realm = Realm::GetCurrent(context); + BlobBindingData* binding = realm->AddBindingData<BlobBindingData>(holder); + CHECK_NOT_NULL(binding); +diff --git a/src/node_builtins.cc b/src/node_builtins.cc +index 557972987abeaa56918362638a17a9b6e0763238..b639f788981c5503c22c471eefd225c26a79c3f8 100644 +--- a/src/node_builtins.cc ++++ b/src/node_builtins.cc +@@ -275,7 +275,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal( + const char* id, + LocalVector<String>* parameters, + Realm* optional_realm) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + EscapableHandleScope scope(isolate); + + Local<String> source; +@@ -397,7 +397,7 @@ void BuiltinLoader::SaveCodeCache(const char* id, Local<Function> fun) { + MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context, + const char* id, + Realm* optional_realm) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + LocalVector<String> parameters(isolate); + // Detects parameters of the scripts based on module ids. + // internal/bootstrap/realm: process, getLinkedBinding, +@@ -451,7 +451,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context, + MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context, + const char* id, + Realm* realm) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + // Detects parameters of the scripts based on module ids. + // internal/bootstrap/realm: process, getLinkedBinding, + // getInternalBinding, primordials +@@ -507,7 +507,7 @@ MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context, + if (!maybe_fn.ToLocal(&fn)) { + return MaybeLocal<Value>(); + } +- Local<Value> undefined = Undefined(context->GetIsolate()); ++ Local<Value> undefined = Undefined(Isolate::GetCurrent()); + return fn->Call(context, undefined, argc, argv); + } + +@@ -546,14 +546,14 @@ bool BuiltinLoader::CompileAllBuiltinsAndCopyCodeCache( + to_eager_compile_.emplace(id); + } + +- v8::TryCatch bootstrapCatch(context->GetIsolate()); ++ v8::TryCatch bootstrapCatch(Isolate::GetCurrent()); + auto fn = LookupAndCompile(context, id.data(), nullptr); + if (bootstrapCatch.HasCaught()) { + per_process::Debug(DebugCategory::CODE_CACHE, + "Failed to compile code cache for %s\n", + id.data()); + all_succeeded = false; +- PrintCaughtException(context->GetIsolate(), context, bootstrapCatch); ++ PrintCaughtException(Isolate::GetCurrent(), context, bootstrapCatch); + } else { + // This is used by the snapshot builder, so save the code cache + // unconditionally. +diff --git a/src/node_constants.cc b/src/node_constants.cc +index d193725ea9a3270ed9affea12d11467fb14efdf8..24364b7458c822ff84ac9123843aea1f01d84bc0 100644 +--- a/src/node_constants.cc ++++ b/src/node_constants.cc +@@ -1268,7 +1268,7 @@ void CreatePerContextProperties(Local<Object> target, + Local<Value> unused, + Local<Context> context, + void* priv) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + Environment* env = Environment::GetCurrent(context); + + CHECK(target->SetPrototype(env->context(), Null(env->isolate())).FromJust()); +diff --git a/src/node_contextify.cc b/src/node_contextify.cc +index 386102dfe7e4d9136f47058b03f3702126cd5063..7f4917c3bb73bb333ba85ae11a4be6e6968a7e36 100644 +--- a/src/node_contextify.cc ++++ b/src/node_contextify.cc +@@ -111,7 +111,7 @@ namespace { + + // Convert an int to a V8 Name (String or Symbol). + MaybeLocal<String> Uint32ToName(Local<Context> context, uint32_t index) { +- return Uint32::New(context->GetIsolate(), index)->ToString(context); ++ return Uint32::New(Isolate::GetCurrent(), index)->ToString(context); + } + + } // anonymous namespace +@@ -682,7 +682,7 @@ Intercepted ContextifyContext::PropertyDefinerCallback( + } + + Local<Context> context = ctx->context(); +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + + PropertyAttribute attributes = PropertyAttribute::None; + bool is_declared = +@@ -1651,7 +1651,7 @@ static MaybeLocal<Function> CompileFunctionForCJSLoader( + bool* cache_rejected, + bool is_cjs_scope, + ScriptCompiler::CachedData* cached_data) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + EscapableHandleScope scope(isolate); + + Local<Symbol> symbol = env->vm_dynamic_import_default_internal(); +diff --git a/src/node_env_var.cc b/src/node_env_var.cc +index 492d5f455f45a5c8a957ecdabed38709a633f640..48f9917113555c7ed87e37750c45d152fa4b68f8 100644 +--- a/src/node_env_var.cc ++++ b/src/node_env_var.cc +@@ -295,7 +295,7 @@ std::shared_ptr<KVStore> KVStore::CreateMapKVStore() { + + Maybe<void> KVStore::AssignFromObject(Local<Context> context, + Local<Object> entries) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + HandleScope handle_scope(isolate); + Local<Array> keys; + if (!entries->GetOwnPropertyNames(context).ToLocal(&keys)) +diff --git a/src/node_errors.cc b/src/node_errors.cc +index befb642f1effa3c4139e4cd99ff64d9c5175fd72..9c068afd1c4c3fadeee4ba035e67ec4ae72c7f73 100644 +--- a/src/node_errors.cc ++++ b/src/node_errors.cc +@@ -633,7 +633,7 @@ v8::ModifyCodeGenerationFromStringsResult ModifyCodeGenerationFromStrings( + v8::Local<v8::Context> context, + v8::Local<v8::Value> source, + bool is_code_like) { +- HandleScope scope(context->GetIsolate()); ++ HandleScope scope(Isolate::GetCurrent()); + + if (context->GetNumberOfEmbedderDataFields() <= + ContextEmbedderIndex::kAllowCodeGenerationFromStrings) { +@@ -1000,7 +1000,7 @@ const char* errno_string(int errorno) { + } + + void PerIsolateMessageListener(Local<Message> message, Local<Value> error) { +- Isolate* isolate = message->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + switch (message->ErrorLevel()) { + case Isolate::MessageErrorLevel::kMessageWarning: { + Environment* env = Environment::GetCurrent(isolate); +@@ -1118,7 +1118,7 @@ void Initialize(Local<Object> target, + SetMethod( + context, target, "triggerUncaughtException", TriggerUncaughtException); + +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + Local<Object> exit_codes = Object::New(isolate); + READONLY_PROPERTY(target, "exitCodes", exit_codes); + +diff --git a/src/node_file.cc b/src/node_file.cc +index 7221708a2296ff44c19ed01dc52d78653ecc4e58..e9ddf73af28a62245291d9d1eb452eeb39312dff 100644 +--- a/src/node_file.cc ++++ b/src/node_file.cc +@@ -3755,7 +3755,7 @@ void BindingData::Deserialize(Local<Context> context, + int index, + InternalFieldInfoBase* info) { + DCHECK_IS_SNAPSHOT_SLOT(index); +- HandleScope scope(context->GetIsolate()); ++ HandleScope scope(Isolate::GetCurrent()); + Realm* realm = Realm::GetCurrent(context); + InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info); + BindingData* binding = +diff --git a/src/node_messaging.cc b/src/node_messaging.cc +index 66c8868b9d8e69812464ca9eca53434321f8ec4a..0146a0ee909d570e840e8ae7dc448bcd1c6b31e4 100644 +--- a/src/node_messaging.cc ++++ b/src/node_messaging.cc +@@ -253,7 +253,7 @@ namespace { + + MaybeLocal<Function> GetEmitMessageFunction(Local<Context> context, + IsolateData* isolate_data) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + Local<Object> per_context_bindings; + Local<Value> emit_message_val; + if (!GetPerContextExports(context, isolate_data) +@@ -268,7 +268,7 @@ MaybeLocal<Function> GetEmitMessageFunction(Local<Context> context, + } + + MaybeLocal<Function> GetDOMException(Local<Context> context) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + Local<Object> per_context_bindings; + Local<Value> domexception_ctor_val; + if (!GetPerContextExports(context).ToLocal(&per_context_bindings) || +@@ -283,7 +283,7 @@ MaybeLocal<Function> GetDOMException(Local<Context> context) { + } + + void ThrowDataCloneException(Local<Context> context, Local<String> message) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + Local<Value> argv[] = {message, + FIXED_ONE_BYTE_STRING(isolate, "DataCloneError")}; + Local<Value> exception; +@@ -1465,7 +1465,7 @@ BaseObjectPtr<BaseObject> JSTransferable::Data::Deserialize( + + Maybe<bool> JSTransferable::Data::FinalizeTransferWrite( + Local<Context> context, ValueSerializer* serializer) { +- HandleScope handle_scope(context->GetIsolate()); ++ HandleScope handle_scope(Isolate::GetCurrent()); + auto ret = serializer->WriteValue(context, PersistentToLocal::Strong(data_)); + data_.Reset(); + return ret; +diff --git a/src/node_modules.cc b/src/node_modules.cc +index 6204986dc97686a248d6ae483f3a413ee5c51e47..c0108310df81c9bd1756a6fb92466a7f84e53f7c 100644 +--- a/src/node_modules.cc ++++ b/src/node_modules.cc +@@ -64,7 +64,7 @@ void BindingData::Deserialize(v8::Local<v8::Context> context, + int index, + InternalFieldInfoBase* info) { + DCHECK_IS_SNAPSHOT_SLOT(index); +- HandleScope scope(context->GetIsolate()); ++ HandleScope scope(Isolate::GetCurrent()); + Realm* realm = Realm::GetCurrent(context); + BindingData* binding = realm->AddBindingData<BindingData>(holder); + CHECK_NOT_NULL(binding); +@@ -706,7 +706,7 @@ void BindingData::CreatePerContextProperties(Local<Object> target, + Realm* realm = Realm::GetCurrent(context); + realm->AddBindingData<BindingData>(target); + +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + LocalVector<Value> compile_cache_status_values(isolate); + + #define V(status) \ +diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc +index 1cb08b715865f8337e0292fc8e2a26488ba21694..2bd20fc173d4110282ee736e49b49ce0859088f3 100644 +--- a/src/node_process_methods.cc ++++ b/src/node_process_methods.cc +@@ -736,7 +736,7 @@ void BindingData::Deserialize(Local<Context> context, + int index, + InternalFieldInfoBase* info) { + DCHECK_IS_SNAPSHOT_SLOT(index); +- v8::HandleScope scope(context->GetIsolate()); ++ v8::HandleScope scope(Isolate::GetCurrent()); + Realm* realm = Realm::GetCurrent(context); + // Recreate the buffer in the constructor. + InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info); +diff --git a/src/node_realm.cc b/src/node_realm.cc +index e87c6e2da4936827a8426a4d09589afa261c8cba..dabb8836add263088a919a6a3529c9aca47f1ef9 100644 +--- a/src/node_realm.cc ++++ b/src/node_realm.cc +@@ -19,7 +19,7 @@ using v8::String; + using v8::Value; + + Realm::Realm(Environment* env, v8::Local<v8::Context> context, Kind kind) +- : env_(env), isolate_(context->GetIsolate()), kind_(kind) { ++ : env_(env), isolate_(v8::Isolate::GetCurrent()), kind_(kind) { + context_.Reset(isolate_, context); + env->AssignToContext(context, this, ContextInfo("")); + } +diff --git a/src/node_report.cc b/src/node_report.cc +index da7b846d555ba63c30b5700c081ee38685dcaa83..53ac70f319796efafaeea9b4bd314b2f4de3cb06 100644 +--- a/src/node_report.cc ++++ b/src/node_report.cc +@@ -399,7 +399,7 @@ static void PrintJavaScriptErrorProperties(JSONWriter* writer, + if (!error.IsEmpty() && error->IsObject()) { + TryCatch try_catch(isolate); + Local<Object> error_obj = error.As<Object>(); +- Local<Context> context = error_obj->GetIsolate()->GetCurrentContext(); ++ Local<Context> context = Isolate::GetCurrent()->GetCurrentContext(); + Local<Array> keys; + if (!error_obj->GetOwnPropertyNames(context).ToLocal(&keys)) { + return writer->json_objectend(); // the end of 'errorProperties' +diff --git a/src/node_snapshotable.cc b/src/node_snapshotable.cc +index a500204c4768e26a4d2476e7b99e173389e8e1ef..949201e7ddce501b7135fb1c4a907e3ad3ab1146 100644 +--- a/src/node_snapshotable.cc ++++ b/src/node_snapshotable.cc +@@ -1584,7 +1584,7 @@ void BindingData::Deserialize(Local<Context> context, + int index, + InternalFieldInfoBase* info) { + DCHECK_IS_SNAPSHOT_SLOT(index); +- v8::HandleScope scope(context->GetIsolate()); ++ v8::HandleScope scope(Isolate::GetCurrent()); + Realm* realm = Realm::GetCurrent(context); + // Recreate the buffer in the constructor. + InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info); +diff --git a/src/node_sqlite.cc b/src/node_sqlite.cc +index f5704bc13d415853316d72661e9d5584c2432b9f..62f280c1e0e860ae3a3c8b48eda31a3cc8f0c216 100644 +--- a/src/node_sqlite.cc ++++ b/src/node_sqlite.cc +@@ -1856,7 +1856,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) { + + if (args[0]->IsObject() && !args[0]->IsArrayBufferView()) { + Local<Object> obj = args[0].As<Object>(); +- Local<Context> context = obj->GetIsolate()->GetCurrentContext(); ++ Local<Context> context = Isolate::GetCurrent()->GetCurrentContext(); + Local<Array> keys; + if (!obj->GetOwnPropertyNames(context).ToLocal(&keys)) { + return false; +diff --git a/src/node_task_queue.cc b/src/node_task_queue.cc +index 0a5aba6e31fa799a77267aa81d8324f8a5ea6f05..794c802ec09f5e20176816fcdde7152eb24ac27b 100644 +--- a/src/node_task_queue.cc ++++ b/src/node_task_queue.cc +@@ -48,7 +48,7 @@ void PromiseRejectCallback(PromiseRejectMessage message) { + static std::atomic<uint64_t> rejectionsHandledAfter{0}; + + Local<Promise> promise = message.GetPromise(); +- Isolate* isolate = promise->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + PromiseRejectEvent event = message.GetEvent(); + + Environment* env = Environment::GetCurrent(isolate); +diff --git a/src/node_url.cc b/src/node_url.cc +index 09589e85e8bc131811204833d9a76f98c7b2a102..1154b452151b6b597aed67effbb3796c635d236b 100644 +--- a/src/node_url.cc ++++ b/src/node_url.cc +@@ -69,7 +69,7 @@ void BindingData::Deserialize(Local<Context> context, + int index, + InternalFieldInfoBase* info) { + DCHECK_IS_SNAPSHOT_SLOT(index); +- HandleScope scope(context->GetIsolate()); ++ HandleScope scope(Isolate::GetCurrent()); + Realm* realm = Realm::GetCurrent(context); + BindingData* binding = realm->AddBindingData<BindingData>(holder); + CHECK_NOT_NULL(binding); +diff --git a/src/node_v8.cc b/src/node_v8.cc +index 430d5dd4f808af7b1790bd62f06d47b86100d4e9..08a741216d88c95d580e9281e174550001ff2b21 100644 +--- a/src/node_v8.cc ++++ b/src/node_v8.cc +@@ -157,7 +157,7 @@ void BindingData::Deserialize(Local<Context> context, + int index, + InternalFieldInfoBase* info) { + DCHECK_IS_SNAPSHOT_SLOT(index); +- HandleScope scope(context->GetIsolate()); ++ HandleScope scope(Isolate::GetCurrent()); + Realm* realm = Realm::GetCurrent(context); + // Recreate the buffer in the constructor. + InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info); +diff --git a/src/node_wasi.cc b/src/node_wasi.cc +index 3f91b651b83a20e70d5b368e012f5ee4b9d16092..40c601acd752b559f7ffbc00c15728fbb5275ac5 100644 +--- a/src/node_wasi.cc ++++ b/src/node_wasi.cc +@@ -49,7 +49,7 @@ using v8::WasmMemoryObject; + static MaybeLocal<Value> WASIException(Local<Context> context, + int errorno, + const char* syscall) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + Environment* env = Environment::GetCurrent(context); + CHECK_NOT_NULL(env); + const char* err_name = uvwasi_embedder_err_code_to_string(errorno); +@@ -275,7 +275,7 @@ R WASI::WasiFunction<FT, F, R, Args...>::FastCallback( + return EinvalError<R>(); + } + +- v8::Isolate* isolate = receiver->GetIsolate(); ++ v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::HandleScope handle_scope(isolate); + if (wasi->memory_.IsEmpty()) { + THROW_ERR_WASI_NOT_STARTED(isolate); +diff --git a/src/node_webstorage.cc b/src/node_webstorage.cc +index 74ece724e207a69e2457598a199c12f1cebcfd4a..1705e430099c5a363e02010f83d729b0aa54f8e5 100644 +--- a/src/node_webstorage.cc ++++ b/src/node_webstorage.cc +@@ -58,7 +58,7 @@ using v8::Value; + } while (0) + + static void ThrowQuotaExceededException(Local<Context> context) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + auto dom_exception_str = FIXED_ONE_BYTE_STRING(isolate, "DOMException"); + auto err_name = FIXED_ONE_BYTE_STRING(isolate, "QuotaExceededError"); + auto err_message = +@@ -434,7 +434,7 @@ Maybe<void> Storage::Store(Local<Name> key, Local<Value> value) { + } + + static MaybeLocal<String> Uint32ToName(Local<Context> context, uint32_t index) { +- return Uint32::New(context->GetIsolate(), index)->ToString(context); ++ return Uint32::New(Isolate::GetCurrent(), index)->ToString(context); + } + + static void Clear(const FunctionCallbackInfo<Value>& info) { +diff --git a/src/node_worker.cc b/src/node_worker.cc +index 6c43928ba5a9752c78544d1c77198278eb11ccd7..d1faec81602bbe41c1239b8abb82b592821b4fa4 100644 +--- a/src/node_worker.cc ++++ b/src/node_worker.cc +@@ -1149,8 +1149,6 @@ void GetEnvMessagePort(const FunctionCallbackInfo<Value>& args) { + Local<Object> port = env->message_port(); + CHECK_IMPLIES(!env->is_main_thread(), !port.IsEmpty()); + if (!port.IsEmpty()) { +- CHECK_EQ(port->GetCreationContextChecked()->GetIsolate(), +- args.GetIsolate()); + args.GetReturnValue().Set(port); + } + } +diff --git a/src/timers.cc b/src/timers.cc +index bf90e68479da141265f748775acacab513b8d437..5f0d07b4ac1d9b8df6c8bb059e5d07ac1a882b36 100644 +--- a/src/timers.cc ++++ b/src/timers.cc +@@ -117,7 +117,7 @@ void BindingData::Deserialize(Local<Context> context, + int index, + InternalFieldInfoBase* info) { + DCHECK_IS_SNAPSHOT_SLOT(index); +- v8::HandleScope scope(context->GetIsolate()); ++ v8::HandleScope scope(Isolate::GetCurrent()); + Realm* realm = Realm::GetCurrent(context); + // Recreate the buffer in the constructor. + BindingData* binding = realm->AddBindingData<BindingData>(holder); +diff --git a/src/util-inl.h b/src/util-inl.h +index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330cb47c1a7 100644 +--- a/src/util-inl.h ++++ b/src/util-inl.h +@@ -326,14 +326,14 @@ v8::Maybe<void> FromV8Array(v8::Local<v8::Context> context, + std::vector<v8::Global<v8::Value>>* out) { + uint32_t count = js_array->Length(); + out->reserve(count); +- ArrayIterationData data{out, context->GetIsolate()}; ++ ArrayIterationData data{out, v8::Isolate::GetCurrent()}; + return js_array->Iterate(context, PushItemToVector, &data); + } + + v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, + std::string_view str, + v8::Isolate* isolate) { +- if (isolate == nullptr) isolate = context->GetIsolate(); ++ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); + if (str.size() >= static_cast<size_t>(v8::String::kMaxLength)) [[unlikely]] { + // V8 only has a TODO comment about adding an exception when the maximum + // string size is exceeded. +@@ -349,7 +349,7 @@ v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, + v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, + v8_inspector::StringView str, + v8::Isolate* isolate) { +- if (isolate == nullptr) isolate = context->GetIsolate(); ++ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); + if (str.length() >= static_cast<size_t>(v8::String::kMaxLength)) + [[unlikely]] { + // V8 only has a TODO comment about adding an exception when the maximum +@@ -376,7 +376,7 @@ template <typename T> + v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, + const std::vector<T>& vec, + v8::Isolate* isolate) { +- if (isolate == nullptr) isolate = context->GetIsolate(); ++ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope handle_scope(isolate); + + MaybeStackBuffer<v8::Local<v8::Value>, 128> arr(vec.size()); +@@ -393,7 +393,7 @@ template <typename T> + v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, + const std::set<T>& set, + v8::Isolate* isolate) { +- if (isolate == nullptr) isolate = context->GetIsolate(); ++ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); + v8::Local<v8::Set> set_js = v8::Set::New(isolate); + v8::HandleScope handle_scope(isolate); + +@@ -412,7 +412,7 @@ template <typename T, typename U> + v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, + const std::unordered_map<T, U>& map, + v8::Isolate* isolate) { +- if (isolate == nullptr) isolate = context->GetIsolate(); ++ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope handle_scope(isolate); + + v8::Local<v8::Map> ret = v8::Map::New(isolate); +@@ -455,7 +455,7 @@ template <typename T, typename> + v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, + const T& number, + v8::Isolate* isolate) { +- if (isolate == nullptr) isolate = context->GetIsolate(); ++ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); + return ConvertNumberToV8Value(isolate, number); + } + +@@ -468,7 +468,7 @@ v8::Local<v8::Array> ToV8ValuePrimitiveArray(v8::Local<v8::Context> context, + std::is_floating_point_v<T>, + "Only primitive types (bool, integral, floating-point) are supported."); + +- if (isolate == nullptr) isolate = context->GetIsolate(); ++ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope handle_scope(isolate); + + v8::LocalVector<v8::Value> elements(isolate); +diff --git a/src/util.cc b/src/util.cc +index 5ca32f026f9f001ddadc14965705fe005600eddd..1b38f22b930b77d80aa53f9b12299d3cc469a46d 100644 +--- a/src/util.cc ++++ b/src/util.cc +@@ -393,7 +393,7 @@ void SetMethod(Local<v8::Context> context, + Local<v8::Object> that, + const std::string_view name, + v8::FunctionCallback callback) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + Local<v8::Function> function = + NewFunctionTemplate(isolate, + callback, +@@ -454,7 +454,7 @@ void SetFastMethod(Local<v8::Context> context, + const std::string_view name, + v8::FunctionCallback slow_callback, + const v8::CFunction* c_function) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + Local<v8::Function> function = + NewFunctionTemplate(isolate, + slow_callback, +@@ -476,7 +476,7 @@ void SetFastMethodNoSideEffect(Local<v8::Context> context, + const std::string_view name, + v8::FunctionCallback slow_callback, + const v8::CFunction* c_function) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + Local<v8::Function> function = + NewFunctionTemplate(isolate, + slow_callback, +@@ -564,7 +564,7 @@ void SetMethodNoSideEffect(Local<v8::Context> context, + Local<v8::Object> that, + const std::string_view name, + v8::FunctionCallback callback) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + Local<v8::Function> function = + NewFunctionTemplate(isolate, + callback, +@@ -665,7 +665,7 @@ void SetConstructorFunction(Local<v8::Context> context, + const char* name, + Local<v8::FunctionTemplate> tmpl, + SetConstructorFunctionFlag flag) { +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + SetConstructorFunction( + context, that, OneByteString(isolate, name), tmpl, flag); + } +diff --git a/src/util.h b/src/util.h +index efeb12d837db7b88093e4a6a2e20df562180ca1e..2631765cb7fded77d70ac3012d63867deb6f2be7 100644 +--- a/src/util.h ++++ b/src/util.h +@@ -752,7 +752,7 @@ inline v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, + // Variation on NODE_DEFINE_CONSTANT that sets a String value. + #define NODE_DEFINE_STRING_CONSTANT(target, name, constant) \ + do { \ +- v8::Isolate* isolate = target->GetIsolate(); \ ++ v8::Isolate* isolate = v8::Isolate::GetCurrent(); \ + v8::Local<v8::String> constant_name = \ + v8::String::NewFromUtf8(isolate, name).ToLocalChecked(); \ + v8::Local<v8::String> constant_value = \ diff --git a/patches/node/reland_api_advance_deprecation_of_getisolate.patch b/patches/node/reland_api_advance_deprecation_of_getisolate.patch deleted file mode 100644 index d4685058fa499..0000000000000 --- a/patches/node/reland_api_advance_deprecation_of_getisolate.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: deepak1556 <hop2deep@gmail.com> -Date: Mon, 1 Sep 2025 03:13:53 +0900 -Subject: Reland "[api] Advance deprecation of GetIsolate" - -https://chromium-review.googlesource.com/c/v8/v8/+/6875273 - -diff --git a/src/util-inl.h b/src/util-inl.h -index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330cb47c1a7 100644 ---- a/src/util-inl.h -+++ b/src/util-inl.h -@@ -326,14 +326,14 @@ v8::Maybe<void> FromV8Array(v8::Local<v8::Context> context, - std::vector<v8::Global<v8::Value>>* out) { - uint32_t count = js_array->Length(); - out->reserve(count); -- ArrayIterationData data{out, context->GetIsolate()}; -+ ArrayIterationData data{out, v8::Isolate::GetCurrent()}; - return js_array->Iterate(context, PushItemToVector, &data); - } - - v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, - std::string_view str, - v8::Isolate* isolate) { -- if (isolate == nullptr) isolate = context->GetIsolate(); -+ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); - if (str.size() >= static_cast<size_t>(v8::String::kMaxLength)) [[unlikely]] { - // V8 only has a TODO comment about adding an exception when the maximum - // string size is exceeded. -@@ -349,7 +349,7 @@ v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, - v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, - v8_inspector::StringView str, - v8::Isolate* isolate) { -- if (isolate == nullptr) isolate = context->GetIsolate(); -+ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); - if (str.length() >= static_cast<size_t>(v8::String::kMaxLength)) - [[unlikely]] { - // V8 only has a TODO comment about adding an exception when the maximum -@@ -376,7 +376,7 @@ template <typename T> - v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, - const std::vector<T>& vec, - v8::Isolate* isolate) { -- if (isolate == nullptr) isolate = context->GetIsolate(); -+ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope handle_scope(isolate); - - MaybeStackBuffer<v8::Local<v8::Value>, 128> arr(vec.size()); -@@ -393,7 +393,7 @@ template <typename T> - v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, - const std::set<T>& set, - v8::Isolate* isolate) { -- if (isolate == nullptr) isolate = context->GetIsolate(); -+ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); - v8::Local<v8::Set> set_js = v8::Set::New(isolate); - v8::HandleScope handle_scope(isolate); - -@@ -412,7 +412,7 @@ template <typename T, typename U> - v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, - const std::unordered_map<T, U>& map, - v8::Isolate* isolate) { -- if (isolate == nullptr) isolate = context->GetIsolate(); -+ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope handle_scope(isolate); - - v8::Local<v8::Map> ret = v8::Map::New(isolate); -@@ -455,7 +455,7 @@ template <typename T, typename> - v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, - const T& number, - v8::Isolate* isolate) { -- if (isolate == nullptr) isolate = context->GetIsolate(); -+ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); - return ConvertNumberToV8Value(isolate, number); - } - -@@ -468,7 +468,7 @@ v8::Local<v8::Array> ToV8ValuePrimitiveArray(v8::Local<v8::Context> context, - std::is_floating_point_v<T>, - "Only primitive types (bool, integral, floating-point) are supported."); - -- if (isolate == nullptr) isolate = context->GetIsolate(); -+ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope handle_scope(isolate); - - v8::LocalVector<v8::Value> elements(isolate); diff --git a/shell/browser/api/electron_api_menu_views.cc b/shell/browser/api/electron_api_menu_views.cc index 8a496f9f85874..cc10653a4dd72 100644 --- a/shell/browser/api/electron_api_menu_views.cc +++ b/shell/browser/api/electron_api_menu_views.cc @@ -34,7 +34,7 @@ void MenuViews::PopupAt(BaseWindow* window, // (-1, -1) means showing on mouse location. gfx::Point location; if (x == -1 || y == -1) { - location = display::Screen::GetScreen()->GetCursorScreenPoint(); + location = display::Screen::Get()->GetCursorScreenPoint(); } else { gfx::Point origin = native_window->GetContentBounds().origin(); location = gfx::Point(origin.x() + x, origin.y() + y); diff --git a/shell/browser/api/electron_api_native_theme.cc b/shell/browser/api/electron_api_native_theme.cc index f4ec558a6c193..eaf0d6e228ad5 100644 --- a/shell/browser/api/electron_api_native_theme.cc +++ b/shell/browser/api/electron_api_native_theme.cc @@ -73,11 +73,18 @@ ui::NativeTheme::ThemeSource NativeTheme::GetThemeSource() const { } bool NativeTheme::ShouldUseDarkColors() { - return ui_theme_->ShouldUseDarkColors(); + auto theme_source = GetThemeSource(); + if (theme_source == ui::NativeTheme::ThemeSource::kForcedLight) + return false; + if (theme_source == ui::NativeTheme::ThemeSource::kForcedDark) + return true; + return ui_theme_->preferred_color_scheme() == + ui::NativeTheme::PreferredColorScheme::kDark; } bool NativeTheme::ShouldUseHighContrastColors() { - return ui_theme_->UserHasContrastPreference(); + return ui_theme_->preferred_contrast() == + ui::NativeTheme::PreferredContrast::kMore; } bool NativeTheme::ShouldUseDarkColorsForSystemIntegratedUI() { @@ -86,11 +93,11 @@ bool NativeTheme::ShouldUseDarkColorsForSystemIntegratedUI() { } bool NativeTheme::InForcedColorsMode() { - return ui_theme_->InForcedColorsMode(); + return ui_theme_->forced_colors(); } bool NativeTheme::GetPrefersReducedTransparency() { - return ui_theme_->GetPrefersReducedTransparency(); + return ui_theme_->prefers_reduced_transparency(); } #if BUILDFLAG(IS_MAC) @@ -109,8 +116,9 @@ bool NativeTheme::ShouldUseInvertedColorScheme() { return false; return is_inverted; #else - return ui_theme_->GetPlatformHighContrastColorScheme() == - ui::NativeTheme::PlatformHighContrastColorScheme::kDark; + return ui_theme_->forced_colors() && + ui_theme_->preferred_color_scheme() == + ui::NativeTheme::PreferredColorScheme::kDark; #endif } diff --git a/shell/browser/api/electron_api_protocol.cc b/shell/browser/api/electron_api_protocol.cc index 1e29412d0c094..cb7093c43f34b 100644 --- a/shell/browser/api/electron_api_protocol.cc +++ b/shell/browser/api/electron_api_protocol.cc @@ -198,6 +198,8 @@ const char* const kBuiltinSchemes[] = { Protocol::Protocol(ProtocolRegistry* protocol_registry) : protocol_registry_{protocol_registry} {} +Protocol::~Protocol() = default; + // Convert error code to string. // static std::string_view Protocol::ErrorCodeToString(Error error) { diff --git a/shell/browser/api/electron_api_protocol.h b/shell/browser/api/electron_api_protocol.h index 372e646259925..79013260ebe9c 100644 --- a/shell/browser/api/electron_api_protocol.h +++ b/shell/browser/api/electron_api_protocol.h @@ -71,7 +71,7 @@ class Protocol final : public gin_helper::DeprecatedWrappable<Protocol>, base::RepeatingCallback<void(v8::Local<v8::Value>)>; explicit Protocol(ProtocolRegistry* protocol_registry); - ~Protocol() override = default; + ~Protocol() override; [[nodiscard]] static std::string_view ErrorCodeToString(Error error); diff --git a/shell/browser/api/electron_api_screen.cc b/shell/browser/api/electron_api_screen.cc index 5dc8389480ea7..3b4cb6f7df41e 100644 --- a/shell/browser/api/electron_api_screen.cc +++ b/shell/browser/api/electron_api_screen.cc @@ -179,7 +179,7 @@ v8::Local<v8::Value> Screen::Create(gin_helper::ErrorThrower error_thrower) { return v8::Null(error_thrower.isolate()); } - display::Screen* screen = display::Screen::GetScreen(); + display::Screen* screen = display::Screen::Get(); if (!screen) { error_thrower.ThrowError("Failed to get screen information"); return v8::Null(error_thrower.isolate()); diff --git a/shell/browser/api/electron_api_system_preferences.h b/shell/browser/api/electron_api_system_preferences.h index c325669cede41..5cf6632a86dcf 100644 --- a/shell/browser/api/electron_api_system_preferences.h +++ b/shell/browser/api/electron_api_system_preferences.h @@ -14,9 +14,9 @@ #include "shell/common/gin_helper/wrappable.h" #if BUILDFLAG(IS_WIN) +#include "base/callback_list.h" #include "shell/browser/browser.h" #include "shell/browser/browser_observer.h" -#include "ui/gfx/win/singleton_hwnd_observer.h" #endif namespace gin_helper { @@ -65,7 +65,7 @@ class SystemPreferences final #if BUILDFLAG(IS_WIN) void InitializeWindow(); - // Called by `singleton_hwnd_observer_`. + // Called by `hwnd_subscription_`. void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); // BrowserObserver: @@ -160,7 +160,7 @@ class SystemPreferences final std::string current_color_; // Color/high contrast mode change observer. - std::unique_ptr<gfx::SingletonHwndObserver> singleton_hwnd_observer_; + base::CallbackListSubscription hwnd_subscription_; #endif }; diff --git a/shell/browser/api/electron_api_system_preferences_win.cc b/shell/browser/api/electron_api_system_preferences_win.cc index 3d7b3969ab3fd..5eeda4c87e844 100644 --- a/shell/browser/api/electron_api_system_preferences_win.cc +++ b/shell/browser/api/electron_api_system_preferences_win.cc @@ -17,6 +17,7 @@ #include "shell/common/color_util.h" #include "shell/common/process_util.h" #include "ui/gfx/win/hwnd_util.h" +#include "ui/gfx/win/singleton_hwnd.h" namespace electron { @@ -157,8 +158,8 @@ void SystemPreferences::InitializeWindow() { // Creating this listener before the app is ready causes global shortcuts // to not fire if (Browser::Get()->is_ready()) - singleton_hwnd_observer_ = - std::make_unique<gfx::SingletonHwndObserver>(base::BindRepeating( + hwnd_subscription_ = + gfx::SingletonHwnd::GetInstance()->RegisterCallback(base::BindRepeating( &SystemPreferences::OnWndProc, base::Unretained(this))); else Browser::Get()->AddObserver(this); @@ -220,8 +221,8 @@ void SystemPreferences::OnWndProc(HWND hwnd, } void SystemPreferences::OnFinishLaunching(base::Value::Dict launch_info) { - singleton_hwnd_observer_ = - std::make_unique<gfx::SingletonHwndObserver>(base::BindRepeating( + hwnd_subscription_ = + gfx::SingletonHwnd::GetInstance()->RegisterCallback(base::BindRepeating( &SystemPreferences::OnWndProc, base::Unretained(this))); } diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 194708bb7c953..47820301daff8 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -572,8 +572,8 @@ std::optional<base::TimeDelta> GetCursorBlinkInterval() { if (system_value) return *system_value; #elif BUILDFLAG(IS_LINUX) - if (auto* linux_ui = ui::LinuxUi::instance()) - return linux_ui->GetCursorBlinkInterval(); + if (auto* native_theme = ui::NativeTheme::GetInstanceForNativeUi()) + return native_theme->caret_blink_interval(); #elif BUILDFLAG(IS_WIN) const auto system_msec = ::GetCaretBlinkTime(); if (system_msec != 0) { @@ -3578,7 +3578,7 @@ v8::Local<v8::Promise> WebContents::CapturePage(gin::Arguments* args) { // current system, increase the requested bitmap size to capture it all. gfx::Size bitmap_size = view_size; const gfx::NativeView native_view = view->GetNativeView(); - const float scale = display::Screen::GetScreen() + const float scale = display::Screen::Get() ->GetDisplayNearestView(native_view) .device_scale_factor(); if (scale > 1.0f) diff --git a/shell/browser/api/frame_subscriber.h b/shell/browser/api/frame_subscriber.h index c6c3300374d9e..61196270015bc 100644 --- a/shell/browser/api/frame_subscriber.h +++ b/shell/browser/api/frame_subscriber.h @@ -61,7 +61,8 @@ class FrameSubscriber : private content::WebContentsObserver, const gfx::Rect& content_rect, mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks> callbacks) override; - void OnNewSubCaptureTargetVersion(uint32_t crop_version) override {} + void OnNewCaptureVersion( + const media::CaptureVersion& capture_version) override {} void OnFrameWithEmptyRegionCapture() override {} void OnStopped() override {} void OnLog(const std::string& message) override {} diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index 67078d24c7bb7..ea0db0c3091bc 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -427,9 +427,10 @@ void ElectronBrowserClient::OverrideWebPreferences( renderer_prefs->can_accept_load_drops = false; ui::NativeTheme* native_theme = ui::NativeTheme::GetInstanceForNativeUi(); - prefs->in_forced_colors = native_theme->InForcedColorsMode(); + prefs->in_forced_colors = native_theme->forced_colors(); prefs->preferred_color_scheme = - native_theme->ShouldUseDarkColors() + native_theme->preferred_color_scheme() == + ui::NativeTheme::PreferredColorScheme::kDark ? blink::mojom::PreferredColorScheme::kDark : blink::mojom::PreferredColorScheme::kLight; @@ -446,9 +447,10 @@ bool ElectronBrowserClient::WebPreferencesNeedUpdateForColorRelatedStateChanges( const content::SiteInstance& main_frame_site) const { const auto& prefs = web_contents.GetOrCreateWebPreferences(); ui::NativeTheme* native_theme = ui::NativeTheme::GetInstanceForNativeUi(); - bool in_forced_colors = native_theme->InForcedColorsMode(); + bool in_forced_colors = native_theme->forced_colors(); blink::mojom::PreferredColorScheme preferred_color_scheme = - native_theme->ShouldUseDarkColors() + native_theme->preferred_color_scheme() == + ui::NativeTheme::PreferredColorScheme::kDark ? blink::mojom::PreferredColorScheme::kDark : blink::mojom::PreferredColorScheme::kLight; return prefs.in_forced_colors != in_forced_colors || diff --git a/shell/browser/electron_browser_main_parts.cc b/shell/browser/electron_browser_main_parts.cc index 2b7b02eade9a6..8421eab969a6f 100644 --- a/shell/browser/electron_browser_main_parts.cc +++ b/shell/browser/electron_browser_main_parts.cc @@ -325,7 +325,7 @@ int ElectronBrowserMainParts::PreCreateThreads() { #if defined(USE_AURA) // NB: must be called _after_ locale resource bundle is loaded, // because ui lib makes use of it in X11 - if (!display::Screen::GetScreen()) { + if (!display::Screen::Get()) { screen_ = views::CreateDesktopScreen(); } #endif diff --git a/shell/browser/electron_pdf_document_helper_client.h b/shell/browser/electron_pdf_document_helper_client.h index 3532e599a9995..c4f447b34a15f 100644 --- a/shell/browser/electron_pdf_document_helper_client.h +++ b/shell/browser/electron_pdf_document_helper_client.h @@ -20,7 +20,7 @@ class ElectronPDFDocumentHelperClient : public pdf::PDFDocumentHelperClient { // pdf::PDFDocumentHelperClient void UpdateContentRestrictions(content::RenderFrameHost* render_frame_host, int content_restrictions) override; - void OnSaveURL(content::WebContents* contents) override {} + void OnSaveURL() override {} void SetPluginCanSave(content::RenderFrameHost* render_frame_host, bool can_save) override; #if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE) diff --git a/shell/browser/electron_permission_manager.cc b/shell/browser/electron_permission_manager.cc index d9ff4b666373a..a58b3a696302b 100644 --- a/shell/browser/electron_permission_manager.cc +++ b/shell/browser/electron_permission_manager.cc @@ -311,7 +311,7 @@ ElectronPermissionManager::GetPermissionResultForOriginWithoutContext( blink::mojom::PermissionStatus status = GetPermissionStatus(permission_descriptor, requesting_origin.GetURL(), embedding_origin.GetURL()); - return {status, content::PermissionStatusSource::UNSPECIFIED}; + return content::PermissionResult(status); } void ElectronPermissionManager::CheckBluetoothDevicePair( @@ -412,13 +412,13 @@ ElectronPermissionManager::CheckProtectedUSBClasses( return protected_usb_handler_.Run(details); } -blink::mojom::PermissionStatus -ElectronPermissionManager::GetPermissionStatusForCurrentDocument( +content::PermissionResult +ElectronPermissionManager::GetPermissionResultForCurrentDocument( const blink::mojom::PermissionDescriptorPtr& permission_descriptor, content::RenderFrameHost* render_frame_host, - bool /*should_include_device_status*/) { + bool should_include_device_status) { if (render_frame_host->IsNestedWithinFencedFrame()) - return blink::mojom::PermissionStatus::DENIED; + return content::PermissionResult(blink::mojom::PermissionStatus::DENIED); const auto permission = blink::PermissionDescriptorToPermissionType(permission_descriptor); @@ -430,30 +430,34 @@ ElectronPermissionManager::GetPermissionStatusForCurrentDocument( bool granted = CheckPermissionWithDetails( permission, render_frame_host, render_frame_host->GetLastCommittedOrigin().GetURL(), std::move(details)); - return granted ? blink::mojom::PermissionStatus::GRANTED - : blink::mojom::PermissionStatus::DENIED; + return granted ? content::PermissionResult( + blink::mojom::PermissionStatus::GRANTED) + : content::PermissionResult( + blink::mojom::PermissionStatus::DENIED); } -blink::mojom::PermissionStatus -ElectronPermissionManager::GetPermissionStatusForWorker( +content::PermissionResult +ElectronPermissionManager::GetPermissionResultForWorker( const blink::mojom::PermissionDescriptorPtr& permission_descriptor, content::RenderProcessHost* render_process_host, const GURL& worker_origin) { - return GetPermissionStatus(permission_descriptor, worker_origin, - worker_origin); + blink::mojom::PermissionStatus status = + GetPermissionStatus(permission_descriptor, worker_origin, worker_origin); + return content::PermissionResult(status); } -blink::mojom::PermissionStatus -ElectronPermissionManager::GetPermissionStatusForEmbeddedRequester( +content::PermissionResult +ElectronPermissionManager::GetPermissionResultForEmbeddedRequester( const blink::mojom::PermissionDescriptorPtr& permission_descriptor, content::RenderFrameHost* render_frame_host, - const url::Origin& overridden_origin) { + const url::Origin& requesting_origin) { if (render_frame_host->IsNestedWithinFencedFrame()) - return blink::mojom::PermissionStatus::DENIED; + return content::PermissionResult(blink::mojom::PermissionStatus::DENIED); - return GetPermissionStatus( - permission_descriptor, overridden_origin.GetURL(), - render_frame_host->GetLastCommittedOrigin().GetURL()); + blink::mojom::PermissionStatus status = + GetPermissionStatus(permission_descriptor, requesting_origin.GetURL(), + render_frame_host->GetLastCommittedOrigin().GetURL()); + return content::PermissionResult(status); } } // namespace electron diff --git a/shell/browser/electron_permission_manager.h b/shell/browser/electron_permission_manager.h index 711064ab566fc..6bdcec371c405 100644 --- a/shell/browser/electron_permission_manager.h +++ b/shell/browser/electron_permission_manager.h @@ -136,15 +136,15 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate { const blink::mojom::PermissionDescriptorPtr& permission_descriptor, const url::Origin& requesting_origin, const url::Origin& embedding_origin) override; - blink::mojom::PermissionStatus GetPermissionStatusForCurrentDocument( + content::PermissionResult GetPermissionResultForCurrentDocument( const blink::mojom::PermissionDescriptorPtr& permission_descriptor, content::RenderFrameHost* render_frame_host, bool should_include_device_status) override; - blink::mojom::PermissionStatus GetPermissionStatusForWorker( + content::PermissionResult GetPermissionResultForWorker( const blink::mojom::PermissionDescriptorPtr& permission_descriptor, content::RenderProcessHost* render_process_host, const GURL& worker_origin) override; - blink::mojom::PermissionStatus GetPermissionStatusForEmbeddedRequester( + content::PermissionResult GetPermissionResultForEmbeddedRequester( const blink::mojom::PermissionDescriptorPtr& permission_descriptor, content::RenderFrameHost* render_frame_host, const url::Origin& requesting_origin) override; diff --git a/shell/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.cc b/shell/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.cc index bab4336953758..985059a1f0c79 100644 --- a/shell/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.cc +++ b/shell/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.cc @@ -4,20 +4,31 @@ #include "shell/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.h" +#include <cmath> +#include <memory> #include <string> #include "base/memory/weak_ptr.h" #include "base/numerics/safe_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" +#include "chrome/browser/pdf/pdf_pref_names.h" // nogncheck #include "chrome/browser/pdf/pdf_viewer_stream_manager.h" #include "chrome/common/extensions/api/pdf_viewer_private.h" #include "chrome/common/pref_names.h" #include "components/pdf/common/constants.h" #include "components/prefs/pref_service.h" #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h" +#include "pdf/buildflags.h" #include "url/url_constants.h" +#if BUILDFLAG(ENABLE_PDF_SAVE_TO_DRIVE) +#include "chrome/browser/save_to_drive/content_reader.h" +#include "chrome/browser/save_to_drive/pdf_content_reader.h" +#include "chrome/browser/save_to_drive/save_to_drive_event_dispatcher.h" +#include "chrome/browser/save_to_drive/save_to_drive_flow.h" +#endif // BUILDFLAG(ENABLE_PDF_SAVE_TO_DRIVE) + namespace extensions { namespace { @@ -25,6 +36,8 @@ namespace { namespace IsAllowedLocalFileAccess = api::pdf_viewer_private::IsAllowedLocalFileAccess; +namespace SaveToDrive = api::pdf_viewer_private::SaveToDrive; + namespace SetPdfPluginAttributes = api::pdf_viewer_private::SetPdfPluginAttributes; @@ -68,6 +81,27 @@ base::WeakPtr<StreamContainer> GetStreamContainer( return pdf_viewer_stream_manager->GetStreamContainer(embedder_host); } +#if BUILDFLAG(ENABLE_PDF_SAVE_TO_DRIVE) +// Converts the `SaveRequestType` enum from the extension API to the mojom enum. +pdf::mojom::SaveRequestType ToMojomSaveRequestType( + api::pdf_viewer_private::SaveRequestType request_type) { + switch (request_type) { + case api::pdf_viewer_private::SaveRequestType::kOriginal: + return pdf::mojom::SaveRequestType::kOriginal; + case api::pdf_viewer_private::SaveRequestType::kEdited: + return pdf::mojom::SaveRequestType::kEdited; + case api::pdf_viewer_private::SaveRequestType::kSearchified: + return pdf::mojom::SaveRequestType::kSearchified; + case api::pdf_viewer_private::SaveRequestType::kAnnotation: + return pdf::mojom::SaveRequestType::kAnnotation; + case api::pdf_viewer_private::SaveRequestType::kNone: + // It should not be called with `kNone`. + NOTREACHED(); + } + NOTREACHED(); +} +#endif // BUILDFLAG(ENABLE_PDF_SAVE_TO_DRIVE) + } // namespace PdfViewerPrivateGetStreamInfoFunction::PdfViewerPrivateGetStreamInfoFunction() = @@ -107,6 +141,64 @@ PdfViewerPrivateIsAllowedLocalFileAccessFunction::Run() { IsUrlAllowedToEmbedLocalFiles(GURL(params->url), base::Value::List()))); } +PdfViewerPrivateSaveToDriveFunction::PdfViewerPrivateSaveToDriveFunction() = + default; + +PdfViewerPrivateSaveToDriveFunction::~PdfViewerPrivateSaveToDriveFunction() = + default; + +ExtensionFunction::ResponseAction PdfViewerPrivateSaveToDriveFunction::Run() { +#if BUILDFLAG(ENABLE_PDF_SAVE_TO_DRIVE) + std::optional<SaveToDrive::Params> params = + SaveToDrive::Params::Create(args()); + EXTENSION_FUNCTION_VALIDATE(params); + if (params->save_request_type != + api::pdf_viewer_private::SaveRequestType::kNone) { + return RunSaveToDriveFlow(params->save_request_type); + } + return StopSaveToDriveFlow(); +#else + return RespondNow(Error("Not supported")); +#endif // BUILDFLAG(ENABLE_PDF_SAVE_TO_DRIVE) +} + +#if BUILDFLAG(ENABLE_PDF_SAVE_TO_DRIVE) +ExtensionFunction::ResponseAction +PdfViewerPrivateSaveToDriveFunction::RunSaveToDriveFlow( + api::pdf_viewer_private::SaveRequestType request_type) { + using SaveToDriveFlow = save_to_drive::SaveToDriveFlow; + + if (SaveToDriveFlow::GetForCurrentDocument(render_frame_host())) { + return RespondNow(Error("An upload is already in progress")); + } + auto event_dispatcher = + save_to_drive::SaveToDriveEventDispatcher::Create(render_frame_host()); + if (!event_dispatcher) { + return RespondNow(Error("Failed to create event dispatcher")); + } + auto content_reader = std::make_unique<save_to_drive::PDFContentReader>( + render_frame_host(), ToMojomSaveRequestType(request_type)); + save_to_drive::SaveToDriveFlow::CreateForCurrentDocument( + render_frame_host(), std::move(event_dispatcher), + std::move(content_reader)); + auto* flow = SaveToDriveFlow::GetForCurrentDocument(render_frame_host()); + flow->Run(); + return RespondNow(NoArguments()); +} + +ExtensionFunction::ResponseAction +PdfViewerPrivateSaveToDriveFunction::StopSaveToDriveFlow() { + using SaveToDriveFlow = save_to_drive::SaveToDriveFlow; + + auto* flow = SaveToDriveFlow::GetForCurrentDocument(render_frame_host()); + if (!flow) { + return RespondNow(Error("Failed to get SaveToDriveFlow")); + } + flow->Stop(); + return RespondNow(NoArguments()); +} +#endif // BUILDFLAG(ENABLE_PDF_SAVE_TO_DRIVE) + PdfViewerPrivateSetPdfDocumentTitleFunction:: PdfViewerPrivateSetPdfDocumentTitleFunction() = default; diff --git a/shell/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.h b/shell/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.h index f184924ad8db8..b42cfd3a0a1f9 100644 --- a/shell/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.h +++ b/shell/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.h @@ -5,7 +5,9 @@ #ifndef ELECTRON_SHELL_BROWSER_EXTENSIONS_API_PDF_VIEWER_PRIVATE_PDF_VIEWER_PRIVATE_API_H_ #define ELECTRON_SHELL_BROWSER_EXTENSIONS_API_PDF_VIEWER_PRIVATE_PDF_VIEWER_PRIVATE_API_H_ +#include "chrome/common/extensions/api/pdf_viewer_private.h" #include "extensions/browser/extension_function.h" +#include "pdf/buildflags.h" namespace extensions { @@ -46,6 +48,32 @@ class PdfViewerPrivateIsAllowedLocalFileAccessFunction ResponseAction Run() override; }; +class PdfViewerPrivateSaveToDriveFunction : public ExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("pdfViewerPrivate.saveToDrive", + PDFVIEWERPRIVATE_SAVETODRIVE) + + PdfViewerPrivateSaveToDriveFunction(); + PdfViewerPrivateSaveToDriveFunction( + const PdfViewerPrivateSaveToDriveFunction&) = delete; + PdfViewerPrivateSaveToDriveFunction& operator=( + const PdfViewerPrivateSaveToDriveFunction&) = delete; + + protected: + ~PdfViewerPrivateSaveToDriveFunction() override; + + // Override from ExtensionFunction: + ResponseAction Run() override; + +#if BUILDFLAG(ENABLE_PDF_SAVE_TO_DRIVE) + private: + ResponseAction RunSaveToDriveFlow( + api::pdf_viewer_private::SaveRequestType request_type); + + ResponseAction StopSaveToDriveFlow(); +#endif // BUILDFLAG(ENABLE_PDF_SAVE_TO_DRIVE) +}; + class PdfViewerPrivateSetPdfDocumentTitleFunction : public ExtensionFunction { public: DECLARE_EXTENSION_FUNCTION("pdfViewerPrivate.setPdfDocumentTitle", diff --git a/shell/browser/extensions/api/resources_private/resources_private_api.cc b/shell/browser/extensions/api/resources_private/resources_private_api.cc index 61a508f409952..f1170e574ab9f 100644 --- a/shell/browser/extensions/api/resources_private/resources_private_api.cc +++ b/shell/browser/extensions/api/resources_private/resources_private_api.cc @@ -39,18 +39,15 @@ ResourcesPrivateGetStringsFunction::~ResourcesPrivateGetStringsFunction() = default; ExtensionFunction::ResponseAction ResourcesPrivateGetStringsFunction::Run() { - std::optional<get_strings::Params> params( - get_strings::Params::Create(args())); + get_strings::Params params = get_strings::Params::Create(args()).value(); base::Value::Dict dict; - api::resources_private::Component component = params->component; - - switch (component) { + switch (params.component) { case api::resources_private::Component::kPdf: #if BUILDFLAG(ENABLE_PDF_VIEWER) - pdf_extension_util::AddStrings( - pdf_extension_util::PdfViewerContext::kPdfViewer, &dict); - pdf_extension_util::AddAdditionalData(browser_context(), &dict); + dict = pdf_extension_util::GetStrings( + pdf_extension_util::PdfViewerContext::kAll); + dict.Merge(pdf_extension_util::GetAdditionalData(browser_context())); #endif break; case api::resources_private::Component::kIdentity: diff --git a/shell/browser/extensions/electron_component_extension_resource_manager.cc b/shell/browser/extensions/electron_component_extension_resource_manager.cc index da72977cfe051..c5b6fb8cca559 100644 --- a/shell/browser/extensions/electron_component_extension_resource_manager.cc +++ b/shell/browser/extensions/electron_component_extension_resource_manager.cc @@ -28,14 +28,12 @@ ElectronComponentExtensionResourceManager:: AddComponentResourceEntries(kPdfResources); // Register strings for the PDF viewer, so that $i18n{} replacements work. - base::Value::Dict pdf_strings; - pdf_extension_util::AddStrings( - pdf_extension_util::PdfViewerContext::kPdfViewer, &pdf_strings); + base::Value::Dict dict = pdf_extension_util::GetStrings( + pdf_extension_util::PdfViewerContext::kPdfViewer); ui::TemplateReplacements pdf_viewer_replacements; - ui::TemplateReplacementsFromDictionaryValue(pdf_strings, - &pdf_viewer_replacements); - extension_template_replacements_[extension_misc::kPdfExtensionId] = + ui::TemplateReplacementsFromDictionaryValue(dict, &pdf_viewer_replacements); + template_replacements_[extension_misc::kPdfExtensionId] = std::move(pdf_viewer_replacements); #endif } @@ -69,8 +67,8 @@ bool ElectronComponentExtensionResourceManager::IsComponentExtensionResource( const ui::TemplateReplacements* ElectronComponentExtensionResourceManager::GetTemplateReplacementsForExtension( const std::string& extension_id) const { - auto it = extension_template_replacements_.find(extension_id); - if (it == extension_template_replacements_.end()) { + auto it = template_replacements_.find(extension_id); + if (it == template_replacements_.end()) { return nullptr; } return &it->second; diff --git a/shell/browser/extensions/electron_component_extension_resource_manager.h b/shell/browser/extensions/electron_component_extension_resource_manager.h index b56d7ce1a6f31..4457b2e2e7459 100644 --- a/shell/browser/extensions/electron_component_extension_resource_manager.h +++ b/shell/browser/extensions/electron_component_extension_resource_manager.h @@ -47,8 +47,7 @@ class ElectronComponentExtensionResourceManager std::map<base::FilePath, int> path_to_resource_id_; // A map from an extension ID to its i18n template replacements. - std::map<std::string, ui::TemplateReplacements> - extension_template_replacements_; + std::map<std::string, ui::TemplateReplacements> template_replacements_; }; } // namespace extensions diff --git a/shell/browser/feature_list.cc b/shell/browser/feature_list.cc index ae98b133ea5d2..178c101336cae 100644 --- a/shell/browser/feature_list.cc +++ b/shell/browser/feature_list.cc @@ -57,7 +57,11 @@ void InitializeFeatureList() { // See https://chromium-review.googlesource.com/c/chromium/src/+/6626905 // Needed so that ElectronBrowserClient::RegisterPendingSiteInstance does // not throw a check. - std::string(", TraceSiteInstanceGetProcessCreation"); + std::string(", TraceSiteInstanceGetProcessCreation") + + // See https://chromium-review.googlesource.com/c/chromium/src/+/6910012 + // Needed until we rework some of our logic and checks to enable this + // properly. + std::string(",") + network::features::kLocalNetworkAccessChecks.name; #if BUILDFLAG(IS_WIN) disable_features += diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index fbb9ee8946c3f..ec234cb03743f 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -118,7 +118,7 @@ static bool FromV8(v8::Isolate* isolate, NativeWindow* parent) : NativeWindow(options, parent), root_view_(new RootViewMac(this)) { ui::NativeTheme::GetInstanceForNativeUi()->AddObserver(this); - display::Screen::GetScreen()->AddObserver(this); + display::Screen::Get()->AddObserver(this); int width = options.ValueOrDefault(options::kWidth, 800); int height = options.ValueOrDefault(options::kHeight, 600); @@ -1680,7 +1680,7 @@ static bool FromV8(v8::Isolate* isolate, void NativeWindowMac::Cleanup() { DCHECK(!IsClosed()); ui::NativeTheme::GetInstanceForNativeUi()->RemoveObserver(this); - display::Screen::GetScreen()->RemoveObserver(this); + display::Screen::Get()->RemoveObserver(this); [window_ cleanup]; } diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index 043e9b8a808e7..18d7d6e876013 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -687,8 +687,8 @@ void NativeWindowViews::Maximize() { #if BUILDFLAG(IS_WIN) if (transparent()) { restore_bounds_ = GetBounds(); - auto display = display::Screen::GetScreen()->GetDisplayNearestWindow( - GetNativeWindow()); + auto display = + display::Screen::Get()->GetDisplayNearestWindow(GetNativeWindow()); SetBounds(display.work_area(), false); NotifyWindowMaximize(); return; @@ -732,8 +732,8 @@ bool NativeWindowViews::IsMaximized() const { if (transparent() && !IsMinimized()) { // If the window is the same dimensions and placement as the // display, we consider it maximized. - auto display = display::Screen::GetScreen()->GetDisplayNearestWindow( - GetNativeWindow()); + auto display = + display::Screen::Get()->GetDisplayNearestWindow(GetNativeWindow()); return GetBounds() == display.work_area(); } #endif @@ -798,7 +798,7 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) { if (fullscreen) { restore_bounds_ = GetBounds(); auto display = - display::Screen::GetScreen()->GetDisplayNearestPoint(GetPosition()); + display::Screen::Get()->GetDisplayNearestPoint(GetPosition()); SetBounds(display.bounds(), false); } else { SetBounds(restore_bounds_, false); @@ -1163,7 +1163,7 @@ ui::ZOrderLevel NativeWindowViews::GetZOrderLevel() const { void NativeWindowViews::Center() { #if BUILDFLAG(IS_LINUX) auto display = - display::Screen::GetScreen()->GetDisplayNearestWindow(GetNativeWindow()); + display::Screen::Get()->GetDisplayNearestWindow(GetNativeWindow()); gfx::Rect window_bounds_in_screen = display.work_area(); window_bounds_in_screen.ClampToCenteredSize(GetSize()); widget()->SetBounds(window_bounds_in_screen); diff --git a/shell/browser/net/url_loader_network_observer.h b/shell/browser/net/url_loader_network_observer.h index 5b7cd43ee092f..5b3db75bd8923 100644 --- a/shell/browser/net/url_loader_network_observer.h +++ b/shell/browser/net/url_loader_network_observer.h @@ -58,6 +58,7 @@ class URLLoaderNetworkObserver int64_t recv_bytes, int64_t sent_bytes) override {} void OnWebSocketConnectedToPrivateNetwork( + const GURL& request_url, network::mojom::IPAddressSpace ip_address_space) override {} void OnCertificateRequested( const std::optional<base::UnguessableToken>& window_id, diff --git a/shell/browser/osr/osr_render_widget_host_view.cc b/shell/browser/osr/osr_render_widget_host_view.cc index df712cefe4f48..81e4606e3fb82 100644 --- a/shell/browser/osr/osr_render_widget_host_view.cc +++ b/shell/browser/osr/osr_render_widget_host_view.cc @@ -961,7 +961,7 @@ void OffScreenRenderWidgetHostView::ResizeRootLayer(bool force) { SetupFrameRate(false); display::Display display = - display::Screen::GetScreen()->GetDisplayNearestView(GetNativeView()); + display::Screen::Get()->GetDisplayNearestView(GetNativeView()); const float scaleFactor = display.device_scale_factor(); float sf = GetDeviceScaleFactor(); const bool sf_did_change = scaleFactor != sf; diff --git a/shell/browser/osr/osr_video_consumer.h b/shell/browser/osr/osr_video_consumer.h index 78dc1518f23ab..e97097996a193 100644 --- a/shell/browser/osr/osr_video_consumer.h +++ b/shell/browser/osr/osr_video_consumer.h @@ -41,7 +41,8 @@ class OffScreenVideoConsumer : public viz::mojom::FrameSinkVideoConsumer { const gfx::Rect& content_rect, mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks> callbacks) override; - void OnNewSubCaptureTargetVersion(uint32_t crop_version) override {} + void OnNewCaptureVersion( + const media::CaptureVersion& capture_version) override {} void OnFrameWithEmptyRegionCapture() override {} void OnStopped() override {} void OnLog(const std::string& message) override {} diff --git a/shell/browser/ui/drag_util_views.cc b/shell/browser/ui/drag_util_views.cc index f64f3ec54dab8..ccd0ea6bffe5f 100644 --- a/shell/browser/ui/drag_util_views.cc +++ b/shell/browser/ui/drag_util_views.cc @@ -38,7 +38,7 @@ void DragFileItems(const std::vector<base::FilePath>& files, } data->SetFilenames(file_infos); - gfx::Point location = display::Screen::GetScreen()->GetCursorScreenPoint(); + gfx::Point location = display::Screen::Get()->GetCursorScreenPoint(); // TODO(varunjain): Properly determine and send DragEventSource below. aura::client::GetDragDropClient(root_window) ->StartDragAndDrop( diff --git a/shell/browser/ui/electron_desktop_window_tree_host_linux.cc b/shell/browser/ui/electron_desktop_window_tree_host_linux.cc index 4502f132c71f9..561f8034538b3 100644 --- a/shell/browser/ui/electron_desktop_window_tree_host_linux.cc +++ b/shell/browser/ui/electron_desktop_window_tree_host_linux.cc @@ -283,7 +283,7 @@ void ElectronDesktopWindowTreeHostLinux::DispatchEvent(ui::Event* event) { ->GetPlatformRuntimeProperties() .supports_server_window_menus) { views::DesktopWindowTreeHostLinux::ShowWindowControlsMenu( - display::Screen::GetScreen()->GetCursorScreenPoint()); + display::Screen::Get()->GetCursorScreenPoint()); } } return; diff --git a/shell/browser/ui/inspectable_web_contents.cc b/shell/browser/ui/inspectable_web_contents.cc index 5add166e8176c..cad4af25589f6 100644 --- a/shell/browser/ui/inspectable_web_contents.cc +++ b/shell/browser/ui/inspectable_web_contents.cc @@ -110,7 +110,7 @@ gfx::Rect DictionaryToRect(const base::Value::Dict& dict) { } bool IsPointInScreen(const gfx::Point& point) { - return std::ranges::any_of(display::Screen::GetScreen()->GetAllDisplays(), + return std::ranges::any_of(display::Screen::Get()->GetAllDisplays(), [&point](auto const& display) { return display.bounds().Contains(point); }); @@ -326,11 +326,11 @@ InspectableWebContents::InspectableWebContents( if (!IsPointInScreen(devtools_bounds_.origin())) { gfx::Rect display; if (!is_guest && web_contents_->GetNativeView()) { - display = display::Screen::GetScreen() + display = display::Screen::Get() ->GetDisplayNearestView(web_contents_->GetNativeView()) .bounds(); } else { - display = display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); + display = display::Screen::Get()->GetPrimaryDisplay().bounds(); } devtools_bounds_.set_x(display.x() + diff --git a/shell/browser/ui/win/notify_icon.cc b/shell/browser/ui/win/notify_icon.cc index c4c9e66563ad5..2412417b6c92a 100644 --- a/shell/browser/ui/win/notify_icon.cc +++ b/shell/browser/ui/win/notify_icon.cc @@ -77,8 +77,7 @@ void NotifyIcon::HandleClickEvent(int modifiers, if (double_button_click) // double left click NotifyDoubleClicked(bounds, modifiers); else // single left click - NotifyClicked(bounds, - display::Screen::GetScreen()->GetCursorScreenPoint(), + NotifyClicked(bounds, display::Screen::Get()->GetCursorScreenPoint(), modifiers); return; } else if (middle_button_click) { // single middle click @@ -92,19 +91,19 @@ void NotifyIcon::HandleClickEvent(int modifiers, } void NotifyIcon::HandleMouseMoveEvent(int modifiers) { - gfx::Point cursorPos = display::Screen::GetScreen()->GetCursorScreenPoint(); + gfx::Point cursorPos = display::Screen::Get()->GetCursorScreenPoint(); // Omit event fired when tray icon is created but cursor is outside of it. if (GetBounds().Contains(cursorPos)) NotifyMouseMoved(cursorPos, modifiers); } void NotifyIcon::HandleMouseEntered(int modifiers) { - gfx::Point cursor_pos = display::Screen::GetScreen()->GetCursorScreenPoint(); + gfx::Point cursor_pos = display::Screen::Get()->GetCursorScreenPoint(); NotifyMouseEntered(cursor_pos, modifiers); } void NotifyIcon::HandleMouseExited(int modifiers) { - gfx::Point cursor_pos = display::Screen::GetScreen()->GetCursorScreenPoint(); + gfx::Point cursor_pos = display::Screen::Get()->GetCursorScreenPoint(); NotifyMouseExited(cursor_pos, modifiers); } @@ -225,7 +224,7 @@ void NotifyIcon::PopUpContextMenu(const gfx::Point& pos, // Show menu at mouse's position by default. gfx::Rect rect(pos, gfx::Size()); if (pos.IsOrigin()) - rect.set_origin(display::Screen::GetScreen()->GetCursorScreenPoint()); + rect.set_origin(display::Screen::Get()->GetCursorScreenPoint()); if (menu_model) { menu_runner_ = std::make_unique<views::MenuRunner>( diff --git a/shell/browser/ui/win/notify_icon_host.cc b/shell/browser/ui/win/notify_icon_host.cc index 2895175e72925..c59d9f6b93713 100644 --- a/shell/browser/ui/win/notify_icon_host.cc +++ b/shell/browser/ui/win/notify_icon_host.cc @@ -120,8 +120,7 @@ class NotifyIconHost::MouseEnteredExitedDetector { } bool IsCursorOverIcon(raw_ptr<NotifyIcon> icon) { - gfx::Point cursor_pos = - display::Screen::GetScreen()->GetCursorScreenPoint(); + gfx::Point cursor_pos = display::Screen::Get()->GetCursorScreenPoint(); return icon->GetBounds().Contains(cursor_pos); } diff --git a/shell/browser/win/dark_mode.cc b/shell/browser/win/dark_mode.cc index 444b832771d35..e78398d1d14b3 100644 --- a/shell/browser/win/dark_mode.cc +++ b/shell/browser/win/dark_mode.cc @@ -42,9 +42,11 @@ bool IsDarkModeSupported() { void SetDarkModeForWindow(HWND hWnd) { ui::NativeTheme* theme = ui::NativeTheme::GetInstanceForNativeUi(); - bool dark = - theme->ShouldUseDarkColors() && !theme->UserHasContrastPreference(); - + bool has_contrast_preference = + theme->preferred_contrast() == ui::NativeTheme::PreferredContrast::kMore; + bool prefers_dark = theme->preferred_color_scheme() == + ui::NativeTheme::PreferredColorScheme::kDark; + bool dark = prefers_dark && !has_contrast_preference; TrySetWindowTheme(hWnd, dark); } diff --git a/shell/common/api/electron_api_url_loader.h b/shell/common/api/electron_api_url_loader.h index 405dccdbda3e2..2ff737ce75db7 100644 --- a/shell/common/api/electron_api_url_loader.h +++ b/shell/common/api/electron_api_url_loader.h @@ -125,6 +125,7 @@ class SimpleURLLoaderWrapper final int64_t recv_bytes, int64_t sent_bytes) override {} void OnWebSocketConnectedToPrivateNetwork( + const GURL& request_url, network::mojom::IPAddressSpace ip_address_space) override {} void Clone( mojo::PendingReceiver<network::mojom::URLLoaderNetworkServiceObserver> diff --git a/shell/renderer/renderer_client_base.cc b/shell/renderer/renderer_client_base.cc index bb8a836de5f38..9b911450f8b9b 100644 --- a/shell/renderer/renderer_client_base.cc +++ b/shell/renderer/renderer_client_base.cc @@ -233,7 +233,7 @@ void RendererClientBase::RenderThreadStarted() { extensions::ExtensionsRendererClient::Set(extensions_renderer_client_.get()); extensions_renderer_client_->RenderThreadStarted(); - WTF::String extension_scheme(extensions::kExtensionScheme); + blink::String extension_scheme(extensions::kExtensionScheme); // Extension resources are HTTP-like and safe to expose to the fetch API. The // rules for the fetch API are consistent with XHR. blink::SchemeRegistry::RegisterURLSchemeAsSupportingFetchAPI( @@ -270,7 +270,7 @@ void RendererClientBase::RenderThreadStarted() { ParseSchemesCLISwitch(command_line, switches::kBypassCSPSchemes); for (const std::string& scheme : csp_bypassing_schemes) blink::SchemeRegistry::RegisterURLSchemeAsBypassingContentSecurityPolicy( - WTF::String::FromUTF8(scheme)); + blink::String::FromUTF8(scheme)); std::vector<std::string> code_cache_schemes_list = ParseSchemesCLISwitch(command_line, switches::kCodeCacheSchemes); diff --git a/spec/api-web-contents-spec.ts b/spec/api-web-contents-spec.ts index 9819327c979f7..e701ff98e0890 100644 --- a/spec/api-web-contents-spec.ts +++ b/spec/api-web-contents-spec.ts @@ -919,7 +919,7 @@ describe('webContents module', () => { return w.webContents.navigationHistory.restore({ index: 2, entries }); }); - expect(formValue).to.equal('Hi!'); + await waitUntil(() => formValue === 'Hi!'); }); it('should handle invalid base64 pageState', async () => { diff --git a/spec/chromium-spec.ts b/spec/chromium-spec.ts index 4a32f9d9b9ab5..4457d2a1bfb8b 100644 --- a/spec/chromium-spec.ts +++ b/spec/chromium-spec.ts @@ -343,12 +343,12 @@ describe('web security', () => { }); } </script>`); - return await w.webContents.executeJavaScript('loadWasm()'); + return (await w.webContents.executeJavaScript('loadWasm()')).trim(); } it('wasm codegen is disallowed by default', async () => { const r = await loadWasm(''); - expect(r).to.equal('WebAssembly.instantiate(): Refused to compile or instantiate WebAssembly module because \'unsafe-eval\' is not an allowed source of script in the following Content Security Policy directive: "script-src \'self\' \'unsafe-inline\'"'); + expect(r).to.equal('WebAssembly.instantiate(): Compiling or instantiating WebAssembly module violates the following Content Security policy directive because \'unsafe-eval\' is not an allowed source of script in the following Content Security Policy directive:'); }); it('wasm codegen is allowed with "wasm-unsafe-eval" csp', async () => { @@ -381,7 +381,7 @@ describe('web security', () => { } </script>`); const [{ message }] = await once(w.webContents, 'console-message'); - expect(message).to.match(/Refused to evaluate a string/); + expect(message).to.match(/Evaluating a string as JavaScript violates/); }); it('does not prevent eval from running in an inline script when there is no csp', async () => { From 146ccd0bad12918f74dadddd49b47bc07488c1f8 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt <nilay2014@gmail.com> Date: Tue, 23 Sep 2025 16:37:38 -0400 Subject: [PATCH 082/268] build: update patches (#48364) chore: update patches --- patches/v8/cherry-pick-ec6c18478382.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/v8/cherry-pick-ec6c18478382.patch b/patches/v8/cherry-pick-ec6c18478382.patch index 3efa9c04d5ec0..453f6d61945e1 100644 --- a/patches/v8/cherry-pick-ec6c18478382.patch +++ b/patches/v8/cherry-pick-ec6c18478382.patch @@ -17,10 +17,10 @@ Reviewed-by: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/main@{#102530} diff --git a/src/compiler/backend/arm64/instruction-selector-arm64.cc b/src/compiler/backend/arm64/instruction-selector-arm64.cc -index 60ff1ee97931edfcca28b6f5f7c4918d015af974..0212f4570750599bc266a1cd8c9efa19ea26e85c 100644 +index 541b81352fb302dcac812df4da42a3c4ce3a0fb9..eed3ee9764e78fa6b0402a1b86165bd7a61edee9 100644 --- a/src/compiler/backend/arm64/instruction-selector-arm64.cc +++ b/src/compiler/backend/arm64/instruction-selector-arm64.cc -@@ -2958,9 +2958,19 @@ bool InstructionSelector::ZeroExtendsWord32ToWord64NoPhis(OpIndex node) { +@@ -2966,9 +2966,19 @@ bool InstructionSelector::ZeroExtendsWord32ToWord64NoPhis(OpIndex node) { return op.Cast<ShiftOp>().rep == WordRepresentation::Word32(); case Opcode::kComparison: return op.Cast<ComparisonOp>().rep == RegisterRepresentation::Word32(); From b51c6ac0c7d090b8b63e105387e2b09dd1e5121a Mon Sep 17 00:00:00 2001 From: Niklas Wenzel <nilay2014@gmail.com> Date: Tue, 23 Sep 2025 23:28:21 +0200 Subject: [PATCH 083/268] docs: mention `setContentProtection` macOS limitations (#48290) --- docs/api/browser-window.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 4578ca0713851..a399f22b645e7 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -1570,11 +1570,18 @@ events. Prevents the window contents from being captured by other apps. -On macOS it sets the NSWindow's [`sharingType`](https://developer.apple.com/documentation/appkit/nswindow/sharingtype-swift.property?language=objc) to [`NSWindowSharingNone`](https://developer.apple.com/documentation/appkit/nswindow/sharingtype-swift.enum/none?language=objc). -On Windows it calls [`SetWindowDisplayAffinity`](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowdisplayaffinity) with `WDA_EXCLUDEFROMCAPTURE`. +On Windows, it calls [`SetWindowDisplayAffinity`](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowdisplayaffinity) with `WDA_EXCLUDEFROMCAPTURE`. For Windows 10 version 2004 and up the window will be removed from capture entirely, older Windows versions behave as if `WDA_MONITOR` is applied capturing a black window. +On macOS, it sets the `NSWindow`'s +[`sharingType`](https://developer.apple.com/documentation/appkit/nswindow/sharingtype-swift.property?language=objc) +to +[`NSWindowSharingNone`](https://developer.apple.com/documentation/appkit/nswindow/sharingtype-swift.enum/none?language=objc). +Unfortunately, due to an intentional change in macOS, newer Mac applications that use +`ScreenCaptureKit` will capture your window despite `win.setContentProtection(true)`. +See [here](https://github.com/electron/electron/issues/48258#issuecomment-3269893618). + #### `win.isContentProtected()` _macOS_ _Windows_ Returns `boolean` - whether or not content protection is currently enabled. From 86cd274d252165191e3102625677e39cfa8e8f50 Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Wed, 24 Sep 2025 08:13:49 -0500 Subject: [PATCH 084/268] chore: remove unused, undocumented, untested executionMode arg from `web_frame.executeJavaScriptInIsolatedWorld()` (#48361) chore: remove unused, undocumented execution mode arg from web_frame.executeJavaScriptInIsolatedWorld() --- shell/renderer/api/electron_api_web_frame.cc | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/shell/renderer/api/electron_api_web_frame.cc b/shell/renderer/api/electron_api_web_frame.cc index 58aaf911b3aab..2575ee0e183d7 100644 --- a/shell/renderer/api/electron_api_web_frame.cc +++ b/shell/renderer/api/electron_api_web_frame.cc @@ -700,20 +700,6 @@ class WebFrameRenderer final bool has_user_gesture = false; args->GetNext(&has_user_gesture); - blink::mojom::EvaluationTiming script_execution_type = - blink::mojom::EvaluationTiming::kSynchronous; - blink::mojom::LoadEventBlockingOption load_blocking_option = - blink::mojom::LoadEventBlockingOption::kDoNotBlock; - std::string execution_type; - args->GetNext(&execution_type); - - if (execution_type == "asynchronous") { - script_execution_type = blink::mojom::EvaluationTiming::kAsynchronous; - } else if (execution_type == "asynchronousBlockingOnload") { - script_execution_type = blink::mojom::EvaluationTiming::kAsynchronous; - load_blocking_option = blink::mojom::LoadEventBlockingOption::kBlock; - } - ScriptExecutionCallback::CompletionCallback completion_callback; args->GetNext(&completion_callback); @@ -749,7 +735,9 @@ class WebFrameRenderer final world_id, base::span(sources), has_user_gesture ? blink::mojom::UserActivationOption::kActivate : blink::mojom::UserActivationOption::kDoNotActivate, - script_execution_type, load_blocking_option, base::NullCallback(), + blink::mojom::EvaluationTiming::kSynchronous, + blink::mojom::LoadEventBlockingOption::kDoNotBlock, + base::NullCallback(), base::BindOnce(&ScriptExecutionCallback::Completed, base::Unretained(self)), blink::BackForwardCacheAware::kPossiblyDisallow, From 03ed226efa3333aca29dba4eadf86b73f2ee5383 Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Wed, 24 Sep 2025 08:39:16 -0500 Subject: [PATCH 085/268] refactor: use gin::Arguments in BaseWindow (#48355) * refactor: make api::Clipboard::GetClipboardBuffer() private * refactor: move GetClipboadBuffer() into anonymous namespace * refactor: use gin::Arguments in BaseWindow::MoveAbove() refactor: use gin::Arguments in BaseWindow::SetAlwaysOnTop() refactor: use gin::Arguments in BaseWindow::SetIgnoreMouseEvent() * refactor: use gin::Arguments in BaseWindow::SetProgresBar() * refactor: use gin::Arguments in BaseWindow::SetVisibleOnAllWorkspaces() * refactor: use gin::Arguments in BaseWindow::SetVibrancy() * refactor: use gin::Arguments in BaseWindow::SetAspectRatio() * refactor: use gin::Arguments in BaseWindow::PreviewFile() * refactor: use gin::Arguments in BaseWindow::SetThumbarButtons() * refactor: use gin::Arguments in BaseWindow::SetBounds() * refactor: use gin::Arguments in BaseWindow::SetContentBounds() * refactor: use gin::Arguments in BaseWindow::SetSize() * refactor: use gin::Arguments in BaseWindow::SetContentSize() * refactor: use gin::Arguments in BaseWindow::SetSheetOffset() * refactor: use gin::Arguments in BaseWindow::SetPosition() * refactor: use gin::Arguments in BaseWindow::AddTabbedWindow() * refactor: use gin::Arguments in BaseWindow::SetParentWindow() * refactor: use gin::Arguments in BaseWindow::BaseWindow() * refactor: use gin::Arguments in BaseWindow::SetAccentColor() * refactor: use gin::Arguments in BaseWindow::SetTitleBarOverlay() --- shell/browser/api/electron_api_base_window.cc | 100 ++++++++++-------- shell/browser/api/electron_api_base_window.h | 48 +++++---- shell/browser/native_window_views.cc | 8 +- shell/browser/native_window_views.h | 6 +- 4 files changed, 87 insertions(+), 75 deletions(-) diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index b362c47a221c3..382a271cd00e2 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -123,7 +123,7 @@ BaseWindow::BaseWindow(v8::Isolate* isolate, #endif } -BaseWindow::BaseWindow(gin_helper::Arguments* args, +BaseWindow::BaseWindow(gin::Arguments* args, const gin_helper::Dictionary& options) : BaseWindow(args->isolate(), options) { InitWithArgs(args); @@ -444,7 +444,7 @@ bool BaseWindow::IsFullscreen() const { } void BaseWindow::SetBounds(const gfx::Rect& bounds, - gin_helper::Arguments* args) { + gin::Arguments* const args) { bool animate = false; args->GetNext(&animate); window_->SetBounds(bounds, animate); @@ -463,7 +463,7 @@ gfx::Rect BaseWindow::GetNormalBounds() const { } void BaseWindow::SetContentBounds(const gfx::Rect& bounds, - gin_helper::Arguments* args) { + gin::Arguments* const args) { bool animate = false; args->GetNext(&animate); window_->SetContentBounds(bounds, animate); @@ -473,7 +473,7 @@ gfx::Rect BaseWindow::GetContentBounds() const { return window_->GetContentBounds(); } -void BaseWindow::SetSize(int width, int height, gin_helper::Arguments* args) { +void BaseWindow::SetSize(int width, int height, gin::Arguments* args) { bool animate = false; gfx::Size size = window_->GetMinimumSize(); size.SetToMax(gfx::Size(width, height)); @@ -485,12 +485,12 @@ std::array<int, 2U> BaseWindow::GetSize() const { return ToArray(window_->GetSize()); } -void BaseWindow::SetContentSize(int width, - int height, - gin_helper::Arguments* args) { +void BaseWindow::SetContentSize(const int width, + const int height, + gin::Arguments* const args) { bool animate = false; args->GetNext(&animate); - window_->SetContentSize(gfx::Size(width, height), animate); + window_->SetContentSize(gfx::Size{width, height}, animate); } std::array<int, 2U> BaseWindow::GetContentSize() const { @@ -513,7 +513,8 @@ std::array<int, 2U> BaseWindow::GetMaximumSize() const { return ToArray(window_->GetMaximumSize()); } -void BaseWindow::SetSheetOffset(double offsetY, gin_helper::Arguments* args) { +void BaseWindow::SetSheetOffset(const double offsetY, + gin::Arguments* const args) { double offsetX = 0.0; args->GetNext(&offsetX); window_->SetSheetOffset(offsetX, offsetY); @@ -567,7 +568,7 @@ bool BaseWindow::IsClosable() const { return window_->IsClosable(); } -void BaseWindow::SetAlwaysOnTop(bool top, gin_helper::Arguments* args) { +void BaseWindow::SetAlwaysOnTop(bool top, gin::Arguments* args) { std::string level = "floating"; int relative_level = 0; args->GetNext(&level); @@ -586,19 +587,21 @@ void BaseWindow::Center() { window_->Center(); } -void BaseWindow::SetPosition(int x, int y, gin_helper::Arguments* args) { +void BaseWindow::SetPosition(const int x, + const int y, + gin::Arguments* const args) { bool animate = false; args->GetNext(&animate); - window_->SetPosition(gfx::Point(x, y), animate); + window_->SetPosition(gfx::Point{x, y}, animate); } std::array<int, 2U> BaseWindow::GetPosition() const { return ToArray(window_->GetPosition()); } void BaseWindow::MoveAbove(const std::string& sourceId, - gin_helper::Arguments* args) { + gin::Arguments* const args) { if (!window_->MoveAbove(sourceId)) - args->ThrowError("Invalid media source id"); + args->ThrowTypeError("Invalid media source id"); } void BaseWindow::MoveTop() { @@ -706,8 +709,7 @@ bool BaseWindow::IsDocumentEdited() const { return window_->IsDocumentEdited(); } -void BaseWindow::SetIgnoreMouseEvents(bool ignore, - gin_helper::Arguments* args) { +void BaseWindow::SetIgnoreMouseEvents(bool ignore, gin::Arguments* const args) { gin_helper::Dictionary options; bool forward = false; args->GetNext(&options) && options.Get("forward", &forward); @@ -759,9 +761,9 @@ void BaseWindow::RemoveMenu() { } void BaseWindow::SetParentWindow(v8::Local<v8::Value> value, - gin_helper::Arguments* args) { + gin::Arguments* const args) { if (IsModal()) { - args->ThrowError("Can not be called for modal window"); + args->ThrowTypeError("Can not be called for modal window"); return; } @@ -776,7 +778,7 @@ void BaseWindow::SetParentWindow(v8::Local<v8::Value> value, window_->SetParentWindow(parent->window_.get()); parent->child_windows_.Set(isolate(), weak_map_id(), GetWrapper()); } else { - args->ThrowError("Must pass BaseWindow instance or null"); + args->ThrowTypeError("Must pass BaseWindow instance or null"); } } @@ -794,7 +796,7 @@ v8::Local<v8::Value> BaseWindow::GetNativeWindowHandle() { } #endif -void BaseWindow::SetProgressBar(double progress, gin_helper::Arguments* args) { +void BaseWindow::SetProgressBar(double progress, gin::Arguments* args) { gin_helper::Dictionary options; std::string mode; args->GetNext(&options) && options.Get("mode", &mode); @@ -818,7 +820,7 @@ void BaseWindow::SetOverlayIcon(const gfx::Image& overlay, } void BaseWindow::SetVisibleOnAllWorkspaces(bool visible, - gin_helper::Arguments* args) { + gin::Arguments* const args) { gin_helper::Dictionary options; bool visibleOnFullScreen = false; bool skipTransformProcessType = false; @@ -838,9 +840,9 @@ void BaseWindow::SetAutoHideCursor(bool auto_hide) { window_->SetAutoHideCursor(auto_hide); } -void BaseWindow::SetVibrancy(v8::Isolate* isolate, +void BaseWindow::SetVibrancy(v8::Isolate* const isolate, v8::Local<v8::Value> value, - gin_helper::Arguments* args) { + gin::Arguments* const args) { std::string type = gin::V8ToString(isolate, value); gin_helper::Dictionary options; int animation_duration_ms = 0; @@ -925,10 +927,11 @@ void BaseWindow::ToggleTabBar() { window_->ToggleTabBar(); } -void BaseWindow::AddTabbedWindow(NativeWindow* window, - gin_helper::Arguments* args) { +void BaseWindow::AddTabbedWindow(NativeWindow* const window, + gin::Arguments* const args) { if (!window_->AddTabbedWindow(window)) - args->ThrowError("AddTabbedWindow cannot be called by a window on itself."); + args->ThrowTypeError( + "AddTabbedWindow cannot be called by a window on itself."); } v8::Local<v8::Value> BaseWindow::GetTabbingIdentifier() { @@ -955,15 +958,15 @@ bool BaseWindow::IsMenuBarVisible() const { return window_->IsMenuBarVisible(); } -void BaseWindow::SetAspectRatio(double aspect_ratio, - gin_helper::Arguments* args) { +void BaseWindow::SetAspectRatio(const double aspect_ratio, + gin::Arguments* const args) { gfx::Size extra_size; args->GetNext(&extra_size); window_->SetAspectRatio(aspect_ratio, extra_size); } void BaseWindow::PreviewFile(const std::string& path, - gin_helper::Arguments* args) { + gin::Arguments* const args) { std::string display_name; if (!args->GetNext(&display_name)) display_name = path; @@ -1000,7 +1003,7 @@ bool BaseWindow::IsModal() const { return window_->is_modal(); } -bool BaseWindow::SetThumbarButtons(gin_helper::Arguments* args) { +bool BaseWindow::SetThumbarButtons(gin::Arguments* args) { #if BUILDFLAG(IS_WIN) std::vector<TaskbarHost::ThumbarButton> buttons; if (!args->GetNext(&buttons)) { @@ -1092,22 +1095,29 @@ bool BaseWindow::IsSnapped() const { return window_->IsSnapped(); } -void BaseWindow::SetAccentColor(gin_helper::Arguments* args) { - bool accent_color = false; - std::string accent_color_string; - if (args->GetNext(&accent_color_string)) { - std::optional<SkColor> maybe_color = ParseCSSColor(accent_color_string); - if (maybe_color.has_value()) { - window_->SetAccentColor(maybe_color.value()); +void BaseWindow::SetAccentColor(gin::Arguments* const args) { + v8::Local<v8::Value> ac_val; + args->GetNext(&ac_val); + + if (!ac_val.IsEmpty() && ac_val->IsBoolean()) { + const bool ac_flag = ac_val->BooleanValue(args->isolate()); + window_->SetAccentColor(ac_flag); + window_->UpdateWindowAccentColor(window_->IsActive()); + return; + } + + if (!ac_val.IsEmpty() && ac_val->IsString()) { + std::string ac_str; + gin::ConvertFromV8(args->isolate(), ac_val, &ac_str); + if (const std::optional<SkColor> ac_color = ParseCSSColor(ac_str)) { + window_->SetAccentColor(*ac_color); window_->UpdateWindowAccentColor(window_->IsActive()); } - } else if (args->GetNext(&accent_color)) { - window_->SetAccentColor(accent_color); - window_->UpdateWindowAccentColor(window_->IsActive()); - } else { - args->ThrowError( - "Invalid accent color value - must be a string or boolean"); + return; } + + args->ThrowTypeError( + "Invalid accent color value - must be a string or boolean"); } v8::Local<v8::Value> BaseWindow::GetAccentColor() const { @@ -1122,7 +1132,7 @@ v8::Local<v8::Value> BaseWindow::GetAccentColor() const { #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) void BaseWindow::SetTitleBarOverlay(const gin_helper::Dictionary& options, - gin_helper::Arguments* args) { + gin::Arguments* args) { static_cast<NativeWindowViews*>(window_.get()) ->SetTitleBarOverlay(options, args); } @@ -1144,7 +1154,7 @@ void BaseWindow::RemoveFromParentChildWindows() { } // static -gin_helper::WrappableBase* BaseWindow::New(gin_helper::Arguments* args) { +gin_helper::WrappableBase* BaseWindow::New(gin::Arguments* const args) { auto options = gin_helper::Dictionary::CreateEmpty(args->isolate()); args->GetNext(&options); diff --git a/shell/browser/api/electron_api_base_window.h b/shell/browser/api/electron_api_base_window.h index 53ddd8cee191f..efb148e0cb69d 100644 --- a/shell/browser/api/electron_api_base_window.h +++ b/shell/browser/api/electron_api_base_window.h @@ -19,8 +19,11 @@ #include "shell/common/api/electron_api_native_image.h" #include "shell/common/gin_helper/trackable_object.h" -namespace gin_helper { +namespace gin { class Arguments; +} // namespace gin + +namespace gin_helper { class PersistentDictionary; template <typename T> class Handle; @@ -37,7 +40,7 @@ class View; class BaseWindow : public gin_helper::TrackableObject<BaseWindow>, private NativeWindowObserver { public: - static gin_helper::WrappableBase* New(gin_helper::Arguments* args); + static gin_helper::WrappableBase* New(gin::Arguments* args); static void BuildPrototype(v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> prototype); @@ -49,8 +52,7 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>, // Common constructor. BaseWindow(v8::Isolate* isolate, const gin_helper::Dictionary& options); // Creating independent BaseWindow instance. - BaseWindow(gin_helper::Arguments* args, - const gin_helper::Dictionary& options); + BaseWindow(gin::Arguments* args, const gin_helper::Dictionary& options); ~BaseWindow() override; // TrackableObject: @@ -118,13 +120,13 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>, bool IsMinimized() const; void SetFullScreen(bool fullscreen); bool IsFullscreen() const; - void SetBounds(const gfx::Rect& bounds, gin_helper::Arguments* args); + void SetBounds(const gfx::Rect& bounds, gin::Arguments* args); gfx::Rect GetBounds() const; - void SetSize(int width, int height, gin_helper::Arguments* args); + void SetSize(int width, int height, gin::Arguments* args); std::array<int, 2U> GetSize() const; - void SetContentSize(int width, int height, gin_helper::Arguments* args); + void SetContentSize(int width, int height, gin::Arguments* args); std::array<int, 2U> GetContentSize() const; - void SetContentBounds(const gfx::Rect& bounds, gin_helper::Arguments* args); + void SetContentBounds(const gfx::Rect& bounds, gin::Arguments* args); gfx::Rect GetContentBounds() const; bool IsNormal() const; gfx::Rect GetNormalBounds() const; @@ -132,11 +134,11 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>, std::array<int, 2U> GetMinimumSize() const; void SetMaximumSize(int width, int height); std::array<int, 2U> GetMaximumSize() const; - void SetSheetOffset(double offsetY, gin_helper::Arguments* args); + void SetSheetOffset(double offsetY, gin::Arguments* args); void SetResizable(bool resizable); bool IsResizable() const; void SetMovable(bool movable); - void MoveAbove(const std::string& sourceId, gin_helper::Arguments* args); + void MoveAbove(const std::string& sourceId, gin::Arguments* args); void MoveTop(); bool IsMovable() const; void SetMinimizable(bool minimizable); @@ -147,10 +149,10 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>, bool IsFullScreenable() const; void SetClosable(bool closable); bool IsClosable() const; - void SetAlwaysOnTop(bool top, gin_helper::Arguments* args); + void SetAlwaysOnTop(bool top, gin::Arguments* args); bool IsAlwaysOnTop() const; void Center(); - void SetPosition(int x, int y, gin_helper::Arguments* args); + void SetPosition(int x, int y, gin::Arguments* args); std::array<int, 2U> GetPosition() const; void SetTitle(const std::string& title); std::string GetTitle() const; @@ -177,25 +179,25 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>, std::string GetRepresentedFilename() const; void SetDocumentEdited(bool edited); bool IsDocumentEdited() const; - void SetIgnoreMouseEvents(bool ignore, gin_helper::Arguments* args); + void SetIgnoreMouseEvents(bool ignore, gin::Arguments* args); void SetContentProtection(bool enable); bool IsContentProtected() const; void SetFocusable(bool focusable); bool IsFocusable() const; void SetMenu(v8::Isolate* isolate, v8::Local<v8::Value> menu); void RemoveMenu(); - void SetParentWindow(v8::Local<v8::Value> value, gin_helper::Arguments* args); + void SetParentWindow(v8::Local<v8::Value> value, gin::Arguments* args); std::string GetMediaSourceId() const; v8::Local<v8::Value> GetNativeWindowHandle(); - void SetProgressBar(double progress, gin_helper::Arguments* args); + void SetProgressBar(double progress, gin::Arguments* args); void SetOverlayIcon(const gfx::Image& overlay, const std::string& description); - void SetVisibleOnAllWorkspaces(bool visible, gin_helper::Arguments* args); + void SetVisibleOnAllWorkspaces(bool visible, gin::Arguments* args); bool IsVisibleOnAllWorkspaces() const; void SetAutoHideCursor(bool auto_hide); virtual void SetVibrancy(v8::Isolate* isolate, v8::Local<v8::Value> value, - gin_helper::Arguments* args); + gin::Arguments* args); virtual void SetBackgroundMaterial(const std::string& material); #if BUILDFLAG(IS_MAC) @@ -218,14 +220,14 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>, void MergeAllWindows(); void MoveTabToNewWindow(); void ToggleTabBar(); - void AddTabbedWindow(NativeWindow* window, gin_helper::Arguments* args); + void AddTabbedWindow(NativeWindow* window, gin::Arguments* args); v8::Local<v8::Value> GetTabbingIdentifier(); void SetAutoHideMenuBar(bool auto_hide); bool IsMenuBarAutoHide() const; void SetMenuBarVisibility(bool visible); bool IsMenuBarVisible() const; - void SetAspectRatio(double aspect_ratio, gin_helper::Arguments* args); - void PreviewFile(const std::string& path, gin_helper::Arguments* args); + void SetAspectRatio(double aspect_ratio, gin::Arguments* args); + void PreviewFile(const std::string& path, gin::Arguments* args); void CloseFilePreview(); void SetGTKDarkThemeEnabled(bool use_dark_theme); @@ -236,7 +238,7 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>, bool IsModal() const; // Extra APIs added in JS. - bool SetThumbarButtons(gin_helper::Arguments* args); + bool SetThumbarButtons(gin::Arguments* args); #if defined(TOOLKIT_VIEWS) void SetIcon(v8::Isolate* isolate, v8::Local<v8::Value> icon); void SetIconImpl(v8::Isolate* isolate, @@ -255,13 +257,13 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>, bool SetThumbnailToolTip(const std::string& tooltip); void SetAppDetails(const gin_helper::Dictionary& options); bool IsSnapped() const; - void SetAccentColor(gin_helper::Arguments* args); + void SetAccentColor(gin::Arguments* args); v8::Local<v8::Value> GetAccentColor() const; #endif #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) void SetTitleBarOverlay(const gin_helper::Dictionary& options, - gin_helper::Arguments* args); + gin::Arguments* args); #endif [[nodiscard]] constexpr int32_t GetID() const { return weak_map_id(); } diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index 18d7d6e876013..fa447f6af055d 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -451,10 +451,10 @@ NativeWindowViews::~NativeWindowViews() { void NativeWindowViews::SetTitleBarOverlay( const gin_helper::Dictionary& options, - gin_helper::Arguments* args) { + gin::Arguments* args) { // Ensure WCO is already enabled on this window if (!IsWindowControlsOverlayEnabled()) { - args->ThrowError("Titlebar overlay is not enabled"); + args->ThrowTypeError("Titlebar overlay is not enabled"); return; } @@ -465,7 +465,7 @@ void NativeWindowViews::SetTitleBarOverlay( // Parse the string as a CSS color SkColor color; if (!content::ParseCssColorString(val, &color)) { - args->ThrowError("Could not parse color as CSS color"); + args->ThrowTypeError("Could not parse color as CSS color"); return; } @@ -479,7 +479,7 @@ void NativeWindowViews::SetTitleBarOverlay( // Parse the string as a CSS color SkColor color; if (!content::ParseCssColorString(val, &color)) { - args->ThrowError("Could not parse symbol color as CSS color"); + args->ThrowTypeError("Could not parse symbol color as CSS color"); return; } diff --git a/shell/browser/native_window_views.h b/shell/browser/native_window_views.h index 69d19ea6093ee..be0cca1c1f163 100644 --- a/shell/browser/native_window_views.h +++ b/shell/browser/native_window_views.h @@ -25,9 +25,9 @@ #include "shell/browser/ui/win/taskbar_host.h" #endif -namespace gin_helper { +namespace gin { class Arguments; -} // namespace gin_helper +} // namespace gin namespace electron { @@ -158,7 +158,7 @@ class NativeWindowViews : public NativeWindow, void DecrementChildModals(); void SetTitleBarOverlay(const gin_helper::Dictionary& options, - gin_helper::Arguments* args); + gin::Arguments* args); #if BUILDFLAG(IS_WIN) // Catch-all message handling and filtering. Called before From 624c27af91cedcf923a0063c7f6d3b7222d13d7b Mon Sep 17 00:00:00 2001 From: John Kleinschmidt <nilay2014@gmail.com> Date: Wed, 24 Sep 2025 16:35:14 -0400 Subject: [PATCH 086/268] test: rerun failed tests individually (#48205) * test: rerun failed tests individually * ci: use screencapture-nag-remover Needed to bypass the popup message "bash" is requesting to bypass the system private window picker and directly access your screen and audio. * Revert "chore: test with 1st quadrant of the window" No longer needed because of the addition of the screencapture-nag-remover script. This reverts commit f4a7e04c0b399aa9a85532f2c11fa35ad45bf71c. * test: fixup navigationHistory flake * rerun test up to 3 times --- .../pipeline-segment-electron-test.yml | 13 +- package.json | 1 + script/actions/screencapture-nag-remover.sh | 297 ++++++++++++++++++ script/spec-runner.js | 177 ++++++++++- spec/lib/screen-helpers.ts | 8 +- spec/webview-spec.ts | 4 +- yarn.lock | 14 +- 7 files changed, 487 insertions(+), 27 deletions(-) create mode 100755 script/actions/screencapture-nag-remover.sh diff --git a/.github/workflows/pipeline-segment-electron-test.yml b/.github/workflows/pipeline-segment-electron-test.yml index ceeaabd1703f6..e21c92a5ab285 100644 --- a/.github/workflows/pipeline-segment-electron-test.yml +++ b/.github/workflows/pipeline-segment-electron-test.yml @@ -110,11 +110,6 @@ jobs: configure_sys_tccdb "$values" fi done - - # Ref: https://github.com/getsentry/sentry-cocoa/blob/main/scripts/ci-enable-permissions.sh - if [ "$OSTYPE" = "darwin24" ]; then - defaults write ~/Library/Group\ Containers/group.com.apple.replayd/ScreenCaptureApprovals.plist "/bin/bash" -date "3024-09-23 12:00:00 +0000" - fi - name: Turn off the unexpectedly quit dialog on macOS if: ${{ inputs.target-platform == 'macos' }} run: defaults write com.apple.CrashReporter DialogType server @@ -127,6 +122,12 @@ jobs: path: src/electron fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} + - name: Turn off screenshot nag on macOS + if: ${{ inputs.target-platform == 'macos' }} + run: | + defaults write ~/Library/Group\ Containers/group.com.apple.replayd/ScreenCaptureApprovals.plist "/bin/bash" -date "3024-09-23 12:00:00 +0000" + src/electron/script/actions/screencapture-nag-remover.sh -a $(which bash) + src/electron/script/actions/screencapture-nag-remover.sh -a /opt/hca/hosted-compute-agent - name: Setup SSH Debugging if: ${{ inputs.target-platform == 'macos' && (inputs.enable-ssh || env.ACTIONS_STEP_DEBUG == 'true') }} uses: ./src/electron/.github/actions/ssh-debug @@ -227,7 +228,7 @@ jobs: export ELECTRON_FORCE_TEST_SUITE_EXIT="true" fi fi - node script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files + node script/yarn test --runners=main --enableRerun=3 --trace-uncaught --enable-logging --files $tests_files else chown :builduser .. && chmod g+w .. chown -R :builduser . && chmod -R g+w . diff --git a/package.json b/package.json index d45a2e60e4131..4ef5e62a0d34b 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@types/temp": "^0.9.4", "@typescript-eslint/eslint-plugin": "^8.32.1", "@typescript-eslint/parser": "^8.7.0", + "@xmldom/xmldom": "^0.8.11", "buffer": "^6.0.3", "chalk": "^4.1.0", "check-for-leaks": "^1.2.1", diff --git a/script/actions/screencapture-nag-remover.sh b/script/actions/screencapture-nag-remover.sh new file mode 100755 index 0000000000000..b62024fb2a345 --- /dev/null +++ b/script/actions/screencapture-nag-remover.sh @@ -0,0 +1,297 @@ +#!/bin/bash +# From https://github.com/luckman212/screencapture-nag-remover + +SELF='screencapture-nag-remover' +FQPN=$(realpath "$0") +PLIST="$HOME/Library/Group Containers/group.com.apple.replayd/ScreenCaptureApprovals.plist" +AGENT_PLIST="$HOME/Library/LaunchAgents/$SELF.plist" +MDM_PROFILE="$HOME/Downloads/macOS_15.1_DisableScreenCaptureAlerts.mobileconfig" +TCC_DB='/Library/Application Support/com.apple.TCC/TCC.db' +FUTURE=$(/bin/date -j -v+100y +"%Y-%m-%d %H:%M:%S +0000") +INTERVAL=86400 #run every 24h + +IFS='.' read -r MAJ MIN _ < <(/usr/bin/sw_vers --productVersion) +if (( MAJ < 15 )); then + echo >&2 "this tool requires macOS 15 (Sequoia)" + exit +fi + +_os_is_151_or_higher() { + (( MAJ >= 15 )) && (( MIN > 0 )) +} + +_fda_settings() { + /usr/bin/open 'x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles' +} + +_open_device_management() { + /usr/bin/open 'x-apple.systempreferences:com.apple.preferences.configurationprofiles' +} + +_bundleid_to_name() { + local APP_NAME + APP_NAME=$(/usr/bin/mdfind kMDItemCFBundleIdentifier == "$1" 2>/dev/null) + echo "${APP_NAME##*/}" +} + +_create_plist() { + cat <<-EOF 2>/dev/null >"$PLIST" + <?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <plist version="1.0"> + <dict> + </dict> + </plist> + EOF +} + +_bounce_daemons() { + /usr/bin/killall -HUP replayd + /usr/bin/killall -u "$USER" cfprefsd +} + +_nagblock() { + local APP_NAME + if _os_is_151_or_higher; then + if [[ -z $1 ]]; then + echo >&2 "supply the bundle ID of the app" + return 1 + fi + APP_NAME=$(_bundleid_to_name "$1") + echo "disabling nag for $1${APP_NAME:+ ($APP_NAME)}" + /usr/bin/defaults write "$PLIST" "$1" -dict \ + kScreenCaptureApprovalLastAlerted -date "$FUTURE" \ + kScreenCaptureApprovalLastUsed -date "$FUTURE" + (( c++ )) + else + if [[ -z $1 ]]; then + echo >&2 "supply complete pathname to the binary inside the app bundle" + return 1 + fi + [[ -e $1 ]] || { echo >&2 "$1 does not exist"; return 1; } + IFS='/' read -ra PARTS <<< "$1" + for p in "${PARTS[@]}"; do + if [[ $p == *.app ]]; then + APP_NAME=$p + break + fi + done + echo "disabling nag for ${APP_NAME:-$1}" + /usr/bin/defaults write "$PLIST" "$1" -date "$FUTURE" + (( c++ )) + return 0 + fi +} + +_enum_apps() { + [[ -e $PLIST ]] || return 1 + if _os_is_151_or_higher; then + /usr/bin/plutil -convert raw -o - -- "$PLIST" + else + /usr/bin/plutil -convert xml1 -o - -- "$PLIST" | + /usr/bin/sed -n "s/.*<key>\(.*\)<\/key>.*/\1/p" + fi +} + +_generate_mdm_profile() { +UUID1=$(/usr/bin/uuidgen) +UUID2=$(/usr/bin/uuidgen) +/bin/cat <<EOF >"$MDM_PROFILE" +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>PayloadContent</key> + <array> + <dict> + <key>PayloadDisplayName</key> + <string>Restrictions</string> + <key>PayloadIdentifier</key> + <string>com.apple.applicationaccess.${UUID2}</string> + <key>PayloadType</key> + <string>com.apple.applicationaccess</string> + <key>PayloadUUID</key> + <string>${UUID2}</string> + <key>PayloadVersion</key> + <integer>1</integer> + <key>forceBypassScreenCaptureAlert</key> + <true/> + </dict> + </array> + <key>PayloadDescription</key> + <string>Disables additional screen capture alerts on macOS 15.1 or higher</string> + <key>PayloadDisplayName</key> + <string>DisableScreenCaptureAlert</string> + <key>PayloadIdentifier</key> + <string>com.apple.applicationaccess.forceBypassScreenCaptureAlert</string> + <key>PayloadScope</key> + <string>System</string> + <key>PayloadType</key> + <string>Configuration</string> + <key>PayloadUUID</key> + <string>${UUID1}</string> + <key>PayloadVersion</key> + <integer>1</integer> + <key>TargetDeviceType</key> + <integer>5</integer> +</dict> +</plist> +EOF +#Apple prohibits self-installing TCC profiles, they can only be pushed via MDM +#/usr/bin/open "$MDM_PROFILE" +#_open_device_management +echo "import ${MDM_PROFILE##*/} into your MDM to provision it" +/usr/bin/open -R "$MDM_PROFILE" +} + +_uninstall_launchagent() { + /bin/launchctl bootout gui/$UID "$AGENT_PLIST" 2>/dev/null + /bin/rm 2>/dev/null "$AGENT_PLIST" + echo "uninstalled $SELF LaunchAgent" +} + +_install_launchagent() { + _uninstall_launchagent &>/dev/null + read -r FDA_TEST < <(/usr/bin/sqlite3 "$TCC_DB" <<-EOS + SELECT COUNT(client) + FROM access + WHERE + client = '/bin/bash' AND + service = 'kTCCServiceSystemPolicyAllFiles' AND + auth_value = 2 + EOS + ) + if (( FDA_TEST == 0 )); then + /bin/cat <<-EOF >&2 + ┌──────────────────────────────────────────────────────────────────────────────────────┐ + │ For the LaunchAgent to work properly, you must grant Full Disk Access to /bin/bash │ + │ │ + │ The Full Disk Access settings panel will now be opened. Press the (+) button near │ + │ the bottom of the window, then press [⌘cmd + ⇧shift + g] and type '/bin/bash' and │ + │ click Open to get it to appear in the app list. │ + │ │ + │ Once that's all done, run the --install command again. │ + └──────────────────────────────────────────────────────────────────────────────────────┘ + EOF + sleep 3 + _fda_settings + return 1 + fi + /bin/cat >"$AGENT_PLIST" <<-EOF + <?xml version="1.0" encoding="UTF-8"?> + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + <plist version="1.0"> + <dict> + <key>Label</key> + <string>$SELF.agent</string> + <key>ProgramArguments</key> + <array> + <string>/bin/bash</string> + <string>--norc</string> + <string>--noprofile</string> + <string>$FQPN</string> + </array> + <key>StandardErrorPath</key> + <string>/private/tmp/$SELF.stderr</string> + <key>StandardOutPath</key> + <string>/private/tmp/$SELF.stdout</string> + <key>StartInterval</key> + <integer>$INTERVAL</integer> + <key>WorkingDirectory</key> + <string>/private/tmp</string> + </dict> + </plist> + EOF + /bin/chmod 644 "$PLIST" + if /bin/launchctl bootstrap gui/$UID "$AGENT_PLIST"; then + echo "installed $SELF LaunchAgent" + fi +} + +_manual_add_desc() { + if _os_is_151_or_higher ; then + echo "-a,--add <bundle_id> manually create an entry" + else + echo "-a,--add <path> manually create an entry (supply full path to binary)" + fi +} + +case $1 in + -h|--help) + /bin/cat <<-EOF + + a tool to help suppress macOS Sequoia's persistent ScreenCapture alerts + usage: ${0##*/} [args] + -r,--reveal show ${PLIST##*/} in Finder + -p,--print print current values + $(_manual_add_desc) + --reset initialize empty ${PLIST##*/} + --generate_profile generate configuration profile for use with your MDM server + --profiles opens Device Management in System Settings + --install install LaunchAgent to ensure alerts continue to be silenced + --uninstall remove LaunchAgent + EOF + if _os_is_151_or_higher; then /bin/cat <<-EOF + + ┌────────────────────────────────────────────────────────────────────────────────────┐ + │ macOS 15.1 introduced an official method for suppressing ScreenCapture alerts │ + │ for ALL apps on Macs enrolled in an MDM server (Jamf, Addigy, Mosyle etc). │ + │ │ + │ A configuration profile to enable this can be generated using --generate_profile │ + └────────────────────────────────────────────────────────────────────────────────────┘ + + EOF + fi + exit + ;; + -r|--reveal) + if [[ -e $PLIST ]]; then + /usr/bin/open -R "$PLIST" + else + /usr/bin/open "$(/usr/bin/dirname "$PLIST")" + fi + exit + ;; + -p|--print) + if [[ -e $PLIST ]]; then + /usr/bin/plutil -p "$PLIST" + else + echo >&2 "${PLIST##*/} does not exist" + fi + exit + ;; + --reset) _create_plist || echo >&2 "error, could not create ${PLIST##*/}"; exit;; + --generate_profile) _generate_mdm_profile; exit;; + --profiles) _open_device_management; exit;; + --install) _install_launchagent; exit;; + --uninstall) _uninstall_launchagent; exit;; +esac + +[[ -e $PLIST ]] || _create_plist +if ! /usr/bin/touch "$PLIST" 2>/dev/null; then + if [[ -n $__CFBundleIdentifier ]]; then + TERMINAL_NAME=$(_bundleid_to_name "$__CFBundleIdentifier") + fi + echo >&2 "Full Disk Access permissions are missing${TERMINAL_NAME:+ for $TERMINAL_NAME}" + exit 1 +fi + +case $1 in + -a|--add) + _nagblock "$2" + _bounce_daemons + exit + ;; + -*) echo >&2 "invalid arg: $1"; exit 1;; +esac + +c=0 +while read -r APP_PATH ; do + [[ -n $APP_PATH ]] || continue + _nagblock "$APP_PATH" +done < <(_enum_apps) + +#bounce daemons if any changes were made so the new settings take effect +(( c > 0 )) && _bounce_daemons + +exit 0 diff --git a/script/spec-runner.js b/script/spec-runner.js index 3457fdb34a9f1..4c5e72acac0c5 100755 --- a/script/spec-runner.js +++ b/script/spec-runner.js @@ -2,6 +2,7 @@ const { ElectronVersions, Installer } = require('@electron/fiddle-core'); +const { DOMParser } = require('@xmldom/xmldom'); const chalk = require('chalk'); const { hashElement } = require('folder-hash'); const minimist = require('minimist'); @@ -21,6 +22,7 @@ const FAILURE_STATUS_KEY = 'Electron_Spec_Runner_Failures'; const args = minimist(process.argv, { string: ['runners', 'target', 'electronVersion'], + number: ['enableRerun'], unknown: arg => unknownFlags.push(arg) }); @@ -191,7 +193,160 @@ async function asyncSpawn (exe, runnerArgs) { }); } -async function runTestUsingElectron (specDir, testName) { +function parseJUnitXML (specDir) { + if (!fs.existsSync(process.env.MOCHA_FILE)) { + console.error('JUnit XML file not found:', process.env.MOCHA_FILE); + return []; + } + + const xmlContent = fs.readFileSync(process.env.MOCHA_FILE, 'utf8'); + const parser = new DOMParser(); + const xmlDoc = parser.parseFromString(xmlContent, 'text/xml'); + + const failedTests = []; + // find failed tests by looking for all testsuite nodes with failure > 0 + const testSuites = xmlDoc.getElementsByTagName('testsuite'); + for (let i = 0; i < testSuites.length; i++) { + const testSuite = testSuites[i]; + const failures = testSuite.getAttribute('failures'); + if (failures > 0) { + const testcases = testSuite.getElementsByTagName('testcase'); + + for (let i = 0; i < testcases.length; i++) { + const testcase = testcases[i]; + const failures = testcase.getElementsByTagName('failure'); + const errors = testcase.getElementsByTagName('error'); + + if (failures.length > 0 || errors.length > 0) { + const testName = testcase.getAttribute('name'); + const filePath = testSuite.getAttribute('file'); + const fileName = filePath ? path.relative(specDir, filePath) : 'unknown file'; + const failureInfo = { + name: testName, + file: fileName, + filePath + }; + if (failures.length > 0) { + failureInfo.failure = failures[0].textContent || failures[0].nodeValue || 'No failure message'; + } + + if (errors.length > 0) { + failureInfo.error = errors[0].textContent || errors[0].nodeValue || 'No error message'; + } + + failedTests.push(failureInfo); + } + } + } + } + + return failedTests; +} + +async function rerunFailedTest (specDir, testName, testInfo) { + console.log('\n========================================'); + console.log(`Rerunning failed test: ${testInfo.name} (${testInfo.file})`); + console.log('========================================'); + + let grepPattern = testInfo.name; + + // Escape special regex characters in test name + grepPattern = grepPattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + + const args = []; + if (testInfo.filePath) { + args.push('--files', testInfo.filePath); + } + args.push('-g', grepPattern); + + const success = await runTestUsingElectron(specDir, testName, false, args); + + if (success) { + console.log(`✅ Test passed: ${testInfo.name}`); + return true; + } else { + console.log(`❌ Test failed again: ${testInfo.name}`); + return false; + } +} + +async function rerunFailedTests (specDir, testName) { + console.log('\n📋 Parsing JUnit XML for failed tests...'); + const failedTests = parseJUnitXML(specDir); + + if (failedTests.length === 0) { + console.log('No failed tests could be found.'); + process.exit(1); + return; + } + + // Save off the original junit xml file + if (fs.existsSync(process.env.MOCHA_FILE)) { + fs.copyFileSync(process.env.MOCHA_FILE, `${process.env.MOCHA_FILE}.save`); + } + + console.log(`\n📊 Found ${failedTests.length} failed test(s):`); + failedTests.forEach((test, index) => { + console.log(` ${index + 1}. ${test.name} (${test.file})`); + }); + + // Step 3: Rerun each failed test individually + console.log('\n🔄 Rerunning failed tests individually...\n'); + + const results = { + total: failedTests.length, + passed: 0, + failed: 0 + }; + + let index = 0; + for (const testInfo of failedTests) { + let runCount = 0; + let success = false; + let retryTest = false; + while (!success && (runCount < args.enableRerun)) { + success = await rerunFailedTest(specDir, testName, testInfo); + if (success) { + results.passed++; + } else { + if (runCount === args.enableRerun - 1) { + results.failed++; + } else { + retryTest = true; + console.log(`Retrying test (${runCount + 1}/${args.enableRerun})...`); + } + } + + // Add a small delay between tests + if (retryTest || index < failedTests.length - 1) { + console.log('\nWaiting 2 seconds before next test...'); + await new Promise(resolve => setTimeout(resolve, 2000)); + } + runCount++; + } + index++; + }; + + // Step 4: Summary + console.log('\n📈 Summary:'); + console.log(`Total failed tests: ${results.total}`); + console.log(`Passed on rerun: ${results.passed}`); + console.log(`Still failing: ${results.failed}`); + + // Restore the original junit xml file + if (fs.existsSync(`${process.env.MOCHA_FILE}.save`)) { + fs.renameSync(`${process.env.MOCHA_FILE}.save`, process.env.MOCHA_FILE); + } + + if (results.failed === 0) { + console.log('🎉 All previously failed tests now pass!'); + } else { + console.log(`⚠️ ${results.failed} test(s) are still failing`); + process.exit(1); + } +} + +async function runTestUsingElectron (specDir, testName, shouldRerun, additionalArgs = []) { let exe; if (args.electronVersion) { const installer = new Installer(); @@ -199,11 +354,16 @@ async function runTestUsingElectron (specDir, testName) { } else { exe = path.resolve(BASE, utils.getElectronExec()); } - const runnerArgs = [`electron/${specDir}`, ...unknownArgs.slice(2)]; + let argsToPass = unknownArgs.slice(2); + if (additionalArgs.includes('--files')) { + argsToPass = argsToPass.filter(arg => (arg.toString().indexOf('--files') === -1 && arg.toString().indexOf('spec/') === -1)); + } + const runnerArgs = [`electron/${specDir}`, ...argsToPass, ...additionalArgs]; if (process.platform === 'linux') { runnerArgs.unshift(path.resolve(__dirname, 'dbus_mock.py'), exe); exe = 'python3'; } + console.log(`Running: ${exe} ${runnerArgs.join(' ')}`); const { status, signal } = await asyncSpawn(exe, runnerArgs); if (status !== 0) { if (status) { @@ -212,13 +372,22 @@ async function runTestUsingElectron (specDir, testName) { } else { console.log(`${fail} Electron tests failed with kill signal ${signal}.`); } - process.exit(1); + if (shouldRerun) { + await rerunFailedTests(specDir, testName); + } else { + return false; + } } console.log(`${pass} Electron ${testName} process tests passed.`); + return true; } async function runMainProcessElectronTests () { - await runTestUsingElectron('spec', 'main'); + let shouldRerun = false; + if (args.enableRerun && args.enableRerun > 0) { + shouldRerun = true; + } + await runTestUsingElectron('spec', 'main', shouldRerun); } async function installSpecModules (dir) { diff --git a/spec/lib/screen-helpers.ts b/spec/lib/screen-helpers.ts index ff68a5bb983d4..2358e5a35cd51 100644 --- a/spec/lib/screen-helpers.ts +++ b/spec/lib/screen-helpers.ts @@ -78,13 +78,9 @@ function areColorsSimilar ( } function displayCenter (display: Electron.Display): Electron.Point { - // On macOS, we get system prompt to ask permission for screen capture - // taking up space in the center. As a workaround, choose - // area of the application window which is not covered by the prompt. - // TODO: Remove this when the prompt situation is resolved. return { - x: display.size.width / (process.platform === 'darwin' ? 4 : 2), - y: display.size.height / (process.platform === 'darwin' ? 4 : 2) + x: display.size.width / 2, + y: display.size.height / 2 }; } diff --git a/spec/webview-spec.ts b/spec/webview-spec.ts index a7e2989cd0948..23d07e32569d8 100644 --- a/spec/webview-spec.ts +++ b/spec/webview-spec.ts @@ -1,4 +1,4 @@ -import { BrowserWindow, session, ipcMain, app, WebContents, screen } from 'electron/main'; +import { BrowserWindow, session, ipcMain, app, WebContents } from 'electron/main'; import * as auth from 'basic-auth'; import { expect } from 'chai'; @@ -782,7 +782,6 @@ describe('<webview> tag', function () { let w: BrowserWindow; before(async () => { - const display = screen.getPrimaryDisplay(); w = new BrowserWindow({ webPreferences: { webviewTag: true, @@ -790,7 +789,6 @@ describe('<webview> tag', function () { contextIsolation: false } }); - w.setBounds(display.bounds); await w.loadURL(`file://${fixtures}/pages/flex-webview.html`); w.setBackgroundColor(WINDOW_BACKGROUND_COLOR); }); diff --git a/yarn.lock b/yarn.lock index c995f4b7fd886..bd5c1017a43fe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1345,6 +1345,11 @@ resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-2.0.5.tgz#325db42395cd49fe6c14057f9a900e427df8810e" integrity sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ== +"@xmldom/xmldom@^0.8.11": + version "0.8.11" + resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.8.11.tgz#b79de2d67389734c57c52595f7a7305e30c2d608" + integrity sha512-cQzWCtO6C8TQiYl1ruKNn2U6Ao4o4WBBcbL61yJl84x+j5sOWWFU9X7DpND8XZG3daDppSsigMdfAIl2upQBRw== + "@xtuc/ieee754@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" @@ -7347,14 +7352,7 @@ stringify-entities@^4.0.0: character-entities-html4 "^2.0.0" character-entities-legacy "^3.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== From efe9c394556483db47c4a1fc787d1027a5e22d29 Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Wed, 24 Sep 2025 19:10:05 -0500 Subject: [PATCH 087/268] refactor: prefer upstream `gin::Arguments::ThrowTypeError()` over `gin_helper` (#48368) * refactor: use gin::Arguments::ThrowTypeError() in AutoUpdater::SetFeedURL() * refactor: use gin::Arguments::ThrowTypeError() in Browser::Focus() * refactor: use gin::Arguments::ThrowTypeError() in SystemPreferences::SetUserDefault() * refactor: use gin::Arguments::ThrowTypeError() in UtilityProcessWrapper::Create() * refactor: use gin::Arguments::ThrowTypeError() in UtilityProcessWrapper::PostMessage() * refactor: use gin::Arguments::ThrowTypeError() in ElectronBundleMover::ShouldContinueMove() * refactor: use gin::Arguments::ThrowTypeError() in OnClientCertificateSelected() * refactor: use gin::Arguments::ThrowTypeError() in Session::ClearData() * refactor: use gin::Arguments::ThrowTypeError() in ElectronBrowserContext::DisplayMediaDeviceChosen() * refactor: use gin::Arguments::ThrowTypeError() in WebContents::ReplaceMisspelling() * refactor: use gin::Arguments::ThrowTypeError() in WebContents::Print() * chore: iwyu shell/common/gin_helper/error_thrower.h --- shell/browser/api/electron_api_app.cc | 7 ++--- .../api/electron_api_service_worker_main.cc | 1 - shell/browser/api/electron_api_session.cc | 9 +++--- shell/browser/api/electron_api_session.h | 3 +- .../api/electron_api_system_preferences.cc | 1 - .../electron_api_system_preferences_mac.mm | 6 ++-- .../api/electron_api_utility_process.cc | 29 +++++++++---------- .../browser/api/electron_api_web_contents.cc | 22 +++++++------- shell/browser/auto_updater_mac.mm | 10 +++---- shell/browser/browser_mac.mm | 11 +++---- shell/browser/electron_browser_context.cc | 27 +++++++---------- .../browser/ui/cocoa/electron_bundle_mover.h | 3 +- .../browser/ui/cocoa/electron_bundle_mover.mm | 15 +++++----- shell/common/gin_converters/osr_converter.cc | 1 - 14 files changed, 61 insertions(+), 84 deletions(-) diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc index dd5cfe93308d2..b103a424fb473 100644 --- a/shell/browser/api/electron_api_app.cc +++ b/shell/browser/api/electron_api_app.cc @@ -455,10 +455,10 @@ void GotPrivateKey(std::shared_ptr<content::ClientCertificateDelegate> delegate, } void OnClientCertificateSelected( - v8::Isolate* isolate, + v8::Isolate* const isolate, std::shared_ptr<content::ClientCertificateDelegate> delegate, std::shared_ptr<net::ClientCertIdentityList> identities, - gin::Arguments* args) { + gin::Arguments* const args) { if (args->Length() == 2) { delegate->ContinueWithCertificate(nullptr, nullptr); return; @@ -473,8 +473,7 @@ void OnClientCertificateSelected( gin_helper::Dictionary cert_data; if (!gin::ConvertFromV8(isolate, val, &cert_data)) { - gin_helper::ErrorThrower(isolate).ThrowError( - "Must pass valid certificate object."); + args->ThrowTypeError("Must pass valid certificate object."); return; } diff --git a/shell/browser/api/electron_api_service_worker_main.cc b/shell/browser/api/electron_api_service_worker_main.cc index c6cc18a7cf1a2..f239466893e5f 100644 --- a/shell/browser/api/electron_api_service_worker_main.cc +++ b/shell/browser/api/electron_api_service_worker_main.cc @@ -21,7 +21,6 @@ #include "shell/common/gin_converters/gurl_converter.h" #include "shell/common/gin_converters/value_converter.h" #include "shell/common/gin_helper/dictionary.h" -#include "shell/common/gin_helper/error_thrower.h" #include "shell/common/gin_helper/handle.h" #include "shell/common/gin_helper/object_template_builder.h" #include "shell/common/gin_helper/promise.h" diff --git a/shell/browser/api/electron_api_session.cc b/shell/browser/api/electron_api_session.cc index 876fc93e821e8..14f87ac72ee2e 100644 --- a/shell/browser/api/electron_api_session.cc +++ b/shell/browser/api/electron_api_session.cc @@ -1469,9 +1469,8 @@ v8::Local<v8::Promise> Session::ClearCodeCaches( return handle; } -v8::Local<v8::Value> Session::ClearData(gin_helper::ErrorThrower thrower, - gin::Arguments* args) { - auto* isolate = JavascriptEnvironment::GetIsolate(); +v8::Local<v8::Value> Session::ClearData(gin::Arguments* const args) { + v8::Isolate* const isolate = JavascriptEnvironment::GetIsolate(); BrowsingDataRemover::DataType data_type_mask = kClearDataTypeAll; std::vector<url::Origin> origins; @@ -1501,7 +1500,7 @@ v8::Local<v8::Value> Session::ClearData(gin_helper::ErrorThrower thrower, options.Get("excludeOrigins", &exclude_origin_urls); if (has_origins_key && has_exclude_origins_key) { - thrower.ThrowError( + args->ThrowTypeError( "Cannot provide both 'origins' and 'excludeOrigins'"); return v8::Undefined(isolate); } @@ -1520,7 +1519,7 @@ v8::Local<v8::Value> Session::ClearData(gin_helper::ErrorThrower thrower, // Opaque origins cannot be used with this API if (origin.opaque()) { - thrower.ThrowError(absl::StrFormat( + args->ThrowTypeError(absl::StrFormat( "Invalid origin: '%s'", origin_url.possibly_invalid_spec())); return v8::Undefined(isolate); } diff --git a/shell/browser/api/electron_api_session.h b/shell/browser/api/electron_api_session.h index c69e21e724f95..da7b64be912f2 100644 --- a/shell/browser/api/electron_api_session.h +++ b/shell/browser/api/electron_api_session.h @@ -170,8 +170,7 @@ class Session final : public gin::Wrappable<Session>, v8::Local<v8::Value> GetPath(v8::Isolate* isolate); void SetCodeCachePath(gin::Arguments* args); v8::Local<v8::Promise> ClearCodeCaches(const gin_helper::Dictionary& options); - v8::Local<v8::Value> ClearData(gin_helper::ErrorThrower thrower, - gin::Arguments* args); + v8::Local<v8::Value> ClearData(gin::Arguments* args); #if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER) base::Value GetSpellCheckerLanguages(); void SetSpellCheckerLanguages(gin_helper::ErrorThrower thrower, diff --git a/shell/browser/api/electron_api_system_preferences.cc b/shell/browser/api/electron_api_system_preferences.cc index ca3c95775973a..053cd89728aee 100644 --- a/shell/browser/api/electron_api_system_preferences.cc +++ b/shell/browser/api/electron_api_system_preferences.cc @@ -7,7 +7,6 @@ #include "shell/common/gin_converters/callback_converter.h" #include "shell/common/gin_converters/value_converter.h" #include "shell/common/gin_helper/dictionary.h" -#include "shell/common/gin_helper/error_thrower.h" #include "shell/common/gin_helper/handle.h" #include "shell/common/node_includes.h" #include "ui/gfx/animation/animation.h" diff --git a/shell/browser/api/electron_api_system_preferences_mac.mm b/shell/browser/api/electron_api_system_preferences_mac.mm index eb9d3e972d8a1..f0f39f43b91fb 100644 --- a/shell/browser/api/electron_api_system_preferences_mac.mm +++ b/shell/browser/api/electron_api_system_preferences_mac.mm @@ -367,13 +367,11 @@ AVMediaType ParseMediaType(const std::string& media_type) { } } } else { - gin_helper::ErrorThrower(args->isolate()) - .ThrowTypeError("Invalid type: " + type); + args->ThrowTypeError("Invalid type: " + type); return; } - gin_helper::ErrorThrower(args->isolate()) - .ThrowTypeError("Unable to convert value to: " + type); + args->ThrowTypeError("Unable to convert value to: " + type); } std::string SystemPreferences::GetAccentColor() { diff --git a/shell/browser/api/electron_api_utility_process.cc b/shell/browser/api/electron_api_utility_process.cc index fe6bde85eecc3..08bd1c95d7447 100644 --- a/shell/browser/api/electron_api_utility_process.cc +++ b/shell/browser/api/electron_api_utility_process.cc @@ -26,7 +26,6 @@ #include "shell/common/gin_converters/callback_converter.h" #include "shell/common/gin_converters/file_path_converter.h" #include "shell/common/gin_helper/dictionary.h" -#include "shell/common/gin_helper/error_thrower.h" #include "shell/common/gin_helper/handle.h" #include "shell/common/gin_helper/object_template_builder.h" #include "shell/common/node_includes.h" @@ -329,17 +328,17 @@ void UtilityProcessWrapper::Shutdown(uint64_t exit_code) { HandleTermination(exit_code); } -void UtilityProcessWrapper::PostMessage(gin::Arguments* args) { +void UtilityProcessWrapper::PostMessage(gin::Arguments* const args) { if (!node_service_remote_.is_connected()) return; blink::TransferableMessage transferable_message; - gin_helper::ErrorThrower thrower(args->isolate()); + v8::Isolate* const isolate = args->isolate(); // |message| is any value that can be serialized to StructuredClone. v8::Local<v8::Value> message_value; if (args->GetNext(&message_value)) { - if (!electron::SerializeV8Value(args->isolate(), message_value, + if (!electron::SerializeV8Value(isolate, message_value, &transferable_message)) { // SerializeV8Value sets an exception. return; @@ -350,31 +349,30 @@ void UtilityProcessWrapper::PostMessage(gin::Arguments* args) { std::vector<gin_helper::Handle<MessagePort>> wrapped_ports; if (args->GetNext(&transferables)) { std::vector<v8::Local<v8::Value>> wrapped_port_values; - if (!gin::ConvertFromV8(args->isolate(), transferables, - &wrapped_port_values)) { - thrower.ThrowTypeError("transferables must be an array of MessagePorts"); + if (!gin::ConvertFromV8(isolate, transferables, &wrapped_port_values)) { + args->ThrowTypeError("transferables must be an array of MessagePorts"); return; } for (size_t i = 0; i < wrapped_port_values.size(); ++i) { if (!gin_helper::IsValidWrappable(wrapped_port_values[i], &MessagePort::kWrapperInfo)) { - thrower.ThrowTypeError( + args->ThrowTypeError( base::StrCat({"Port at index ", base::NumberToString(i), " is not a valid port"})); return; } } - if (!gin::ConvertFromV8(args->isolate(), transferables, &wrapped_ports)) { - thrower.ThrowTypeError("Passed an invalid MessagePort"); + if (!gin::ConvertFromV8(isolate, transferables, &wrapped_ports)) { + args->ThrowTypeError("Passed an invalid MessagePort"); return; } } bool threw_exception = false; - transferable_message.ports = MessagePort::DisentanglePorts( - args->isolate(), wrapped_ports, &threw_exception); + transferable_message.ports = + MessagePort::DisentanglePorts(isolate, wrapped_ports, &threw_exception); if (threw_exception) return; @@ -436,11 +434,10 @@ raw_ptr<UtilityProcessWrapper> UtilityProcessWrapper::FromProcessId( // static gin_helper::Handle<UtilityProcessWrapper> UtilityProcessWrapper::Create( - gin::Arguments* args) { + gin::Arguments* const args) { if (!Browser::Get()->is_ready()) { - gin_helper::ErrorThrower(args->isolate()) - .ThrowTypeError( - "utilityProcess cannot be created before app is ready."); + args->ThrowTypeError( + "utilityProcess cannot be created before app is ready."); return {}; } diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 47820301daff8..4385a3f75e64f 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -3031,23 +3031,24 @@ void OnPDFCreated(gin_helper::Promise<v8::Local<v8::Value>> promise, } } // namespace -void WebContents::Print(gin::Arguments* args) { - auto options = gin_helper::Dictionary::CreateEmpty(args->isolate()); - base::Value::Dict settings; +void WebContents::Print(gin::Arguments* const args) { + v8::Isolate* const isolate = args->isolate(); + auto options = gin_helper::Dictionary::CreateEmpty(isolate); if (args->Length() >= 1 && !args->GetNext(&options)) { - gin_helper::ErrorThrower(args->isolate()) - .ThrowError("webContents.print(): Invalid print settings specified."); + args->ThrowTypeError( + "webContents.print(): Invalid print settings specified."); return; } printing::CompletionCallback callback; if (args->Length() == 2 && !args->GetNext(&callback)) { - gin_helper::ErrorThrower(args->isolate()) - .ThrowError("webContents.print(): Invalid optional callback provided."); + args->ThrowTypeError( + "webContents.print(): Invalid optional callback provided."); return; } + base::Value::Dict settings; if (options.IsEmptyObject()) { content::RenderFrameHost* rfh = GetRenderFrameHostToUse(web_contents()); if (!rfh) @@ -3069,7 +3070,7 @@ void WebContents::Print(gin::Arguments* args) { options.ValueOrDefault("printBackground", false)); // Set custom margin settings - auto margins = gin_helper::Dictionary::CreateEmpty(args->isolate()); + auto margins = gin_helper::Dictionary::CreateEmpty(isolate); if (options.Get("margins", &margins)) { printing::mojom::MarginType margin_type = printing::mojom::MarginType::kDefaultMargins; @@ -3349,11 +3350,10 @@ void WebContents::ReplaceMisspelling(const std::u16string& word) { web_contents()->ReplaceMisspelling(word); } -uint32_t WebContents::FindInPage(gin::Arguments* args) { +uint32_t WebContents::FindInPage(gin::Arguments* const args) { std::u16string search_text; if (!args->GetNext(&search_text) || search_text.empty()) { - gin_helper::ErrorThrower(args->isolate()) - .ThrowError("Must provide a non-empty search content"); + args->ThrowTypeError("Must provide a non-empty search content"); return 0; } diff --git a/shell/browser/auto_updater_mac.mm b/shell/browser/auto_updater_mac.mm index 91c077b12e1f7..cfc0755cdf9ed 100644 --- a/shell/browser/auto_updater_mac.mm +++ b/shell/browser/auto_updater_mac.mm @@ -18,7 +18,6 @@ #include "shell/browser/browser.h" #include "shell/common/gin_converters/value_converter.h" #include "shell/common/gin_helper/dictionary.h" -#include "shell/common/gin_helper/error_thrower.h" namespace auto_updater { @@ -31,8 +30,7 @@ } // namespace // static -void AutoUpdater::SetFeedURL(gin::Arguments* args) { - gin_helper::ErrorThrower thrower(args->isolate()); +void AutoUpdater::SetFeedURL(gin::Arguments* const args) { gin_helper::Dictionary opts; std::string feed; @@ -45,7 +43,7 @@ } } else if (args->GetNext(&opts)) { if (!opts.Get("url", &feed)) { - thrower.ThrowError( + args->ThrowTypeError( "Expected options object to contain a 'url' string property in " "setFeedUrl call"); return; @@ -53,11 +51,11 @@ opts.Get("headers", &requestHeaders); opts.Get("serverType", &serverType); if (serverType != "default" && serverType != "json") { - thrower.ThrowError("Expected serverType to be 'default' or 'json'"); + args->ThrowTypeError("Expected serverType to be 'default' or 'json'"); return; } } else { - thrower.ThrowError( + args->ThrowTypeError( "Expected an options object with a 'url' property to be provided"); return; } diff --git a/shell/browser/browser_mac.mm b/shell/browser/browser_mac.mm index e7a4468649df6..c4fddaa05a595 100644 --- a/shell/browser/browser_mac.mm +++ b/shell/browser/browser_mac.mm @@ -137,13 +137,10 @@ LoginItemSettings GetLoginItemSettingsDeprecated() { gin_helper::Dictionary opts; bool steal_focus = false; - if (args->GetNext(&opts)) { - gin_helper::ErrorThrower thrower(args->isolate()); - if (!opts.Get("steal", &steal_focus)) { - thrower.ThrowError( - "Expected options object to contain a 'steal' boolean property"); - return; - } + if (args->GetNext(&opts) && !opts.Get("steal", &steal_focus)) { + args->ThrowTypeError( + "Expected options object to contain a 'steal' boolean property"); + return; } [[AtomApplication sharedApplication] activateIgnoringOtherApps:steal_focus]; diff --git a/shell/browser/electron_browser_context.cc b/shell/browser/electron_browser_context.cc index 18fccacabae2f..f33da024719b8 100644 --- a/shell/browser/electron_browser_context.cc +++ b/shell/browser/electron_browser_context.cc @@ -66,7 +66,6 @@ #include "shell/common/electron_paths.h" #include "shell/common/gin_converters/frame_converter.h" #include "shell/common/gin_helper/dictionary.h" -#include "shell/common/gin_helper/error_thrower.h" #include "shell/common/options_switches.h" #include "shell/common/thread_restrictions.h" #include "third_party/blink/public/common/page/page_zoom.h" @@ -681,7 +680,7 @@ void ElectronBrowserContext::SetDisplayMediaRequestHandler( void ElectronBrowserContext::DisplayMediaDeviceChosen( const content::MediaStreamRequest& request, content::MediaResponseCallback callback, - gin::Arguments* args) { + gin::Arguments* const args) { blink::mojom::StreamDevicesSetPtr stream_devices_set = blink::mojom::StreamDevicesSet::New(); v8::Local<v8::Value> result; @@ -693,10 +692,9 @@ void ElectronBrowserContext::DisplayMediaDeviceChosen( } gin_helper::Dictionary result_dict; if (!gin::ConvertFromV8(args->isolate(), result, &result_dict)) { - gin_helper::ErrorThrower(args->isolate()) - .ThrowTypeError( - "Display Media Request streams callback must be called with null " - "or a valid object"); + args->ThrowTypeError( + "Display Media Request streams callback must be called with null " + "or a valid object"); std::move(callback).Run( blink::mojom::StreamDevicesSet(), blink::mojom::MediaStreamRequestResult::CAPTURE_FAILURE, nullptr); @@ -735,9 +733,8 @@ void ElectronBrowserContext::DisplayMediaDeviceChosen( content::DesktopMediaID::Parse(video_device.id)); devices.video_device = video_device; } else { - gin_helper::ErrorThrower(args->isolate()) - .ThrowTypeError( - "video must be a WebFrameMain or DesktopCapturerSource"); + args->ThrowTypeError( + "video must be a WebFrameMain or DesktopCapturerSource"); std::move(callback).Run( blink::mojom::StreamDevicesSet(), blink::mojom::MediaStreamRequestResult::CAPTURE_FAILURE, nullptr); @@ -784,10 +781,9 @@ void ElectronBrowserContext::DisplayMediaDeviceChosen( GetAudioDesktopMediaId(request.requested_audio_device_ids)); devices.audio_device = audio_device; } else { - gin_helper::ErrorThrower(args->isolate()) - .ThrowTypeError( - "audio must be a WebFrameMain, \"loopback\" or " - "\"loopbackWithMute\""); + args->ThrowTypeError( + "audio must be a WebFrameMain, \"loopback\" or " + "\"loopbackWithMute\""); std::move(callback).Run( blink::mojom::StreamDevicesSet(), blink::mojom::MediaStreamRequestResult::CAPTURE_FAILURE, nullptr); @@ -796,9 +792,8 @@ void ElectronBrowserContext::DisplayMediaDeviceChosen( } if ((video_requested && !has_video)) { - gin_helper::ErrorThrower(args->isolate()) - .ThrowTypeError( - "Video was requested, but no video stream was provided"); + args->ThrowTypeError( + "Video was requested, but no video stream was provided"); std::move(callback).Run( blink::mojom::StreamDevicesSet(), blink::mojom::MediaStreamRequestResult::CAPTURE_FAILURE, nullptr); diff --git a/shell/browser/ui/cocoa/electron_bundle_mover.h b/shell/browser/ui/cocoa/electron_bundle_mover.h index 5c944952606fe..59b48e099e203 100644 --- a/shell/browser/ui/cocoa/electron_bundle_mover.h +++ b/shell/browser/ui/cocoa/electron_bundle_mover.h @@ -26,8 +26,7 @@ class ElectronBundleMover { static bool IsCurrentAppInApplicationsFolder(); private: - static bool ShouldContinueMove(gin_helper::ErrorThrower thrower, - BundlerMoverConflictType type, + static bool ShouldContinueMove(BundlerMoverConflictType type, gin::Arguments* args); }; diff --git a/shell/browser/ui/cocoa/electron_bundle_mover.mm b/shell/browser/ui/cocoa/electron_bundle_mover.mm index 3eb2692594442..630b98c337ef7 100644 --- a/shell/browser/ui/cocoa/electron_bundle_mover.mm +++ b/shell/browser/ui/cocoa/electron_bundle_mover.mm @@ -328,9 +328,9 @@ bool IsApplicationAtPathRunning(NSString* bundlePath) { namespace electron { -bool ElectronBundleMover::ShouldContinueMove(gin_helper::ErrorThrower thrower, - BundlerMoverConflictType type, - gin::Arguments* args) { +bool ElectronBundleMover::ShouldContinueMove( + const BundlerMoverConflictType type, + gin::Arguments* const args) { gin::Dictionary options(args->isolate()); bool hasOptions = args->GetNext(&options); base::OnceCallback<v8::Local<v8::Value>(BundlerMoverConflictType)> @@ -345,7 +345,7 @@ bool IsApplicationAtPathRunning(NSString* bundlePath) { // we only want to throw an error if a user has returned a non-boolean // value; this allows for client-side error handling should something in // the handler throw - thrower.ThrowError("Invalid conflict handler return type."); + args->ThrowTypeError("Invalid conflict handler return type."); } } return true; @@ -406,8 +406,8 @@ bool IsApplicationAtPathRunning(NSString* bundlePath) { // But first, make sure that it's not running if (IsApplicationAtPathRunning(destinationPath)) { // Check for callback handler and get user choice for open/quit - if (!ShouldContinueMove( - thrower, BundlerMoverConflictType::kExistsAndRunning, args)) + if (!ShouldContinueMove(BundlerMoverConflictType::kExistsAndRunning, + args)) return false; // Unless explicitly denied, give running app focus and terminate self @@ -420,8 +420,7 @@ bool IsApplicationAtPathRunning(NSString* bundlePath) { return true; } else { // Check callback handler and get user choice for app trashing - if (!ShouldContinueMove(thrower, BundlerMoverConflictType::kExists, - args)) + if (!ShouldContinueMove(BundlerMoverConflictType::kExists, args)) return false; // Unless explicitly denied, attempt to trash old app diff --git a/shell/common/gin_converters/osr_converter.cc b/shell/common/gin_converters/osr_converter.cc index 55b94f855c424..0f5e6ffc0c697 100644 --- a/shell/common/gin_converters/osr_converter.cc +++ b/shell/common/gin_converters/osr_converter.cc @@ -16,7 +16,6 @@ #endif #include "shell/common/gin_converters/gfx_converter.h" #include "shell/common/gin_converters/optional_converter.h" -#include "shell/common/gin_helper/error_thrower.h" #include "shell/common/node_includes.h" #include "shell/common/node_util.h" From 0ba9eb84cae91e9a5ac1e1c85f29a653b5f4340c Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Wed, 24 Sep 2025 19:42:22 -0500 Subject: [PATCH 088/268] refactor: make api::Menu inherit from gin::Wrappable (#48351) * refactor: make api::Menu inherit from gin::Wrappable* * refactor: make api::Menu::kWrapperInfo const * refactor: use three-arg version of GetConstructor in Menu refactor: undo branch changes to two-arg version of GetConstructor * fixup! refactor: make api::Menu inherit from gin::Wrappable* fix: return type of Menu::New * fixup! refactor: make api::Menu inherit from gin::Wrappable* make MenuMac's constructor public so that cppgc can use it * refactor: Pinnable -> SelfKeepAlive --- ...ctron_objects_to_wrappablepointertag.patch | 7 ++-- shell/browser/api/electron_api_menu.cc | 16 +++++---- shell/browser/api/electron_api_menu.h | 36 ++++++++++--------- shell/browser/api/electron_api_menu_mac.h | 4 ++- shell/browser/api/electron_api_menu_mac.mm | 15 ++++---- shell/browser/api/electron_api_menu_views.cc | 13 ++++--- shell/common/gin_helper/constructible.h | 4 +-- 7 files changed, 56 insertions(+), 39 deletions(-) diff --git a/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch b/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch index c91b76f1e3a4b..d34c190f251d0 100644 --- a/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch +++ b/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch @@ -8,10 +8,10 @@ electron objects that extend gin::Wrappable and gets allocated on the cpp heap diff --git a/gin/public/wrappable_pointer_tags.h b/gin/public/wrappable_pointer_tags.h -index 80ec409efe1635390887d1324be661643818abff..2e20b63d1fca56efb43c18d0fa04b1e2b4cf339a 100644 +index 80ec409efe1635390887d1324be661643818abff..7b23fbcb16958a37a3ad4d313326c0cd37bf05d4 100644 --- a/gin/public/wrappable_pointer_tags.h +++ b/gin/public/wrappable_pointer_tags.h -@@ -66,7 +66,12 @@ enum WrappablePointerTag : uint16_t { +@@ -66,7 +66,13 @@ enum WrappablePointerTag : uint16_t { kTextInputControllerBindings, // content::TextInputControllerBindings kWebAXObjectProxy, // content::WebAXObjectProxy kWrappedExceptionHandler, // extensions::WrappedExceptionHandler @@ -19,9 +19,10 @@ index 80ec409efe1635390887d1324be661643818abff..2e20b63d1fca56efb43c18d0fa04b1e2 + kElectronApp, // electron::api::App + kElectronDebugger, // electron::api::Debugger + kElectronEvent, // gin_helper::internal::Event ++ kElectronMenu, // electron::api::Menu + kElectronNetLog, // electron::api::NetLog + kElectronSession, // electron::api::Session -+ kLastPointerTag = kElectronEvent, ++ kLastPointerTag = kElectronSession, }; static_assert(kLastPointerTag < diff --git a/shell/browser/api/electron_api_menu.cc b/shell/browser/api/electron_api_menu.cc index 817fa2ac7f97a..269080dba7a16 100644 --- a/shell/browser/api/electron_api_menu.cc +++ b/shell/browser/api/electron_api_menu.cc @@ -50,7 +50,8 @@ struct Converter<SharingItem> { namespace electron::api { -gin::DeprecatedWrapperInfo Menu::kWrapperInfo = {gin::kEmbedderNativeGin}; +const gin::WrapperInfo Menu::kWrapperInfo = {{gin::kEmbedderNativeGin}, + gin::kElectronMenu}; Menu::Menu(gin::Arguments* args) : model_(std::make_unique<ElectronMenuModel>(this)) { @@ -268,12 +269,11 @@ bool Menu::WorksWhenHiddenAt(int index) const { } void Menu::OnMenuWillClose() { - Unpin(); + keep_alive_.Clear(); Emit("menu-will-close"); } void Menu::OnMenuWillShow() { - Pin(JavascriptEnvironment::GetIsolate()); Emit("menu-will-show"); } @@ -311,8 +311,12 @@ void Menu::FillObjectTemplate(v8::Isolate* isolate, .Build(); } -const char* Menu::GetTypeName() { - return GetClassName(); +const gin::WrapperInfo* Menu::wrapper_info() const { + return &kWrapperInfo; +} + +const char* Menu::GetHumanReadableName() const { + return "Electron / Menu"; } } // namespace electron::api @@ -327,7 +331,7 @@ void Initialize(v8::Local<v8::Object> exports, void* priv) { v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate(); gin_helper::Dictionary dict{isolate, exports}; - dict.Set("Menu", Menu::GetConstructor(isolate, context)); + dict.Set("Menu", Menu::GetConstructor(isolate, context, &Menu::kWrapperInfo)); #if BUILDFLAG(IS_MAC) dict.SetMethod("setApplicationMenu", &Menu::SetApplicationMenu); dict.SetMethod("sendActionToFirstResponder", diff --git a/shell/browser/api/electron_api_menu.h b/shell/browser/api/electron_api_menu.h index ba92e230e3f4c..fc76a0c3df5ae 100644 --- a/shell/browser/api/electron_api_menu.h +++ b/shell/browser/api/electron_api_menu.h @@ -9,11 +9,11 @@ #include <string> #include "base/memory/raw_ptr.h" +#include "gin/wrappable.h" #include "shell/browser/event_emitter_mixin.h" #include "shell/browser/ui/electron_menu_model.h" #include "shell/common/gin_helper/constructible.h" -#include "shell/common/gin_helper/pinnable.h" -#include "shell/common/gin_helper/wrappable.h" +#include "shell/common/gin_helper/self_keep_alive.h" #include "ui/base/mojom/menu_source_type.mojom-forward.h" namespace gin { @@ -25,22 +25,31 @@ namespace electron::api { class BaseWindow; class WebFrameMain; -class Menu : public gin_helper::DeprecatedWrappable<Menu>, +class Menu : public gin::Wrappable<Menu>, public gin_helper::EventEmitterMixin<Menu>, public gin_helper::Constructible<Menu>, - public gin_helper::Pinnable<Menu>, public ElectronMenuModel::Delegate, private ElectronMenuModel::Observer { public: + static Menu* New(gin::Arguments* args); + + // Make public for cppgc::MakeGarbageCollected. + explicit Menu(gin::Arguments* args); + ~Menu() override; + + // disable copy + Menu(const Menu&) = delete; + Menu& operator=(const Menu&) = delete; + + // gin::Wrappable + static const gin::WrapperInfo kWrapperInfo; + const gin::WrapperInfo* wrapper_info() const override; + const char* GetHumanReadableName() const override; + // gin_helper::Constructible - static gin_helper::Handle<Menu> New(gin::Arguments* args); static void FillObjectTemplate(v8::Isolate*, v8::Local<v8::ObjectTemplate>); static const char* GetClassName() { return "Menu"; } - // gin_helper::Wrappable - static gin::DeprecatedWrapperInfo kWrapperInfo; - const char* GetTypeName() override; - #if BUILDFLAG(IS_MAC) // Set the global menubar. static void SetApplicationMenu(Menu* menu); @@ -51,14 +60,7 @@ class Menu : public gin_helper::DeprecatedWrappable<Menu>, ElectronMenuModel* model() const { return model_.get(); } - // disable copy - Menu(const Menu&) = delete; - Menu& operator=(const Menu&) = delete; - protected: - explicit Menu(gin::Arguments* args); - ~Menu() override; - // Returns a new callback which keeps references of the JS wrapper until the // passed |callback| is called. base::OnceClosure BindSelfToClosure(base::OnceClosure callback); @@ -129,6 +131,8 @@ class Menu : public gin_helper::DeprecatedWrappable<Menu>, bool IsEnabledAt(int index) const; bool IsVisibleAt(int index) const; bool WorksWhenHiddenAt(int index) const; + + gin_helper::SelfKeepAlive<Menu> keep_alive_{this}; }; } // namespace electron::api diff --git a/shell/browser/api/electron_api_menu_mac.h b/shell/browser/api/electron_api_menu_mac.h index f4d92f0840693..750f2a01a258a 100644 --- a/shell/browser/api/electron_api_menu_mac.h +++ b/shell/browser/api/electron_api_menu_mac.h @@ -18,10 +18,12 @@ class WebFrameMain; namespace api { class MenuMac : public Menu { - protected: + public: + // Make public for cppgc::MakeGarbageCollected. explicit MenuMac(gin::Arguments* args); ~MenuMac() override; + protected: // Menu void PopupAt(BaseWindow* window, std::optional<WebFrameMain*> frame, diff --git a/shell/browser/api/electron_api_menu_mac.mm b/shell/browser/api/electron_api_menu_mac.mm index a70725d983d9b..b5c60b3eb5d7c 100644 --- a/shell/browser/api/electron_api_menu_mac.mm +++ b/shell/browser/api/electron_api_menu_mac.mm @@ -20,6 +20,8 @@ #include "shell/common/keyboard_util.h" #include "shell/common/node_includes.h" #include "ui/base/cocoa/menu_utils.h" +#include "v8/include/cppgc/allocation.h" +#include "v8/include/v8-cppgc.h" namespace { @@ -47,7 +49,7 @@ namespace electron::api { -MenuMac::MenuMac(gin::Arguments* args) : Menu(args) {} +MenuMac::MenuMac(gin::Arguments* args) : Menu{args} {} MenuMac::~MenuMac() = default; @@ -288,11 +290,12 @@ } // static -gin_helper::Handle<Menu> Menu::New(gin::Arguments* args) { - auto handle = gin_helper::CreateHandle(args->isolate(), - static_cast<Menu*>(new MenuMac(args))); - gin_helper::CallMethod(args->isolate(), handle.get(), "_init"); - return handle; +Menu* Menu::New(gin::Arguments* args) { + v8::Isolate* const isolate = args->isolate(); + Menu* const menu = cppgc::MakeGarbageCollected<MenuMac>( + isolate->GetCppHeap()->GetAllocationHandle(), args); + gin_helper::CallMethod(isolate, menu, "_init"); + return menu; } } // namespace electron::api diff --git a/shell/browser/api/electron_api_menu_views.cc b/shell/browser/api/electron_api_menu_views.cc index cc10653a4dd72..1fa67b3bb4390 100644 --- a/shell/browser/api/electron_api_menu_views.cc +++ b/shell/browser/api/electron_api_menu_views.cc @@ -11,6 +11,8 @@ #include "shell/browser/api/electron_api_web_frame_main.h" #include "shell/browser/native_window_views.h" #include "ui/display/screen.h" +#include "v8/include/cppgc/allocation.h" +#include "v8/include/v8-cppgc.h" using views::MenuRunner; @@ -84,11 +86,12 @@ void MenuViews::OnClosed(int32_t window_id, base::OnceClosure callback) { } // static -gin_helper::Handle<Menu> Menu::New(gin::Arguments* args) { - auto handle = gin_helper::CreateHandle( - args->isolate(), static_cast<Menu*>(new MenuViews(args))); - gin_helper::CallMethod(args->isolate(), handle.get(), "_init"); - return handle; +Menu* Menu::New(gin::Arguments* args) { + v8::Isolate* const isolate = args->isolate(); + Menu* menu = cppgc::MakeGarbageCollected<MenuViews>( + isolate->GetCppHeap()->GetAllocationHandle(), args); + gin_helper::CallMethod(isolate, menu, "_init"); + return menu; } } // namespace electron::api diff --git a/shell/common/gin_helper/constructible.h b/shell/common/gin_helper/constructible.h index dc07046269e1d..1f6db4bc8cb45 100644 --- a/shell/common/gin_helper/constructible.h +++ b/shell/common/gin_helper/constructible.h @@ -43,7 +43,7 @@ class Constructible { v8::Isolate* const isolate, v8::Local<v8::Context> context) { gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); - auto* wrapper_info = &T::kWrapperInfo; + auto* const wrapper_info = &T::kWrapperInfo; v8::Local<v8::FunctionTemplate> constructor = data->DeprecatedGetFunctionTemplate(wrapper_info); if (constructor.IsEmpty()) { @@ -67,7 +67,7 @@ class Constructible { static v8::Local<v8::Function> GetConstructor( v8::Isolate* const isolate, v8::Local<v8::Context> context, - gin::WrapperInfo* wrapper_info) { + const gin::WrapperInfo* const wrapper_info) { gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); v8::Local<v8::FunctionTemplate> constructor = data->GetFunctionTemplate(wrapper_info); From 37c398fa995c74a6f1e455439baa80dec0e3a425 Mon Sep 17 00:00:00 2001 From: Robo <nilay2014@gmail.com> Date: Fri, 26 Sep 2025 08:40:55 +0900 Subject: [PATCH 089/268] fix: disable NSAutoFillHeuristicController on macOS 26 (#48379) Co-authored-by: Keeley Hammond <khammond@slack-corp.com> --- patches/chromium/.patches | 1 + ...ofillheuristiccontroller_on_macos_26.patch | 53 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 patches/chromium/disable_nsautofillheuristiccontroller_on_macos_26.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 3fdbc6350fe7e..3b7351578c83c 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -141,3 +141,4 @@ chore_add_electron_objects_to_wrappablepointertag.patch chore_expose_isolate_parameter_in_script_lifecycle_observers.patch revert_partial_remove_unused_prehandlemouseevent.patch allow_electron_to_depend_on_components_os_crypt_sync.patch +disable_nsautofillheuristiccontroller_on_macos_26.patch diff --git a/patches/chromium/disable_nsautofillheuristiccontroller_on_macos_26.patch b/patches/chromium/disable_nsautofillheuristiccontroller_on_macos_26.patch new file mode 100644 index 0000000000000..e8f0f5b6153e9 --- /dev/null +++ b/patches/chromium/disable_nsautofillheuristiccontroller_on_macos_26.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Perry <perryuwang@tencent.com> +Date: Wed, 24 Sep 2025 09:56:23 -0700 +Subject: Disable NSAutoFillHeuristicController on macOS 26 + +The reason for this issue is that NSAutoFillHeuristicController is +enabled by default on macOS 26. In pages with <input> tags, browser +process sends synchronized IPC messages to renderer process. At this +point, if the renderer process also sends synchronized IPC messages to +the browser process, it will cause a deadlock. + +This bug can be reproduced on many websites. From the perspective of +user experience, we should first disable this feature on macOS 26. + +Bug: 446070423, 446481994 +Change-Id: I2d3855648980a22678548e373756fc156e28ecd7 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6965487 +Reviewed-by: Mark Mentovai <mark@chromium.org> +Commit-Queue: Mark Mentovai <mark@chromium.org> +Cr-Commit-Position: refs/heads/main@{#1520058} + +diff --git a/content/app/mac_init.mm b/content/app/mac_init.mm +index 603c25a1bd4a11b9dbe57ac6add81647302e63be..963f45a8936850b59013390faf7890bc4215f2d9 100644 +--- a/content/app/mac_init.mm ++++ b/content/app/mac_init.mm +@@ -6,6 +6,7 @@ + + #import <Cocoa/Cocoa.h> + ++#include "base/mac/mac_util.h" + #include "content/common/mac/system_policy.h" + + namespace content { +@@ -29,6 +30,19 @@ void InitializeMac() { + @"NSAppSleepDisabled" : @YES, + }]; + ++ if (base::mac::MacOSVersion() >= 26'00'00) { ++ [NSUserDefaults.standardUserDefaults registerDefaults:@{ ++ // Disable NSAutoFillHeuristicController on macOS 26. On macOS 26, the ++ // browser process sends synchronized IPC messages to the renderer process ++ // on pages with <input> tags. At this point, if the renderer process ++ // sends a synchronized IPC message to the browser process, it will cause ++ // a deadlock. ++ // https://crbug.com/446070423 ++ // https://crbug.com/446481994 ++ @"NSAutoFillHeuristicControllerEnabled" : @NO, ++ }]; ++ } ++ + SetSystemPolicyCrashKeys(); + } + From e408f1bf438f49fe2b9561e8d2e9b40406707865 Mon Sep 17 00:00:00 2001 From: avarayr <nilay2014@gmail.com> Date: Fri, 26 Sep 2025 15:41:16 -0400 Subject: [PATCH 090/268] fix: MacOS 26 Tahoe - stop overriding private cornerMask API to fix WindowServer GPU load (#48376) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: macOS stop overriding private cornerMask API to fix WindowServer GPU load spike Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window shadow to be rendered from a fully transparent surface, causing the WindowServer GPU load regression. Remove the `cornerMask` property and the `_cornerMask` override so we stay on Apple’s default shadow path. --- shell/browser/native_window_mac.mm | 1 - shell/browser/ui/cocoa/electron_ns_window.h | 2 -- shell/browser/ui/cocoa/electron_ns_window.mm | 12 ------------ 3 files changed, 15 deletions(-) diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index ec234cb03743f..8ddc2aa996fe4 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -1333,7 +1333,6 @@ static bool FromV8(v8::Isolate* isolate, maskImage.capInsets = NSEdgeInsetsMake(radius, radius, radius, radius); maskImage.resizingMode = NSImageResizingModeStretch; [vibrantView setMaskImage:maskImage]; - [window_ setCornerMask:maskImage]; } } } diff --git a/shell/browser/ui/cocoa/electron_ns_window.h b/shell/browser/ui/cocoa/electron_ns_window.h index 8c026c0b0bdca..de2414e041e57 100644 --- a/shell/browser/ui/cocoa/electron_ns_window.h +++ b/shell/browser/ui/cocoa/electron_ns_window.h @@ -40,7 +40,6 @@ class ElectronNativeWindowObserver; @property BOOL disableAutoHideCursor; @property BOOL disableKeyOrMainWindow; @property(nonatomic, retain) NSVisualEffectView* vibrantView; -@property(nonatomic, retain) NSImage* cornerMask; - (id)initWithShell:(electron::NativeWindowMac*)shell styleMask:(NSUInteger)styleMask; - (void)cleanup; @@ -48,7 +47,6 @@ class ElectronNativeWindowObserver; - (id)accessibilityFocusedUIElement; - (NSRect)originalContentRectForFrameRect:(NSRect)frameRect; - (BOOL)toggleFullScreenMode:(id)sender; -- (NSImage*)_cornerMask; - (void)disableHeadlessMode; @end diff --git a/shell/browser/ui/cocoa/electron_ns_window.mm b/shell/browser/ui/cocoa/electron_ns_window.mm index 007997838699d..7156fa986406e 100644 --- a/shell/browser/ui/cocoa/electron_ns_window.mm +++ b/shell/browser/ui/cocoa/electron_ns_window.mm @@ -25,7 +25,6 @@ } // namespace electron @interface NSWindow (PrivateAPI) -- (NSImage*)_cornerMask; - (int64_t)_resizeDirectionForMouseLocation:(CGPoint)location; @end @@ -123,7 +122,6 @@ @implementation ElectronNSWindow @synthesize disableAutoHideCursor; @synthesize disableKeyOrMainWindow; @synthesize vibrantView; -@synthesize cornerMask; - (id)initWithShell:(electron::NativeWindowMac*)shell styleMask:(NSUInteger)styleMask { @@ -308,16 +306,6 @@ - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { return [super validateUserInterfaceItem:item]; } -// By overriding this built-in method the corners of the vibrant view (if set) -// will be smooth. -- (NSImage*)_cornerMask { - if (self.vibrantView != nil) { - return [self cornerMask]; - } else { - return [super _cornerMask]; - } -} - - (void)disableHeadlessMode { if (shell_) { // We initialize the window in headless mode to allow painting before it is From 43170b405aa5004caa340455275c8a333b1d0ab6 Mon Sep 17 00:00:00 2001 From: BILL SHEN <nilay2014@gmail.com> Date: Sat, 27 Sep 2025 04:34:06 +0800 Subject: [PATCH 091/268] fix: add missed enum `SaveRequestType` to PdfViewerPrivate function (#48372) fix: add missed SaveRequestType enum to PdfViewerPrivate function --- .../common/extensions/api/pdf_viewer_private.idl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/shell/common/extensions/api/pdf_viewer_private.idl b/shell/common/extensions/api/pdf_viewer_private.idl index 0de5d9f6ce615..449f53ccfc47c 100644 --- a/shell/common/extensions/api/pdf_viewer_private.idl +++ b/shell/common/extensions/api/pdf_viewer_private.idl @@ -6,6 +6,15 @@ // functionality that the PDF Viewer needs from outside the PDF plugin. This API // is exclusively for the PDF Viewer. namespace pdfViewerPrivate { + // Must match `SaveRequestType` in `pdf/mojom/pdf.mojom` and + // `tools/typescript/definitions/pdf_viewer_private.d.ts`. + enum SaveRequestType { + ANNOTATION, + ORIGINAL, + EDITED, + SEARCHIFIED + }; + // Nearly identical to mimeHandlerPrivate.StreamInfo, but without a mime type // nor a response header field. Those fields are unused by the PDF viewer. dictionary StreamInfo { @@ -52,6 +61,13 @@ namespace pdfViewerPrivate { DOMString url, IsAllowedLocalFileAccessCallback callback); + // Sends a request to save the PDF to Google Drive if `saveRequestType` is + // set. Otherwise, if `saveRequestType` is not set, the default action is + // to cancel the existing upload. + static void saveToDrive( + optional SaveRequestType saveRequestType, + optional VoidCallback callback); + // Sets the current tab title to `title` for a full-page PDF. static void setPdfDocumentTitle( DOMString title, From fef9e0859386817b4265789e82b47d3d39fb763c Mon Sep 17 00:00:00 2001 From: Samuel Attard <nilay2014@gmail.com> Date: Mon, 29 Sep 2025 11:16:39 -0700 Subject: [PATCH 092/268] build: add missing copied tarball to cloudstore paths (#48408) It's guarunteed that `iojs-*` and `node-*` were the same origin file (we azcopy them) but this was missing in logs and it annoyed me --- script/release/release.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/release/release.ts b/script/release/release.ts index 1438577fae8db..6e64764e44301 100755 --- a/script/release/release.ts +++ b/script/release/release.ts @@ -210,8 +210,10 @@ function assetsForVersion (version: string, validatingRelease: boolean) { const cloudStoreFilePaths = (version: string) => [ `iojs-${version}-headers.tar.gz`, `iojs-${version}.tar.gz`, + `node-${version}-headers.tar.gz`, `node-${version}.tar.gz`, 'node.lib', + 'arm64/node.lib', 'x64/node.lib', 'win-x64/iojs.lib', 'win-x86/iojs.lib', @@ -219,7 +221,6 @@ const cloudStoreFilePaths = (version: string) => [ 'win-x64/node.lib', 'win-x86/node.lib', 'win-arm64/node.lib', - 'arm64/node.lib', 'SHASUMS.txt', 'SHASUMS256.txt' ]; From 85001523a9e008797160df2d31dc1cd3af22b779 Mon Sep 17 00:00:00 2001 From: Fedor Indutny <nilay2014@gmail.com> Date: Tue, 30 Sep 2025 09:32:13 -0700 Subject: [PATCH 093/268] fix: runtime JS error that crashes `GetPackageJSON` (#48293) We overriden the `GetPackageJSON` in Node.js to let us read files straight from the ASAR file instead of disk. The override works by providing a JS method with the limitation that it should not throw a runtime error. However, this invariant was accidentally violated by `asar.splitPath` that sometimes contrary to its' TypeScript definition returned `false`. --- shell/common/api/electron_api_asar.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shell/common/api/electron_api_asar.cc b/shell/common/api/electron_api_asar.cc index 2e872759d0dcd..93229863e2b36 100644 --- a/shell/common/api/electron_api_asar.cc +++ b/shell/common/api/electron_api_asar.cc @@ -191,13 +191,15 @@ class Archive : public node::ObjectWrap { static void SplitPath(const v8::FunctionCallbackInfo<v8::Value>& args) { auto* isolate = args.GetIsolate(); + auto dict = gin_helper::Dictionary::CreateEmpty(isolate); + args.GetReturnValue().Set(dict.GetHandle()); + base::FilePath path; if (!gin::ConvertFromV8(isolate, args[0], &path)) { - args.GetReturnValue().Set(v8::False(isolate)); + dict.Set("isAsar", false); return; } - auto dict = gin_helper::Dictionary::CreateEmpty(isolate); base::FilePath asar_path, file_path; if (asar::GetAsarArchivePath(path, &asar_path, &file_path, true)) { dict.Set("isAsar", true); @@ -206,7 +208,6 @@ static void SplitPath(const v8::FunctionCallbackInfo<v8::Value>& args) { } else { dict.Set("isAsar", false); } - args.GetReturnValue().Set(dict.GetHandle()); } void Initialize(v8::Local<v8::Object> exports, From 5ad79407855ffc1f634cf54e0bd68fcab8c523fc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Tue, 30 Sep 2025 18:36:57 +0200 Subject: [PATCH 094/268] build(deps): bump github/codeql-action from 3.30.1 to 3.30.5 (#48420) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.30.1 to 3.30.5. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/f1f6e5f6af878fb37288ce1c627459e94dbf7d01...3599b3baa15b485a2e49ef411a7a4bb2452e7f93) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 3.30.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/scorecards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 36ce4ca1b8b00..ab7aae98d0eda 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -50,6 +50,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # v3.29.5 + uses: github/codeql-action/upload-sarif@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5 with: sarif_file: results.sarif From 91d126950a9d5c57d8f24b743f68d25c5354e645 Mon Sep 17 00:00:00 2001 From: Erick Zhao <nilay2014@gmail.com> Date: Wed, 1 Oct 2025 22:27:28 -0700 Subject: [PATCH 095/268] docs: fix formatting in asar integrity (#48431) --- docs/tutorial/asar-integrity.md | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/docs/tutorial/asar-integrity.md b/docs/tutorial/asar-integrity.md index fd3c8ba25244f..38903628d8d42 100644 --- a/docs/tutorial/asar-integrity.md +++ b/docs/tutorial/asar-integrity.md @@ -64,13 +64,10 @@ flipFuses( ) ``` -:::tip Fuses in Electron Forge - -With Electron Forge, you can configure your app's fuses with -[@electron-forge/plugin-fuses](https://www.electronforge.io/config/plugins/fuses) -in your Forge configuration file. - -::: +> [!TIP] +> With Electron Forge, you can configure your app's fuses with +> [@electron-forge/plugin-fuses](https://www.electronforge.io/config/plugins/fuses) +> in your Forge configuration file. ## Providing the header hash @@ -109,7 +106,7 @@ Valid `algorithm` values are currently `SHA256` only. The `hash` is a hash of th The `@electron/asar` package exposes a `getRawHeader` method whose result can then be hashed to generate this value (e.g. using the [`node:crypto`](https://nodejs.org/api/crypto.html) module). -### Windows +#### Windows When packaging for Windows, you must populate a valid [resource](https://learn.microsoft.com/en-us/windows/win32/menurc/resources) entry of type `Integrity` and name `ElectronAsar`. The value of this resource should be a JSON encoded dictionary @@ -125,9 +122,6 @@ in the form included below: ] ``` -:::info - -For an implementation example, see [`src/resedit.ts`](https://github.com/electron/packager/blob/main/src/resedit.ts) -in the Electron Packager code. - -::: +> [!NOTE] +> For an implementation example, see [`src/resedit.ts`](https://github.com/electron/packager/blob/main/src/resedit.ts) +> in the Electron Packager code. From 2c005b7e2aba0e0d0eca1cdb0a59a797187ee61d Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Thu, 2 Oct 2025 18:14:48 +0200 Subject: [PATCH 096/268] fix: snapped window restoring to correct position (#48296) --- shell/browser/native_window_views_win.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/shell/browser/native_window_views_win.cc b/shell/browser/native_window_views_win.cc index fc1f476a93b8e..d222972156764 100644 --- a/shell/browser/native_window_views_win.cc +++ b/shell/browser/native_window_views_win.cc @@ -509,7 +509,7 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) { WINDOWPLACEMENT wp; wp.length = sizeof(WINDOWPLACEMENT); - if (GetWindowPlacement(GetAcceleratedWidget(), &wp)) { + if (GetWindowPlacement(GetAcceleratedWidget(), &wp) && !was_snapped_) { last_normal_placement_bounds_ = gfx::Rect(wp.rcNormalPosition); } @@ -518,11 +518,9 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) { if (w_param == SIZE_MAXIMIZED && last_window_state_ != ui::mojom::WindowShowState::kMaximized) { if (last_window_state_ == ui::mojom::WindowShowState::kMinimized) { - if (was_snapped_) { - SetRoundedCorners(false); - was_snapped_ = false; - } NotifyWindowRestore(); + if (was_snapped_) + was_snapped_ = false; } last_window_state_ = ui::mojom::WindowShowState::kMaximized; NotifyWindowMaximize(); @@ -545,12 +543,10 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) { last_window_state_ = ui::mojom::WindowShowState::kFullscreen; NotifyWindowEnterFullScreen(); } else { - if (was_snapped_) { - SetRoundedCorners(false); - was_snapped_ = false; - } last_window_state_ = ui::mojom::WindowShowState::kNormal; NotifyWindowRestore(); + if (was_snapped_) + was_snapped_ = false; } break; default: From ae6beddbb4c0de2f263003e8394b49a3f7a2d9e5 Mon Sep 17 00:00:00 2001 From: Robo <nilay2014@gmail.com> Date: Fri, 3 Oct 2025 08:18:14 +0900 Subject: [PATCH 097/268] fix: initialze featurelist before parsing features (#48411) --- shell/app/electron_main_delegate.cc | 7 +++++++ shell/browser/electron_browser_main_parts.cc | 2 -- shell/browser/electron_browser_main_parts.h | 5 ----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/shell/app/electron_main_delegate.cc b/shell/app/electron_main_delegate.cc index e4ba443e43b46..2339136712a35 100644 --- a/shell/app/electron_main_delegate.cc +++ b/shell/app/electron_main_delegate.cc @@ -13,10 +13,12 @@ #include "base/apple/bundle_locations.h" #include "base/base_switches.h" #include "base/command_line.h" +#include "base/debug/leak_annotations.h" #include "base/debug/stack_trace.h" #include "base/environment.h" #include "base/files/file_util.h" #include "base/logging.h" +#include "base/metrics/field_trial.h" #include "base/path_service.h" #include "base/strings/cstring_view.h" #include "base/strings/string_number_conversions.cc" @@ -419,6 +421,11 @@ std::optional<int> ElectronMainDelegate::PreBrowserMain() { // This is initialized early because the service manager reads some feature // flags and we need to make sure the feature list is initialized before the // service manager reads the features. + if (!base::FieldTrialList::GetInstance()) { + base::FieldTrialList* leaked_field_trial_list = new base::FieldTrialList(); + ANNOTATE_LEAKING_OBJECT_PTR(leaked_field_trial_list); + std::ignore = leaked_field_trial_list; + } InitializeFeatureList(); // Initialize mojo core as soon as we have a valid feature list content::InitializeMojoCore(); diff --git a/shell/browser/electron_browser_main_parts.cc b/shell/browser/electron_browser_main_parts.cc index 8421eab969a6f..e6b732c67e5ee 100644 --- a/shell/browser/electron_browser_main_parts.cc +++ b/shell/browser/electron_browser_main_parts.cc @@ -14,7 +14,6 @@ #include "base/command_line.h" #include "base/feature_list.h" #include "base/i18n/rtl.h" -#include "base/metrics/field_trial.h" #include "base/nix/xdg_util.h" #include "base/path_service.h" #include "base/run_loop.h" @@ -206,7 +205,6 @@ int ElectronBrowserMainParts::GetExitCode() const { } int ElectronBrowserMainParts::PreEarlyInitialization() { - field_trial_list_ = std::make_unique<base::FieldTrialList>(); #if BUILDFLAG(IS_POSIX) HandleSIGCHLD(); #endif diff --git a/shell/browser/electron_browser_main_parts.h b/shell/browser/electron_browser_main_parts.h index 86897fc9c780a..ccc1565822614 100644 --- a/shell/browser/electron_browser_main_parts.h +++ b/shell/browser/electron_browser_main_parts.h @@ -19,10 +19,6 @@ class BrowserProcessImpl; class IconManager; -namespace base { -class FieldTrialList; -} - namespace display { class Screen; class ScopedNativeScreen; @@ -171,7 +167,6 @@ class ElectronBrowserMainParts : public content::BrowserMainParts { std::unique_ptr<Browser> browser_; std::unique_ptr<IconManager> icon_manager_; - std::unique_ptr<base::FieldTrialList> field_trial_list_; #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) std::unique_ptr<ElectronExtensionsClient> extensions_client_; From 69129b59d24ffe14efd4ad2ed05ce31adaf8f1e6 Mon Sep 17 00:00:00 2001 From: Niklas Wenzel <nilay2014@gmail.com> Date: Fri, 3 Oct 2025 01:29:26 +0200 Subject: [PATCH 098/268] docs: update allowed `window.open` options (#48428) --- docs/api/window-open.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/window-open.md b/docs/api/window-open.md index 7285c956bd056..e9c4b80550e59 100644 --- a/docs/api/window-open.md +++ b/docs/api/window-open.md @@ -39,8 +39,8 @@ consider using `webContents.setWindowOpenHandler` to customize the BrowserWindow creation. A subset of [`WebPreferences`](structures/web-preferences.md) can be set directly, -unnested, from the features string: `zoomFactor`, `nodeIntegration`, `preload`, -`javascript`, `contextIsolation`, and `webviewTag`. +unnested, from the features string: `zoomFactor`, `nodeIntegration`, `javascript`, +`contextIsolation`, and `webviewTag`. For example: From 3e4c20519b74d4a8c8ebc8bc1cd0dd21a1fd8dad Mon Sep 17 00:00:00 2001 From: zoy <nilay2014@gmail.com> Date: Sat, 4 Oct 2025 02:10:18 +0800 Subject: [PATCH 099/268] fix: accentColor set distinguishes the frame (#48405) * fix: accentColor set distinguishes the frame * chore: invalid change * fix: lint --- shell/browser/native_window_views_win.cc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/shell/browser/native_window_views_win.cc b/shell/browser/native_window_views_win.cc index d222972156764..400d140fd58f2 100644 --- a/shell/browser/native_window_views_win.cc +++ b/shell/browser/native_window_views_win.cc @@ -31,15 +31,15 @@ namespace electron { namespace { -void SetWindowBorderAndCaptionColor(HWND hwnd, COLORREF color) { - if (base::win::GetVersion() < base::win::Version::WIN11) - return; - - HRESULT result = - DwmSetWindowAttribute(hwnd, DWMWA_CAPTION_COLOR, &color, sizeof(color)); - - if (FAILED(result)) - LOG(WARNING) << "Failed to set caption color"; +void SetWindowBorderAndCaptionColor(HWND hwnd, COLORREF color, bool has_frame) { + HRESULT result; + if (has_frame) { + result = + DwmSetWindowAttribute(hwnd, DWMWA_CAPTION_COLOR, &color, sizeof(color)); + + if (FAILED(result)) + LOG(WARNING) << "Failed to set caption color"; + } result = DwmSetWindowAttribute(hwnd, DWMWA_BORDER_COLOR, &color, sizeof(color)); @@ -591,7 +591,8 @@ void NativeWindowViews::UpdateWindowAccentColor(bool active) { } COLORREF final_color = border_color.value_or(DWMWA_COLOR_DEFAULT); - SetWindowBorderAndCaptionColor(GetAcceleratedWidget(), final_color); + SetWindowBorderAndCaptionColor(GetAcceleratedWidget(), final_color, + has_frame()); } void NativeWindowViews::SetAccentColor( From d0ba2a10d6f2b2c4b5a2b9417102d70da2d461b8 Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Fri, 3 Oct 2025 14:10:29 -0500 Subject: [PATCH 100/268] refactor: remove `gin_helper::Arguments` (#48374) * refactor: make api::Clipboard::GetClipboardBuffer() private * refactor: move GetClipboadBuffer() into anonymous namespace * refactor: use gin::Arguments in StopRecording() * refactor: use gin::Arguments in ImageView::New() * refactor: use gin::Arguments in AppendSwitch() * refactor: use gin::Arguments WebContentsView::New() * refactor: make gin::Arguments arg const in WrappableBase::InitWithArgs() This makes explicit that we are using it for wrapper + isolate, not the args values * refactor: remove gin_helper::Arguments arg from ExposeAPI() refactor: remove gin_helper::Arguments arg from ExposeAPIInWorld() * refactor: remove gin_helper::Arguments arg from ElectronBindings::GetSystemMemoryInfo() * refactor: remove gin_helper::Arguments arg from preload_utils::GetBinding() * refactor: use gin::Arguments in OpenExternal() * refactor: use gin::Arguments in ExecuteInWorld() * refactor: use gin::Arguments in ExecuteJavaScript() * refactor: use gin::Arguments in InvokeNew() * refactor: use gin::Arguments in ExecuteJavaScriptInIsolatedWorld() * refactor: remove unused GetNextArgument() marshaller for gin_helper::Arguments * refactor: remove unused #include gin_helper/arguments.h * chore: remove unused gin_helper::Arguments * fixup! refactor: use gin::Arguments in ExecuteJavaScriptInIsolatedWorld() Xref: https://github.com/electron/electron/pull/48447 --- filenames.gni | 2 - .../api/electron_api_content_tracing.cc | 4 +- .../api/electron_api_web_contents_view.cc | 23 ++++---- .../api/electron_api_web_contents_view.h | 2 +- .../api/views/electron_api_image_view.cc | 2 +- .../api/views/electron_api_image_view.h | 7 ++- shell/browser/browser.cc | 2 +- shell/browser/native_window_views.cc | 1 - shell/common/api/electron_api_command_line.cc | 2 +- shell/common/api/electron_api_shell.cc | 5 +- shell/common/api/electron_bindings.cc | 7 +-- shell/common/api/electron_bindings.h | 4 +- shell/common/gin_helper/arguments.cc | 26 --------- shell/common/gin_helper/arguments.h | 53 ------------------- shell/common/gin_helper/constructor.h | 8 +-- shell/common/gin_helper/function_template.h | 10 ---- shell/common/gin_helper/wrappable.cc | 2 +- shell/common/gin_helper/wrappable_base.h | 2 +- .../api/electron_api_context_bridge.cc | 24 ++++----- shell/renderer/api/electron_api_web_frame.cc | 38 +++++++------ shell/renderer/preload_utils.cc | 12 ++--- shell/renderer/preload_utils.h | 3 +- 22 files changed, 76 insertions(+), 163 deletions(-) delete mode 100644 shell/common/gin_helper/arguments.cc delete mode 100644 shell/common/gin_helper/arguments.h diff --git a/filenames.gni b/filenames.gni index 488058008c20e..a41f5cae22f5a 100644 --- a/filenames.gni +++ b/filenames.gni @@ -629,8 +629,6 @@ filenames = { "shell/common/gin_converters/usb_device_info_converter.h", "shell/common/gin_converters/value_converter.cc", "shell/common/gin_converters/value_converter.h", - "shell/common/gin_helper/arguments.cc", - "shell/common/gin_helper/arguments.h", "shell/common/gin_helper/callback.cc", "shell/common/gin_helper/callback.h", "shell/common/gin_helper/cleaned_up_at_exit.cc", diff --git a/shell/browser/api/electron_api_content_tracing.cc b/shell/browser/api/electron_api_content_tracing.cc index 278ec587df985..90652c0de5881 100644 --- a/shell/browser/api/electron_api_content_tracing.cc +++ b/shell/browser/api/electron_api_content_tracing.cc @@ -98,8 +98,8 @@ void StopTracing(gin_helper::Promise<base::FilePath> promise, } } -v8::Local<v8::Promise> StopRecording(gin_helper::Arguments* args) { - gin_helper::Promise<base::FilePath> promise(args->isolate()); +v8::Local<v8::Promise> StopRecording(gin::Arguments* const args) { + gin_helper::Promise<base::FilePath> promise{args->isolate()}; v8::Local<v8::Promise> handle = promise.GetHandle(); base::FilePath path; diff --git a/shell/browser/api/electron_api_web_contents_view.cc b/shell/browser/api/electron_api_web_contents_view.cc index 0b9be9bd55dc9..360d03d050817 100644 --- a/shell/browser/api/electron_api_web_contents_view.cc +++ b/shell/browser/api/electron_api_web_contents_view.cc @@ -153,36 +153,37 @@ v8::Local<v8::Function> WebContentsView::GetConstructor(v8::Isolate* isolate) { } // static -gin_helper::WrappableBase* WebContentsView::New(gin_helper::Arguments* args) { +gin_helper::WrappableBase* WebContentsView::New(gin::Arguments* const args) { + v8::Isolate* const isolate = args->isolate(); gin_helper::Dictionary web_preferences; v8::Local<v8::Value> existing_web_contents_value; { v8::Local<v8::Value> options_value; if (args->GetNext(&options_value)) { gin_helper::Dictionary options; - if (!gin::ConvertFromV8(args->isolate(), options_value, &options)) { - args->ThrowError("options must be an object"); + if (!gin::ConvertFromV8(isolate, options_value, &options)) { + args->ThrowTypeError("options must be an object"); return nullptr; } v8::Local<v8::Value> web_preferences_value; if (options.Get("webPreferences", &web_preferences_value)) { - if (!gin::ConvertFromV8(args->isolate(), web_preferences_value, + if (!gin::ConvertFromV8(isolate, web_preferences_value, &web_preferences)) { - args->ThrowError("options.webPreferences must be an object"); + args->ThrowTypeError("options.webPreferences must be an object"); return nullptr; } } if (options.Get("webContents", &existing_web_contents_value)) { gin_helper::Handle<WebContents> existing_web_contents; - if (!gin::ConvertFromV8(args->isolate(), existing_web_contents_value, + if (!gin::ConvertFromV8(isolate, existing_web_contents_value, &existing_web_contents)) { - args->ThrowError("options.webContents must be a WebContents"); + args->ThrowTypeError("options.webContents must be a WebContents"); return nullptr; } if (existing_web_contents->owner_window() != nullptr) { - args->ThrowError( + args->ThrowTypeError( "options.webContents is already attached to a window"); return nullptr; } @@ -191,7 +192,7 @@ gin_helper::WrappableBase* WebContentsView::New(gin_helper::Arguments* args) { } if (web_preferences.IsEmpty()) - web_preferences = gin_helper::Dictionary::CreateEmpty(args->isolate()); + web_preferences = gin_helper::Dictionary::CreateEmpty(isolate); if (!web_preferences.Has(options::kShow)) web_preferences.Set(options::kShow, false); @@ -200,10 +201,10 @@ gin_helper::WrappableBase* WebContentsView::New(gin_helper::Arguments* args) { } auto web_contents = - WebContents::CreateFromWebPreferences(args->isolate(), web_preferences); + WebContents::CreateFromWebPreferences(isolate, web_preferences); // Constructor call. - auto* view = new WebContentsView(args->isolate(), web_contents); + auto* view = new WebContentsView{isolate, web_contents}; view->InitWithArgs(args); return view; } diff --git a/shell/browser/api/electron_api_web_contents_view.h b/shell/browser/api/electron_api_web_contents_view.h index 51c67231e1176..f04254d30bd04 100644 --- a/shell/browser/api/electron_api_web_contents_view.h +++ b/shell/browser/api/electron_api_web_contents_view.h @@ -57,7 +57,7 @@ class WebContentsView : public View, void OnViewRemovedFromWidget(views::View* view) override; private: - static gin_helper::WrappableBase* New(gin_helper::Arguments* args); + static gin_helper::WrappableBase* New(gin::Arguments* args); void ApplyBorderRadius(); diff --git a/shell/browser/api/views/electron_api_image_view.cc b/shell/browser/api/views/electron_api_image_view.cc index c0578c7777615..3dbc56f226c24 100644 --- a/shell/browser/api/views/electron_api_image_view.cc +++ b/shell/browser/api/views/electron_api_image_view.cc @@ -25,7 +25,7 @@ void ImageView::SetImage(const gfx::Image& image) { } // static -gin_helper::WrappableBase* ImageView::New(gin_helper::Arguments* args) { +gin_helper::WrappableBase* ImageView::New(gin::Arguments* const args) { // Constructor call. auto* view = new ImageView(); view->InitWithArgs(args); diff --git a/shell/browser/api/views/electron_api_image_view.h b/shell/browser/api/views/electron_api_image_view.h index 78d913c046b13..156d256771dea 100644 --- a/shell/browser/api/views/electron_api_image_view.h +++ b/shell/browser/api/views/electron_api_image_view.h @@ -13,8 +13,11 @@ namespace gfx { class Image; } -namespace gin_helper { +namespace gin { class Arguments; +} // namespace gin + +namespace gin_helper { class WrappableBase; } // namespace gin_helper @@ -22,7 +25,7 @@ namespace electron::api { class ImageView : public View { public: - static gin_helper::WrappableBase* New(gin_helper::Arguments* args); + static gin_helper::WrappableBase* New(gin::Arguments* args); static void BuildPrototype(v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> prototype); diff --git a/shell/browser/browser.cc b/shell/browser/browser.cc index 0c0e7c8c5076f..ca23057de9784 100644 --- a/shell/browser/browser.cc +++ b/shell/browser/browser.cc @@ -13,13 +13,13 @@ #include "base/task/single_thread_task_runner.h" #include "base/threading/thread_restrictions.h" #include "chrome/common/chrome_paths.h" +#include "gin/arguments.h" #include "shell/browser/browser_observer.h" #include "shell/browser/electron_browser_main_parts.h" #include "shell/browser/native_window.h" #include "shell/browser/window_list.h" #include "shell/common/application_info.h" #include "shell/common/gin_converters/login_item_settings_converter.h" -#include "shell/common/gin_helper/arguments.h" #include "shell/common/thread_restrictions.h" namespace electron { diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index fa447f6af055d..6621158a0e8c5 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -35,7 +35,6 @@ #include "shell/browser/window_list.h" #include "shell/common/electron_constants.h" #include "shell/common/gin_converters/image_converter.h" -#include "shell/common/gin_helper/arguments.h" #include "shell/common/gin_helper/dictionary.h" #include "shell/common/options_switches.h" #include "ui/aura/window_tree_host.h" diff --git a/shell/common/api/electron_api_command_line.cc b/shell/common/api/electron_api_command_line.cc index 5225a43ec6361..98bbf6035118c 100644 --- a/shell/common/api/electron_api_command_line.cc +++ b/shell/common/api/electron_api_command_line.cc @@ -29,7 +29,7 @@ base::CommandLine::StringType GetSwitchValue(gin_helper::ErrorThrower thrower, } void AppendSwitch(const std::string& switch_string, - gin_helper::Arguments* args) { + gin::Arguments* const args) { auto switch_str = base::ToLowerASCII(switch_string); auto* command_line = base::CommandLine::ForCurrentProcess(); if (base::EndsWith(switch_string, "-path", diff --git a/shell/common/api/electron_api_shell.cc b/shell/common/api/electron_api_shell.cc index 944e4a6b36035..fc9d014a14840 100644 --- a/shell/common/api/electron_api_shell.cc +++ b/shell/common/api/electron_api_shell.cc @@ -55,7 +55,8 @@ void OnOpenFinished(gin_helper::Promise<void> promise, promise.RejectWithErrorMessage(error); } -v8::Local<v8::Promise> OpenExternal(const GURL& url, gin::Arguments* args) { +v8::Local<v8::Promise> OpenExternal(const GURL& url, + gin::Arguments* const args) { gin_helper::Promise<void> promise(args->isolate()); v8::Local<v8::Promise> handle = promise.GetHandle(); @@ -108,7 +109,7 @@ v8::Local<v8::Promise> TrashItem(v8::Isolate* isolate, #if BUILDFLAG(IS_WIN) bool WriteShortcutLink(const base::FilePath& shortcut_path, - gin_helper::Arguments* args) { + gin::Arguments* const args) { base::win::ShortcutOperation operation = base::win::ShortcutOperation::kCreateAlways; args->GetNext(&operation); diff --git a/shell/common/api/electron_bindings.cc b/shell/common/api/electron_bindings.cc index 417334f331332..3bae82a89726f 100644 --- a/shell/common/api/electron_bindings.cc +++ b/shell/common/api/electron_bindings.cc @@ -21,6 +21,7 @@ #include "shell/common/application_info.h" #include "shell/common/gin_converters/file_path_converter.h" #include "shell/common/gin_helper/dictionary.h" +#include "shell/common/gin_helper/error_thrower.h" #include "shell/common/gin_helper/locker.h" #include "shell/common/gin_helper/promise.h" #include "shell/common/heap_snapshot.h" @@ -163,11 +164,11 @@ v8::Local<v8::Value> ElectronBindings::GetCreationTime(v8::Isolate* isolate) { // static v8::Local<v8::Value> ElectronBindings::GetSystemMemoryInfo( - v8::Isolate* isolate, - gin_helper::Arguments* args) { + v8::Isolate* const isolate) { base::SystemMemoryInfo mem_info; if (!base::GetSystemMemoryInfo(&mem_info)) { - args->ThrowError("Unable to retrieve system memory information"); + gin_helper::ErrorThrower{isolate}.ThrowError( + "Unable to retrieve system memory information"); return v8::Undefined(isolate); } diff --git a/shell/common/api/electron_bindings.h b/shell/common/api/electron_bindings.h index 851ae358f62ef..76259e0480245 100644 --- a/shell/common/api/electron_bindings.h +++ b/shell/common/api/electron_bindings.h @@ -18,7 +18,6 @@ class FilePath; } namespace gin_helper { -class Arguments; class Dictionary; template <typename T> class Promise; @@ -67,8 +66,7 @@ class ElectronBindings { static void Hang(); static v8::Local<v8::Value> GetHeapStatistics(v8::Isolate* isolate); static v8::Local<v8::Value> GetCreationTime(v8::Isolate* isolate); - static v8::Local<v8::Value> GetSystemMemoryInfo(v8::Isolate* isolate, - gin_helper::Arguments* args); + static v8::Local<v8::Value> GetSystemMemoryInfo(v8::Isolate* isolate); static v8::Local<v8::Promise> GetProcessMemoryInfo(v8::Isolate* isolate); static v8::Local<v8::Value> GetBlinkMemoryInfo(v8::Isolate* isolate); static v8::Local<v8::Value> GetCPUUsage(base::ProcessMetrics* metrics, diff --git a/shell/common/gin_helper/arguments.cc b/shell/common/gin_helper/arguments.cc deleted file mode 100644 index 9047d26d6dec8..0000000000000 --- a/shell/common/gin_helper/arguments.cc +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE.chromium file. - -#include <string_view> - -#include "shell/common/gin_helper/arguments.h" - -#include "v8/include/v8-exception.h" - -namespace gin_helper { - -void Arguments::ThrowError() const { - // Gin advances |next_| counter when conversion fails while we do not, so we - // have to manually advance the counter here to make gin report error with the - // correct index. - const_cast<Arguments*>(this)->Skip(); - gin::Arguments::ThrowError(); -} - -void Arguments::ThrowError(const std::string_view message) const { - isolate()->ThrowException( - v8::Exception::Error(gin::StringToV8(isolate(), message))); -} - -} // namespace gin_helper diff --git a/shell/common/gin_helper/arguments.h b/shell/common/gin_helper/arguments.h deleted file mode 100644 index eb79200972287..0000000000000 --- a/shell/common/gin_helper/arguments.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE.chromium file. - -#ifndef ELECTRON_SHELL_COMMON_GIN_HELPER_ARGUMENTS_H_ -#define ELECTRON_SHELL_COMMON_GIN_HELPER_ARGUMENTS_H_ - -#include <string_view> - -#include "gin/arguments.h" - -namespace gin_helper { - -// Provides additional APIs to the gin::Arguments class. -class Arguments : public gin::Arguments { - public: - // Get the next argument, if conversion to T fails then state is unchanged. - // - // This is difference from gin::Arguments::GetNext which always advances the - // |next_| counter no matter whether the conversion succeeds. - template <typename T> - bool GetNext(T* out) { - v8::Local<v8::Value> val = PeekNext(); - if (val.IsEmpty()) - return false; - if (!gin::ConvertFromV8(isolate(), val, out)) - return false; - Skip(); - return true; - } - - // Gin always returns true when converting V8 value to boolean, we do not want - // this behavior when parsing parameters. - bool GetNext(bool* out) { - v8::Local<v8::Value> val = PeekNext(); - if (val.IsEmpty() || !val->IsBoolean()) - return false; - *out = val->BooleanValue(isolate()); - Skip(); - return true; - } - - // Throw error with custom error message. - void ThrowError() const; - void ThrowError(std::string_view message) const; - - private: - // MUST NOT ADD ANY DATA MEMBER. -}; - -} // namespace gin_helper - -#endif // ELECTRON_SHELL_COMMON_GIN_HELPER_ARGUMENTS_H_ diff --git a/shell/common/gin_helper/constructor.h b/shell/common/gin_helper/constructor.h index 7ae5e096c15b7..2e406a0dbb92f 100644 --- a/shell/common/gin_helper/constructor.h +++ b/shell/common/gin_helper/constructor.h @@ -40,7 +40,7 @@ class GinArgumentsToTuple { // Invoke a callback with arguments extracted from `args`. template <typename... Types> WrappableBase* InvokeFactory( - gin::Arguments* args, + gin::Arguments* const args, const base::RepeatingCallback<WrappableBase*(Types...)>& callback) { auto [ok, tup] = GinArgumentsToTuple<Types...>::GetArgs(args); if (!ok) @@ -52,10 +52,10 @@ WrappableBase* InvokeFactory( template <typename Sig> void InvokeNew(const base::RepeatingCallback<Sig>& factory, - v8::Isolate* isolate, - gin_helper::Arguments* args) { + v8::Isolate* const isolate, + gin::Arguments* const args) { if (!args->IsConstructCall()) { - args->ThrowError("Requires constructor call"); + args->ThrowTypeError("Requires constructor call"); return; } diff --git a/shell/common/gin_helper/function_template.h b/shell/common/gin_helper/function_template.h index 43bace908b734..c9d82747ceea4 100644 --- a/shell/common/gin_helper/function_template.h +++ b/shell/common/gin_helper/function_template.h @@ -13,7 +13,6 @@ #include "base/memory/raw_ptr.h" #include "gin/arguments.h" #include "gin/per_isolate_data.h" -#include "shell/common/gin_helper/arguments.h" #include "shell/common/gin_helper/destroyable.h" #include "shell/common/gin_helper/error_thrower.h" #include "v8/include/v8-context.h" @@ -154,15 +153,6 @@ inline bool GetNextArgument(gin::Arguments* args, return true; } -// Electron-specific GetNextArgument that supports the gin_helper::Arguments. -inline bool GetNextArgument(gin::Arguments* args, - const InvokerOptions& invoker_options, - bool is_first, - gin_helper::Arguments** result) { - *result = static_cast<gin_helper::Arguments*>(args); - return true; -} - // For advanced use cases, we allow callers to request the unparsed Arguments // object and poke around in it directly. inline bool GetNextArgument(gin::Arguments* args, diff --git a/shell/common/gin_helper/wrappable.cc b/shell/common/gin_helper/wrappable.cc index 94dbe2ffbe21e..2549fe8af60de 100644 --- a/shell/common/gin_helper/wrappable.cc +++ b/shell/common/gin_helper/wrappable.cc @@ -48,7 +48,7 @@ v8::Local<v8::Object> WrappableBase::GetWrapper() const { return {}; } -void WrappableBase::InitWithArgs(gin::Arguments* args) { +void WrappableBase::InitWithArgs(const gin::Arguments* const args) { v8::Local<v8::Object> holder; args->GetHolder(&holder); InitWith(args->isolate(), holder); diff --git a/shell/common/gin_helper/wrappable_base.h b/shell/common/gin_helper/wrappable_base.h index 35a9de3f21d14..5d63a148ab606 100644 --- a/shell/common/gin_helper/wrappable_base.h +++ b/shell/common/gin_helper/wrappable_base.h @@ -51,7 +51,7 @@ class WrappableBase { virtual void InitWith(v8::Isolate* isolate, v8::Local<v8::Object> wrapper); // Helper to init with arguments. - void InitWithArgs(gin::Arguments* args); + void InitWithArgs(const gin::Arguments* args); v8::Global<v8::Object> wrapper_; // Weak diff --git a/shell/renderer/api/electron_api_context_bridge.cc b/shell/renderer/api/electron_api_context_bridge.cc index 3efed5f4d5dbe..343fa0e70b2ea 100644 --- a/shell/renderer/api/electron_api_context_bridge.cc +++ b/shell/renderer/api/electron_api_context_bridge.cc @@ -739,14 +739,13 @@ void ExposeAPI(v8::Isolate* isolate, v8::Isolate* target_isolate, v8::Local<v8::Context> target_context, const std::string& key, - v8::Local<v8::Value> api, - gin_helper::Arguments* args) { + v8::Local<v8::Value> api) { DCHECK(!target_context.IsEmpty()); v8::Context::Scope target_context_scope(target_context); gin_helper::Dictionary global(target_isolate, target_context->Global()); if (global.Has(key)) { - args->ThrowError( + gin_helper::ErrorThrower{isolate}.ThrowError( "Cannot bind an API on top of an existing property on the window " "object"); return; @@ -813,8 +812,7 @@ v8::MaybeLocal<v8::Context> GetTargetContext(v8::Isolate* isolate, void ExposeAPIInWorld(v8::Isolate* isolate, const int world_id, const std::string& key, - v8::Local<v8::Value> api, - gin_helper::Arguments* args) { + v8::Local<v8::Value> api) { TRACE_EVENT2("electron", "ContextBridge::ExposeAPIInWorld", "key", key, "worldId", world_id); v8::Local<v8::Context> source_context = isolate->GetCurrentContext(); @@ -825,8 +823,7 @@ void ExposeAPIInWorld(v8::Isolate* isolate, if (maybe_target_context.IsEmpty() || !target_isolate) return; v8::Local<v8::Context> target_context = maybe_target_context.ToLocalChecked(); - ExposeAPI(isolate, source_context, target_isolate, target_context, key, api, - args); + ExposeAPI(isolate, source_context, target_isolate, target_context, key, api); } gin_helper::Dictionary TraceKeyPath(const gin_helper::Dictionary& start, @@ -923,24 +920,23 @@ bool OverrideGlobalPropertyFromIsolatedWorld( } // Serialize script to be executed in the given world. -v8::Local<v8::Value> ExecuteInWorld(v8::Isolate* isolate, +v8::Local<v8::Value> ExecuteInWorld(v8::Isolate* const isolate, const int world_id, - gin_helper::Arguments* args) { + gin::Arguments* const args) { // Get context of caller v8::Local<v8::Context> source_context = isolate->GetCurrentContext(); // Get execution script argument gin_helper::Dictionary exec_script; if (args->Length() >= 1 && !args->GetNext(&exec_script)) { - gin_helper::ErrorThrower(args->isolate()).ThrowError("Invalid script"); + args->ThrowTypeError("Invalid script"); return v8::Undefined(isolate); } // Get "func" from execution script v8::Local<v8::Function> func; if (!exec_script.Get("func", &func)) { - gin_helper::ErrorThrower(isolate).ThrowError( - "Function 'func' is required in script"); + args->ThrowTypeError("Function 'func' is required in script"); return v8::Undefined(isolate); } @@ -949,7 +945,7 @@ v8::Local<v8::Value> ExecuteInWorld(v8::Isolate* isolate, v8::Local<v8::Value> args_value; if (exec_script.Get("args", &args_value)) { if (!args_value->IsArray()) { - gin_helper::ErrorThrower(isolate).ThrowError("'args' must be an array"); + args->ThrowTypeError("'args' must be an array"); return v8::Undefined(isolate); } args_array = args_value.As<v8::Array>(); @@ -961,7 +957,7 @@ v8::Local<v8::Value> ExecuteInWorld(v8::Isolate* isolate, v8::Local<v8::String> serialized_function; if (!func->FunctionProtoToString(isolate->GetCurrentContext()) .ToLocal(&serialized_function)) { - gin_helper::ErrorThrower(isolate).ThrowError( + gin_helper::ErrorThrower{isolate}.ThrowError( "Failed to serialize function"); return v8::Undefined(isolate); } diff --git a/shell/renderer/api/electron_api_web_frame.cc b/shell/renderer/api/electron_api_web_frame.cc index 2575ee0e183d7..5c700084c37d1 100644 --- a/shell/renderer/api/electron_api_web_frame.cc +++ b/shell/renderer/api/electron_api_web_frame.cc @@ -18,6 +18,7 @@ #include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame_observer.h" #include "content/public/renderer/render_frame_visitor.h" +#include "gin/arguments.h" #include "gin/object_template_builder.h" #include "services/service_manager/public/cpp/interface_provider.h" #include "shell/common/api/api.mojom.h" @@ -637,12 +638,11 @@ class WebFrameRenderer final return !context->GetContentSecurityPolicy()->ShouldCheckEval(); } - v8::Local<v8::Promise> ExecuteJavaScript(gin::Arguments* gin_args, + // webFrame.executeJavaScript(code[, userGesture][, callback]) + v8::Local<v8::Promise> ExecuteJavaScript(gin::Arguments* const args, const std::u16string& code) { - gin_helper::Arguments* args = static_cast<gin_helper::Arguments*>(gin_args); - - v8::Isolate* isolate = args->isolate(); - gin_helper::Promise<v8::Local<v8::Value>> promise(isolate); + v8::Isolate* const isolate = args->isolate(); + gin_helper::Promise<v8::Local<v8::Value>> promise{isolate}; v8::Local<v8::Promise> handle = promise.GetHandle(); content::RenderFrame* render_frame; @@ -655,10 +655,14 @@ class WebFrameRenderer final const blink::WebScriptSource source{blink::WebString::FromUTF16(code)}; bool has_user_gesture = false; - args->GetNext(&has_user_gesture); + if (auto next = args->PeekNext(); !next.IsEmpty() && next->IsBoolean()) { + args->GetNext(&has_user_gesture); + } ScriptExecutionCallback::CompletionCallback completion_callback; - args->GetNext(&completion_callback); + if (auto next = args->PeekNext(); !next.IsEmpty() && next->IsFunction()) { + args->GetNext(&completion_callback); + } auto* self = new ScriptExecutionCallback(std::move(promise), std::move(completion_callback)); @@ -679,14 +683,14 @@ class WebFrameRenderer final return handle; } + // executeJavaScriptInIsolatedWorld( + // worldId, scripts[, userGesture][, callback]) v8::Local<v8::Promise> ExecuteJavaScriptInIsolatedWorld( - gin::Arguments* gin_args, - int world_id, + gin::Arguments* const args, + const int world_id, const std::vector<gin_helper::Dictionary>& scripts) { - gin_helper::Arguments* args = static_cast<gin_helper::Arguments*>(gin_args); - - v8::Isolate* isolate = args->isolate(); - gin_helper::Promise<v8::Local<v8::Value>> promise(isolate); + v8::Isolate* const isolate = args->isolate(); + gin_helper::Promise<v8::Local<v8::Value>> promise{isolate}; v8::Local<v8::Promise> handle = promise.GetHandle(); content::RenderFrame* render_frame; @@ -698,10 +702,14 @@ class WebFrameRenderer final } bool has_user_gesture = false; - args->GetNext(&has_user_gesture); + if (auto next = args->PeekNext(); !next.IsEmpty() && next->IsBoolean()) { + args->GetNext(&has_user_gesture); + } ScriptExecutionCallback::CompletionCallback completion_callback; - args->GetNext(&completion_callback); + if (auto next = args->PeekNext(); !next.IsEmpty() && next->IsFunction()) { + args->GetNext(&completion_callback); + } std::vector<blink::WebScriptSource> sources; sources.reserve(scripts.size()); diff --git a/shell/renderer/preload_utils.cc b/shell/renderer/preload_utils.cc index 298b018eabdaf..a7a3d55859085 100644 --- a/shell/renderer/preload_utils.cc +++ b/shell/renderer/preload_utils.cc @@ -6,7 +6,6 @@ #include "base/process/process.h" #include "base/strings/strcat.h" -#include "shell/common/gin_helper/arguments.h" #include "shell/common/gin_helper/dictionary.h" #include "shell/common/node_includes.h" #include "v8/include/v8-context.h" @@ -34,20 +33,19 @@ v8::Local<v8::Object> GetBindingCache(v8::Isolate* isolate) { // adapted from node.cc v8::Local<v8::Value> GetBinding(v8::Isolate* isolate, - v8::Local<v8::String> key, - gin_helper::Arguments* margs) { + v8::Local<v8::String> key) { v8::Local<v8::Object> exports; - std::string binding_key = gin::V8ToString(isolate, key); + const std::string binding_key = gin::V8ToString(isolate, key); gin_helper::Dictionary cache(isolate, GetBindingCache(isolate)); if (cache.Get(binding_key, &exports)) { return exports; } - auto* mod = node::binding::get_linked_module(binding_key.c_str()); - + auto* const mod = node::binding::get_linked_module(binding_key.c_str()); if (!mod) { - margs->ThrowError(base::StrCat({"No such binding: ", binding_key})); + gin_helper::ErrorThrower{isolate}.ThrowError( + base::StrCat({"No such binding: ", binding_key})); return exports; } diff --git a/shell/renderer/preload_utils.h b/shell/renderer/preload_utils.h index 542e76a125ffd..b2931cf54a237 100644 --- a/shell/renderer/preload_utils.h +++ b/shell/renderer/preload_utils.h @@ -14,8 +14,7 @@ class Arguments; namespace electron::preload_utils { v8::Local<v8::Value> GetBinding(v8::Isolate* isolate, - v8::Local<v8::String> key, - gin_helper::Arguments* margs); + v8::Local<v8::String> key); v8::Local<v8::Value> CreatePreloadScript(v8::Isolate* isolate, v8::Local<v8::String> source); From e5dce686dfedc58af5d1838015ee771753010686 Mon Sep 17 00:00:00 2001 From: Kaiichiro Ota <nilay2014@gmail.com> Date: Sat, 4 Oct 2025 05:07:38 +0900 Subject: [PATCH 101/268] docs: mention that webUtils should be used via preload script (#45861) * docs: mention that webUtils should be used via preload script * docs: suppress lint errors * docs: clarify webUtils usage scope * docs: exclude potentially dangerous alert() in the example code * docs: minor change * docs: minor change * docs: minor change * docs: minor change * docs: minor change * docs: minor change * docs: minor change * docs: minor change * docs: minor change * docs: minor change * docs: make linter happy * docs: apply suggestion Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> * docs: apply suggestion Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> * docs: apply suggestion Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> * docs: minor change * docs: minor change * docs: remove preload line --------- Co-authored-by: Niklas Wenzel <dev@nikwen.de> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> --- docs/api/web-utils.md | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/api/web-utils.md b/docs/api/web-utils.md index 6ce407260e922..f4518149c3500 100644 --- a/docs/api/web-utils.md +++ b/docs/api/web-utils.md @@ -17,11 +17,27 @@ Returns `string` - The file system path that this `File` object points to. In th This method superseded the previous augmentation to the `File` object with the `path` property. An example is included below. ```js @ts-nocheck -// Before -const oldPath = document.querySelector('input').files[0].path +// Before (renderer) +const oldPath = document.querySelector('input[type=file]').files[0].path +``` +```js @ts-nocheck // After -const { webUtils } = require('electron') -const newPath = webUtils.getPathForFile(document.querySelector('input').files[0]) +// Renderer: + +const file = document.querySelector('input[type=file]').files[0] +electronApi.doSomethingWithFile(file) + +// Preload script: + +const { contextBridge, webUtils } = require('electron') + +contextBridge.exposeInMainWorld('electronApi', { + doSomethingWithFile (file) { + const path = webUtils.getPathForFile(file) + // Do something with the path, e.g., send it over IPC to the main process. + // It's best not to expose the full file path to the web content if possible. + } +}) ``` From 3cf1b062f91aac1fb75ea7b2a7ddd489703da914 Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Sat, 4 Oct 2025 09:28:06 -0500 Subject: [PATCH 102/268] docs: clarify optional args in webFrame.executeJavaScript() (#48447) --- docs/api/web-frame.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/web-frame.md b/docs/api/web-frame.md index 4c92a8985e29c..2bd42fe3cf9fe 100644 --- a/docs/api/web-frame.md +++ b/docs/api/web-frame.md @@ -139,7 +139,7 @@ by its key, which is returned from `webFrame.insertCSS(css)`. Inserts `text` to the focused element. -### `webFrame.executeJavaScript(code[, userGesture, callback])` +### `webFrame.executeJavaScript(code[, userGesture][, callback])` * `code` string * `userGesture` boolean (optional) - Default is `false`. @@ -160,7 +160,7 @@ In the browser window some HTML APIs like `requestFullScreen` can only be invoked by a gesture from the user. Setting `userGesture` to `true` will remove this limitation. -### `webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture, callback])` +### `webFrame.executeJavaScriptInIsolatedWorld(worldId, scripts[, userGesture][, callback])` * `worldId` Integer - The ID of the world to run the javascript in, `0` is the default main world (where content runs), `999` is the From 451bba4f060cdef81502633354a12703ca7f726d Mon Sep 17 00:00:00 2001 From: Niklas Wenzel <nilay2014@gmail.com> Date: Sat, 4 Oct 2025 18:44:10 +0200 Subject: [PATCH 103/268] docs: recommend calling renderer process modules from preload script (#48427) --- docs/api/clipboard.md | 6 ++++++ docs/api/crash-reporter.md | 6 ++++++ docs/api/ipc-renderer.md | 6 ++++++ docs/api/native-image.md | 6 ++++++ docs/api/web-frame.md | 6 ++++++ docs/api/web-utils.md | 6 ++++++ 6 files changed, 36 insertions(+) diff --git a/docs/api/clipboard.md b/docs/api/clipboard.md index 275a7afe62108..a6e6da7592ea6 100644 --- a/docs/api/clipboard.md +++ b/docs/api/clipboard.md @@ -4,6 +4,12 @@ Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process) (non-sandboxed only) +> [!IMPORTANT] +> If you want to call this API from a renderer process with context isolation enabled, +> place the API call in your preload script and +> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the +> [`contextBridge`](context-bridge.md) API. + On Linux, there is also a `selection` clipboard. To manipulate it you need to pass `selection` to each method: diff --git a/docs/api/crash-reporter.md b/docs/api/crash-reporter.md index d00dad544f7b8..a269750e70498 100644 --- a/docs/api/crash-reporter.md +++ b/docs/api/crash-reporter.md @@ -4,6 +4,12 @@ Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process) +> [!IMPORTANT] +> If you want to call this API from a renderer process with context isolation enabled, +> place the API call in your preload script and +> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the +> [`contextBridge`](context-bridge.md) API. + The following is an example of setting up Electron to automatically submit crash reports to a remote server: diff --git a/docs/api/ipc-renderer.md b/docs/api/ipc-renderer.md index 53722a414bbea..307ac8bf01263 100644 --- a/docs/api/ipc-renderer.md +++ b/docs/api/ipc-renderer.md @@ -20,6 +20,12 @@ changes: Process: [Renderer](../glossary.md#renderer-process) +> [!IMPORTANT] +> If you want to call this API from a renderer process with context isolation enabled, +> place the API call in your preload script and +> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the +> [`contextBridge`](context-bridge.md) API. + The `ipcRenderer` module is an [EventEmitter][event-emitter]. It provides a few methods so you can send synchronous and asynchronous messages from the render process (web page) to the main process. You can also receive replies from the diff --git a/docs/api/native-image.md b/docs/api/native-image.md index 68ecbbe1ad1d7..61b3c5ab3173e 100644 --- a/docs/api/native-image.md +++ b/docs/api/native-image.md @@ -4,6 +4,12 @@ Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process) +> [!IMPORTANT] +> If you want to call this API from a renderer process with context isolation enabled, +> place the API call in your preload script and +> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the +> [`contextBridge`](context-bridge.md) API. + The `nativeImage` module provides a unified interface for manipulating system images. These can be handy if you want to provide multiple scaled versions of the same icon or take advantage of macOS [template images][template-image]. diff --git a/docs/api/web-frame.md b/docs/api/web-frame.md index 2bd42fe3cf9fe..2681df864a507 100644 --- a/docs/api/web-frame.md +++ b/docs/api/web-frame.md @@ -4,6 +4,12 @@ Process: [Renderer](../glossary.md#renderer-process) +> [!IMPORTANT] +> If you want to call this API from a renderer process with context isolation enabled, +> place the API call in your preload script and +> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the +> [`contextBridge`](context-bridge.md) API. + `webFrame` export of the Electron module is an instance of the `WebFrame` class representing the current frame. Sub-frames can be retrieved by certain properties and methods (e.g. `webFrame.firstChild`). diff --git a/docs/api/web-utils.md b/docs/api/web-utils.md index f4518149c3500..f1d04fcc9887b 100644 --- a/docs/api/web-utils.md +++ b/docs/api/web-utils.md @@ -4,6 +4,12 @@ Process: [Renderer](../glossary.md#renderer-process) +> [!IMPORTANT] +> If you want to call this API from a renderer process with context isolation enabled, +> place the API call in your preload script and +> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the +> [`contextBridge`](context-bridge.md) API. + ## Methods The `webUtils` module has the following methods: From 1947e73b4abe658612cebeab727edccbbd689325 Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Sat, 4 Oct 2025 23:52:53 -0500 Subject: [PATCH 104/268] perf: avoid a little extra work in `InvokeIpcCallback()` (#48456) perf: two minor perf refactors in InvokeIpcCallback() 1. Allocate the CallbackScope on the stack instead of the heap 2. Skip a redundant call to node::Environment::GetCurrent() --- shell/renderer/electron_ipc_native.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/shell/renderer/electron_ipc_native.cc b/shell/renderer/electron_ipc_native.cc index 36396ad2ff483..7fac851f9e2e7 100644 --- a/shell/renderer/electron_ipc_native.cc +++ b/shell/renderer/electron_ipc_native.cc @@ -4,6 +4,8 @@ #include "electron/shell/renderer/electron_ipc_native.h" +#include <optional> + #include "base/trace_event/trace_event.h" #include "shell/common/gin_converters/blink_converter.h" #include "shell/common/gin_converters/value_converter.h" @@ -45,10 +47,9 @@ void InvokeIpcCallback(v8::Isolate* const isolate, // Only set up the node::CallbackScope if there's a node environment. // Sandboxed renderers don't have a node environment. - std::unique_ptr<node::CallbackScope> callback_scope; - if (node::Environment::GetCurrent(context)) { - callback_scope = std::make_unique<node::CallbackScope>( - isolate, ipcNative, node::async_context{0, 0}); + std::optional<node::CallbackScope> callback_scope; + if (auto* env = node::Environment::GetCurrent(context)) { + callback_scope.emplace(env, ipcNative, node::async_context{0, 0}); } auto callback_key = gin::ConvertToV8(isolate, callback_name) From 929ee8108b4b62ac9230a0ef1e1489795da95112 Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Sun, 5 Oct 2025 12:32:28 -0500 Subject: [PATCH 105/268] refactor: DRY in App::SetAppLogPath() (#48452) --- shell/browser/api/electron_api_app.cc | 45 +++++++++++++---------- shell/browser/api/electron_api_app.h | 5 ++- shell/browser/api/electron_api_app_mac.mm | 32 ++++------------ 3 files changed, 36 insertions(+), 46 deletions(-) diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc index b103a424fb473..777f64be02241 100644 --- a/shell/browser/api/electron_api_app.cc +++ b/shell/browser/api/electron_api_app.cc @@ -870,28 +870,33 @@ void App::SetAppPath(const base::FilePath& app_path) { app_path_ = app_path; } +void App::SetAppLogsPath(gin::Arguments* const args) { + base::FilePath path; + + // if caller provided a path, it must be absolute + if (args->GetNext(&path) && !path.IsAbsolute()) { + args->ThrowTypeError("Path must be absolute"); + return; + } + + // if caller did not provide a path, then use a default one + if (path.empty()) { + path = GetDefaultAppLogPath(); + } + + ScopedAllowBlockingForElectron allow_blocking; + base::PathService::Override(DIR_APP_LOGS, path); +} + #if !BUILDFLAG(IS_MAC) -void App::SetAppLogsPath(gin_helper::ErrorThrower thrower, - std::optional<base::FilePath> custom_path) { - if (custom_path.has_value()) { - if (!custom_path->IsAbsolute()) { - thrower.ThrowError("Path must be absolute"); - return; - } - { - ScopedAllowBlockingForElectron allow_blocking; - base::PathService::Override(DIR_APP_LOGS, custom_path.value()); - } - } else { - base::FilePath path; - if (base::PathService::Get(chrome::DIR_USER_DATA, &path)) { - path = path.Append(base::FilePath::FromUTF8Unsafe("logs")); - { - ScopedAllowBlockingForElectron allow_blocking; - base::PathService::Override(DIR_APP_LOGS, path); - } - } +// static +// default to `${DIR_USER_DATA}/logs` +base::FilePath App::GetDefaultAppLogPath() { + base::FilePath path; + if (base::PathService::Get(chrome::DIR_USER_DATA, &path)) { + path = path.Append(base::FilePath::FromUTF8Unsafe("logs")); } + return path; } #endif diff --git a/shell/browser/api/electron_api_app.h b/shell/browser/api/electron_api_app.h index b1e40cedb72de..066790f492809 100644 --- a/shell/browser/api/electron_api_app.h +++ b/shell/browser/api/electron_api_app.h @@ -178,6 +178,8 @@ class App final : public gin::Wrappable<App>, const content::ChildProcessTerminationInfo& info) override; private: + [[nodiscard]] static base::FilePath GetDefaultAppLogPath(); + void BrowserChildProcessCrashedOrKilled( const content::ChildProcessData& data, const content::ChildProcessTerminationInfo& info); @@ -190,8 +192,7 @@ class App final : public gin::Wrappable<App>, const std::string& name = std::string()); void ChildProcessDisconnected(content::ChildProcessId pid); - void SetAppLogsPath(gin_helper::ErrorThrower thrower, - std::optional<base::FilePath> custom_path); + void SetAppLogsPath(gin::Arguments* args); // Get/Set the pre-defined path in PathService. base::FilePath GetPath(gin_helper::ErrorThrower thrower, diff --git a/shell/browser/api/electron_api_app_mac.mm b/shell/browser/api/electron_api_app_mac.mm index 37bf73426a542..b7d9228a121d2 100644 --- a/shell/browser/api/electron_api_app_mac.mm +++ b/shell/browser/api/electron_api_app_mac.mm @@ -17,30 +17,14 @@ namespace electron::api { -void App::SetAppLogsPath(gin_helper::ErrorThrower thrower, - std::optional<base::FilePath> custom_path) { - if (custom_path.has_value()) { - if (!custom_path->IsAbsolute()) { - thrower.ThrowError("Path must be absolute"); - return; - } - { - ScopedAllowBlockingForElectron allow_blocking; - base::PathService::Override(DIR_APP_LOGS, custom_path.value()); - } - } else { - NSString* bundle_name = - [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]; - NSString* logs_path = - [NSString stringWithFormat:@"Library/Logs/%@", bundle_name]; - NSString* library_path = - [NSHomeDirectory() stringByAppendingPathComponent:logs_path]; - { - ScopedAllowBlockingForElectron allow_blocking; - base::PathService::Override(DIR_APP_LOGS, - base::FilePath([library_path UTF8String])); - } - } +base::FilePath App::GetDefaultAppLogPath() { + NSString* bundle_name = + [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]; + NSString* logs_path = + [NSString stringWithFormat:@"Library/Logs/%@", bundle_name]; + NSString* library_path = + [NSHomeDirectory() stringByAppendingPathComponent:logs_path]; + return base::FilePath{[library_path UTF8String]}; } void App::SetActivationPolicy(gin_helper::ErrorThrower thrower, From e9f348a4432558ca55bc2870eb5fe8c94d860253 Mon Sep 17 00:00:00 2001 From: Keeley Hammond <nilay2014@gmail.com> Date: Mon, 6 Oct 2025 07:17:46 -0700 Subject: [PATCH 106/268] build: handle Metal toolchain being unbundled from Xcode 26 (#48467) * chore: add metal patch dir * chore: cherry-pick 2f564f1ca07b from angle (#48465) * chore: update patch --- patches/angle/.patches | 1 + patches/angle/cherry-pick-2f564f1ca07b.patch | 125 +++++++++++++++++++ patches/config.json | 3 +- 3 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 patches/angle/.patches create mode 100644 patches/angle/cherry-pick-2f564f1ca07b.patch diff --git a/patches/angle/.patches b/patches/angle/.patches new file mode 100644 index 0000000000000..30503ef3561d6 --- /dev/null +++ b/patches/angle/.patches @@ -0,0 +1 @@ +cherry-pick-2f564f1ca07b.patch diff --git a/patches/angle/cherry-pick-2f564f1ca07b.patch b/patches/angle/cherry-pick-2f564f1ca07b.patch new file mode 100644 index 0000000000000..06060e5968f33 --- /dev/null +++ b/patches/angle/cherry-pick-2f564f1ca07b.patch @@ -0,0 +1,125 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mark Mentovai <mark@chromium.org> +Date: Tue, 16 Sep 2025 16:46:36 -0400 +Subject: mac: handle Metal toolchain being unbundled from Xcode 26 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The Metal toolchain was formerly part of Xcode, but in Xcode 26, it has +been unbundled and is now a separate install. Attempting to use the +Metal toolchain without installing it results in a build error, such as: + +error: error: cannot execute tool 'metal' due to missing Metal +Toolchain; use: xcodebuild -downloadComponent MetalToolchain + +By running the suggested command, the Metal toolchain can be installed, +but the existing angle build does not know how to find it correctly. + +For system Xcode installations, tools from the Metal toolchain (`metal` +and `metallib`) can be run via `xcrun`. This construct should work +equally well for older Xcode versions, for situations where it’s still +in use. + +For the hermetic toolchain, we’ll continue splicing the Metal toolchain +into the location it had previously been avialable (see +https://chromium-review.googlesource.com/c/6950738), although this is +subject to change in the future. + +Bug: chromium:423933062, chromium:445400016 +Change-Id: I139eca51938f7cecfec9b90fd488947160ef4ec9 +Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6955000 +Auto-Submit: Mark Mentovai <mark@chromium.org> +Commit-Queue: Mark Mentovai <mark@chromium.org> +Reviewed-by: Geoff Lang <geofflang@chromium.org> + +diff --git a/src/libANGLE/renderer/metal/BUILD.gn b/src/libANGLE/renderer/metal/BUILD.gn +index 96e9ee8420810f6a3ca9a0c290d4a654200eb7b9..50ac42a5b9a0f7c8b3b161af40c598cb34ff132a 100644 +--- a/src/libANGLE/renderer/metal/BUILD.gn ++++ b/src/libANGLE/renderer/metal/BUILD.gn +@@ -24,20 +24,56 @@ config("angle_metal_backend_config") { + } + + if (metal_internal_shader_compilation_supported) { ++ template("run_metal_tool") { ++ action(target_name) { ++ forward_variables_from(invoker, ++ [ ++ "deps", ++ "sources", ++ "outputs", ++ "metal_tool", ++ ]) ++ script = "shaders/metal_wrapper.py" ++ if (use_system_xcode) { ++ # System Xcode: run metal and metallib via xcrun. Since Xcode 26.0, the ++ # Metal toolchain has been unbundled from Xcode, and must be installed ++ # separately by running `xcodebuild -downloadComponent MetalToolchain`. ++ # There is a vestigial metal executable in mac_bin_path, but it’s ++ # incapable of running successfuly without the ++ # rest of the Metal toolchain surrounding it. `xcrun` is able to find ++ # and run the correct Metal toolchain when properly installed. ++ # ++ # If you’re using system Xcode and your build fails with this message: ++ # error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain ++ # then do what the error message suggests, and then retry your build. ++ args = [ ++ "xcrun", ++ metal_tool, ++ ] ++ } else { ++ # Hermetic Xcode: at least for now, the Metal toolchain is ++ # “spliced” into the location in the hermetic toolchain where it lived ++ # before Xcode 26.0, so it can be run directly from there. ++ args = [ mac_bin_path + metal_tool ] ++ } ++ ++ args += invoker.args ++ } ++ } ++ + _metal_internal_shaders_air_file = + "$root_gen_dir/angle/mtl_internal_shaders_autogen.air" + +- action("angle_metal_internal_shaders_to_air") { +- script = "shaders/metal_wrapper.py" +- +- outputs = [ _metal_internal_shaders_air_file ] +- ++ run_metal_tool("angle_metal_internal_shaders_to_air") { + _metal_internal_shaders_metal_source = + "shaders/mtl_internal_shaders_autogen.metal" + sources = [ _metal_internal_shaders_metal_source ] + ++ outputs = [ _metal_internal_shaders_air_file ] ++ ++ metal_tool = "metal" ++ + args = [ +- mac_bin_path + "metal", + "-c", + rebase_path(_metal_internal_shaders_metal_source, root_build_dir), + "-o", +@@ -60,17 +96,16 @@ if (metal_internal_shader_compilation_supported) { + _metal_internal_shaders_metallib_file = + "$root_gen_dir/angle/mtl_internal_shaders_autogen.metallib" + +- action("angle_metal_internal_shaders_to_mtllib") { +- script = "shaders/metal_wrapper.py" +- +- outputs = [ _metal_internal_shaders_metallib_file ] ++ run_metal_tool("angle_metal_internal_shaders_to_mtllib") { ++ deps = [ ":angle_metal_internal_shaders_to_air" ] + + sources = [ _metal_internal_shaders_air_file ] + +- deps = [ ":angle_metal_internal_shaders_to_air" ] ++ outputs = [ _metal_internal_shaders_metallib_file ] ++ ++ metal_tool = "metallib" + + args = [ +- mac_bin_path + "metallib", + rebase_path(_metal_internal_shaders_air_file, root_build_dir), + "-o", + rebase_path(_metal_internal_shaders_metallib_file, root_build_dir), diff --git a/patches/config.json b/patches/config.json index 8d297c0fd3e66..37f4600e246f4 100644 --- a/patches/config.json +++ b/patches/config.json @@ -12,5 +12,6 @@ { "patch_dir": "src/electron/patches/ReactiveObjC", "repo": "src/third_party/squirrel.mac/vendor/ReactiveObjC" }, { "patch_dir": "src/electron/patches/webrtc", "repo": "src/third_party/webrtc" }, { "patch_dir": "src/electron/patches/reclient-configs", "repo": "src/third_party/engflow-reclient-configs" }, - { "patch_dir": "src/electron/patches/sqlite", "repo": "src/third_party/sqlite/src" } + { "patch_dir": "src/electron/patches/sqlite", "repo": "src/third_party/sqlite/src" }, + { "patch_dir": "src/electron/patches/angle", "repo": "src/third_party/angle" } ] From ac4dceb9baf355bc92ab10c1a86c1802ca338b29 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt <nilay2014@gmail.com> Date: Mon, 6 Oct 2025 20:22:55 -0700 Subject: [PATCH 107/268] build: fixup chromedriver and mksnapshot (#48470) * build: update build tools to get proper exit codes from e build xref: https://github.com/electron/build-tools/pull/759 * build: target zips directly mksnapshot and chromedriver have issues with siso trying to run a separate build and zip step, so just target the zip target * build: don't unzip chromedriver and mksnapshot in tests The contents of these files are not used in testing, so we shouldn't unzip them. --- .github/actions/build-electron/action.yml | 4 +--- .github/actions/install-build-tools/action.yml | 2 +- .github/workflows/pipeline-segment-electron-test.yml | 8 ++------ 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/actions/build-electron/action.yml b/.github/actions/build-electron/action.yml index 38e514a553403..83b565576eecd 100644 --- a/.github/actions/build-electron/action.yml +++ b/.github/actions/build-electron/action.yml @@ -79,7 +79,7 @@ runs: shell: bash run: | cd src - e build --target electron:electron_mksnapshot + e build --target electron:electron_mksnapshot_zip ELECTRON_DEPOT_TOOLS_DISABLE_LOG=1 e d gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args # Remove unused args from mksnapshot_args SEDOPTION="-i" @@ -89,7 +89,6 @@ runs: sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args sed $SEDOPTION '/--turbo-profiling-input/d' out/Default/mksnapshot_args - e build --target electron:electron_mksnapshot_zip if [ "${{ inputs.target-platform }}" = "win" ]; then cd out/Default powershell Compress-Archive -update mksnapshot_args mksnapshot.zip @@ -123,7 +122,6 @@ runs: shell: bash run: | cd src - e build --target electron:electron_chromedriver e build --target electron:electron_chromedriver_zip if [ "${{ inputs.is-asan }}" != "true" ]; then diff --git a/.github/actions/install-build-tools/action.yml b/.github/actions/install-build-tools/action.yml index 9156c09384680..868cdc63a44b6 100644 --- a/.github/actions/install-build-tools/action.yml +++ b/.github/actions/install-build-tools/action.yml @@ -15,7 +15,7 @@ runs: git config --global core.preloadindex true git config --global core.longpaths true fi - export BUILD_TOOLS_SHA=c13f4bdb50e65da46a4703f8f882079dd21fd99e + export BUILD_TOOLS_SHA=706147b2376f55078f718576b28129a0457f1795 npm i -g @electron/build-tools # Update depot_tools to ensure python e d update_depot_tools diff --git a/.github/workflows/pipeline-segment-electron-test.yml b/.github/workflows/pipeline-segment-electron-test.yml index e21c92a5ab285..418409411e9b9 100644 --- a/.github/workflows/pipeline-segment-electron-test.yml +++ b/.github/workflows/pipeline-segment-electron-test.yml @@ -177,22 +177,18 @@ jobs: path: ./src_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }} - name: Restore Generated Artifacts run: ./src/electron/script/actions/restore-artifacts.sh - - name: Unzip Dist, Mksnapshot & Chromedriver (win) + - name: Unzip Dist (win) if: ${{ inputs.target-platform == 'win' }} shell: powershell run: | Set-ExecutionPolicy Bypass -Scope Process -Force cd src/out/Default Expand-Archive -Force dist.zip -DestinationPath ./ - Expand-Archive -Force chromedriver.zip -DestinationPath ./ - Expand-Archive -Force mksnapshot.zip -DestinationPath ./ - - name: Unzip Dist, Mksnapshot & Chromedriver (unix) + - name: Unzip Dist (unix) if: ${{ inputs.target-platform != 'win' }} run: | cd src/out/Default unzip -:o dist.zip - unzip -:o chromedriver.zip - unzip -:o mksnapshot.zip #- name: Import & Trust Self-Signed Codesigning Cert on MacOS # if: ${{ inputs.target-platform == 'macos' && inputs.target-arch == 'x64' }} # run: | From 5b031bc913d70619f295dbfbae0a2b50eaa6b2df Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Wed, 8 Oct 2025 09:56:23 +0200 Subject: [PATCH 108/268] build(deps): bump actions/stale from 9.1.0 to 10.1.0 (#48477) Bumps [actions/stale](https://github.com/actions/stale) from 9.1.0 to 10.1.0. - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/stale/compare/5bef64f19d7facfb25b37b414482c7164d639639...5f858e3efba33a5ca4407a664cc011ad407f2008) --- updated-dependencies: - dependency-name: actions/stale dependency-version: 10.1.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/stale.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 7fd2e20fa5e5c..2e645130c63f9 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -16,7 +16,7 @@ jobs: id: generate-token with: creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} - - uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # tag: v9.1.0 + - uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # tag: v10.1.0 with: repo-token: ${{ steps.generate-token.outputs.token }} days-before-stale: 90 @@ -39,7 +39,7 @@ jobs: id: generate-token with: creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} - - uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # tag: v9.1.0 + - uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # tag: v10.1.0 with: repo-token: ${{ steps.generate-token.outputs.token }} days-before-stale: -1 From 34aac59dc18b7b2d890dcc51f4077201dd2665d2 Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Wed, 8 Oct 2025 03:43:28 -0500 Subject: [PATCH 109/268] chore: remove unused reference to `api::BrowserView` (#48474) chore: remove unused reference to api::BrowserView Unused since #35658 / 15c60143 --- shell/browser/native_window.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index 2c25fa547ab78..bf7fab116ae50 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -50,10 +50,6 @@ namespace electron { class ElectronMenuModel; class BackgroundThrottlingSource; -namespace api { -class BrowserView; -} - #if BUILDFLAG(IS_MAC) using NativeWindowHandle = gfx::NativeView; #else @@ -434,8 +430,6 @@ class NativeWindow : public base::SupportsUserData, void UpdateBackgroundThrottlingState(); protected: - friend class api::BrowserView; - NativeWindow(const gin_helper::Dictionary& options, NativeWindow* parent); void set_titlebar_overlay_height(int height) { From 07036b7eb0bfd6b21ce1ab23c6537648aa3949bf Mon Sep 17 00:00:00 2001 From: Fedor Indutny <nilay2014@gmail.com> Date: Wed, 8 Oct 2025 01:44:09 -0700 Subject: [PATCH 110/268] feat: dynamic ESM import in preload without context isolation (#48375) Dynamic ESM import in non-context-isolated preload Extend `HostImportModuleWithPhaseDynamically`'s routing to support Node.js import resolution in non-context-isolated preloads through `v8_host_defined_options` length check. The length of host defined options is distinct between Blink and Node.js and we can use it to determine which resolver to use. --- docs/tutorial/esm.md | 2 +- patches/chromium/.patches | 1 + ...erscriptinfo_hostdefinedoptionsindex.patch | 53 +++++++++++ shell/common/node_bindings.cc | 93 ++++++++++++++----- spec/esm-spec.ts | 34 ++++--- 5 files changed, 148 insertions(+), 35 deletions(-) create mode 100644 patches/chromium/expose_referrerscriptinfo_hostdefinedoptionsindex.patch diff --git a/docs/tutorial/esm.md b/docs/tutorial/esm.md index ae532fbba5b11..f1500eb5ff2b2 100644 --- a/docs/tutorial/esm.md +++ b/docs/tutorial/esm.md @@ -32,7 +32,7 @@ This table gives a general overview of where ESM is supported and which ESM load | Main | Node.js | N/A | <ul><li> [You must use `await` generously before the app's `ready` event](#you-must-use-await-generously-before-the-apps-ready-event) </li></ul> | | Renderer (Sandboxed) | Chromium | Unsupported | <ul><li> [Sandboxed preload scripts can't use ESM imports](#sandboxed-preload-scripts-cant-use-esm-imports) </li></ul> | | Renderer (Unsandboxed & Context Isolated) | Chromium | Node.js | <ul><li> [Unsandboxed ESM preload scripts will run after page load on pages with no content](#unsandboxed-esm-preload-scripts-will-run-after-page-load-on-pages-with-no-content) </li> <li>[ESM Preload Scripts must have the `.mjs` extension](#esm-preload-scripts-must-have-the-mjs-extension)</li></ul> | -| Renderer (Unsandboxed & Non Context Isolated) | Chromium | Node.js | <ul><li>[Unsandboxed ESM preload scripts will run after page load on pages with no content](#unsandboxed-esm-preload-scripts-will-run-after-page-load-on-pages-with-no-content)</li><li>[ESM Preload Scripts must have the `.mjs` extension](#esm-preload-scripts-must-have-the-mjs-extension)</li><li>[ESM preload scripts must be context isolated to use dynamic Node.js ESM imports](#esm-preload-scripts-must-be-context-isolated-to-use-dynamic-nodejs-esm-imports)</li></ul> | +| Renderer (Unsandboxed & Non Context Isolated) | Chromium | Node.js | <ul><li>[Unsandboxed ESM preload scripts will run after page load on pages with no content](#unsandboxed-esm-preload-scripts-will-run-after-page-load-on-pages-with-no-content)</li><li>[ESM Preload Scripts must have the `.mjs` extension](#esm-preload-scripts-must-have-the-mjs-extension)</li></ul> | ## Main process diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 3b7351578c83c..3c2e03908670c 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -142,3 +142,4 @@ chore_expose_isolate_parameter_in_script_lifecycle_observers.patch revert_partial_remove_unused_prehandlemouseevent.patch allow_electron_to_depend_on_components_os_crypt_sync.patch disable_nsautofillheuristiccontroller_on_macos_26.patch +expose_referrerscriptinfo_hostdefinedoptionsindex.patch diff --git a/patches/chromium/expose_referrerscriptinfo_hostdefinedoptionsindex.patch b/patches/chromium/expose_referrerscriptinfo_hostdefinedoptionsindex.patch new file mode 100644 index 0000000000000..a95d1b500c0fb --- /dev/null +++ b/patches/chromium/expose_referrerscriptinfo_hostdefinedoptionsindex.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Fedor Indutny <indutny@signal.org> +Date: Wed, 24 Sep 2025 10:08:48 -0700 +Subject: Expose ReferrerScriptInfo::HostDefinedOptionsIndex + +In `shell/common/node_bindings.cc`'s +`HostImportModuleWithPhaseDynamically` we route dynamic imports to +either Node.js's or Blink's resolver based on presence of Node.js +environment, process type, etc. Exporting `HostDefinedOptionsIndex` +allows us to route based on the size of `v8_host_defined_options` data +which enables us to support dynamic imports in non-context-isolated +preload scripts. + +diff --git a/third_party/blink/renderer/bindings/core/v8/referrer_script_info.cc b/third_party/blink/renderer/bindings/core/v8/referrer_script_info.cc +index 1b797783987255622735047bd78ca0e8bb635d5e..b209c736bb80c186ed51999af1dac0a1d50fc232 100644 +--- a/third_party/blink/renderer/bindings/core/v8/referrer_script_info.cc ++++ b/third_party/blink/renderer/bindings/core/v8/referrer_script_info.cc +@@ -12,15 +12,6 @@ namespace blink { + + namespace { + +-enum HostDefinedOptionsIndex : size_t { +- kBaseURL, +- kCredentialsMode, +- kNonce, +- kParserState, +- kReferrerPolicy, +- kLength +-}; +- + // Omit storing base URL if it is same as ScriptOrigin::ResourceName(). + // Note: This improves chance of getting into a fast path in + // ReferrerScriptInfo::ToV8HostDefinedOptions. +diff --git a/third_party/blink/renderer/bindings/core/v8/referrer_script_info.h b/third_party/blink/renderer/bindings/core/v8/referrer_script_info.h +index 0119624a028bec3e53e4e402938a98fe6def1483..743865839448748fe00e3e7d5027587cb65393c9 100644 +--- a/third_party/blink/renderer/bindings/core/v8/referrer_script_info.h ++++ b/third_party/blink/renderer/bindings/core/v8/referrer_script_info.h +@@ -23,6 +23,15 @@ class CORE_EXPORT ReferrerScriptInfo { + STACK_ALLOCATED(); + + public: ++ enum HostDefinedOptionsIndex : size_t { ++ kBaseURL, ++ kCredentialsMode, ++ kNonce, ++ kParserState, ++ kReferrerPolicy, ++ kLength ++ }; ++ + ReferrerScriptInfo() {} + ReferrerScriptInfo(const KURL& base_url, + network::mojom::CredentialsMode credentials_mode, diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc index 0f4ee0539285f..bde0c03105cb4 100644 --- a/shell/common/node_bindings.cc +++ b/shell/common/node_bindings.cc @@ -24,6 +24,7 @@ #include "base/trace_event/trace_event.h" #include "chrome/common/chrome_version.h" #include "content/public/common/content_paths.h" +#include "content/public/renderer/render_frame.h" #include "electron/buildflags/buildflags.h" #include "electron/electron_version.h" #include "electron/fuses.h" @@ -41,7 +42,9 @@ #include "shell/common/node_util.h" #include "shell/common/process_util.h" #include "shell/common/world_ids.h" +#include "third_party/blink/public/common/web_preferences/web_preferences.h" #include "third_party/blink/public/web/web_local_frame.h" +#include "third_party/blink/renderer/bindings/core/v8/referrer_script_info.h" // nogncheck #include "third_party/blink/renderer/bindings/core/v8/v8_initializer.h" // nogncheck #include "third_party/electron_node/src/debug_utils.h" #include "third_party/electron_node/src/module_wrap.h" @@ -211,6 +214,61 @@ bool AllowWasmCodeGenerationCallback(v8::Local<v8::Context> context, return node::AllowWasmCodeGenerationCallback(context, source); } +enum ESMHandlerPlatform { + kNone, + kNodeJS, + kBlink, +}; + +static ESMHandlerPlatform SelectESMHandlerPlatform( + v8::Local<v8::Context> context, + v8::Local<v8::Data> raw_host_defined_options) { + if (node::Environment::GetCurrent(context) == nullptr) { + if (electron::IsBrowserProcess() || electron::IsUtilityProcess()) + return ESMHandlerPlatform::kNone; + + return ESMHandlerPlatform::kBlink; + } + + if (!electron::IsRendererProcess()) + return ESMHandlerPlatform::kNodeJS; + + blink::WebLocalFrame* frame = blink::WebLocalFrame::FrameForContext(context); + + if (frame == nullptr) + return ESMHandlerPlatform::kBlink; + + auto prefs = content::RenderFrame::FromWebFrame(frame)->GetBlinkPreferences(); + + // If we're running with contextIsolation enabled in the renderer process, + // fall back to Blink's logic when the frame is not in the isolated world. + if (prefs.context_isolation) { + return frame->GetScriptContextWorldId(context) == + electron::WorldIDs::ISOLATED_WORLD_ID + ? ESMHandlerPlatform::kNodeJS + : ESMHandlerPlatform::kBlink; + } + + if (raw_host_defined_options.IsEmpty() || + !raw_host_defined_options->IsFixedArray()) { + return ESMHandlerPlatform::kBlink; + } + + // Since the routing is based on the `host_defined_options` length - + // make sure that Node's host defined options are different from Blink's. + static_assert( + static_cast<size_t>(node::loader::HostDefinedOptions::kLength) != + blink::ReferrerScriptInfo::HostDefinedOptionsIndex::kLength); + + // Use Node.js resolver only if host options were created by it. + auto options = v8::Local<v8::FixedArray>::Cast(raw_host_defined_options); + if (options->Length() == node::loader::HostDefinedOptions::kLength) { + return ESMHandlerPlatform::kNodeJS; + } + + return ESMHandlerPlatform::kBlink; +} + v8::MaybeLocal<v8::Promise> HostImportModuleWithPhaseDynamically( v8::Local<v8::Context> context, v8::Local<v8::Data> v8_host_defined_options, @@ -218,33 +276,22 @@ v8::MaybeLocal<v8::Promise> HostImportModuleWithPhaseDynamically( v8::Local<v8::String> v8_specifier, v8::ModuleImportPhase import_phase, v8::Local<v8::FixedArray> v8_import_attributes) { - if (node::Environment::GetCurrent(context) == nullptr) { - if (electron::IsBrowserProcess() || electron::IsUtilityProcess()) - return {}; - return blink::V8Initializer::HostImportModuleWithPhaseDynamically( - context, v8_host_defined_options, v8_referrer_resource_url, - v8_specifier, import_phase, v8_import_attributes); - } - - // If we're running with contextIsolation enabled in the renderer process, - // fall back to Blink's logic. - if (electron::IsRendererProcess()) { - blink::WebLocalFrame* frame = - blink::WebLocalFrame::FrameForContext(context); - if (!frame || frame->GetScriptContextWorldId(context) != - electron::WorldIDs::ISOLATED_WORLD_ID) { + switch (SelectESMHandlerPlatform(context, v8_host_defined_options)) { + case ESMHandlerPlatform::kBlink: return blink::V8Initializer::HostImportModuleWithPhaseDynamically( context, v8_host_defined_options, v8_referrer_resource_url, v8_specifier, import_phase, v8_import_attributes); - } + case ESMHandlerPlatform::kNodeJS: + // TODO: Switch to node::loader::ImportModuleDynamicallyWithPhase + // once we land the Node.js version that has it in upstream. + CHECK(import_phase == v8::ModuleImportPhase::kEvaluation); + return node::loader::ImportModuleDynamically( + context, v8_host_defined_options, v8_referrer_resource_url, + v8_specifier, v8_import_attributes); + case ESMHandlerPlatform::kNone: + default: + return {}; } - - // TODO: Switch to node::loader::ImportModuleDynamicallyWithPhase - // once we land the Node.js version that has it in upstream. - CHECK(import_phase == v8::ModuleImportPhase::kEvaluation); - return node::loader::ImportModuleDynamically( - context, v8_host_defined_options, v8_referrer_resource_url, v8_specifier, - v8_import_attributes); } v8::MaybeLocal<v8::Promise> HostImportModuleDynamically( diff --git a/spec/esm-spec.ts b/spec/esm-spec.ts index a09198ba7486e..b4221c0eda0a4 100644 --- a/spec/esm-spec.ts +++ b/spec/esm-spec.ts @@ -130,6 +130,17 @@ describe('esm', () => { } describe('nodeIntegration', () => { + let badFilePath = ''; + + beforeEach(async () => { + badFilePath = path.resolve(path.resolve(os.tmpdir(), 'bad-file.badjs')); + await fs.promises.writeFile(badFilePath, 'const foo = "bar";'); + }); + + afterEach(async () => { + await fs.promises.unlink(badFilePath); + }); + it('should support an esm entrypoint', async () => { const [webContents] = await loadWindowWithPreload('import { resolve } from "path"; window.resolvePath = resolve;', { nodeIntegration: true, @@ -189,6 +200,18 @@ describe('esm', () => { expect(error?.message).to.include('Failed to fetch dynamically imported module'); }); + it('should use Node.js ESM dynamic loader in the preload', async () => { + const [, preloadError] = await loadWindowWithPreload(`await import(${JSON.stringify((pathToFileURL(badFilePath)))})`, { + nodeIntegration: true, + sandbox: false, + contextIsolation: false + }); + + expect(preloadError).to.not.equal(null); + // This is a node.js specific error message + expect(preloadError!.toString()).to.include('Unknown file extension'); + }); + it('should use import.meta callback handling from Node.js for Node.js modules', async () => { const result = await runFixture(path.resolve(fixturePath, 'import-meta')); expect(result.code).to.equal(0); @@ -196,17 +219,6 @@ describe('esm', () => { }); describe('with context isolation', () => { - let badFilePath = ''; - - beforeEach(async () => { - badFilePath = path.resolve(path.resolve(os.tmpdir(), 'bad-file.badjs')); - await fs.promises.writeFile(badFilePath, 'const foo = "bar";'); - }); - - afterEach(async () => { - await fs.promises.unlink(badFilePath); - }); - it('should use Node.js ESM dynamic loader in the isolated context', async () => { const [, preloadError] = await loadWindowWithPreload(`await import(${JSON.stringify((pathToFileURL(badFilePath)))})`, { nodeIntegration: true, From 77129af04876bf2a2cb4ece373e60ff591aac0ff Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Wed, 8 Oct 2025 15:19:08 +0200 Subject: [PATCH 111/268] chore: bump node to v22.20.0 (main) (#48383) * chore: bump node in DEPS to v22.20.0 * chore: fixup patches --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> --- DEPS | 2 +- ..._to_foreground_task_runner_signature.patch | 4 +- .../api_remove_deprecated_getisolate.patch | 80 +++++++++---------- patches/node/build_add_gn_build_files.patch | 6 +- .../build_compile_with_c_20_support.patch | 4 +- patches/node/build_enable_perfetto.patch | 16 ++-- ...compilation_fails_if_not_using_a_new.patch | 8 +- ...f_original-fs_and_custom_embedder_js.patch | 2 +- ...e_clang_as_default_compiler_on_macos.patch | 2 +- ...e_expose_importmoduledynamically_and.patch | 8 +- ...cli_move_--trace-atomics-wait_to_eol.patch | 18 ++--- .../node/cli_remove_deprecated_v8_flag.patch | 6 +- ...enable_crashpad_linux_node_processes.patch | 6 +- ..._values_for_variables_in_common_gypi.patch | 2 +- ...d_source_location_for_v8_task_runner.patch | 8 +- ...g_fileexists_fn_to_legacymainresolve.patch | 10 +-- ...ssert_module_in_the_renderer_process.patch | 2 +- .../node/fix_cppgc_initializing_twice.patch | 4 +- ..._do_not_resolve_electron_entrypoints.patch | 13 +-- ...se_readfilesync_override_for_modules.patch | 4 +- ...n_electron_module_via_the_esm_loader.patch | 24 +++--- ...ingssl_and_openssl_incompatibilities.patch | 26 +++--- ...in_esm_loaders_to_apply_asar_patches.patch | 8 +- ...ix_remove_deprecated_errno_constants.patch | 2 +- .../fix_remove_fastapitypedarray_usage.patch | 6 +- ...emove_outdated_v8_flags_from_node_cc.patch | 2 +- ...ch_cppgc_heap_on_v8_isolate_creation.patch | 32 ++++---- ...not_use_soon-to-be-deprecated_v8_api.patch | 8 +- ..._on_wrapper-descriptor-based_cppheap.patch | 18 ++--- .../node/support_v8_sandboxed_pointers.patch | 14 ++-- ...st_formally_mark_some_tests_as_flaky.patch | 4 +- 31 files changed, 175 insertions(+), 174 deletions(-) diff --git a/DEPS b/DEPS index ece4dac4bfbb5..90c9be2a68408 100644 --- a/DEPS +++ b/DEPS @@ -4,7 +4,7 @@ vars = { 'chromium_version': '142.0.7417.0', 'node_version': - 'v22.19.0', + 'v22.20.0', 'nan_version': 'e14bdcd1f72d62bca1d541b66da43130384ec213', 'squirrel.mac_version': diff --git a/patches/node/add_v8_taskpirority_to_foreground_task_runner_signature.patch b/patches/node/add_v8_taskpirority_to_foreground_task_runner_signature.patch index e1497804ce738..8d89edc40754d 100644 --- a/patches/node/add_v8_taskpirority_to_foreground_task_runner_signature.patch +++ b/patches/node/add_v8_taskpirority_to_foreground_task_runner_signature.patch @@ -8,10 +8,10 @@ naturally upstream, and we will be able to remove this patch in a future Node.js upgrade. diff --git a/src/node_platform.cc b/src/node_platform.cc -index b438b3774d0aa7680fdbc6c6bf39a87893d221b2..ec355061825fb861c17fa2e6cc967b4c7b8d4586 100644 +index b24e170cb247261d4a16d77ad40df4dfd33709d9..5e31f984b5655ae2d1d7559b1bd550ba6dc90fb4 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc -@@ -687,8 +687,8 @@ bool NodePlatform::IdleTasksEnabled(Isolate* isolate) { +@@ -688,8 +688,8 @@ bool NodePlatform::IdleTasksEnabled(Isolate* isolate) { return ForIsolate(isolate)->IdleTasksEnabled(); } diff --git a/patches/node/api_remove_deprecated_getisolate.patch b/patches/node/api_remove_deprecated_getisolate.patch index 54a87160c8be2..59d8f6a7fcba2 100644 --- a/patches/node/api_remove_deprecated_getisolate.patch +++ b/patches/node/api_remove_deprecated_getisolate.patch @@ -6,10 +6,10 @@ Subject: Remove deprecated `GetIsolate` https://chromium-review.googlesource.com/c/v8/v8/+/6905244 diff --git a/src/api/environment.cc b/src/api/environment.cc -index 244d747f010c51366e44dec705ae304423038a85..796be2ce65af31af20994cad63a9ec4843caf89a 100644 +index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7c630fddf 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -620,7 +620,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create( +@@ -654,7 +654,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create( MaybeLocal<Object> GetPerContextExports(Local<Context> context, IsolateData* isolate_data) { @@ -18,7 +18,7 @@ index 244d747f010c51366e44dec705ae304423038a85..796be2ce65af31af20994cad63a9ec48 EscapableHandleScope handle_scope(isolate); Local<Object> global = context->Global(); -@@ -666,7 +666,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) { +@@ -700,7 +700,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) { // This runs at runtime, regardless of whether the context // is created from a snapshot. Maybe<void> InitializeContextRuntime(Local<Context> context) { @@ -27,7 +27,7 @@ index 244d747f010c51366e44dec705ae304423038a85..796be2ce65af31af20994cad63a9ec48 HandleScope handle_scope(isolate); // When `IsCodeGenerationFromStringsAllowed` is true, V8 takes the fast path -@@ -745,7 +745,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) { +@@ -779,7 +779,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) { } Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) { @@ -36,7 +36,7 @@ index 244d747f010c51366e44dec705ae304423038a85..796be2ce65af31af20994cad63a9ec48 HandleScope handle_scope(isolate); // Delete `Intl.v8BreakIterator` -@@ -770,7 +770,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) { +@@ -804,7 +804,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) { } Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) { @@ -45,7 +45,7 @@ index 244d747f010c51366e44dec705ae304423038a85..796be2ce65af31af20994cad63a9ec48 HandleScope handle_scope(isolate); // Initialize the default values. -@@ -788,7 +788,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) { +@@ -822,7 +822,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) { MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context, IsolateData* isolate_data) { CHECK(isolate_data); @@ -54,7 +54,7 @@ index 244d747f010c51366e44dec705ae304423038a85..796be2ce65af31af20994cad63a9ec48 EscapableHandleScope scope(isolate); Context::Scope context_scope(context); -@@ -812,7 +812,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context, +@@ -846,7 +846,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context, MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context, IsolateData* isolate_data) { CHECK(isolate_data); @@ -63,7 +63,7 @@ index 244d747f010c51366e44dec705ae304423038a85..796be2ce65af31af20994cad63a9ec48 EscapableHandleScope scope(isolate); Context::Scope context_scope(context); -@@ -838,7 +838,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context, +@@ -872,7 +872,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context, Maybe<void> InitializePrimordials(Local<Context> context, IsolateData* isolate_data) { // Run per-context JS files. @@ -85,10 +85,10 @@ index 6f731b17fe0b84dd3d2c9bc9cfef1f8062a2c5f7..71a1072ed2decbee08d40eda7c47456b return handle; diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc -index ea5179ad5155cb599891d7421cd61df719ac4cae..ee5380fd055663e5d58491943532ec1dfa11a3c3 100644 +index a3d309d832c73ddc79564b9644d825bec7459e7f..580cbaf3858961f375ca2f53c48a07bcba82ef46 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc -@@ -946,7 +946,7 @@ bool ArrayOfStringsToX509s(Local<Context> context, +@@ -967,7 +967,7 @@ bool ArrayOfStringsToX509s(Local<Context> context, Local<Array> cert_array, std::vector<X509*>* certs) { ClearErrorOnReturn clear_error_on_return; @@ -157,10 +157,10 @@ index 31ed995714bb99ab534f26ba9ebc6051c258a1c9..5ace688bb7ffc86eedf5aff11ab0ab48 // Recreate the buffer in the constructor. InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info); diff --git a/src/env.cc b/src/env.cc -index 8cdfbac602796cabbd8a2f673385b93bea9bd7cc..a0097a4af25f760ba4b31865d9a800d1974a454c 100644 +index c6209cc7cf317de1bb9217e39dd760e5a83303e2..161d577e0ea6a251c83ba1903b1ec9a582a5317c 100644 --- a/src/env.cc +++ b/src/env.cc -@@ -1744,10 +1744,10 @@ void AsyncHooks::Deserialize(Local<Context> context) { +@@ -1748,10 +1748,10 @@ void AsyncHooks::Deserialize(Local<Context> context) { context->GetDataFromSnapshotOnce<Array>( info_->js_execution_async_resources).ToLocalChecked(); } else { @@ -173,7 +173,7 @@ index 8cdfbac602796cabbd8a2f673385b93bea9bd7cc..a0097a4af25f760ba4b31865d9a800d1 // The native_execution_async_resources_ field requires v8::Local<> instances // for async calls whose resources were on the stack as JS objects when they -@@ -1787,7 +1787,7 @@ AsyncHooks::SerializeInfo AsyncHooks::Serialize(Local<Context> context, +@@ -1791,7 +1791,7 @@ AsyncHooks::SerializeInfo AsyncHooks::Serialize(Local<Context> context, info.async_id_fields = async_id_fields_.Serialize(context, creator); if (!js_execution_async_resources_.IsEmpty()) { info.js_execution_async_resources = creator->AddData( @@ -310,10 +310,10 @@ index 27aeac589b19cd681923fb848ce5f36c66fc05e2..5f2900869763f40cac54e3cb3fe2e24e module_api_version(module_api_version) { napi_clear_last_error(this); diff --git a/src/module_wrap.cc b/src/module_wrap.cc -index e3880111172363feafb53b51deb08c93596cd4f4..6ab85bb74d708037274e08df343559a37db384dc 100644 +index cbb3e7f4df72f83cb8a1afc25a7429218792e964..ffccac5589bfe12eaf7861364cc6f2e403d26679 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc -@@ -859,7 +859,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback( +@@ -865,7 +865,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback( Local<String> specifier, Local<FixedArray> import_attributes, Local<Module> referrer) { @@ -322,7 +322,7 @@ index e3880111172363feafb53b51deb08c93596cd4f4..6ab85bb74d708037274e08df343559a3 Environment* env = Environment::GetCurrent(context); if (env == nullptr) { THROW_ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE(isolate); -@@ -901,7 +901,7 @@ MaybeLocal<Promise> ImportModuleDynamically( +@@ -907,7 +907,7 @@ MaybeLocal<Promise> ImportModuleDynamically( Local<Value> resource_name, Local<String> specifier, Local<FixedArray> import_attributes) { @@ -331,7 +331,7 @@ index e3880111172363feafb53b51deb08c93596cd4f4..6ab85bb74d708037274e08df343559a3 Environment* env = Environment::GetCurrent(context); if (env == nullptr) { THROW_ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE(isolate); -@@ -1125,7 +1125,7 @@ MaybeLocal<Module> LinkRequireFacadeWithOriginal( +@@ -1131,7 +1131,7 @@ MaybeLocal<Module> LinkRequireFacadeWithOriginal( Local<FixedArray> import_attributes, Local<Module> referrer) { Environment* env = Environment::GetCurrent(context); @@ -341,10 +341,10 @@ index e3880111172363feafb53b51deb08c93596cd4f4..6ab85bb74d708037274e08df343559a3 CHECK(!env->temporary_required_module_facade_original.IsEmpty()); return env->temporary_required_module_facade_original.Get(isolate); diff --git a/src/node.h b/src/node.h -index 4335c7cf53b7e08c95dcee3461384ac12c8ebe41..16ba26ff9babd719b6807bc01339183866c8cf33 100644 +index 16a0c71aef949b0ddd27def9dc843298f9a6b75f..28fa4cb3e7a621480a5ff11c48666c0de1363375 100644 --- a/src/node.h +++ b/src/node.h -@@ -1034,7 +1034,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly", +@@ -1050,7 +1050,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly", #define NODE_DEFINE_CONSTANT(target, constant) \ do { \ @@ -353,7 +353,7 @@ index 4335c7cf53b7e08c95dcee3461384ac12c8ebe41..16ba26ff9babd719b6807bc013391838 v8::Local<v8::Context> context = isolate->GetCurrentContext(); \ v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \ isolate, #constant, v8::NewStringType::kInternalized); \ -@@ -1050,7 +1050,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly", +@@ -1066,7 +1066,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly", #define NODE_DEFINE_HIDDEN_CONSTANT(target, constant) \ do { \ @@ -376,7 +376,7 @@ index 9b9956f5ee3150a80f040cd0dbb9ef6589295600..14de0dad25fbf854ea23eb25abd6f9f2 BlobBindingData* binding = realm->AddBindingData<BlobBindingData>(holder); CHECK_NOT_NULL(binding); diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index 557972987abeaa56918362638a17a9b6e0763238..b639f788981c5503c22c471eefd225c26a79c3f8 100644 +index 4b288e0f89e0156cb5b0555c0259b2c1150770db..bc87057c8473d4731de55b909c58106217b32d1b 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -275,7 +275,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal( @@ -433,10 +433,10 @@ index 557972987abeaa56918362638a17a9b6e0763238..b639f788981c5503c22c471eefd225c2 // This is used by the snapshot builder, so save the code cache // unconditionally. diff --git a/src/node_constants.cc b/src/node_constants.cc -index d193725ea9a3270ed9affea12d11467fb14efdf8..24364b7458c822ff84ac9123843aea1f01d84bc0 100644 +index cbcecfba33070b820aca0e2814982160a97a6378..b1ee513fc0873a51b4885f612dbf7b950b5cf2ca 100644 --- a/src/node_constants.cc +++ b/src/node_constants.cc -@@ -1268,7 +1268,7 @@ void CreatePerContextProperties(Local<Object> target, +@@ -1264,7 +1264,7 @@ void CreatePerContextProperties(Local<Object> target, Local<Value> unused, Local<Context> context, void* priv) { @@ -446,7 +446,7 @@ index d193725ea9a3270ed9affea12d11467fb14efdf8..24364b7458c822ff84ac9123843aea1f CHECK(target->SetPrototype(env->context(), Null(env->isolate())).FromJust()); diff --git a/src/node_contextify.cc b/src/node_contextify.cc -index 386102dfe7e4d9136f47058b03f3702126cd5063..7f4917c3bb73bb333ba85ae11a4be6e6968a7e36 100644 +index 21a08a738e5c3506d27e402762a4a267e9278588..475b5628f9b82a2b9b86343f25759c1e6814f816 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -111,7 +111,7 @@ namespace { @@ -467,7 +467,7 @@ index 386102dfe7e4d9136f47058b03f3702126cd5063..7f4917c3bb73bb333ba85ae11a4be6e6 PropertyAttribute attributes = PropertyAttribute::None; bool is_declared = -@@ -1651,7 +1651,7 @@ static MaybeLocal<Function> CompileFunctionForCJSLoader( +@@ -1657,7 +1657,7 @@ static MaybeLocal<Function> CompileFunctionForCJSLoader( bool* cache_rejected, bool is_cjs_scope, ScriptCompiler::CachedData* cached_data) { @@ -521,10 +521,10 @@ index befb642f1effa3c4139e4cd99ff64d9c5175fd72..9c068afd1c4c3fadeee4ba035e67ec4a READONLY_PROPERTY(target, "exitCodes", exit_codes); diff --git a/src/node_file.cc b/src/node_file.cc -index 7221708a2296ff44c19ed01dc52d78653ecc4e58..e9ddf73af28a62245291d9d1eb452eeb39312dff 100644 +index d7009937b31729f33d9c45cbda7f5440fbdac2aa..e57a3140cd90d7e7852a0c6892091e50b850ae64 100644 --- a/src/node_file.cc +++ b/src/node_file.cc -@@ -3755,7 +3755,7 @@ void BindingData::Deserialize(Local<Context> context, +@@ -3753,7 +3753,7 @@ void BindingData::Deserialize(Local<Context> context, int index, InternalFieldInfoBase* info) { DCHECK_IS_SNAPSHOT_SLOT(index); @@ -534,7 +534,7 @@ index 7221708a2296ff44c19ed01dc52d78653ecc4e58..e9ddf73af28a62245291d9d1eb452eeb InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info); BindingData* binding = diff --git a/src/node_messaging.cc b/src/node_messaging.cc -index 66c8868b9d8e69812464ca9eca53434321f8ec4a..0146a0ee909d570e840e8ae7dc448bcd1c6b31e4 100644 +index 1eff9399ff87510164390a1dfea84158a8856b86..e912562d768308906286890b7015cf2c462bac49 100644 --- a/src/node_messaging.cc +++ b/src/node_messaging.cc @@ -253,7 +253,7 @@ namespace { @@ -564,7 +564,7 @@ index 66c8868b9d8e69812464ca9eca53434321f8ec4a..0146a0ee909d570e840e8ae7dc448bcd Local<Value> argv[] = {message, FIXED_ONE_BYTE_STRING(isolate, "DataCloneError")}; Local<Value> exception; -@@ -1465,7 +1465,7 @@ BaseObjectPtr<BaseObject> JSTransferable::Data::Deserialize( +@@ -1464,7 +1464,7 @@ BaseObjectPtr<BaseObject> JSTransferable::Data::Deserialize( Maybe<bool> JSTransferable::Data::FinalizeTransferWrite( Local<Context> context, ValueSerializer* serializer) { @@ -609,7 +609,7 @@ index 1cb08b715865f8337e0292fc8e2a26488ba21694..2bd20fc173d4110282ee736e49b49ce0 // Recreate the buffer in the constructor. InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info); diff --git a/src/node_realm.cc b/src/node_realm.cc -index e87c6e2da4936827a8426a4d09589afa261c8cba..dabb8836add263088a919a6a3529c9aca47f1ef9 100644 +index cd2b4c0107594a8ba9bf671669e4c82326719908..d18945085ff1860bbe3796e0b47904210aafd941 100644 --- a/src/node_realm.cc +++ b/src/node_realm.cc @@ -19,7 +19,7 @@ using v8::String; @@ -622,7 +622,7 @@ index e87c6e2da4936827a8426a4d09589afa261c8cba..dabb8836add263088a919a6a3529c9ac env->AssignToContext(context, this, ContextInfo("")); } diff --git a/src/node_report.cc b/src/node_report.cc -index da7b846d555ba63c30b5700c081ee38685dcaa83..53ac70f319796efafaeea9b4bd314b2f4de3cb06 100644 +index df73a8204bc0917073a70ca68d019ceab3159b08..d7bb94db78b3a729f25ceaf66d193032056b36ff 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -399,7 +399,7 @@ static void PrintJavaScriptErrorProperties(JSONWriter* writer, @@ -635,10 +635,10 @@ index da7b846d555ba63c30b5700c081ee38685dcaa83..53ac70f319796efafaeea9b4bd314b2f if (!error_obj->GetOwnPropertyNames(context).ToLocal(&keys)) { return writer->json_objectend(); // the end of 'errorProperties' diff --git a/src/node_snapshotable.cc b/src/node_snapshotable.cc -index a500204c4768e26a4d2476e7b99e173389e8e1ef..949201e7ddce501b7135fb1c4a907e3ad3ab1146 100644 +index 69d8d15d8989ed31a19489e68588e730760c8ffb..d342a5ff91bbd9cb73c02c26ae3a36b9d0dc7b47 100644 --- a/src/node_snapshotable.cc +++ b/src/node_snapshotable.cc -@@ -1584,7 +1584,7 @@ void BindingData::Deserialize(Local<Context> context, +@@ -1613,7 +1613,7 @@ void BindingData::Deserialize(Local<Context> context, int index, InternalFieldInfoBase* info) { DCHECK_IS_SNAPSHOT_SLOT(index); @@ -648,10 +648,10 @@ index a500204c4768e26a4d2476e7b99e173389e8e1ef..949201e7ddce501b7135fb1c4a907e3a // Recreate the buffer in the constructor. InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info); diff --git a/src/node_sqlite.cc b/src/node_sqlite.cc -index f5704bc13d415853316d72661e9d5584c2432b9f..62f280c1e0e860ae3a3c8b48eda31a3cc8f0c216 100644 +index 8b6fe36e1fece112269ebf193d6322a4d1dacc0a..96101167016573e80fff520256ebb78c71d83302 100644 --- a/src/node_sqlite.cc +++ b/src/node_sqlite.cc -@@ -1856,7 +1856,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) { +@@ -1858,7 +1858,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) { if (args[0]->IsObject() && !args[0]->IsArrayBufferView()) { Local<Object> obj = args[0].As<Object>(); @@ -661,7 +661,7 @@ index f5704bc13d415853316d72661e9d5584c2432b9f..62f280c1e0e860ae3a3c8b48eda31a3c if (!obj->GetOwnPropertyNames(context).ToLocal(&keys)) { return false; diff --git a/src/node_task_queue.cc b/src/node_task_queue.cc -index 0a5aba6e31fa799a77267aa81d8324f8a5ea6f05..794c802ec09f5e20176816fcdde7152eb24ac27b 100644 +index c4257110d8b52017fccd8e1e746b557a0b7084df..6f00da0b515397d300e387f03f4a2bf71155cfe0 100644 --- a/src/node_task_queue.cc +++ b/src/node_task_queue.cc @@ -48,7 +48,7 @@ void PromiseRejectCallback(PromiseRejectMessage message) { @@ -744,10 +744,10 @@ index 74ece724e207a69e2457598a199c12f1cebcfd4a..1705e430099c5a363e02010f83d729b0 static void Clear(const FunctionCallbackInfo<Value>& info) { diff --git a/src/node_worker.cc b/src/node_worker.cc -index 6c43928ba5a9752c78544d1c77198278eb11ccd7..d1faec81602bbe41c1239b8abb82b592821b4fa4 100644 +index 8555ab556b5b74a1cf9cf30747f1f417bfe4e4d9..1a2532337504444d59098304b87e0d65f16e838c 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc -@@ -1149,8 +1149,6 @@ void GetEnvMessagePort(const FunctionCallbackInfo<Value>& args) { +@@ -1289,8 +1289,6 @@ void GetEnvMessagePort(const FunctionCallbackInfo<Value>& args) { Local<Object> port = env->message_port(); CHECK_IMPLIES(!env->is_main_thread(), !port.IsEmpty()); if (!port.IsEmpty()) { @@ -894,10 +894,10 @@ index 5ca32f026f9f001ddadc14965705fe005600eddd..1b38f22b930b77d80aa53f9b12299d3c context, that, OneByteString(isolate, name), tmpl, flag); } diff --git a/src/util.h b/src/util.h -index efeb12d837db7b88093e4a6a2e20df562180ca1e..2631765cb7fded77d70ac3012d63867deb6f2be7 100644 +index 7c98de621ca4d53cbaaa5bd4488aab20c7b033a7..329d2397c87ac37d157e3325e2ab62907d7286b4 100644 --- a/src/util.h +++ b/src/util.h -@@ -752,7 +752,7 @@ inline v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, +@@ -756,7 +756,7 @@ inline v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, // Variation on NODE_DEFINE_CONSTANT that sets a String value. #define NODE_DEFINE_STRING_CONSTANT(target, name, constant) \ do { \ diff --git a/patches/node/build_add_gn_build_files.patch b/patches/node/build_add_gn_build_files.patch index ed758f53ab541..9176dfe6f4e3d 100644 --- a/patches/node/build_add_gn_build_files.patch +++ b/patches/node/build_add_gn_build_files.patch @@ -11,10 +11,10 @@ really in 20/21. We have to wait until 22 is released to be able to build with upstream GN files. diff --git a/configure.py b/configure.py -index 2415940835036226799a7ea14c6687cc0d56c523..0feb07afbccad97a92cee00954443407eb20ac67 100755 +index 91283ca577f580dbf1e0c4e2dbf851a9ceaa38ed..e8eaff30ec947677db2d45425f9180759d0c55de 100755 --- a/configure.py +++ b/configure.py -@@ -1722,7 +1722,7 @@ def configure_v8(o, configs): +@@ -1728,7 +1728,7 @@ def configure_v8(o, configs): # Until we manage to get rid of all those, v8_enable_sandbox cannot be used. # Note that enabling pointer compression without enabling sandbox is unsupported by V8, # so this can be broken at any time. @@ -68,7 +68,7 @@ index d4438f7fd61598afac2c1e3184721a759d22b10c..e2407027ab05e59b2f0f1c213b98ea46 assert(!node_enable_inspector || node_use_openssl, diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index b4acc40618e372b09d0cb5e3755034f08711a282..efeaaef7e4dc64a0adb5e6bdbbe18945890de62c 100644 +index b83aa87c969fb4e71cb202816713af869bb76283..c54df6fee333ddfe59b9df7e0ddd2935b4dcb33f 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -789,6 +789,7 @@ void BuiltinLoader::RegisterExternalReferences( diff --git a/patches/node/build_compile_with_c_20_support.patch b/patches/node/build_compile_with_c_20_support.patch index 4ea916a3b1342..c7faa4e0db275 100644 --- a/patches/node/build_compile_with_c_20_support.patch +++ b/patches/node/build_compile_with_c_20_support.patch @@ -10,7 +10,7 @@ V8 requires C++20 support as of https://chromium-review.googlesource.com/c/v8/v8 This can be removed when Electron upgrades to a version of Node.js containing the required V8 version. diff --git a/common.gypi b/common.gypi -index 3a1d2fc9d147a8c89f7b5231d63d37f29979965d..6425ee9e8dba993f3e899362ce9bd7b097f08883 100644 +index c28d6f5fe2c922f0b1e3f7e56289c78e7b91c294..95c56305926fc3e0e46e4cf99ec86d3d1b5576a7 100644 --- a/common.gypi +++ b/common.gypi @@ -539,7 +539,7 @@ @@ -22,7 +22,7 @@ index 3a1d2fc9d147a8c89f7b5231d63d37f29979965d..6425ee9e8dba993f3e899362ce9bd7b0 ], 'defines': [ '__STDC_FORMAT_MACROS' ], 'ldflags': [ '-rdynamic' ], -@@ -709,7 +709,7 @@ +@@ -719,7 +719,7 @@ ['clang==1', { 'xcode_settings': { 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', diff --git a/patches/node/build_enable_perfetto.patch b/patches/node/build_enable_perfetto.patch index a4aff646cb114..5f481d544c8ed 100644 --- a/patches/node/build_enable_perfetto.patch +++ b/patches/node/build_enable_perfetto.patch @@ -64,10 +64,10 @@ index 251f51ec454f9cba4023b8b6729241ee753aac13..1de8cac6e3953ce9cab9db03530da327 module.exports = { diff --git a/node.gyp b/node.gyp -index d604e0ddd973174aa7be6f2d250af7b9c2b0fcfd..8e97aa3f44087213425927113fe72bca9ddef45b 100644 +index 0e0071b508f605bb9b7722f8304814dc176d907e..bcb9f371c4e4d8c665058115dc39eaa65125d679 100644 --- a/node.gyp +++ b/node.gyp -@@ -176,7 +176,6 @@ +@@ -174,7 +174,6 @@ 'src/timers.cc', 'src/timer_wrap.cc', 'src/tracing/agent.cc', @@ -75,7 +75,7 @@ index d604e0ddd973174aa7be6f2d250af7b9c2b0fcfd..8e97aa3f44087213425927113fe72bca 'src/tracing/node_trace_writer.cc', 'src/tracing/trace_event.cc', 'src/tracing/traced_value.cc', -@@ -304,7 +303,6 @@ +@@ -302,7 +301,6 @@ 'src/tcp_wrap.h', 'src/timers.h', 'src/tracing/agent.h', @@ -105,7 +105,7 @@ index 40c8aea35c931c46fc62b717c978eab0659645fd..348cdfb0b42aa18f352c220cea0b896c if (!json_writer_) return; diff --git a/src/tracing/agent.cc b/src/tracing/agent.cc -index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187177fc3bd 100644 +index eddcf6c3bf91b730d6ca72960e3048ceed7e7844..184e8647b2148bc597d9d3eb63f86ae99917c642 100644 --- a/src/tracing/agent.cc +++ b/src/tracing/agent.cc @@ -2,7 +2,9 @@ @@ -144,7 +144,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187 // This thread should be created *after* async handles are created // (within NodeTraceWriter and NodeTraceBuffer constructors). -@@ -143,8 +151,10 @@ void Agent::StopTracing() { +@@ -148,8 +156,10 @@ void Agent::StopTracing() { return; // Perform final Flush on TraceBuffer. We don't want the tracing controller // to flush the buffer again on destruction of the V8::Platform. @@ -156,7 +156,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187 started_ = false; // Thread should finish when the tracing loop is stopped. -@@ -202,6 +212,7 @@ std::string Agent::GetEnabledCategories() const { +@@ -207,6 +217,7 @@ std::string Agent::GetEnabledCategories() const { return categories; } @@ -164,7 +164,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187 void Agent::AppendTraceEvent(TraceObject* trace_event) { for (const auto& id_writer : writers_) id_writer.second->AppendTraceEvent(trace_event); -@@ -211,18 +222,21 @@ void Agent::AddMetadataEvent(std::unique_ptr<TraceObject> event) { +@@ -216,18 +227,21 @@ void Agent::AddMetadataEvent(std::unique_ptr<TraceObject> event) { Mutex::ScopedLock lock(metadata_events_mutex_); metadata_events_.push_back(std::move(event)); } @@ -187,7 +187,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187 void TracingController::AddMetadataEvent( const unsigned char* category_group_enabled, const char* name, -@@ -246,6 +260,6 @@ void TracingController::AddMetadataEvent( +@@ -251,6 +265,6 @@ void TracingController::AddMetadataEvent( if (node_agent != nullptr) node_agent->AddMetadataEvent(std::move(trace_event)); } diff --git a/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch b/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch index c698eb1826006..6c6d33c0276de 100644 --- a/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch +++ b/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch @@ -7,7 +7,7 @@ Subject: build: ensure native module compilation fails if not using a new This should not be upstreamed, it is a quality-of-life patch for downstream module builders. diff --git a/common.gypi b/common.gypi -index e56ba31ed068b81f5c6fbd432cd82bb6916e9a85..3a1d2fc9d147a8c89f7b5231d63d37f29979965d 100644 +index 6b79de07be3f839af5b0644f19bfef9c33de590e..c28d6f5fe2c922f0b1e3f7e56289c78e7b91c294 100644 --- a/common.gypi +++ b/common.gypi @@ -89,6 +89,8 @@ @@ -42,10 +42,10 @@ index e56ba31ed068b81f5c6fbd432cd82bb6916e9a85..3a1d2fc9d147a8c89f7b5231d63d37f2 # list in v8/BUILD.gn. ['v8_enable_v8_checks == 1', { diff --git a/configure.py b/configure.py -index 0feb07afbccad97a92cee00954443407eb20ac67..5eccced7cf0212f229db68c76cc824a37e4a29bc 100755 +index e8eaff30ec947677db2d45425f9180759d0c55de..dc2d9d80059e845b33444f8bdc29e82d0fe0e26b 100755 --- a/configure.py +++ b/configure.py -@@ -1704,6 +1704,7 @@ def configure_library(lib, output, pkgname=None): +@@ -1710,6 +1710,7 @@ def configure_library(lib, output, pkgname=None): def configure_v8(o, configs): set_configuration_variable(configs, 'v8_enable_v8_checks', release=1, debug=0) @@ -54,7 +54,7 @@ index 0feb07afbccad97a92cee00954443407eb20ac67..5eccced7cf0212f229db68c76cc824a3 o['variables']['v8_enable_javascript_promise_hooks'] = 1 o['variables']['v8_enable_lite_mode'] = 1 if options.v8_lite_mode else 0 diff --git a/src/node.h b/src/node.h -index 835c78145956de3d8c52b6cc0581bcfef600f90b..174fd4d1af4c8cd75aec09f4548a674fd5539fb2 100644 +index a336f44dc1e785ea237865077216d41ab032c0af..96c599aa6448e2aa8e57e84f811564a5281c139a 100644 --- a/src/node.h +++ b/src/node.h @@ -22,6 +22,12 @@ diff --git a/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch b/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch index 270f96dc50c2b..27bb1db444b56 100644 --- a/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch +++ b/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch @@ -34,7 +34,7 @@ index 0244a214b187e67e0cb89f26cd019855963ec93a..b65a3be6bcb0e28f7f43367d0fa9da53 let kResistStopPropagation; diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index efeaaef7e4dc64a0adb5e6bdbbe18945890de62c..557972987abeaa56918362638a17a9b6e0763238 100644 +index c54df6fee333ddfe59b9df7e0ddd2935b4dcb33f..4b288e0f89e0156cb5b0555c0259b2c1150770db 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -35,6 +35,7 @@ using v8::Value; diff --git a/patches/node/build_restore_clang_as_default_compiler_on_macos.patch b/patches/node/build_restore_clang_as_default_compiler_on_macos.patch index e03a0c3932020..085cae86bc2a9 100644 --- a/patches/node/build_restore_clang_as_default_compiler_on_macos.patch +++ b/patches/node/build_restore_clang_as_default_compiler_on_macos.patch @@ -11,7 +11,7 @@ node-gyp will use the result of `process.config` that reflects the environment in which the binary got built. diff --git a/common.gypi b/common.gypi -index 6425ee9e8dba993f3e899362ce9bd7b097f08883..95d66f75b582b3fd3b833109dfe110ae5b196f83 100644 +index 95c56305926fc3e0e46e4cf99ec86d3d1b5576a7..45bb2c4ff94ceac377c9117da4497cdc5ac41171 100644 --- a/common.gypi +++ b/common.gypi @@ -128,6 +128,7 @@ diff --git a/patches/node/chore_expose_importmoduledynamically_and.patch b/patches/node/chore_expose_importmoduledynamically_and.patch index 3f44ec26449ef..072c465e1185e 100644 --- a/patches/node/chore_expose_importmoduledynamically_and.patch +++ b/patches/node/chore_expose_importmoduledynamically_and.patch @@ -40,10 +40,10 @@ index 9b41db8b0714b7408f79cbd5b4c460d9bc08f239..35ecfb9bbaf2c8e7351e1c69da84c82a /** diff --git a/src/module_wrap.cc b/src/module_wrap.cc -index e317a84e55714af0a93719336d02ac26410ad724..e3880111172363feafb53b51deb08c93596cd4f4 100644 +index c52e20d742942667f43ea3e151fc6702260b176b..cbb3e7f4df72f83cb8a1afc25a7429218792e964 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc -@@ -895,7 +895,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback( +@@ -901,7 +901,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback( return module->module_.Get(isolate); } @@ -52,7 +52,7 @@ index e317a84e55714af0a93719336d02ac26410ad724..e3880111172363feafb53b51deb08c93 Local<Context> context, Local<Data> host_defined_options, Local<Value> resource_name, -@@ -967,12 +967,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback( +@@ -973,12 +973,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback( Realm* realm = Realm::GetCurrent(args); HandleScope handle_scope(isolate); @@ -68,7 +68,7 @@ index e317a84e55714af0a93719336d02ac26410ad724..e3880111172363feafb53b51deb08c93 } void ModuleWrap::HostInitializeImportMetaObjectCallback( -@@ -1014,13 +1015,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback( +@@ -1020,13 +1021,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback( Realm* realm = Realm::GetCurrent(args); Isolate* isolate = realm->isolate(); diff --git a/patches/node/cli_move_--trace-atomics-wait_to_eol.patch b/patches/node/cli_move_--trace-atomics-wait_to_eol.patch index b2451d795d6ad..394ae7770d0cc 100644 --- a/patches/node/cli_move_--trace-atomics-wait_to_eol.patch +++ b/patches/node/cli_move_--trace-atomics-wait_to_eol.patch @@ -15,10 +15,10 @@ Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> diff --git a/doc/api/cli.md b/doc/api/cli.md -index 8cabb58e621a9951acd5551afb85c192f2b1c690..b69bacebef3e5e5e5b191c61aa5fe0f71c1edfb3 100644 +index 9a0e83b95a72486ab9751b3b8818f4beeb527041..1da7126b9d51238e9b89ee6bed602df3f5598a9e 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md -@@ -2712,39 +2712,6 @@ added: v12.0.0 +@@ -2727,39 +2727,6 @@ added: v12.0.0 Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.3'. Use to disable support for TLSv1.2, which is not as secure as TLSv1.3. @@ -58,7 +58,7 @@ index 8cabb58e621a9951acd5551afb85c192f2b1c690..b69bacebef3e5e5e5b191c61aa5fe0f7 ### `--trace-deprecation` <!-- YAML -@@ -3429,7 +3396,6 @@ one is included in the list below. +@@ -3445,7 +3412,6 @@ one is included in the list below. * `--tls-min-v1.1` * `--tls-min-v1.2` * `--tls-min-v1.3` @@ -67,10 +67,10 @@ index 8cabb58e621a9951acd5551afb85c192f2b1c690..b69bacebef3e5e5e5b191c61aa5fe0f7 * `--trace-env-js-stack` * `--trace-env-native-stack` diff --git a/doc/node.1 b/doc/node.1 -index 6913992a5476d2317a34fb69d3c6af63b686f9a6..1faef5ba1d4206a5cc4c71cb71f7a08f613fbf17 100644 +index e3b2c45af01b2e9b9522964da2572988edd2b9e9..64e975546285a1042dda6fdb54fdd502f338a929 100644 --- a/doc/node.1 +++ b/doc/node.1 -@@ -539,11 +539,6 @@ but the option is supported for compatibility with older Node.js versions. +@@ -542,11 +542,6 @@ but the option is supported for compatibility with older Node.js versions. Set default minVersion to 'TLSv1.3'. Use to disable support for TLSv1.2 in favour of TLSv1.3, which is more secure. . @@ -83,7 +83,7 @@ index 6913992a5476d2317a34fb69d3c6af63b686f9a6..1faef5ba1d4206a5cc4c71cb71f7a08f Print stack traces for deprecations. . diff --git a/src/node.cc b/src/node.cc -index 0d383dcdb80fe30e3c2d6880b44f626f065bb1f3..9d9992dacbc595c987827f55eb12ea8af0480df6 100644 +index f0c0b6229048a2e9bc05684fab44ab09bc34e1f6..9027df9a321f7db76edd1218c194df519017dfaf 100644 --- a/src/node.cc +++ b/src/node.cc @@ -232,44 +232,6 @@ void Environment::WaitForInspectorFrontendByOptions() { @@ -150,7 +150,7 @@ index 0d383dcdb80fe30e3c2d6880b44f626f065bb1f3..9d9992dacbc595c987827f55eb12ea8a isolate_->SetPromiseHook(TracePromises); } diff --git a/src/node_options.cc b/src/node_options.cc -index cfb95f65ccb0c6d150be8a4039caf26faf7cd06d..cb0ecd81b33abd7743e66e225a6cb96b4094f935 100644 +index e8424d7539db191a55edebb7d33a3c1dc37e2403..556776b79282d953fdc371d1901f21ca301bec1a 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -773,10 +773,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { @@ -165,10 +165,10 @@ index cfb95f65ccb0c6d150be8a4039caf26faf7cd06d..cb0ecd81b33abd7743e66e225a6cb96b "show stack traces on deprecations", &EnvironmentOptions::trace_deprecation, diff --git a/src/node_options.h b/src/node_options.h -index 3ff1f4b4baa64b8ee2a4587e150ea14cb2fdfdf4..26ac54c4b18dd00b2c1f915dc1ba0e90ca70b48f 100644 +index 418dee360f867c363f1576012b32213a51c4fdd0..7078d2493ed696bc5bd92df9c629b714c1a8fbfb 100644 --- a/src/node_options.h +++ b/src/node_options.h -@@ -204,7 +204,6 @@ class EnvironmentOptions : public Options { +@@ -205,7 +205,6 @@ class EnvironmentOptions : public Options { std::vector<std::string> coverage_include_pattern; std::vector<std::string> coverage_exclude_pattern; bool throw_deprecation = false; diff --git a/patches/node/cli_remove_deprecated_v8_flag.patch b/patches/node/cli_remove_deprecated_v8_flag.patch index 0e2555325e123..1d8b239e3aaff 100644 --- a/patches/node/cli_remove_deprecated_v8_flag.patch +++ b/patches/node/cli_remove_deprecated_v8_flag.patch @@ -18,10 +18,10 @@ Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> diff --git a/doc/api/cli.md b/doc/api/cli.md -index 1a1e0ec1d89a4d0ecf1c9ae37c23b8f660c051d6..8cabb58e621a9951acd5551afb85c192f2b1c690 100644 +index b8f9fb49fcb45602828e79bd79902233b5987dda..9a0e83b95a72486ab9751b3b8818f4beeb527041 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md -@@ -3467,7 +3467,6 @@ V8 options that are allowed are: +@@ -3483,7 +3483,6 @@ V8 options that are allowed are: * `--disallow-code-generation-from-strings` * `--enable-etw-stack-walking` * `--expose-gc` @@ -30,7 +30,7 @@ index 1a1e0ec1d89a4d0ecf1c9ae37c23b8f660c051d6..8cabb58e621a9951acd5551afb85c192 * `--jitless` * `--max-old-space-size` diff --git a/src/node_options.cc b/src/node_options.cc -index 415d4e34f29bc303674dccbfdc231b251401961b..cfb95f65ccb0c6d150be8a4039caf26faf7cd06d 100644 +index 8afded658c3f569de7b329ea9dddc11010748cf9..e8424d7539db191a55edebb7d33a3c1dc37e2403 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -1001,11 +1001,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser( diff --git a/patches/node/enable_crashpad_linux_node_processes.patch b/patches/node/enable_crashpad_linux_node_processes.patch index b874729cbe31e..7defc4cc3c14f 100644 --- a/patches/node/enable_crashpad_linux_node_processes.patch +++ b/patches/node/enable_crashpad_linux_node_processes.patch @@ -8,7 +8,7 @@ to child processes spawned with `ELECTRON_RUN_AS_NODE` which is used by the crashpad client to connect with the handler process. diff --git a/lib/child_process.js b/lib/child_process.js -index 655349b6fa17217a9202616224032a36fd01e284..bf62c5adf0e0d75cb50636f365f71db82c29ba29 100644 +index 960ecd25ebb5b2aba0b92b869a2332a3a69011e1..ced0a5d792c63662c577a41c88b52cae076e7d08 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -62,6 +62,7 @@ let debug = require('internal/util/debuglog').debuglog( @@ -49,8 +49,8 @@ index 655349b6fa17217a9202616224032a36fd01e284..bf62c5adf0e0d75cb50636f365f71db8 + if (options.shell) { validateArgumentNullCheck(options.shell, 'options.shell'); - const command = ArrayPrototypeJoin([file, ...args], ' '); -@@ -670,8 +686,6 @@ function normalizeSpawnArguments(file, args, options) { + +@@ -671,8 +687,6 @@ function normalizeSpawnArguments(file, args, options) { ArrayPrototypeUnshift(args, file); } diff --git a/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch b/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch index 3f5ec3af50551..077c811a595ca 100644 --- a/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch +++ b/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch @@ -7,7 +7,7 @@ common.gypi is a file that's included in the node header bundle, despite the fact that we do not build node with gyp. diff --git a/common.gypi b/common.gypi -index 7780ae106b479ca620a4065f08d6e4acc200628c..e56ba31ed068b81f5c6fbd432cd82bb6916e9a85 100644 +index ae31b372b96358a156761ec7e9c39c9530d1abd1..6b79de07be3f839af5b0644f19bfef9c33de590e 100644 --- a/common.gypi +++ b/common.gypi @@ -91,6 +91,23 @@ diff --git a/patches/node/fix_add_source_location_for_v8_task_runner.patch b/patches/node/fix_add_source_location_for_v8_task_runner.patch index 43896b7b67e60..2f60e1ea7fb76 100644 --- a/patches/node/fix_add_source_location_for_v8_task_runner.patch +++ b/patches/node/fix_add_source_location_for_v8_task_runner.patch @@ -15,10 +15,10 @@ corresponding change. CL: https://chromium-review.googlesource.com/c/v8/v8/+/5300826 diff --git a/src/node_platform.cc b/src/node_platform.cc -index 9c4c1e1db5fa7c0ca791e01d9be331e0957e9699..b438b3774d0aa7680fdbc6c6bf39a87893d221b2 100644 +index 0ffebd1dcb693dcddbedff5d259cf65c115f1dc2..b24e170cb247261d4a16d77ad40df4dfd33709d9 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc -@@ -307,11 +307,13 @@ void PerIsolatePlatformData::FlushTasks(uv_async_t* handle) { +@@ -308,11 +308,13 @@ void PerIsolatePlatformData::FlushTasks(uv_async_t* handle) { platform_data->FlushForegroundTasksInternal(); } @@ -34,7 +34,7 @@ index 9c4c1e1db5fa7c0ca791e01d9be331e0957e9699..b438b3774d0aa7680fdbc6c6bf39a878 // The task can be posted from any V8 background worker thread, even when // the foreground task runner is being cleaned up by Shutdown(). In that // case, make sure we wait until the shutdown is completed (which leads -@@ -330,8 +332,10 @@ void PerIsolatePlatformData::PostTask(std::unique_ptr<Task> task) { +@@ -331,8 +333,10 @@ void PerIsolatePlatformData::PostTask(std::unique_ptr<Task> task) { uv_async_send(flush_tasks_); } @@ -47,7 +47,7 @@ index 9c4c1e1db5fa7c0ca791e01d9be331e0957e9699..b438b3774d0aa7680fdbc6c6bf39a878 if (debug_log_level_ != PlatformDebugLogLevel::kNone) { fprintf(stderr, "\nPerIsolatePlatformData::PostDelayedTaskImpl %p %f", -@@ -353,13 +357,15 @@ void PerIsolatePlatformData::PostDelayedTask( +@@ -354,13 +358,15 @@ void PerIsolatePlatformData::PostDelayedTask( uv_async_send(flush_tasks_); } diff --git a/patches/node/fix_allow_passing_fileexists_fn_to_legacymainresolve.patch b/patches/node/fix_allow_passing_fileexists_fn_to_legacymainresolve.patch index 3565a108e1957..b415690b0b764 100644 --- a/patches/node/fix_allow_passing_fileexists_fn_to_legacymainresolve.patch +++ b/patches/node/fix_allow_passing_fileexists_fn_to_legacymainresolve.patch @@ -53,10 +53,10 @@ index e3afd30ba1f591d0298793bc42fd7166a4219bce..408dc96307d7f52f92db41004b358051 const maybeMain = resolvedOption <= legacyMainResolveExtensionsIndexes.kResolvedByMainIndexNode ? packageConfig.main || './' : ''; diff --git a/src/node_file.cc b/src/node_file.cc -index c8e7e341b1d9f5a1142afdc265704455c252a0c3..7221708a2296ff44c19ed01dc52d78653ecc4e58 100644 +index e78326ed0de805a8bf4f621cad9158635eb44aa2..d7009937b31729f33d9c45cbda7f5440fbdac2aa 100644 --- a/src/node_file.cc +++ b/src/node_file.cc -@@ -3504,13 +3504,25 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) { +@@ -3502,13 +3502,25 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) { } BindingData::FilePathIsFileReturnType BindingData::FilePathIsFile( @@ -83,7 +83,7 @@ index c8e7e341b1d9f5a1142afdc265704455c252a0c3..7221708a2296ff44c19ed01dc52d7865 uv_fs_t req; int rc = uv_fs_stat(env->event_loop(), &req, file_path.c_str(), nullptr); -@@ -3568,6 +3580,11 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { +@@ -3566,6 +3578,11 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { std::optional<std::string> initial_file_path; std::string file_path; @@ -95,7 +95,7 @@ index c8e7e341b1d9f5a1142afdc265704455c252a0c3..7221708a2296ff44c19ed01dc52d7865 if (args.Length() >= 2 && args[1]->IsString()) { auto package_config_main = Utf8Value(isolate, args[1]).ToString(); -@@ -3588,7 +3605,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { +@@ -3586,7 +3603,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { BufferValue buff_file_path(isolate, local_file_path); ToNamespacedPath(env, &buff_file_path); @@ -104,7 +104,7 @@ index c8e7e341b1d9f5a1142afdc265704455c252a0c3..7221708a2296ff44c19ed01dc52d7865 case BindingData::FilePathIsFileReturnType::kIsFile: return args.GetReturnValue().Set(i); case BindingData::FilePathIsFileReturnType::kIsNotFile: -@@ -3625,7 +3642,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { +@@ -3623,7 +3640,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { BufferValue buff_file_path(isolate, local_file_path); ToNamespacedPath(env, &buff_file_path); diff --git a/patches/node/fix_assert_module_in_the_renderer_process.patch b/patches/node/fix_assert_module_in_the_renderer_process.patch index 6c41fe86663c4..bf7adcbd9a605 100644 --- a/patches/node/fix_assert_module_in_the_renderer_process.patch +++ b/patches/node/fix_assert_module_in_the_renderer_process.patch @@ -44,7 +44,7 @@ index 13e41d67c635c27bd5e69eb4960eace34beaef0d..9a99c9ca93907630f9f3ba7ba24577a1 let filename = call.getFileName(); const line = call.getLineNumber() - 1; diff --git a/src/node_options.cc b/src/node_options.cc -index 653112fbaea59fe8b446236085dcae8be671c6e5..415d4e34f29bc303674dccbfdc231b251401961b 100644 +index e3509abbc3bf84ac0edcd495eb3dde6219dbfc2d..8afded658c3f569de7b329ea9dddc11010748cf9 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -1566,14 +1566,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) { diff --git a/patches/node/fix_cppgc_initializing_twice.patch b/patches/node/fix_cppgc_initializing_twice.patch index d4a2189b9a3e1..d33ea35c66949 100644 --- a/patches/node/fix_cppgc_initializing_twice.patch +++ b/patches/node/fix_cppgc_initializing_twice.patch @@ -12,10 +12,10 @@ This can be removed/refactored once Node.js upgrades to a version of V8 containing the above CL. diff --git a/src/node.cc b/src/node.cc -index 9d9992dacbc595c987827f55eb12ea8af0480df6..d43a88b8780f04d186485a2dc58ad07083e699ac 100644 +index 9027df9a321f7db76edd1218c194df519017dfaf..cc1c35da5601fffc3c53985c5d95cc466662649d 100644 --- a/src/node.cc +++ b/src/node.cc -@@ -1222,7 +1222,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, +@@ -1246,7 +1246,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, result->platform_ = per_process::v8_platform.Platform(); } diff --git a/patches/node/fix_do_not_resolve_electron_entrypoints.patch b/patches/node/fix_do_not_resolve_electron_entrypoints.patch index c9357d2e059e1..a69a82f520a37 100644 --- a/patches/node/fix_do_not_resolve_electron_entrypoints.patch +++ b/patches/node/fix_do_not_resolve_electron_entrypoints.patch @@ -6,19 +6,20 @@ Subject: fix: do not resolve electron entrypoints This wastes fs cycles and can result in strange behavior if this path actually exists on disk diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index 8e099e0961b624c6143f5a60f050855b3366f177..dfed827fd3fc794f52bad39ccf7b5c14b1caebc3 100644 +index 2c33fd44b9a251682de78a8bcdad9ee5a0d3e5e8..ae3ef0e853ae19fca649704854d4bda84a5bd287 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js -@@ -293,6 +293,9 @@ function cjsPreparseModuleExports(filename, source, isMain, format) { - if (module && module[kModuleExportNames] !== undefined) { +@@ -355,6 +355,10 @@ function cjsPreparseModuleExports(filename, source, format) { return { module, exportNames: module[kModuleExportNames] }; } + + if (filename === 'electron') { + return { module, exportNames: new SafeSet(['default', ...Object.keys(module.exports)]) }; + } - const loaded = Boolean(module); - if (!loaded) { - module = new CJSModule(filename); ++ + if (source === undefined) { + ({ source } = loadSourceForCJSWithHooks(module, filename, format)); + } diff --git a/lib/internal/modules/run_main.js b/lib/internal/modules/run_main.js index 02ba43adc2c8e92a78942bbb04023a16f5870ee9..bbf1ab69b884a9325bebdd07b2c4fd354eee946b 100644 --- a/lib/internal/modules/run_main.js diff --git a/patches/node/fix_expose_readfilesync_override_for_modules.patch b/patches/node/fix_expose_readfilesync_override_for_modules.patch index 2b87a86ef43fb..4a4f1fdaa6fc3 100644 --- a/patches/node/fix_expose_readfilesync_override_for_modules.patch +++ b/patches/node/fix_expose_readfilesync_override_for_modules.patch @@ -8,10 +8,10 @@ an API override to replace the native `ReadFileSync` in the `modules` binding. diff --git a/src/env_properties.h b/src/env_properties.h -index 5cb8dd86fe712755fe09556d227702aec905fbc9..f1768da6ef82fa85700fecbdf9321653345e92c5 100644 +index 82225b0a53dd828750991a4e15a060b736b6ea2b..4b0d31356a2496a7fc67876a22da2453efc54f53 100644 --- a/src/env_properties.h +++ b/src/env_properties.h -@@ -506,6 +506,7 @@ +@@ -508,6 +508,7 @@ V(maybe_cache_generated_source_map, v8::Function) \ V(messaging_deserialize_create_object, v8::Function) \ V(message_port, v8::Object) \ diff --git a/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch b/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch index 1ed3bfda1b5cd..cc97575ed4c68 100644 --- a/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch +++ b/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch @@ -18,7 +18,7 @@ index 9519f947b8dfdc69808839948c9cb8434a0acf0e..23ce72d479f638c33edffcea7c35f5da /** diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js -index e718d7b3e7c11addc78cf7af33c93f63a9cb247b..3334818153068468967baa5adc1ed2382592ec76 100644 +index 307c35980551470b65128bebf5efe94df4e56892..3676a9852bcd42de0a3a380de117de58035f757b 100644 --- a/lib/internal/modules/esm/load.js +++ b/lib/internal/modules/esm/load.js @@ -81,7 +81,7 @@ function defaultLoad(url, context = kEmptyObject) { @@ -29,8 +29,8 @@ index e718d7b3e7c11addc78cf7af33c93f63a9cb247b..3334818153068468967baa5adc1ed238 + if (urlInstance.protocol === 'node:' || format === 'electron') { source = null; format ??= 'builtin'; - } else if (format !== 'commonjs' || defaultType === 'module') { -@@ -94,7 +94,7 @@ function defaultLoad(url, context = kEmptyObject) { + } else if (format === 'addon') { +@@ -97,7 +97,7 @@ function defaultLoad(url, context = kEmptyObject) { // Now that we have the source for the module, run `defaultGetFormat` to detect its format. format = defaultGetFormat(urlInstance, context); @@ -39,7 +39,7 @@ index e718d7b3e7c11addc78cf7af33c93f63a9cb247b..3334818153068468967baa5adc1ed238 // For backward compatibility reasons, we need to discard the source in // order for the CJS loader to re-fetch it. source = null; -@@ -142,7 +142,7 @@ function defaultLoadSync(url, context = kEmptyObject) { +@@ -145,7 +145,7 @@ function defaultLoadSync(url, context = kEmptyObject) { throwIfUnsupportedURLScheme(urlInstance, false); @@ -48,7 +48,7 @@ index e718d7b3e7c11addc78cf7af33c93f63a9cb247b..3334818153068468967baa5adc1ed238 source = null; } else if (source == null) { ({ responseURL, source } = getSourceSync(urlInstance, context)); -@@ -175,12 +175,13 @@ function throwIfUnsupportedURLScheme(parsed) { +@@ -178,12 +178,13 @@ function throwIfUnsupportedURLScheme(parsed) { protocol !== 'file:' && protocol !== 'data:' && protocol !== 'node:' && @@ -64,10 +64,10 @@ index e718d7b3e7c11addc78cf7af33c93f63a9cb247b..3334818153068468967baa5adc1ed238 } } diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js -index 87c14d1f84def72c1326e09154b38c417840634e..4491499e6da1724a7fd66b028a78ba145d6114aa 100644 +index 78985575beb3df7722ba90968e8f085574b5afdf..e032c016efe227c26364e81804ad183cd2c0d17f 100644 --- a/lib/internal/modules/esm/loader.js +++ b/lib/internal/modules/esm/loader.js -@@ -498,7 +498,7 @@ class ModuleLoader { +@@ -504,7 +504,7 @@ class ModuleLoader { } const cjsModule = wrap[imported_cjs_symbol]; @@ -103,12 +103,12 @@ index 859b6bfedac4bbee2df054f9ebca7cbaaed45f18..5aa946f66c71beff0b7a43c30638ab28 const packageConfig = packageJsonReader.read(packageJSONPath, { __proto__: null, specifier, base, isESM: true }); diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index d595ccbab8ce3042e83054e875eef612914115d8..7ea645b92a015b04cc121ff62aa1fc64b2961241 100644 +index 757f093becd112002f3422302f4c29bb464f1a6c..c8cea2117080930105b33e4e50586a2c88ef7352 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -188,7 +188,7 @@ function createCJSModuleWrap(url, source, isMain, format, loadCJS = loadCJSModul - const { exportNames, module } = cjsPreparseModuleExports(filename, source, isMain, format); + const { exportNames, module } = cjsPreparseModuleExports(filename, source, format); cjsCache.set(url, module); - const namesWithDefault = exportNames.has('default') ? + const namesWithDefault = filename === 'electron' ? ['default', ...Object.keys(module.exports)] : exportNames.has('default') ? @@ -126,7 +126,7 @@ index d595ccbab8ce3042e83054e875eef612914115d8..7ea645b92a015b04cc121ff62aa1fc64 continue; } // We might trigger a getter -> dont fail. -@@ -245,6 +245,10 @@ translators.set('require-commonjs', (url, source, isMain) => { +@@ -286,6 +286,10 @@ translators.set('require-commonjs', (url, source, isMain) => { return createCJSModuleWrap(url, source, isMain, 'commonjs'); }); @@ -138,10 +138,10 @@ index d595ccbab8ce3042e83054e875eef612914115d8..7ea645b92a015b04cc121ff62aa1fc64 // This translator function must be sync, as `require` is sync. translators.set('require-commonjs-typescript', (url, source, isMain) => { diff --git a/lib/internal/url.js b/lib/internal/url.js -index b6057ae6656e03d98ea40c018369419749409c6d..9bd9abd49523406fd9ac77f2b5efe311da1fa9aa 100644 +index d0c04be7c6ebc352d5958a987f3a4ba538e0d23a..00f9f3b73ed84c04ae712f6057b68737bd416333 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js -@@ -1604,6 +1604,8 @@ function fileURLToPath(path, options = kEmptyObject) { +@@ -1605,6 +1605,8 @@ function fileURLToPath(path, options = kEmptyObject) { path = new URL(path); else if (!isURL(path)) throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path); diff --git a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch index f1d0d94ef1bfc..316767a8fed2a 100644 --- a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch +++ b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch @@ -228,7 +228,7 @@ index d94f6e1c82c4a62547b3b395f375c86ce4deb5de..b81b9005365272217c77e2b9289bd9f8 X509View ca(sk_X509_value(peer_certs.get(), i)); if (!cert->view().isIssuedBy(ca)) continue; diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc -index 5e368e3fd93b560c629aef720acd576f118cb1d6..ea5179ad5155cb599891d7421cd61df719ac4cae 100644 +index c08dab17fa229d1d67d3ad5174c97192989b2bd0..a3d309d832c73ddc79564b9644d825bec7459e7f 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc @@ -141,7 +141,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx, @@ -240,7 +240,7 @@ index 5e368e3fd93b560c629aef720acd576f118cb1d6..ea5179ad5155cb599891d7421cd61df7 X509* ca = sk_X509_value(extra_certs, i); // NOTE: Increments reference count on `ca` -@@ -1752,11 +1752,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) { +@@ -1773,11 +1773,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) { // If the user specified "auto" for dhparams, the JavaScript layer will pass // true to this function instead of the original string. Any other string // value will be interpreted as custom DH parameters below. @@ -254,7 +254,7 @@ index 5e368e3fd93b560c629aef720acd576f118cb1d6..ea5179ad5155cb599891d7421cd61df7 DHPointer dh; { BIOPointer bio(LoadBIO(env, args[0])); -@@ -1982,7 +1983,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) { +@@ -2003,7 +2004,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) { } // Add CA certs too @@ -372,7 +372,7 @@ index c26a88b395abfc645da56231635b36fb23c8fa09..f23cedf4f2449d8edc9a8de1b70332e7 UNREACHABLE(); } diff --git a/src/crypto/crypto_dsa.cc b/src/crypto/crypto_dsa.cc -index 471fee77531139ce988292470dff443fdfb05b07..931f7c2ae3d7e12afce471545d610d22f63412d7 100644 +index ca5edc8ebdf2550bb62b7969a5650733a2647f4f..198e18b58f31e361a9d2865cbe81e067e5f0b543 100644 --- a/src/crypto/crypto_dsa.cc +++ b/src/crypto/crypto_dsa.cc @@ -43,7 +43,7 @@ namespace crypto { @@ -520,11 +520,11 @@ index 7c548d32b40365343f0e208c3aa856a1c847f4c3..6346f8f7199cf7b7d3736c59571606ff } // namespace diff --git a/src/env.h b/src/env.h -index c42493ad958508f650917bf5ca92088714a5056c..07accfbcca491966c6c8ad9c20e146dbd22347f0 100644 +index 874e5f4d15a75307e45cf70c06fc104fed843a6a..35e16159a94bb97f19d17767e3ad4bb798660f44 100644 --- a/src/env.h +++ b/src/env.h -@@ -50,7 +50,7 @@ - #include "uv.h" +@@ -51,7 +51,7 @@ + #include "v8-profiler.h" #include "v8.h" -#if HAVE_OPENSSL @@ -532,7 +532,7 @@ index c42493ad958508f650917bf5ca92088714a5056c..07accfbcca491966c6c8ad9c20e146db #include <openssl/evp.h> #endif -@@ -1076,7 +1076,7 @@ class Environment final : public MemoryRetainer { +@@ -1077,7 +1077,7 @@ class Environment final : public MemoryRetainer { kExitInfoFieldCount }; @@ -542,11 +542,11 @@ index c42493ad958508f650917bf5ca92088714a5056c..07accfbcca491966c6c8ad9c20e146db // We declare another alias here to avoid having to include crypto_util.h using EVPMDPointer = DeleteFnPtr<EVP_MD, EVP_MD_free>; diff --git a/src/node_metadata.h b/src/node_metadata.h -index 7b2072ad39c3f1a7c73101b25b69beb781141e26..d23536d88d21255d348175425a59e2424332cd19 100644 +index d9c533f100d25aeab1fe8589932a8ddead431258..2acab8786a8a752b17961445edeb872c2b08fdeb 100644 --- a/src/node_metadata.h +++ b/src/node_metadata.h -@@ -6,7 +6,7 @@ - #include <string> +@@ -8,7 +8,7 @@ + #include <utility> #include "node_version.h" -#if HAVE_OPENSSL @@ -555,7 +555,7 @@ index 7b2072ad39c3f1a7c73101b25b69beb781141e26..d23536d88d21255d348175425a59e242 #if NODE_OPENSSL_HAS_QUIC #include <openssl/quic.h> diff --git a/src/node_options.cc b/src/node_options.cc -index 249361e351946c16452124029c60fca52782adf9..653112fbaea59fe8b446236085dcae8be671c6e5 100644 +index ed85bf11f6f325823b59b3b0275908f9210c1b24..e3509abbc3bf84ac0edcd495eb3dde6219dbfc2d 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -7,7 +7,7 @@ @@ -568,7 +568,7 @@ index 249361e351946c16452124029c60fca52782adf9..653112fbaea59fe8b446236085dcae8b #endif diff --git a/src/node_options.h b/src/node_options.h -index 2a1a6aaf9f2d358ffffb0a8171df470686b9450e..3ff1f4b4baa64b8ee2a4587e150ea14cb2fdfdf4 100644 +index cdbd9ca39e907ab22515293eac2c5512223f4ca2..418dee360f867c363f1576012b32213a51c4fdd0 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -11,7 +11,7 @@ diff --git a/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch b/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch index ff8f0ae81c00a..98867a20f98e2 100644 --- a/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch +++ b/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch @@ -6,7 +6,7 @@ Subject: fix: lazyload fs in esm loaders to apply asar patches Changes { foo } from fs to just "fs.foo" so that our patching of fs is applied to esm loaders diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js -index 3334818153068468967baa5adc1ed2382592ec76..ab4c8a4d00f1813e72f1ea8349850b40f55a393e 100644 +index 3676a9852bcd42de0a3a380de117de58035f757b..eaecfcfd8b922908957c3fefea65fb9deb445249 100644 --- a/lib/internal/modules/esm/load.js +++ b/lib/internal/modules/esm/load.js @@ -10,7 +10,7 @@ const { @@ -50,10 +50,10 @@ index 5aa946f66c71beff0b7a43c30638ab28a1a5dfc0..e3afd30ba1f591d0298793bc42fd7166 }); const { search, hash } = resolved; diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index 7ea645b92a015b04cc121ff62aa1fc64b2961241..8e099e0961b624c6143f5a60f050855b3366f177 100644 +index c8cea2117080930105b33e4e50586a2c88ef7352..2c33fd44b9a251682de78a8bcdad9ee5a0d3e5e8 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js -@@ -25,7 +25,7 @@ const { +@@ -24,7 +24,7 @@ const { const { BuiltinModule } = require('internal/bootstrap/realm'); const assert = require('internal/assert'); @@ -62,7 +62,7 @@ index 7ea645b92a015b04cc121ff62aa1fc64b2961241..8e099e0961b624c6143f5a60f050855b const { dirname, extname } = require('path'); const { assertBufferSource, -@@ -274,7 +274,7 @@ translators.set('commonjs', function commonjsStrategy(url, source, isMain) { +@@ -315,7 +315,7 @@ translators.set('commonjs', function commonjsStrategy(url, source, isMain) { try { // We still need to read the FS to detect the exports. diff --git a/patches/node/fix_remove_deprecated_errno_constants.patch b/patches/node/fix_remove_deprecated_errno_constants.patch index 55ac88fa57cd0..3f6bf1ecbd32c 100644 --- a/patches/node/fix_remove_deprecated_errno_constants.patch +++ b/patches/node/fix_remove_deprecated_errno_constants.patch @@ -45,7 +45,7 @@ index ac00778cfc59fb55e361b24fc81a965a5e8f97e7..f0c4d6dfc9f03bee59e656b2da9ac325 # define UV__EUNATCH UV__ERR(EUNATCH) #else diff --git a/src/node_constants.cc b/src/node_constants.cc -index 8c44e32381a44675792ca0922e47df1adda48e41..d193725ea9a3270ed9affea12d11467fb14efdf8 100644 +index 0ca643aa74d13f278685d2330b791182b55c15b4..cbcecfba33070b820aca0e2814982160a97a6378 100644 --- a/src/node_constants.cc +++ b/src/node_constants.cc @@ -241,10 +241,6 @@ void DefineErrnoConstants(Local<Object> target) { diff --git a/patches/node/fix_remove_fastapitypedarray_usage.patch b/patches/node/fix_remove_fastapitypedarray_usage.patch index 13e446df08857..9aef887c0f000 100644 --- a/patches/node/fix_remove_fastapitypedarray_usage.patch +++ b/patches/node/fix_remove_fastapitypedarray_usage.patch @@ -194,10 +194,10 @@ index e39852c8e0392e0a9ae5d4ea58be115416e19233..c94b14741c827a81d69a6f036426a344 static const v8::CFunction fast_write_string_ascii( diff --git a/src/util.h b/src/util.h -index dbec66247852df91c57c2a4e9664d2fea7d3dcef..efeb12d837db7b88093e4a6a2e20df562180ca1e 100644 +index dcd6548d41be786c42ce8328d89e532a8e9d43a2..7c98de621ca4d53cbaaa5bd4488aab20c7b033a7 100644 --- a/src/util.h +++ b/src/util.h -@@ -60,6 +60,7 @@ +@@ -62,6 +62,7 @@ namespace node { constexpr char kPathSeparator = std::filesystem::path::preferred_separator; @@ -205,7 +205,7 @@ index dbec66247852df91c57c2a4e9664d2fea7d3dcef..efeb12d837db7b88093e4a6a2e20df56 #ifdef _WIN32 /* MAX_PATH is in characters, not bytes. Make sure we have enough headroom. */ -@@ -585,6 +586,16 @@ class BufferValue : public MaybeStackBuffer<char> { +@@ -589,6 +590,16 @@ class BufferValue : public MaybeStackBuffer<char> { static_cast<char*>(name->Buffer()->Data()) + name##_offset; \ if (name##_length > 0) CHECK_NE(name##_data, nullptr); diff --git a/patches/node/fix_remove_outdated_v8_flags_from_node_cc.patch b/patches/node/fix_remove_outdated_v8_flags_from_node_cc.patch index 5b14b177b5a54..8eba2bbcbb479 100644 --- a/patches/node/fix_remove_outdated_v8_flags_from_node_cc.patch +++ b/patches/node/fix_remove_outdated_v8_flags_from_node_cc.patch @@ -13,7 +13,7 @@ This patch can be removed when we upgrade to a V8 version that contains the above CLs. diff --git a/src/node.cc b/src/node.cc -index 1b5e989e5456a9bf77475e06250702029568c08d..61d65094aebd7f3016d51a8e7c9c761fc69cecba 100644 +index 07684482f855363e26c3d7299a585a8a5654015e..627337efae49319e2a77b4686176ce92a8493024 100644 --- a/src/node.cc +++ b/src/node.cc @@ -816,7 +816,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args, diff --git a/patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch b/patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch index 48cae66788047..991b0cfe3154e 100644 --- a/patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch +++ b/patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch @@ -18,10 +18,10 @@ This can be removed when Node.js upgrades to a version of V8 containing CLs from the above issue. diff --git a/src/api/environment.cc b/src/api/environment.cc -index 9e1b8d147a99fda962d75c343d0687ffea3c9c69..244d747f010c51366e44dec705ae304423038a85 100644 +index cb37fa080fc8e8d524cfa2758c4a8c2c5652324d..8e227ddd1be50c046a8cf2895a31d607eb7d31de 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -313,6 +313,10 @@ Isolate* NewIsolate(Isolate::CreateParams* params, +@@ -316,6 +316,10 @@ Isolate* NewIsolate(Isolate::CreateParams* params, MultiIsolatePlatform* platform, const SnapshotData* snapshot_data, const IsolateSettings& settings) { @@ -32,7 +32,7 @@ index 9e1b8d147a99fda962d75c343d0687ffea3c9c69..244d747f010c51366e44dec705ae3044 Isolate* isolate = Isolate::Allocate(); if (isolate == nullptr) return nullptr; -@@ -356,9 +360,12 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator, +@@ -359,9 +363,12 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator, uv_loop_t* event_loop, MultiIsolatePlatform* platform, const EmbedderSnapshotData* snapshot_data, @@ -47,10 +47,10 @@ index 9e1b8d147a99fda962d75c343d0687ffea3c9c69..244d747f010c51366e44dec705ae3044 event_loop, platform, diff --git a/src/env.cc b/src/env.cc -index 56eb42643f26f3ebb447cb625d5422dcfa872189..8cdfbac602796cabbd8a2f673385b93bea9bd7cc 100644 +index 85641b68b1e6f6dd4149f33ba13f76bccc8bf47d..c6209cc7cf317de1bb9217e39dd760e5a83303e2 100644 --- a/src/env.cc +++ b/src/env.cc -@@ -577,14 +577,6 @@ IsolateData::IsolateData(Isolate* isolate, +@@ -578,14 +578,6 @@ IsolateData::IsolateData(Isolate* isolate, // We do not care about overflow since we just want this to be different // from the cppgc id. uint16_t non_cppgc_id = cppgc_id + 1; @@ -65,7 +65,7 @@ index 56eb42643f26f3ebb447cb625d5422dcfa872189..8cdfbac602796cabbd8a2f673385b93b { // GC could still be run after the IsolateData is destroyed, so we store // the ids in a static map to ensure pointers to them are still valid -@@ -607,15 +599,6 @@ IsolateData::IsolateData(Isolate* isolate, +@@ -608,15 +600,6 @@ IsolateData::IsolateData(Isolate* isolate, } } @@ -82,10 +82,10 @@ index 56eb42643f26f3ebb447cb625d5422dcfa872189..8cdfbac602796cabbd8a2f673385b93b void SetCppgcReference(Isolate* isolate, Local<Object> object, diff --git a/src/env.h b/src/env.h -index 1079e3beb02e5f5d71a15fd2db65cb93ebd175d6..a7be609c3ab9093cec5145367b95ae6859936a24 100644 +index 2d5fa8dbd75851bca30453548f6cbe0159509f26..c346e3a9c827993036438685d758a734f9ce8c05 100644 --- a/src/env.h +++ b/src/env.h -@@ -155,7 +155,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer { +@@ -157,7 +157,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer { ArrayBufferAllocator* node_allocator = nullptr, const EmbedderSnapshotData* embedder_snapshot_data = nullptr, std::shared_ptr<PerIsolateOptions> options = nullptr); @@ -93,7 +93,7 @@ index 1079e3beb02e5f5d71a15fd2db65cb93ebd175d6..a7be609c3ab9093cec5145367b95ae68 SET_MEMORY_INFO_NAME(IsolateData) SET_SELF_SIZE(IsolateData) -@@ -258,7 +257,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer { +@@ -260,7 +259,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer { const SnapshotData* snapshot_data_; std::optional<SnapshotConfig> snapshot_config_; @@ -102,10 +102,10 @@ index 1079e3beb02e5f5d71a15fd2db65cb93ebd175d6..a7be609c3ab9093cec5145367b95ae68 worker::Worker* worker_context_ = nullptr; PerIsolateWrapperData* wrapper_data_; diff --git a/src/node.cc b/src/node.cc -index 61d65094aebd7f3016d51a8e7c9c761fc69cecba..0d383dcdb80fe30e3c2d6880b44f626f065bb1f3 100644 +index 627337efae49319e2a77b4686176ce92a8493024..f0c0b6229048a2e9bc05684fab44ab09bc34e1f6 100644 --- a/src/node.cc +++ b/src/node.cc -@@ -1271,6 +1271,14 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, +@@ -1295,6 +1295,14 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, result->platform_ = per_process::v8_platform.Platform(); } @@ -120,7 +120,7 @@ index 61d65094aebd7f3016d51a8e7c9c761fc69cecba..0d383dcdb80fe30e3c2d6880b44f626f if (!(flags & ProcessInitializationFlags::kNoInitializeV8)) { V8::Initialize(); -@@ -1280,14 +1288,6 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, +@@ -1304,14 +1312,6 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, absl::SetMutexDeadlockDetectionMode(absl::OnDeadlockCycle::kIgnore); } @@ -136,7 +136,7 @@ index 61d65094aebd7f3016d51a8e7c9c761fc69cecba..0d383dcdb80fe30e3c2d6880b44f626f bool use_wasm_trap_handler = !per_process::cli_options->disable_wasm_trap_handler; diff --git a/src/node.h b/src/node.h -index 42d55d24bd0770795ae0c0e19241d25a6350ae08..4335c7cf53b7e08c95dcee3461384ac12c8ebe41 100644 +index d3a965661d068db359bb1bb4b14e59c28bb615f9..16a0c71aef949b0ddd27def9dc843298f9a6b75f 100644 --- a/src/node.h +++ b/src/node.h @@ -590,7 +590,8 @@ NODE_EXTERN v8::Isolate* NewIsolate( @@ -174,10 +174,10 @@ index 4119ac1b002681d39711eac810ca2fcc2702ffc7..790347056cde949ffe6cf8498a7eca0c ExitCode NodeMainInstance::Run() { diff --git a/src/node_worker.cc b/src/node_worker.cc -index e2dbdd39b06c4f2f85eba46cbf1383af144456c6..6c43928ba5a9752c78544d1c77198278eb11ccd7 100644 +index 29c4b1de42b3127a98871d200c80197bf974b31f..8555ab556b5b74a1cf9cf30747f1f417bfe4e4d9 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc -@@ -163,6 +163,9 @@ class WorkerThreadData { +@@ -177,6 +177,9 @@ class WorkerThreadData { SetIsolateCreateParamsForNode(¶ms); w->UpdateResourceConstraints(¶ms.constraints); params.array_buffer_allocator_shared = allocator; @@ -187,7 +187,7 @@ index e2dbdd39b06c4f2f85eba46cbf1383af144456c6..6c43928ba5a9752c78544d1c77198278 Isolate* isolate = NewIsolate(¶ms, &loop_, w->platform_, w->snapshot_data()); if (isolate == nullptr) { -@@ -231,13 +234,8 @@ class WorkerThreadData { +@@ -245,13 +248,8 @@ class WorkerThreadData { *static_cast<bool*>(data) = true; }, &platform_finished); diff --git a/patches/node/src_do_not_use_soon-to-be-deprecated_v8_api.patch b/patches/node/src_do_not_use_soon-to-be-deprecated_v8_api.patch index c866e376873fc..15650a4479567 100644 --- a/patches/node/src_do_not_use_soon-to-be-deprecated_v8_api.patch +++ b/patches/node/src_do_not_use_soon-to-be-deprecated_v8_api.patch @@ -33,7 +33,7 @@ Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> diff --git a/src/node_process_object.cc b/src/node_process_object.cc -index 7dd24545fee674b25503b0fcff9b9af0d5c6a26a..5de8be7f8ed97e6b110e397fc4cacb9a246892b6 100644 +index 2e0d180d249c6925c761cb673a4a396905cc971c..5bf854723040859f841608f40ac43ea3d4a44b1e 100644 --- a/src/node_process_object.cc +++ b/src/node_process_object.cc @@ -13,7 +13,6 @@ @@ -44,7 +44,7 @@ index 7dd24545fee674b25503b0fcff9b9af0d5c6a26a..5de8be7f8ed97e6b110e397fc4cacb9a using v8::EscapableHandleScope; using v8::Function; using v8::FunctionCallbackInfo; -@@ -186,13 +185,12 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) { +@@ -168,13 +167,12 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) { // process.title CHECK(process @@ -59,7 +59,7 @@ index 7dd24545fee674b25503b0fcff9b9af0d5c6a26a..5de8be7f8ed97e6b110e397fc4cacb9a None, SideEffectType::kHasNoSideEffect) .FromJust()); -@@ -211,9 +209,15 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) { +@@ -193,9 +191,15 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) { READONLY_PROPERTY(process, "pid", Integer::New(isolate, uv_os_getpid())); @@ -78,7 +78,7 @@ index 7dd24545fee674b25503b0fcff9b9af0d5c6a26a..5de8be7f8ed97e6b110e397fc4cacb9a // --security-revert flags #define V(code, _, __) \ -@@ -238,12 +242,15 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) { +@@ -220,12 +224,15 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) { // process.debugPort CHECK(process diff --git a/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch b/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch index f6d219887d84a..36cc33e7effed 100644 --- a/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch +++ b/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch @@ -16,7 +16,7 @@ patch: (cherry picked from commit 30329d06235a9f9733b1d4da479b403462d1b326) diff --git a/src/env-inl.h b/src/env-inl.h -index 0d32d9f5a55da257a5e5a895a2ff002b780f96fe..9567d9499c62ea44cca651e87ab912ad55e2d90b 100644 +index 67b4cc2037b8e02f6382cd12a7abb157d0dbac65..4906c6c4c0ab5260d6e6387d0ed8e0687f982a38 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -62,31 +62,6 @@ inline uv_loop_t* IsolateData::event_loop() const { @@ -52,7 +52,7 @@ index 0d32d9f5a55da257a5e5a895a2ff002b780f96fe..9567d9499c62ea44cca651e87ab912ad return &(wrapper_data_->cppgc_id); } diff --git a/src/env.cc b/src/env.cc -index 63fdeeb26ba89284e74ca37050dfd170e7963331..56eb42643f26f3ebb447cb625d5422dcfa872189 100644 +index 926645dc647fe7ca01165462f08eac1ade71ac4e..85641b68b1e6f6dd4149f33ba13f76bccc8bf47d 100644 --- a/src/env.cc +++ b/src/env.cc @@ -23,6 +23,7 @@ @@ -71,7 +71,7 @@ index 63fdeeb26ba89284e74ca37050dfd170e7963331..56eb42643f26f3ebb447cb625d5422dc using worker::Worker; int const ContextEmbedderTag::kNodeContextTag = 0x6e6f64; -@@ -529,6 +529,14 @@ void IsolateData::CreateProperties() { +@@ -530,6 +530,14 @@ void IsolateData::CreateProperties() { CreateEnvProxyTemplate(this); } @@ -86,7 +86,7 @@ index 63fdeeb26ba89284e74ca37050dfd170e7963331..56eb42643f26f3ebb447cb625d5422dc constexpr uint16_t kDefaultCppGCEmbedderID = 0x90de; Mutex IsolateData::isolate_data_mutex_; std::unordered_map<uint16_t, std::unique_ptr<PerIsolateWrapperData>> -@@ -566,36 +574,16 @@ IsolateData::IsolateData(Isolate* isolate, +@@ -567,36 +575,16 @@ IsolateData::IsolateData(Isolate* isolate, v8::CppHeap* cpp_heap = isolate->GetCppHeap(); uint16_t cppgc_id = kDefaultCppGCEmbedderID; @@ -130,7 +130,7 @@ index 63fdeeb26ba89284e74ca37050dfd170e7963331..56eb42643f26f3ebb447cb625d5422dc { // GC could still be run after the IsolateData is destroyed, so we store -@@ -628,11 +616,12 @@ IsolateData::~IsolateData() { +@@ -629,11 +617,12 @@ IsolateData::~IsolateData() { } } @@ -146,10 +146,10 @@ index 63fdeeb26ba89284e74ca37050dfd170e7963331..56eb42643f26f3ebb447cb625d5422dc void IsolateData::MemoryInfo(MemoryTracker* tracker) const { diff --git a/src/env.h b/src/env.h -index 07accfbcca491966c6c8ad9c20e146dbd22347f0..1079e3beb02e5f5d71a15fd2db65cb93ebd175d6 100644 +index 35e16159a94bb97f19d17767e3ad4bb798660f44..2d5fa8dbd75851bca30453548f6cbe0159509f26 100644 --- a/src/env.h +++ b/src/env.h -@@ -175,10 +175,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer { +@@ -177,10 +177,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer { uint16_t* embedder_id_for_cppgc() const; uint16_t* embedder_id_for_non_cppgc() const; @@ -161,10 +161,10 @@ index 07accfbcca491966c6c8ad9c20e146dbd22347f0..1079e3beb02e5f5d71a15fd2db65cb93 inline MultiIsolatePlatform* platform() const; inline const SnapshotData* snapshot_data() const; diff --git a/src/node.h b/src/node.h -index 174fd4d1af4c8cd75aec09f4548a674fd5539fb2..42d55d24bd0770795ae0c0e19241d25a6350ae08 100644 +index 96c599aa6448e2aa8e57e84f811564a5281c139a..d3a965661d068db359bb1bb4b14e59c28bb615f9 100644 --- a/src/node.h +++ b/src/node.h -@@ -1560,24 +1560,14 @@ void RegisterSignalHandler(int signal, +@@ -1576,24 +1576,14 @@ void RegisterSignalHandler(int signal, bool reset_handler = false); #endif // _WIN32 diff --git a/patches/node/support_v8_sandboxed_pointers.patch b/patches/node/support_v8_sandboxed_pointers.patch index 18508387fe1a7..d46ef48236169 100644 --- a/patches/node/support_v8_sandboxed_pointers.patch +++ b/patches/node/support_v8_sandboxed_pointers.patch @@ -7,10 +7,10 @@ This refactors several allocators to allocate within the V8 memory cage, allowing them to be compatible with the V8_SANDBOXED_POINTERS feature. diff --git a/src/api/environment.cc b/src/api/environment.cc -index 50accbf4052da11d47a5200997f1098ed9d85354..9e1b8d147a99fda962d75c343d0687ffea3c9c69 100644 +index fd71ceac65ccef1d2832b45b0b5612877cee22c1..cb37fa080fc8e8d524cfa2758c4a8c2c5652324d 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -103,6 +103,14 @@ MaybeLocal<Value> PrepareStackTraceCallback(Local<Context> context, +@@ -106,6 +106,14 @@ MaybeLocal<Value> PrepareStackTraceCallback(Local<Context> context, return result; } @@ -143,10 +143,10 @@ index 6346f8f7199cf7b7d3736c59571606fff102fbb6..7eea2eaefcad5780663a6b87985925ae void SecureHeapUsed(const FunctionCallbackInfo<Value>& args) { #ifndef OPENSSL_IS_BORINGSSL diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h -index 1592134716da2de40de4ba028ee937b765423e37..8f3ba65f1fef2c066d6df6087a08ba71100d1090 100644 +index ebc7fddeccf04a92c610849b626b33f900d63493..ed7d202d1b041f8a6cd43ae767d696fb29ab9cd9 100644 --- a/src/crypto/crypto_util.h +++ b/src/crypto/crypto_util.h -@@ -242,7 +242,7 @@ class ByteSource { +@@ -243,7 +243,7 @@ class ByteSource { // Creates a v8::BackingStore that takes over responsibility for // any allocated data. The ByteSource will be reset with size = 0 // after being called. @@ -229,10 +229,10 @@ index 61b6ecd240c9500f21f683065a2f920af3afb502..ad2b1c76325cb5c8f18a618c5a85ae87 constexpr const char* EncodingName(const enum encoding encoding) { diff --git a/src/node_internals.h b/src/node_internals.h -index 275534285ec28f02b46639142ab4195b24267476..5f9d123f9d4b9feb7bc0b627b1e6309fdbd6e30d 100644 +index 12ea72b61b0a5e194207bb369dfed4b8667107cb..64442215714a98f648971e517ddd9c77e38fe3f2 100644 --- a/src/node_internals.h +++ b/src/node_internals.h -@@ -120,7 +120,9 @@ v8::MaybeLocal<v8::Object> InitializePrivateSymbols( +@@ -121,7 +121,9 @@ v8::MaybeLocal<v8::Object> InitializePrivateSymbols( class NodeArrayBufferAllocator : public ArrayBufferAllocator { public: @@ -243,7 +243,7 @@ index 275534285ec28f02b46639142ab4195b24267476..5f9d123f9d4b9feb7bc0b627b1e6309f void* Allocate(size_t size) override; // Defined in src/node.cc void* AllocateUninitialized(size_t size) override; -@@ -138,7 +140,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator { +@@ -139,7 +141,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator { } private: diff --git a/patches/node/test_formally_mark_some_tests_as_flaky.patch b/patches/node/test_formally_mark_some_tests_as_flaky.patch index dd4e460660c05..c1614283331d4 100644 --- a/patches/node/test_formally_mark_some_tests_as_flaky.patch +++ b/patches/node/test_formally_mark_some_tests_as_flaky.patch @@ -7,7 +7,7 @@ Instead of disabling the tests, flag them as flaky so they still run but don't cause CI failures on flakes. diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status -index 0546a81ef11ec7ac8d6e214e4090b0e7b94bf70f..25b08be32c7a0aa501b64102f10c9bffc8c57970 100644 +index 67c0c04d2365e59db111258d008f8c73173e3e96..a4204e7580e7823399f6057d57c09cba56b5ff78 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -5,6 +5,16 @@ prefix parallel @@ -28,7 +28,7 @@ index 0546a81ef11ec7ac8d6e214e4090b0e7b94bf70f..25b08be32c7a0aa501b64102f10c9bff test-net-write-fully-async-hex-string: PASS, FLAKY # https://github.com/nodejs/node/issues/52273 diff --git a/test/sequential/sequential.status b/test/sequential/sequential.status -index 6893abfe6e1c03d455099099f0d7e6b6930372a6..24aab3bad500ce4b9d43bf693c5efa6d563fe858 100644 +index 4ae3b6c5fd2eb633ae78bed1824046d862d7579b..d291954d4451b63aeb2bf46232e8705150eb9e79 100644 --- a/test/sequential/sequential.status +++ b/test/sequential/sequential.status @@ -7,6 +7,18 @@ prefix sequential From 7e4115d23164d2609e432daf50937b552e9f05a9 Mon Sep 17 00:00:00 2001 From: Sam Maddock <nilay2014@gmail.com> Date: Wed, 8 Oct 2025 14:21:55 -0400 Subject: [PATCH 112/268] build: bump version in .nvmrc to 22 (#48413) --- .nvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nvmrc b/.nvmrc index 209e3ef4b6247..2bd5a0a98a36c 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -20 +22 From f1c484adb131985f729ba8d4b7955dc8c34ed627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulises=20Gasc=C3=B3n?= <nilay2014@gmail.com> Date: Thu, 9 Oct 2025 00:19:07 +0200 Subject: [PATCH 113/268] docs: add security escalation policy (#48317) --- SECURITY.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SECURITY.md b/SECURITY.md index ebf5d628d18ee..7b1e3dd46a025 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -8,6 +8,12 @@ The Electron team will send a response indicating the next steps in handling you Report security bugs in third-party modules to the person or team maintaining the module. You can also report a vulnerability through the [npm contact form](https://www.npmjs.com/support) by selecting "I'm reporting a security vulnerability". +## Escalation + +If you do not receive an acknowledgement of your report within 6 business days, or if you cannot find a private security contact for the project, you may escalate to the OpenJS Foundation CNA at `security@lists.openjsf.org`. + +If the project acknowledges your report but does not provide any further response or engagement within 14 days, escalation is also appropriate. + ## The Electron Security Notification Process For context on Electron's security notification process, please see the [Notifications](https://github.com/electron/governance/blob/main/wg-security/membership-and-notifications.md#notifications) section of the Security WG's [Membership and Notifications](https://github.com/electron/governance/blob/main/wg-security/membership-and-notifications.md) Governance document. From b08b87e67b06b6d53e126f8d3e0dc95eaf810d4f Mon Sep 17 00:00:00 2001 From: Erick Zhao <nilay2014@gmail.com> Date: Thu, 9 Oct 2025 00:48:22 -0700 Subject: [PATCH 114/268] docs: add note for `node_modules` for Yarn and pnpm (#48484) * Add instructions on using node_modules with Yarn * update text for pnpm --------- Co-authored-by: CodingOtto <otto+github@fysiker.fi> --- docs/tutorial/tutorial-2-first-app.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/tutorial/tutorial-2-first-app.md b/docs/tutorial/tutorial-2-first-app.md index 465c98c0bf26e..588bb21e05e27 100644 --- a/docs/tutorial/tutorial-2-first-app.md +++ b/docs/tutorial/tutorial-2-first-app.md @@ -55,6 +55,18 @@ There are a few rules to follow for the purposes of this tutorial: - _author_, _license_, and _description_ can be any value, but will be necessary for [packaging][packaging] later on. +:::caution Install dependencies with a regular `node_modules` folder + +Electron's packaging toolchain requires the `node_modules` folder to be physically on disk in the +way that npm installs Node dependencies. By default, [Yarn Berry](https://yarnpkg.com/) and +[pnpm](http://pnpm.io/) both use alternative installation strategies. + +Therefore, you must set [`nodeLinker: node-modules`](https://yarnpkg.com/configuration/yarnrc#nodeLinker) +in Yarn or [`nodeLinker: hoisted`](https://pnpm.io/settings#nodelinker) in pnpm if you are using +those package managers. + +::: + Then, install Electron into your app's **devDependencies**, which is the list of external development-only package dependencies not required in production. From cf96b89a845bda484a36feb173de568c5a71016e Mon Sep 17 00:00:00 2001 From: Erick Zhao <nilay2014@gmail.com> Date: Thu, 9 Oct 2025 00:48:47 -0700 Subject: [PATCH 115/268] docs: clarify postinstall requirements (#48485) postinstall --- docs/faq.md | 25 +++++++++++++++++-------- docs/tutorial/installation.md | 12 ++++++------ docs/tutorial/tutorial-2-first-app.md | 20 ++++++++++++++++---- 3 files changed, 39 insertions(+), 18 deletions(-) diff --git a/docs/faq.md b/docs/faq.md index b7259d1661b39..34aa74b04ab0e 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -12,19 +12,28 @@ network problems. The best resolution is to try switching networks, or wait a bit and try installing again. You can also attempt to download Electron directly from -[electron/electron/releases](https://github.com/electron/electron/releases) +[GitHub Releases](https://github.com/electron/electron/releases) if installing via `npm` is failing. -## When will Electron upgrade to latest Chrome? +If you need to install Electron through a custom mirror or proxy, see +the [Advanced Installation](./tutorial/installation.md) documentation for more details. -The Chrome version of Electron is usually bumped within one or two weeks after -a new stable Chrome version gets released. This estimate is not guaranteed and -depends on the amount of work involved with upgrading. +## How are Electron binaries downloaded? -Only the stable channel of Chrome is used. If an important fix is in beta or dev -channel, we will back-port it. +When you run `npm install electron`, the Electron binary for the corresponding version is downloaded +into your project's `node_modules` folder via npm's `postinstall` lifecycle script. -For more information, please see the [security introduction](tutorial/security.md). +This logic is handled by the [`@electron/get`](https://github.com/electron/get) utility package +under the hood. + +## When will Electron upgrade to latest Chromium? + +Every new major version of Electron releases with a Chromium major version upgrade. By releasing every +8 weeks, Electron is able to pull in every other major Chromium release on the very same day that it +releases upstream. Security fixes will be backported to stable release channels ahead of time. + +See the [Electron Releases](./tutorial/electron-timelines.md) documentation for more details or +[releases.electronjs.org](https://releases.electronjs.org) to see our Release Status dashboard. ## When will Electron upgrade to latest Node.js? diff --git a/docs/tutorial/installation.md b/docs/tutorial/installation.md index c96de676358da..821611a922505 100644 --- a/docs/tutorial/installation.md +++ b/docs/tutorial/installation.md @@ -26,12 +26,12 @@ any dependencies in your app will not be installed. ## Customization -If you want to change the architecture that is downloaded (e.g., `ia32` on an -`x64` machine), you can use the `--arch` flag with npm install or set the +If you want to change the architecture that is downloaded (e.g., `x64` on an +`arm64` machine), you can use the `--arch` flag with npm install or set the `npm_config_arch` environment variable: ```shell -npm install --arch=ia32 electron +npm install --arch=x64 electron ``` In addition to changing the architecture, you can also specify the platform @@ -60,7 +60,7 @@ where `$VERSION` is the exact version of Electron). If you are unable to access GitHub or you need to provide a custom build, you can do so by either providing a mirror or an existing cache directory. -#### Mirror +### Mirror You can use environment variables to override the base URL, the path at which to look for Electron binaries, and the binary filename. The URL used by `@electron/get` @@ -95,7 +95,7 @@ Electron release you may have to set `electron_use_remote_checksums=1` directly, or configure it in a `.npmrc` file, to force Electron to use the remote `SHASUMS256.txt` file to verify the checksum instead of the embedded checksums. -#### Cache +### Cache Alternatively, you can override the local cache. `@electron/get` will cache downloaded binaries in a local directory to not stress your network. You can use @@ -120,7 +120,7 @@ The cache contains the version's official zip file as well as a checksum, and is │ └── electron-v15.3.1-darwin-x64.zip ``` -## Skip binary download +## Postinstall script Under the hood, Electron's JavaScript API binds to a binary that contains its implementations. Because this binary is crucial to the function of any Electron app, diff --git a/docs/tutorial/tutorial-2-first-app.md b/docs/tutorial/tutorial-2-first-app.md index 588bb21e05e27..ee830d3101ead 100644 --- a/docs/tutorial/tutorial-2-first-app.md +++ b/docs/tutorial/tutorial-2-first-app.md @@ -70,11 +70,12 @@ those package managers. Then, install Electron into your app's **devDependencies**, which is the list of external development-only package dependencies not required in production. -:::info Why is Electron a devDependency? +:::info Why is Electron a dev dependency? -This may seem counter-intuitive since your production code is running Electron APIs. -However, packaged apps will come bundled with the Electron binary, eliminating the need to specify -it as a production dependency. +This may seem counter-intuitive since your production code is running Electron APIs. Under the hood, +Electron's JavaScript API binds to a binary that contains its implementations. The packaging step for +Electron handles the bundling of this binary, eliminating the need to specify it as a production +dependency. ::: @@ -82,6 +83,17 @@ it as a production dependency. npm install electron --save-dev ``` +:::warning + +In order to correctly install Electron, you need to ensure that its `postinstall` lifecycle +script is able to run. This means avoiding the `--ignore-scripts` flag on npm and allowlisting +`electron` to run build scripts on other package managers. + +This is likely to change in a future version of Electron. See +[electron/rfcs#22](https://github.com/electron/rfcs/pull/22) for more details. + +::: + Your package.json file should look something like this after initializing your package and installing Electron. You should also now have a `node_modules` folder containing the Electron executable, as well as a `package-lock.json` lockfile that specifies From f332958affc0b471dcc6869e96046dfbd188f95a Mon Sep 17 00:00:00 2001 From: David Sanders <nilay2014@gmail.com> Date: Thu, 9 Oct 2025 00:48:56 -0700 Subject: [PATCH 116/268] ci: ignore lost communication with server annotation in audit (#48493) --- .github/workflows/audit-branch-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/audit-branch-ci.yml b/.github/workflows/audit-branch-ci.yml index 62d0ccbb44703..c1f39c9c50d51 100644 --- a/.github/workflows/audit-branch-ci.yml +++ b/.github/workflows/audit-branch-ci.yml @@ -73,6 +73,7 @@ jobs: annotation_level === "failure" && !message.startsWith("Process completed with exit code") && !message.startsWith("Response status code does not indicate success") && + !message.startsWith("The hosted runner lost communication with the server") && !/Unable to make request/.test(message) && !/The requested URL returned error/.test(message), ) From 88ee4b5d1f6c7758d837b7237f1d5ccc01d4c050 Mon Sep 17 00:00:00 2001 From: zoy <nilay2014@gmail.com> Date: Thu, 9 Oct 2025 15:49:20 +0800 Subject: [PATCH 117/268] fix: broken transparent window styles on resizable change (#48378) * fix: wrong api call * fix: consistency of the resize state * fix: edge cases * chore: add detailed comments * fix: lint * chore: only windows * chore: use transparent --- shell/browser/native_window_views.cc | 33 +++++++++++++++------------- shell/browser/native_window_views.h | 1 + spec/api-browser-window-spec.ts | 2 +- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index 6621158a0e8c5..0aee88c7ac49d 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -266,7 +266,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options, params.remove_standard_frame = !has_frame() || has_client_frame(); // If a client frame, we need to draw our own shadows. - if (IsTranslucent() || has_client_frame()) + if (transparent() || has_client_frame()) params.opacity = InitParams::WindowOpacity::kTranslucent; // The given window is most likely not rectangular since it is translucent and @@ -300,7 +300,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options, widget()->Init(std::move(params)); widget()->SetNativeWindowProperty(kNativeWindowKey.c_str(), this); - SetCanResize(resizable_); + widget()->OnSizeConstraintsChanged(); const bool fullscreen = options.ValueOrDefault(options::kFullscreen, false); @@ -354,11 +354,11 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options, // frameless. DWORD frame_style = WS_CAPTION | WS_OVERLAPPED; - if (resizable_) + if (CanResize()) frame_style |= WS_THICKFRAME; if (minimizable_) frame_style |= WS_MINIMIZEBOX; - if (maximizable_) + if (maximizable_ && CanResize()) frame_style |= WS_MAXIMIZEBOX; // We should not show a frame for transparent window. @@ -866,7 +866,7 @@ void NativeWindowViews::SetBounds(const gfx::Rect& bounds, bool animate) { #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) // On Linux and Windows the minimum and maximum size should be updated with // window size when window is not resizable. - if (!resizable_) { + if (!CanResize()) { SetMaximumSize(bounds.size()); SetMinimumSize(bounds.size()); } @@ -947,26 +947,21 @@ extensions::SizeConstraints NativeWindowViews::GetContentSizeConstraints() void NativeWindowViews::SetResizable(bool resizable) { if (resizable != resizable_) { + resizable_ = resizable; // On Linux there is no "resizable" property of a window, we have to set // both the minimum and maximum size to the window size to achieve it. if (resizable) { SetContentSizeConstraints(old_size_constraints_); - SetMaximizable(maximizable_); } else { old_size_constraints_ = GetContentSizeConstraints(); - resizable_ = false; gfx::Size content_size = GetContentSize(); SetContentSizeConstraints( extensions::SizeConstraints(content_size, content_size)); } - } - - resizable_ = resizable; - SetCanResize(resizable_); - #if BUILDFLAG(IS_WIN) - UpdateThickFrame(); + UpdateThickFrame(); #endif + } } bool NativeWindowViews::MoveAbove(const std::string& sourceId) { @@ -1011,12 +1006,20 @@ void NativeWindowViews::MoveTop() { #endif } +bool NativeWindowViews::CanResize() const { +#if BUILDFLAG(IS_WIN) + return resizable_ && thick_frame_; +#else + return resizable_; +#endif +} + bool NativeWindowViews::IsResizable() const { #if BUILDFLAG(IS_WIN) if (has_frame()) return ::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME; #endif - return resizable_; + return CanResize(); } void NativeWindowViews::SetAspectRatio(double aspect_ratio, @@ -1817,7 +1820,7 @@ views::View* NativeWindowViews::GetInitiallyFocusedView() { } bool NativeWindowViews::CanMaximize() const { - return resizable_ && maximizable_; + return CanResize() && maximizable_; } bool NativeWindowViews::CanMinimize() const { diff --git a/shell/browser/native_window_views.h b/shell/browser/native_window_views.h index be0cca1c1f163..e2a6d04f305fa 100644 --- a/shell/browser/native_window_views.h +++ b/shell/browser/native_window_views.h @@ -89,6 +89,7 @@ class NativeWindowViews : public NativeWindow, bool IsResizable() const override; void SetAspectRatio(double aspect_ratio, const gfx::Size& extra_size) override; + bool CanResize() const override; void SetMovable(bool movable) override; bool IsMovable() const override; void SetMinimizable(bool minimizable) override; diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 58529ac1f8379..84784a7c322d8 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -5455,7 +5455,7 @@ describe('BrowserWindow module', () => { thickFrame: true, transparent: true }); - expect(w.isResizable()).to.be.true('resizable'); + expect(w.isResizable()).to.be.false('resizable'); w.maximize(); expect(w.isMaximized()).to.be.true('maximized'); const bounds = w.getBounds(); From dcb21b8ac8bac2ac5c229ac793b1314cf3b7f30a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Thu, 9 Oct 2025 10:33:24 +0200 Subject: [PATCH 118/268] build(deps): bump actions/github-script from 7.0.1 to 8.0.0 (#48329) Bumps [actions/github-script](https://github.com/actions/github-script) from 7.0.1 to 8.0.0. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/60a0d83039c74a4aee543508d2ffcb1c3799cdea...ed597411d8f924073f98dfc5c65a23a2325f34cd) --- updated-dependencies: - dependency-name: actions/github-script dependency-version: 8.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/audit-branch-ci.yml | 2 +- .github/workflows/branch-created.yml | 2 +- .github/workflows/issue-opened.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/audit-branch-ci.yml b/.github/workflows/audit-branch-ci.yml index c1f39c9c50d51..67e6a9f18823f 100644 --- a/.github/workflows/audit-branch-ci.yml +++ b/.github/workflows/audit-branch-ci.yml @@ -20,7 +20,7 @@ jobs: with: node-version: 22.17.x - run: npm install @actions/cache@4.0.3 @electron/fiddle-core@2.0.1 - - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 id: audit-errors with: github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/branch-created.yml b/.github/workflows/branch-created.yml index 87c4aa933b49f..8416afccfff06 100644 --- a/.github/workflows/branch-created.yml +++ b/.github/workflows/branch-created.yml @@ -75,7 +75,7 @@ jobs: org: electron - name: Generate Release Project Board Metadata if: ${{ steps.check-major-version.outputs.MAJOR }} - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 id: generate-project-metadata with: script: | diff --git a/.github/workflows/issue-opened.yml b/.github/workflows/issue-opened.yml index 32048864809a4..d01349b22701f 100644 --- a/.github/workflows/issue-opened.yml +++ b/.github/workflows/issue-opened.yml @@ -37,7 +37,7 @@ jobs: org: electron - run: npm install @electron/fiddle-core@1.3.3 mdast-util-from-markdown@2.0.0 unist-util-select@5.1.0 semver@7.6.0 - name: Add labels - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 id: add-labels env: ISSUE_BODY: ${{ github.event.issue.body }} From 6d847ba372d99828add39cdd8a519d2459a346f5 Mon Sep 17 00:00:00 2001 From: reito <nilay2014@gmail.com> Date: Thu, 9 Oct 2025 16:33:34 +0800 Subject: [PATCH 119/268] feat: offscreen rendering support rgbaf16 hdr output format. (#48265) * feat: offscreen rendering support rgbaf16 * docs: update doc * docs: update doc. --- .../structures/offscreen-shared-texture.md | 5 +++- docs/api/structures/web-preferences.md | 5 ++++ .../browser/api/electron_api_web_contents.cc | 5 ++++ shell/browser/api/electron_api_web_contents.h | 1 + .../osr/osr_render_widget_host_view.cc | 6 ++++- .../browser/osr/osr_render_widget_host_view.h | 23 ++++++++++++------- shell/browser/osr/osr_video_consumer.cc | 21 ++++++++++++++++- shell/browser/osr/osr_web_contents_view.cc | 9 ++++++-- shell/browser/osr/osr_web_contents_view.h | 9 +++++--- shell/common/gin_converters/osr_converter.cc | 2 ++ shell/common/options_switches.h | 3 +++ 11 files changed, 73 insertions(+), 16 deletions(-) diff --git a/docs/api/structures/offscreen-shared-texture.md b/docs/api/structures/offscreen-shared-texture.md index b930bc5daf254..e434287747409 100644 --- a/docs/api/structures/offscreen-shared-texture.md +++ b/docs/api/structures/offscreen-shared-texture.md @@ -2,7 +2,10 @@ * `textureInfo` Object - The shared texture info. * `widgetType` string - The widget type of the texture. Can be `popup` or `frame`. - * `pixelFormat` string - The pixel format of the texture. Can be `rgba` or `bgra`. + * `pixelFormat` string - The pixel format of the texture. + * `rgba` - The texture format is 8-bit unorm RGBA. + * `bgra` - The texture format is 8-bit unorm BGRA. + * `rgbaf16` - The texture format is 16-bit float RGBA. * `codedSize` [Size](size.md) - The full dimensions of the video frame. * `colorSpace` [ColorSpace](color-space.md) - The color space of the video frame. * `visibleRect` [Rectangle](rectangle.md) - A subsection of [0, 0, codedSize.width, codedSize.height]. In OSR case, it is expected to have the full section area. diff --git a/docs/api/structures/web-preferences.md b/docs/api/structures/web-preferences.md index 26ead57c2329f..b0ca4cc1090c6 100644 --- a/docs/api/structures/web-preferences.md +++ b/docs/api/structures/web-preferences.md @@ -87,6 +87,11 @@ paint event. Defaults to `false`. See the [offscreen rendering tutorial](../../tutorial/offscreen-rendering.md) for more details. + * `sharedTexturePixelFormat` string (optional) _Experimental_ - The requested output format of the shared texture. Defaults to `argb`. + The name is originated from Chromium [`media::VideoPixelFormat`](https://source.chromium.org/chromium/chromium/src/+/main:media/base/video_types.h) enum suffix and only subset of them are supported. + The actual output pixel format and color space of the texture should refer to [`OffscreenSharedTexture`](../structures/offscreen-shared-texture.md) object in the `paint` event. + * `argb` - The requested output texture format is 8-bit unorm RGBA, with SRGB SDR color space. + * `rgbaf16` - The requested output texture format is 16-bit float RGBA, with scRGB HDR color space. * `contextIsolation` boolean (optional) - Whether to run Electron APIs and the specified `preload` script in a separate JavaScript context. Defaults to `true`. The context that the `preload` script runs in will only have diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 4385a3f75e64f..badb2b32cbcc6 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -814,6 +814,8 @@ WebContents::WebContents(v8::Isolate* isolate, options.Get(options::kOffscreen, &use_offscreen_dict); use_offscreen_dict.Get(options::kUseSharedTexture, &offscreen_use_shared_texture_); + use_offscreen_dict.Get(options::kSharedTexturePixelFormat, + &offscreen_shared_texture_pixel_format_); } } @@ -851,6 +853,7 @@ WebContents::WebContents(v8::Isolate* isolate, if (embedder_ && embedder_->IsOffScreen()) { auto* view = new OffScreenWebContentsView( false, offscreen_use_shared_texture_, + offscreen_shared_texture_pixel_format_, base::BindRepeating(&WebContents::OnPaint, base::Unretained(this))); params.view = view; params.delegate_view = view; @@ -872,6 +875,7 @@ WebContents::WebContents(v8::Isolate* isolate, content::WebContents::CreateParams params(session->browser_context()); auto* view = new OffScreenWebContentsView( transparent, offscreen_use_shared_texture_, + offscreen_shared_texture_pixel_format_, base::BindRepeating(&WebContents::OnPaint, base::Unretained(this))); params.view = view; params.delegate_view = view; @@ -1229,6 +1233,7 @@ void WebContents::MaybeOverrideCreateParamsForNewWindow( if (is_offscreen) { auto* view = new OffScreenWebContentsView( false, offscreen_use_shared_texture_, + offscreen_shared_texture_pixel_format_, base::BindRepeating(&WebContents::OnPaint, base::Unretained(this))); create_params->view = view; create_params->delegate_view = view; diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h index 084fd3e0f1e6f..ae22cbbf29708 100644 --- a/shell/browser/api/electron_api_web_contents.h +++ b/shell/browser/api/electron_api_web_contents.h @@ -817,6 +817,7 @@ class WebContents final : public ExclusiveAccessContext, // Whether offscreen rendering use gpu shared texture bool offscreen_use_shared_texture_ = false; + std::string offscreen_shared_texture_pixel_format_ = "argb"; // Whether window is fullscreened by HTML5 api. bool html_fullscreen_ = false; diff --git a/shell/browser/osr/osr_render_widget_host_view.cc b/shell/browser/osr/osr_render_widget_host_view.cc index 81e4606e3fb82..48a1b1ed58cef 100644 --- a/shell/browser/osr/osr_render_widget_host_view.cc +++ b/shell/browser/osr/osr_render_widget_host_view.cc @@ -154,6 +154,7 @@ class ElectronDelegatedFrameHostClient OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView( bool transparent, bool offscreen_use_shared_texture, + const std::string& offscreen_shared_texture_pixel_format, bool painting, int frame_rate, const OnPaintCallback& callback, @@ -165,6 +166,8 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView( parent_host_view_(parent_host_view), transparent_(transparent), offscreen_use_shared_texture_(offscreen_use_shared_texture), + offscreen_shared_texture_pixel_format_( + offscreen_shared_texture_pixel_format), callback_(callback), frame_rate_(frame_rate), size_(initial_size), @@ -548,7 +551,8 @@ OffScreenRenderWidgetHostView::CreateViewForWidget( } return new OffScreenRenderWidgetHostView( - transparent_, offscreen_use_shared_texture_, true, + transparent_, offscreen_use_shared_texture_, + offscreen_shared_texture_pixel_format_, true, embedder_host_view->frame_rate(), callback_, render_widget_host, embedder_host_view, size()); } diff --git a/shell/browser/osr/osr_render_widget_host_view.h b/shell/browser/osr/osr_render_widget_host_view.h index 2e7738fe2faf4..92433ffa209cb 100644 --- a/shell/browser/osr/osr_render_widget_host_view.h +++ b/shell/browser/osr/osr_render_widget_host_view.h @@ -69,14 +69,16 @@ class OffScreenRenderWidgetHostView public ui::CompositorDelegate, private OffscreenViewProxyObserver { public: - OffScreenRenderWidgetHostView(bool transparent, - bool offscreen_use_shared_texture, - bool painting, - int frame_rate, - const OnPaintCallback& callback, - content::RenderWidgetHost* render_widget_host, - OffScreenRenderWidgetHostView* parent_host_view, - gfx::Size initial_size); + OffScreenRenderWidgetHostView( + bool transparent, + bool offscreen_use_shared_texture, + const std::string& offscreen_shared_texture_pixel_format, + bool painting, + int frame_rate, + const OnPaintCallback& callback, + content::RenderWidgetHost* render_widget_host, + OffScreenRenderWidgetHostView* parent_host_view, + gfx::Size initial_size); ~OffScreenRenderWidgetHostView() override; // disable copy @@ -238,6 +240,10 @@ class OffScreenRenderWidgetHostView return offscreen_use_shared_texture_; } + const std::string offscreen_shared_texture_pixel_format() const { + return offscreen_shared_texture_pixel_format_; + } + ui::Layer* root_layer() const { return root_layer_.get(); } content::DelegatedFrameHost* delegated_frame_host() const { @@ -283,6 +289,7 @@ class OffScreenRenderWidgetHostView const bool transparent_; const bool offscreen_use_shared_texture_; + const std::string offscreen_shared_texture_pixel_format_; OnPaintCallback callback_; OnPopupPaintCallback parent_callback_; diff --git a/shell/browser/osr/osr_video_consumer.cc b/shell/browser/osr/osr_video_consumer.cc index ac00b63a817e5..caedef4d2594a 100644 --- a/shell/browser/osr/osr_video_consumer.cc +++ b/shell/browser/osr/osr_video_consumer.cc @@ -16,6 +16,22 @@ #include "third_party/skia/include/core/SkRegion.h" #include "ui/gfx/skbitmap_operations.h" +namespace { + +media::VideoPixelFormat GetTargetPixelFormatFromOption( + const std::string& pixel_format_option) { + if (pixel_format_option == "argb") { + return media::PIXEL_FORMAT_ARGB; + } else if (pixel_format_option == "rgbaf16") { + return media::PIXEL_FORMAT_RGBAF16; + } + + // Use ARGB as default. + return media::PIXEL_FORMAT_ARGB; +} + +} // namespace + namespace electron { OffScreenVideoConsumer::OffScreenVideoConsumer( @@ -26,7 +42,10 @@ OffScreenVideoConsumer::OffScreenVideoConsumer( video_capturer_(view->CreateVideoCapturer()) { video_capturer_->SetAutoThrottlingEnabled(false); video_capturer_->SetMinSizeChangePeriod(base::TimeDelta()); - video_capturer_->SetFormat(media::PIXEL_FORMAT_ARGB); + + auto format = GetTargetPixelFormatFromOption( + view->offscreen_shared_texture_pixel_format()); + video_capturer_->SetFormat(format); // https://crrev.org/c/6438681 // Disable capturer's animation lock-in feature for offscreen capture to diff --git a/shell/browser/osr/osr_web_contents_view.cc b/shell/browser/osr/osr_web_contents_view.cc index 3606e2754ce74..99991fee12cef 100644 --- a/shell/browser/osr/osr_web_contents_view.cc +++ b/shell/browser/osr/osr_web_contents_view.cc @@ -16,9 +16,12 @@ namespace electron { OffScreenWebContentsView::OffScreenWebContentsView( bool transparent, bool offscreen_use_shared_texture, + const std::string& offscreen_shared_texture_pixel_format, const OnPaintCallback& callback) : transparent_(transparent), offscreen_use_shared_texture_(offscreen_use_shared_texture), + offscreen_shared_texture_pixel_format_( + offscreen_shared_texture_pixel_format), callback_(callback) { #if BUILDFLAG(IS_MAC) PlatformCreate(); @@ -112,7 +115,8 @@ OffScreenWebContentsView::CreateViewForWidget( return static_cast<content::RenderWidgetHostViewBase*>(rwhv); return new OffScreenRenderWidgetHostView( - transparent_, offscreen_use_shared_texture_, painting_, GetFrameRate(), + transparent_, offscreen_use_shared_texture_, + offscreen_shared_texture_pixel_format_, painting_, GetFrameRate(), callback_, render_widget_host, nullptr, GetSize()); } @@ -132,7 +136,8 @@ OffScreenWebContentsView::CreateViewForChildWidget( } return new OffScreenRenderWidgetHostView( - transparent_, offscreen_use_shared_texture_, painting_, + transparent_, offscreen_use_shared_texture_, + offscreen_shared_texture_pixel_format_, painting_, embedder_host_view->frame_rate(), callback_, render_widget_host, embedder_host_view, GetSize()); } diff --git a/shell/browser/osr/osr_web_contents_view.h b/shell/browser/osr/osr_web_contents_view.h index 50f24b9033037..364fabff78dc8 100644 --- a/shell/browser/osr/osr_web_contents_view.h +++ b/shell/browser/osr/osr_web_contents_view.h @@ -34,9 +34,11 @@ class OffScreenWebContentsView : public content::WebContentsView, public content::RenderViewHostDelegateView, private NativeWindowObserver { public: - OffScreenWebContentsView(bool transparent, - bool offscreen_use_shared_texture, - const OnPaintCallback& callback); + OffScreenWebContentsView( + bool transparent, + bool offscreen_use_shared_texture, + const std::string& offscreen_shared_texture_pixel_format, + const OnPaintCallback& callback); ~OffScreenWebContentsView() override; void SetWebContents(content::WebContents*); @@ -109,6 +111,7 @@ class OffScreenWebContentsView : public content::WebContentsView, const bool transparent_; const bool offscreen_use_shared_texture_; + const std::string offscreen_shared_texture_pixel_format_; bool painting_ = true; int frame_rate_ = 60; OnPaintCallback callback_; diff --git a/shell/common/gin_converters/osr_converter.cc b/shell/common/gin_converters/osr_converter.cc index 0f5e6ffc0c697..82195f6a1ac79 100644 --- a/shell/common/gin_converters/osr_converter.cc +++ b/shell/common/gin_converters/osr_converter.cc @@ -28,6 +28,8 @@ std::string OsrVideoPixelFormatToString(media::VideoPixelFormat format) { return "bgra"; case media::PIXEL_FORMAT_ABGR: return "rgba"; + case media::PIXEL_FORMAT_RGBAF16: + return "rgbaf16"; default: NOTREACHED(); } diff --git a/shell/common/options_switches.h b/shell/common/options_switches.h index b07313f033ec1..7b0cb2bb969dd 100644 --- a/shell/common/options_switches.h +++ b/shell/common/options_switches.h @@ -183,6 +183,9 @@ inline constexpr std::string_view kOffscreen = "offscreen"; inline constexpr std::string_view kUseSharedTexture = "useSharedTexture"; +inline constexpr std::string_view kSharedTexturePixelFormat = + "sharedTexturePixelFormat"; + inline constexpr std::string_view kNodeIntegrationInSubFrames = "nodeIntegrationInSubFrames"; From b482f08e9ecdd5a4a64af20078fd1fd827579eb7 Mon Sep 17 00:00:00 2001 From: Robo <nilay2014@gmail.com> Date: Fri, 10 Oct 2025 18:34:09 +0900 Subject: [PATCH 120/268] fix: crash when inspector evaluates on provisional frames (#48503) --- patches/chromium/.patches | 1 + ...nt_provisional_frame_speculative_fix.patch | 116 ++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 patches/chromium/inspectorpageagent_provisional_frame_speculative_fix.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 3c2e03908670c..63f4be9b196d3 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -143,3 +143,4 @@ revert_partial_remove_unused_prehandlemouseevent.patch allow_electron_to_depend_on_components_os_crypt_sync.patch disable_nsautofillheuristiccontroller_on_macos_26.patch expose_referrerscriptinfo_hostdefinedoptionsindex.patch +inspectorpageagent_provisional_frame_speculative_fix.patch diff --git a/patches/chromium/inspectorpageagent_provisional_frame_speculative_fix.patch b/patches/chromium/inspectorpageagent_provisional_frame_speculative_fix.patch new file mode 100644 index 0000000000000..aaa26e9b1ee5a --- /dev/null +++ b/patches/chromium/inspectorpageagent_provisional_frame_speculative_fix.patch @@ -0,0 +1,116 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Joey Arhar <jarhar@chromium.org> +Date: Wed, 1 Oct 2025 02:03:37 -0700 +Subject: InspectorPageAgent provisional frame speculative fix + +According to crash reports, addScriptToEvaluateOnNewDocument is running +on provisional frames. + +Fixed: 390710982 +Change-Id: I5cecf63c9517d0b28fff40361c607b0aa54e68cf +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6216479 +Reviewed-by: Alex Rudenko <alexrudenko@chromium.org> +Commit-Queue: Alex Rudenko <alexrudenko@chromium.org> +Auto-Submit: Joey Arhar <jarhar@chromium.org> +Cr-Commit-Position: refs/heads/main@{#1523418} + +diff --git a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc +index 386df6dc728e5a1b1aac9865c1687db03f48d9ee..77bcd0f9f8155d1c9ddc167f594791abf48fcfb9 100644 +--- a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc ++++ b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc +@@ -603,7 +603,11 @@ protocol::Response InspectorPageAgent::addScriptToEvaluateOnNewDocument( + // Runtime.enable that forces main context creation. In this case, we would + // not normally evaluate the script, but we should. + for (LocalFrame* frame : *inspected_frames_) { +- EvaluateScriptOnNewDocument(*frame, *identifier); ++ // Don't evaluate scripts on provisional frames: ++ // https://crbug.com/390710982 ++ if (!frame->IsProvisional()) { ++ EvaluateScriptOnNewDocument(*frame, *identifier); ++ } + } + } + +diff --git a/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials b/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials +index 8df5aa4252464bd4bf06d04b1b4f100453954082..a58b683bd7f2bea8b059f096b48e61d9cd9302d7 100644 +--- a/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials ++++ b/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials +@@ -63,6 +63,7 @@ http/tests/inspector-protocol/target/target-filter.js [ Skip ] + virtual/fenced-frame-mparch/http/tests/inspector-protocol/fenced-frame/fenced-frame-in-oopif-auto-attach.js [ Skip ] + http/tests/inspector-protocol/target/target-info-changed-auto-attach.js [ Skip ] + http/tests/inspector-protocol/page/frame-detached-oopif.js [ Skip ] ++http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload.js [ Skip ] + + # Rely on OOPIF for an iframe to be a separate devtools target + http/tests/inspector-protocol/timeline/auction-worklet-frame.js [ Skip ] +diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload-expected.txt +new file mode 100644 +index 0000000000000000000000000000000000000000..0131df6c227e1803741e654d42b15f589275061a +--- /dev/null ++++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload-expected.txt +@@ -0,0 +1,28 @@ ++Tests that Page.addScriptToEvaluateOnNewDocument on auto-attach with runImmediately=true. ++Regression test for crbug.com/390710982. ++console called: { ++ method : Runtime.consoleAPICalled ++ params : { ++ args : [ ++ [0] : { ++ type : string ++ value : evaluated ++ } ++ ] ++ executionContextId : <number> ++ stackTrace : { ++ callFrames : [ ++ [0] : { ++ columnNumber : 8 ++ functionName : ++ lineNumber : 0 ++ scriptId : <string> ++ url : ++ } ++ ] ++ } ++ timestamp : <number> ++ type : log ++ } ++ sessionId : <string> ++} +diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload.js b/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload.js +new file mode 100644 +index 0000000000000000000000000000000000000000..52ebe845c323c6d692147052f3458777dcd7f966 +--- /dev/null ++++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload.js +@@ -0,0 +1,31 @@ ++(async function(/** @type {import('test_runner').TestRunner} */ testRunner) { ++ const { session, dp } = await testRunner.startBlank( ++ `Tests that Page.addScriptToEvaluateOnNewDocument on auto-attach with runImmediately=true. ++Regression test for crbug.com/390710982.`); ++ ++ await dp.Page.enable(); ++ await dp.Target.enable(); ++ await dp.Target.setAutoAttach({ flatten: true, autoAttach: true, waitForDebuggerOnStart: true }); ++ ++ dp.Target.onAttachedToTarget(async event => { ++ const dp2 = session.createChild(event.params.sessionId).protocol; ++ dp2.Page.enable(); ++ dp2.Runtime.enable(); ++ dp2.Runtime.onConsoleAPICalled(event => { ++ testRunner.log(event, 'console called: '); ++ }); ++ dp2.Page.addScriptToEvaluateOnNewDocument({ ++ source: 'console.log("evaluated")', ++ runImmediately: true, ++ }); ++ await dp2.Runtime.runIfWaitingForDebugger(); ++ }); ++ ++ const loaded = dp.Page.onceLoadEventFired(); ++ await dp.Page.navigate({ ++ url: testRunner.url('resources/iframe-src.html') ++ }); ++ await loaded; ++ ++ testRunner.completeTest(); ++}); From 8e7d3c190d9e95f22e1df1fde8fb4b811b3aa79a Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Fri, 10 Oct 2025 12:48:44 +0200 Subject: [PATCH 121/268] fix: unexpected `openExternal` dialog on macOS Tahoe (#48502) fix: unexpected openExternal dialog on macOS Tahoe --- shell/common/platform_util_mac.mm | 6 ++++++ spec/api-shell-spec.ts | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/shell/common/platform_util_mac.mm b/shell/common/platform_util_mac.mm index 001d17b3fff94..153334f7f1d24 100644 --- a/shell/common/platform_util_mac.mm +++ b/shell/common/platform_util_mac.mm @@ -148,6 +148,12 @@ void OpenExternal(const GURL& url, return; } + // Check this to prevent system dialog from popping up on macOS Tahoe. + if (![[NSWorkspace sharedWorkspace] URLForApplicationToOpenURL:ns_url]) { + std::move(callback).Run("No application found to open URL"); + return; + } + NSWorkspaceOpenConfiguration* configuration = [NSWorkspaceOpenConfiguration configuration]; configuration.activates = options.activate; diff --git a/spec/api-shell-spec.ts b/spec/api-shell-spec.ts index 643c780ed4ac1..eef14040b028d 100644 --- a/spec/api-shell-spec.ts +++ b/spec/api-shell-spec.ts @@ -82,6 +82,11 @@ describe('shell module', () => { ]); }); + ifit(process.platform === 'darwin')('throws when there is no application registered to open the URL', async () => { + const url = `unknownscheme-${Date.now()}://test`; + await expect(shell.openExternal(url)).to.eventually.be.rejectedWith(/No application found to open URL/); + }); + it('opens an external link in the renderer', async () => { const { url, requestReceived } = await urlOpened(); const w = new BrowserWindow({ show: false, webPreferences: { sandbox: false, contextIsolation: false, nodeIntegration: true } }); From 63d14388069ecf9cada7389fa5a1351c0b1dc48e Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Fri, 10 Oct 2025 15:39:23 +0200 Subject: [PATCH 122/268] fix: `dialog.showMessageBox` defaultid on Windows (#48216) * fix: dialog.showMessageBox defaultid on Windows * Update shell/browser/ui/message_box_win.cc Co-authored-by: Robo <hop2deep@gmail.com> --------- Co-authored-by: Robo <hop2deep@gmail.com> --- shell/browser/ui/message_box_win.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/shell/browser/ui/message_box_win.cc b/shell/browser/ui/message_box_win.cc index 9ba64cb3f9a23..88775b0446fa8 100644 --- a/shell/browser/ui/message_box_win.cc +++ b/shell/browser/ui/message_box_win.cc @@ -163,8 +163,19 @@ DialogResult ShowTaskDialogWstr(gfx::AcceleratedWidget parent, config.dwFlags |= TDF_POSITION_RELATIVE_TO_WINDOW; } - if (default_id > 0) - config.nDefaultButton = kIDStart + default_id; + if (default_id >= 0 && + base::checked_cast<size_t>(default_id) < buttons.size()) { + if (!no_link) { + auto common = GetCommonID(buttons[default_id]); + if (common.button != -1) { + config.nDefaultButton = common.id; + } else { + config.nDefaultButton = kIDStart + default_id; + } + } else { + config.nDefaultButton = kIDStart + default_id; + } + } // TaskDialogIndirect doesn't allow empty name, if we set empty title it // will show "electron.exe" in title. From be63f37c06c5744a83a6d512996460771c6ee28e Mon Sep 17 00:00:00 2001 From: Niklas Wenzel <nilay2014@gmail.com> Date: Fri, 10 Oct 2025 11:43:29 -0400 Subject: [PATCH 123/268] docs: update Azure Trusted Signing availability (#48494) * docs: update Azure Trusted Signing availability Source: https://github.com/Azure/trusted-signing-action/issues/93#issuecomment-3383517386 * docs: remove unused link --- docs/tutorial/code-signing.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/tutorial/code-signing.md b/docs/tutorial/code-signing.md index d0eff31e5fe38..a51db39acf243 100644 --- a/docs/tutorial/code-signing.md +++ b/docs/tutorial/code-signing.md @@ -233,10 +233,10 @@ can find [its documentation here](https://www.electron.build/code-signing). [Azure Trusted Signing][] is Microsoft's modern cloud-based alternative to EV certificates. It is the cheapest option for code signing on Windows, and it gets rid of SmartScreen warnings. -As of May 2025, Azure Trusted Signing is [available][trusted-signing-availability] to US and -Canada-based organizations with 3+ years of verifiable business history. Microsoft is looking -to make the program more widely available. If you're reading this at a later point, it could -make sense to check if the eligibility criteria have changed. +As of October 2025, Azure Trusted Signing is available to US and Canada-based organizations +with 3+ years of verifiable business history and to individual developers in the US and Canada. +Microsoft is looking to make the program more widely available. If you're reading this at a +later point, it could make sense to check if the eligibility criteria have changed. #### Using Electron Forge @@ -267,6 +267,5 @@ See the [Windows Store Guide][]. [maker-squirrel]: https://www.electronforge.io/config/makers/squirrel.windows [maker-msi]: https://www.electronforge.io/config/makers/wix-msi [azure trusted signing]: https://azure.microsoft.com/en-us/products/trusted-signing -[trusted-signing-availability]: https://techcommunity.microsoft.com/blog/microsoft-security-blog/trusted-signing-public-preview-update/4399713 [forge-trusted-signing]: https://www.electronforge.io/guides/code-signing/code-signing-windows#using-azure-trusted-signing [builder-trusted-signing]: https://www.electron.build/code-signing-win#using-azure-trusted-signing-beta From 348cd96cab7035700138dd8b64deb30521d39a0e Mon Sep 17 00:00:00 2001 From: Erick Zhao <nilay2014@gmail.com> Date: Fri, 10 Oct 2025 12:56:48 -0700 Subject: [PATCH 124/268] docs: unmark asar integrity as experimental and clean docs (#48434) --- docs/glossary.md | 9 +++ docs/tutorial/asar-integrity.md | 4 +- docs/tutorial/fuses.md | 113 ++++++++++++++++++++++++-------- docs/tutorial/security.md | 6 +- 4 files changed, 100 insertions(+), 32 deletions(-) diff --git a/docs/glossary.md b/docs/glossary.md index b917ed0d7b609..5ce09d8c5a1eb 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -12,6 +12,15 @@ The ASAR format was created primarily to improve performance on Windows when reading large quantities of small files (e.g. when loading your app's JavaScript dependency tree from `node_modules`). +### ASAR integrity + +ASAR integrity is an security feature that validates the contents of your app's +ASAR archives at runtime. When enabled, your Electron app will verify the +header hash of its ASAR archive on runtime. If no hash is present or if there is a mismatch in the +hashes, the app will forcefully terminate. + +See the [ASAR Integrity](./tutorial/asar-integrity.md) guide for more details. + ### code signing Code signing is a process where an app developer digitally signs their code to diff --git a/docs/tutorial/asar-integrity.md b/docs/tutorial/asar-integrity.md index 38903628d8d42..f1067eea9ee42 100644 --- a/docs/tutorial/asar-integrity.md +++ b/docs/tutorial/asar-integrity.md @@ -5,7 +5,7 @@ slug: asar-integrity hide_title: false --- -ASAR integrity is an experimental feature that validates the contents of your app's +ASAR integrity is a security feature that validates the contents of your app's [ASAR archives](./asar-archives.md) at runtime. ## Version support @@ -77,7 +77,7 @@ on package time. The process of providing this packaged hash is different for ma ### Using Electron tooling Electron Forge and Electron Packager do this setup automatically for you with no additional -configuration. The minimum required versions for ASAR integrity are: +configuration whenever `asar` is enabled. The minimum required versions for ASAR integrity are: * `@electron/packager@18.3.1` * `@electron/forge@7.4.0` diff --git a/docs/tutorial/fuses.md b/docs/tutorial/fuses.md index c810d1af2a660..f5dc6a6ee4012 100644 --- a/docs/tutorial/fuses.md +++ b/docs/tutorial/fuses.md @@ -4,11 +4,24 @@ ## What are fuses? -For a subset of Electron functionality it makes sense to disable certain features for an entire application. For example, 99% of apps don't make use of `ELECTRON_RUN_AS_NODE`, these applications want to be able to ship a binary that is incapable of using that feature. We also don't want Electron consumers building Electron from source as that is both a massive technical challenge and has a high cost of both time and money. +From a security perspective, it makes sense to disable certain unused Electron features +that are powerful but may make your app's security posture weaker. For example, any app that doesn't +use the `ELECTRON_RUN_AS_NODE` environment variable would want to disable the feature to prevent a +subset of "living off the land" attacks. -Fuses are the solution to this problem, at a high level they are "magic bits" in the Electron binary that can be flipped when packaging your Electron app to enable / disable certain features / restrictions. Because they are flipped at package time before you code sign your app the OS becomes responsible for ensuring those bits aren't flipped back via OS level code signing validation (Gatekeeper / App Locker). +We also don't want Electron consumers forking to achieve this goal, as building from source and +maintaining a fork is a massive technical challenge and costs a lot of time and money. -## Current Fuses +Fuses are the solution to this problem. At a high level, they are "magic bits" in the Electron binary +that can be flipped when packaging your Electron app to enable or disable certain features/restrictions. + +Because they are flipped at package time before you code sign your app, the OS becomes responsible +for ensuring those bits aren't flipped back via OS-level code signing validation +(e.g. [Gatekeeper](https://support.apple.com/en-ca/guide/security/sec5599b66df/web) on macOS or +[AppLocker](https://learn.microsoft.com/en-us/windows/security/application-security/application-control/app-control-for-business/applocker/applocker-overview) +on Windows). + +## Current fuses ### `runAsNode` @@ -16,7 +29,11 @@ Fuses are the solution to this problem, at a high level they are "magic bits" in **@electron/fuses:** `FuseV1Options.RunAsNode` -The runAsNode fuse toggles whether the `ELECTRON_RUN_AS_NODE` environment variable is respected or not. Please note that if this fuse is disabled then `process.fork` in the main process will not function as expected as it depends on this environment variable to function. Instead, we recommend that you use [Utility Processes](../api/utility-process.md), which work for many use cases where you need a standalone Node.js process (like a Sqlite server process or similar scenarios). +The `runAsNode` fuse toggles whether the [`ELECTRON_RUN_AS_NODE`](../api/environment-variables.md) +environment variable is respected or not. With this fuse disabled, [`child_process.fork`](https://nodejs.org/api/child_process.html#child_processforkmodulepath-args-options) in the main process will not function +as expected, as it depends on this environment variable to function. Instead, we recommend that you +use [Utility Processes](../api/utility-process.md), which work for many use cases where you need a +standalone Node.js process (e.g. a SQLite server process). ### `cookieEncryption` @@ -24,7 +41,12 @@ The runAsNode fuse toggles whether the `ELECTRON_RUN_AS_NODE` environment variab **@electron/fuses:** `FuseV1Options.EnableCookieEncryption` -The cookieEncryption fuse toggles whether the cookie store on disk is encrypted using OS level cryptography keys. By default the sqlite database that Chromium uses to store cookies stores the values in plaintext. If you wish to ensure your apps cookies are encrypted in the same way Chrome does then you should enable this fuse. Please note it is a one-way transition, if you enable this fuse existing unencrypted cookies will be encrypted-on-write but if you then disable the fuse again your cookie store will effectively be corrupt and useless. Most apps can safely enable this fuse. +The `cookieEncryption` fuse toggles whether the cookie store on disk is encrypted using OS level +cryptography keys. By default, the SQLite database that Chromium uses to store cookies stores the +values in plaintext. If you wish to ensure your app's cookies are encrypted in the same way Chrome +does, then you should enable this fuse. Please note it is a one-way transition—if you enable this +fuse, existing unencrypted cookies will be encrypted-on-write, but subsequently disabling the fuse +later will make your cookie store corrupt and useless. Most apps can safely enable this fuse. ### `nodeOptions` @@ -32,7 +54,11 @@ The cookieEncryption fuse toggles whether the cookie store on disk is encrypted **@electron/fuses:** `FuseV1Options.EnableNodeOptionsEnvironmentVariable` -The nodeOptions fuse toggles whether the [`NODE_OPTIONS`](https://nodejs.org/api/cli.html#node_optionsoptions) and [`NODE_EXTRA_CA_CERTS`](https://github.com/nodejs/node/blob/main/doc/api/cli.md#node_extra_ca_certsfile) environment variables are respected. The `NODE_OPTIONS` environment variable can be used to pass all kinds of custom options to the Node.js runtime and isn't typically used by apps in production. Most apps can safely disable this fuse. +The `nodeOptions` fuse toggles whether the [`NODE_OPTIONS`](https://nodejs.org/api/cli.html#node_optionsoptions) +and [`NODE_EXTRA_CA_CERTS`](https://github.com/nodejs/node/blob/main/doc/api/cli.md#node_extra_ca_certsfile) +environment variables are respected. The `NODE_OPTIONS` environment variable can be used to pass all +kinds of custom options to the Node.js runtime and isn't typically used by apps in production. +Most apps can safely disable this fuse. ### `nodeCliInspect` @@ -40,7 +66,9 @@ The nodeOptions fuse toggles whether the [`NODE_OPTIONS`](https://nodejs.org/api **@electron/fuses:** `FuseV1Options.EnableNodeCliInspectArguments` -The nodeCliInspect fuse toggles whether the `--inspect`, `--inspect-brk`, etc. flags are respected or not. When disabled it also ensures that `SIGUSR1` signal does not initialize the main process inspector. Most apps can safely disable this fuse. +The `nodeCliInspect` fuse toggles whether the `--inspect`, `--inspect-brk`, etc. flags are respected +or not. When disabled, it also ensures that `SIGUSR1` signal does not initialize the main process +inspector. Most apps can safely disable this fuse. ### `embeddedAsarIntegrityValidation` @@ -48,9 +76,12 @@ The nodeCliInspect fuse toggles whether the `--inspect`, `--inspect-brk`, etc. f **@electron/fuses:** `FuseV1Options.EnableEmbeddedAsarIntegrityValidation` -The embeddedAsarIntegrityValidation fuse toggles an experimental feature on macOS and Windows that validates the content of the `app.asar` file when it is loaded. This feature is designed to have a minimal performance impact but may marginally slow down file reads from inside the `app.asar` archive. +The `embeddedAsarIntegrityValidation` fuse toggles a feature on macOS and Windows that validates the +content of the `app.asar` file when it is loaded. This feature is designed to have a minimal +performance impact but may marginally slow down file reads from inside the `app.asar` archive. +Most apps can safely enable this fuse. -For more information on how to use asar integrity validation please read the [Asar Integrity](asar-integrity.md) documentation. +For more information on how to use ASAR integrity validation, please read the [Asar Integrity](asar-integrity.md) documentation. ### `onlyLoadAppFromAsar` @@ -58,7 +89,15 @@ For more information on how to use asar integrity validation please read the [As **@electron/fuses:** `FuseV1Options.OnlyLoadAppFromAsar` -The onlyLoadAppFromAsar fuse changes the search system that Electron uses to locate your app code. By default Electron will search in the following order `app.asar` -> `app` -> `default_app.asar`. When this fuse is enabled the search order becomes a single entry `app.asar` thus ensuring that when combined with the `embeddedAsarIntegrityValidation` fuse it is impossible to load non-validated code. +The `onlyLoadAppFromAsar` fuse changes the search system that Electron uses to locate your app code. +By default, Electron will search for this code in the following order: + +1. `app.asar` +1. `app` +1. `default_app.asar` + +When this fuse is enabled, Electron will _only_ search for `app.asar`. When combined with the [`embeddedAsarIntegrityValidation`](#embeddedasarintegrityvalidation) fuse, this fuse ensures that +it is impossible to load non-validated code. ### `loadBrowserProcessSpecificV8Snapshot` @@ -66,11 +105,17 @@ The onlyLoadAppFromAsar fuse changes the search system that Electron uses to loc **@electron/fuses:** `FuseV1Options.LoadBrowserProcessSpecificV8Snapshot` -The loadBrowserProcessSpecificV8Snapshot fuse changes which V8 snapshot file is used for the browser process. By default Electron's processes will all use the same V8 snapshot file. When this fuse is enabled the browser process uses the file called `browser_v8_context_snapshot.bin` for its V8 snapshot. The other processes will use the V8 snapshot file that they normally do. +V8 snapshots can be useful to improve app startup performance. V8 lets you take snapshots of +initialized heaps and then load them back in to avoid the cost of initializing the heap. -V8 snapshots can be useful to improve app startup performance. V8 lets you take snapshots of initialized heaps and then load them back in to avoid the cost of initializing the heap. +The `loadBrowserProcessSpecificV8Snapshot` fuse changes which V8 snapshot file is used for the browser +process. By default, Electron's processes will all use the same V8 snapshot file. When this fuse is +enabled, the main process uses the file called `browser_v8_context_snapshot.bin` for its V8 snapshot. +Other processes will use the V8 snapshot file that they normally do. -Using separate snapshots for renderer processes and the main process can improve security, especially to make sure that the renderer doesn't use a snapshot with `nodeIntegration` enabled. See [#35170](https://github.com/electron/electron/issues/35170) for details. +Using separate snapshots for renderer processes and the main process can improve security, especially +to make sure that the renderer doesn't use a snapshot with `nodeIntegration` enabled. +See [electron/electron#35170](https://github.com/electron/electron/issues/35170) for details. ### `grantFileProtocolExtraPrivileges` @@ -78,19 +123,25 @@ Using separate snapshots for renderer processes and the main process can improve **@electron/fuses:** `FuseV1Options.GrantFileProtocolExtraPrivileges` -The grantFileProtocolExtraPrivileges fuse changes whether pages loaded from the `file://` protocol are given privileges beyond what they would receive in a traditional web browser. This behavior was core to Electron apps in original versions of Electron but is no longer required as apps should be [serving local files from custom protocols](./security.md#18-avoid-usage-of-the-file-protocol-and-prefer-usage-of-custom-protocols) now instead. If you aren't serving pages from `file://` you should disable this fuse. +The `grantFileProtocolExtraPrivileges` fuse changes whether pages loaded from the `file://` protocol +are given privileges beyond what they would receive in a traditional web browser. This behavior was +core to Electron apps in original versions of Electron, but is no longer required as apps should be +[serving local files from custom protocols](./security.md#18-avoid-usage-of-the-file-protocol-and-prefer-usage-of-custom-protocols) now instead. + +If you aren't serving pages from `file://`, you should disable this fuse. The extra privileges granted to the `file://` protocol by this fuse are incompletely documented below: * `file://` protocol pages can use `fetch` to load other assets over `file://` * `file://` protocol pages can use service workers -* `file://` protocol pages have universal access granted to child frames also running on `file://` protocols regardless of sandbox settings +* `file://` protocol pages have universal access granted to child frames also running on `file://` + protocols regardless of sandbox settings -## How do I flip the fuses? +## How do I flip fuses? ### The easy way -We've made a handy module, [`@electron/fuses`](https://npmjs.com/package/@electron/fuses), to make flipping these fuses easy. Check out the README of that module for more details on usage and potential error cases. +[`@electron/fuses`](https://npmjs.com/package/@electron/fuses) is a JavaScript utility designed to make flipping these fuses easy. Check out the README of that module for more details on usage and potential error cases. ```js @ts-nocheck const { flipFuses, FuseVersion, FuseV1Options } = require('@electron/fuses') @@ -106,29 +157,37 @@ flipFuses( ) ``` -You can validate the fuses have been flipped or check the fuse status of an arbitrary Electron app using the fuses CLI. +You can validate the fuses that have been flipped or check the fuse status of an arbitrary Electron +app using the `@electron/fuses` CLI. ```bash npx @electron/fuses read --app /Applications/Foo.app ``` -### The hard way +>[!NOTE] +> If you are using Electron Forge to distribute your application, you can flip fuses using +> [`@electron-forge/plugin-fuses`](https://www.electronforge.io/config/plugins/fuses), +> which comes pre-installed with all templates. -#### Quick Glossary +### The hard way -* **Fuse Wire**: A sequence of bytes in the Electron binary used to control the fuses -* **Sentinel**: A static known sequence of bytes you can use to locate the fuse wire -* **Fuse Schema**: The format / allowed values for the fuse wire +> [!IMPORTANT] +> Glossary: +> +> * **Fuse Wire**: A sequence of bytes in the Electron binary used to control the fuses +> * **Sentinel**: A static known sequence of bytes you can use to locate the fuse wire +> * **Fuse Schema**: The format/allowed values for the fuse wire -Manually flipping fuses requires editing the Electron binary and modifying the fuse wire to be the sequence of bytes that represent the state of the fuses you want. +Manually flipping fuses requires editing the Electron binary and modifying the fuse wire to be the +sequence of bytes that represent the state of the fuses you want. -Somewhere in the Electron binary there will be a sequence of bytes that look like this: +Somewhere in the Electron binary, there will be a sequence of bytes that look like this: ```text | ...binary | sentinel_bytes | fuse_version | fuse_wire_length | fuse_wire | ...binary | ``` -* `sentinel_bytes` is always this exact string `dL7pKGdnNz796PbbjQWNKmHXBZaB9tsX` +* `sentinel_bytes` is always this exact string: `dL7pKGdnNz796PbbjQWNKmHXBZaB9tsX` * `fuse_version` is a single byte whose unsigned integer value represents the version of the fuse schema * `fuse_wire_length` is a single byte whose unsigned integer value represents the number of fuses in the following fuse wire * `fuse_wire` is a sequence of N bytes, each byte represents a single fuse and its state. @@ -136,6 +195,6 @@ Somewhere in the Electron binary there will be a sequence of bytes that look lik * "1" (0x31) indicates the fuse is enabled * "r" (0x72) indicates the fuse has been removed and changing the byte to either 1 or 0 will have no effect. -To flip a fuse you find its position in the fuse wire and change it to "0" or "1" depending on the state you'd like. +To flip a fuse, you find its position in the fuse wire and change it to "0" or "1" depending on the state you'd like. You can view the current schema [here](https://github.com/electron/electron/blob/main/build/fuses/fuses.json5). diff --git a/docs/tutorial/security.md b/docs/tutorial/security.md index 3b5c554b88dfa..f7dcd3ebe5b8b 100644 --- a/docs/tutorial/security.md +++ b/docs/tutorial/security.md @@ -98,7 +98,7 @@ either `process.env` or the `window` object. You should at least follow these steps to improve the security of your application: 1. [Only load secure content](#1-only-load-secure-content) -2. [Disable the Node.js integration in all renderers that display remote content](#2-do-not-enable-nodejs-integration-for-remote-content) +2. [Do not enable Node.js integration for remote content](#2-do-not-enable-nodejs-integration-for-remote-content) 3. [Enable context isolation in all renderers](#3-enable-context-isolation) 4. [Enable process sandboxing](#4-enable-process-sandboxing) 5. [Use `ses.setPermissionRequestHandler()` in all sessions that load remote content](#5-handle-session-permission-requests-from-remote-content) @@ -804,10 +804,10 @@ that your application might have the rights for. #### How? -We've made a module, [`@electron/fuses`](https://npmjs.com/package/@electron/fuses), to make +[`@electron/fuses`](https://npmjs.com/package/@electron/fuses) is a module we made to make flipping these fuses easy. Check out the README of that module for more details on usage and potential error cases, and refer to -[How do I flip the fuses?](./fuses.md#how-do-i-flip-the-fuses) in our documentation. +[How do I flip fuses?](./fuses.md#how-do-i-flip-fuses) in our documentation. ### 20. Do not expose Electron APIs to untrusted web content From fa0ce9ad27dfd4fc58a1805ea7b7d6f22c7f20dd Mon Sep 17 00:00:00 2001 From: David Sanders <nilay2014@gmail.com> Date: Fri, 10 Oct 2025 19:55:21 -0700 Subject: [PATCH 125/268] ci: upload build effective cache hit rate stats to Datadog (#48509) --- .github/actions/build-electron/action.yml | 7 ++ .../pipeline-segment-electron-build.yml | 2 + script/build-stats.mjs | 90 +++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 script/build-stats.mjs diff --git a/.github/actions/build-electron/action.yml b/.github/actions/build-electron/action.yml index 83b565576eecd..51b1a1b069c9d 100644 --- a/.github/actions/build-electron/action.yml +++ b/.github/actions/build-electron/action.yml @@ -63,6 +63,13 @@ runs: NINJA_SUMMARIZE_BUILD=1 e build cp out/Default/.ninja_log out/electron_ninja_log node electron/script/check-symlinks.js + + # Upload build stats to Datadog + if ! [ -z $DD_API_KEY ]; then + npx node electron/script/build-stats.mjs out/Default/siso.INFO --upload-stats || true + else + echo "Skipping build-stats.mjs upload because DD_API_KEY is not set" + fi - name: Build Electron dist.zip ${{ inputs.step-suffix }} shell: bash run: | diff --git a/.github/workflows/pipeline-segment-electron-build.yml b/.github/workflows/pipeline-segment-electron-build.yml index f0f0e767df793..154b3b73c6e31 100644 --- a/.github/workflows/pipeline-segment-electron-build.yml +++ b/.github/workflows/pipeline-segment-electron-build.yml @@ -66,6 +66,7 @@ concurrency: env: CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }} CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }} + DD_API_KEY: ${{ secrets.DD_API_KEY }} ELECTRON_ARTIFACTS_BLOB_STORAGE: ${{ secrets.ELECTRON_ARTIFACTS_BLOB_STORAGE }} ELECTRON_RBE_JWT: ${{ secrets.ELECTRON_RBE_JWT }} SUDOWOODO_EXCHANGE_URL: ${{ secrets.SUDOWOODO_EXCHANGE_URL }} @@ -84,6 +85,7 @@ jobs: environment: ${{ inputs.environment }} env: TARGET_ARCH: ${{ inputs.target-arch }} + TARGET_PLATFORM: ${{ inputs.target-platform }} steps: - name: Create src dir run: | diff --git a/script/build-stats.mjs b/script/build-stats.mjs new file mode 100644 index 0000000000000..ff09b84f4ee3b --- /dev/null +++ b/script/build-stats.mjs @@ -0,0 +1,90 @@ +import * as fs from 'node:fs/promises'; +import { fileURLToPath } from 'node:url'; +import { parseArgs } from 'node:util'; + +async function main () { + const { positionals: [filename], values: { 'upload-stats': uploadStats } } = parseArgs({ + allowPositionals: true, + options: { + 'upload-stats': { + type: 'boolean', + default: false + } + } + }); + + if (!filename) { + throw new Error('filename is required (should be a siso.INFO file)'); + } + + const log = await fs.readFile(filename, 'utf-8'); + + // We expect to find a line which looks like stats=build.Stats{..., CacheHit:39008, Local:4778, Remote:0, LocalFallback:0, ...} + const match = log.match(/stats=build\.Stats{(.*)}/); + + if (!match) { + throw new Error('could not find stats=build.Stats in log'); + } + + const stats = Object.fromEntries(match[1].split(',').map(part => { + const [key, value] = part.trim().split(':'); + return [key, parseInt(value)]; + })); + const hitRate = stats.CacheHit / (stats.Remote + stats.CacheHit + stats.LocalFallback); + + console.log(`Effective cache hit rate: ${(hitRate * 100).toFixed(2)}%`); + + if (uploadStats) { + if (!process.env.DD_API_KEY) { + throw new Error('DD_API_KEY is not set'); + } + + const timestamp = Math.round(new Date().getTime() / 1000); + + const tags = []; + + if (process.env.TARGET_ARCH) tags.push(`target-arch:${process.env.TARGET_ARCH}`); + if (process.env.TARGET_PLATFORM) tags.push(`target-platform:${process.env.TARGET_PLATFORM}`); + if (process.env.GITHUB_HEAD_REF) tags.push(`branch:${process.env.GITHUB_HEAD_REF}`); + + const series = [ + { + metric: 'electron.build.effective-cache-hit-rate', + points: [{ timestamp, value: (hitRate * 100).toFixed(2) }], + type: 3, // GAUGE + unit: 'percent', + tags + } + ]; + + // Add all raw stats as individual metrics + for (const [key, value] of Object.entries(stats)) { + series.push({ + metric: `electron.build.stats.${key.toLowerCase()}`, + points: [{ timestamp, value }], + type: 1, // COUNT + tags + }); + } + + await fetch('https://api.datadoghq.com/api/v2/series', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'DD-API-KEY': process.env.DD_API_KEY + }, + body: JSON.stringify({ series }) + }); + } +} + +if ((await fs.realpath(process.argv[1])) === fileURLToPath(import.meta.url)) { + main() + .then(() => { + process.exit(0); + }) + .catch((err) => { + console.error(`ERROR: ${err.message}`); + process.exit(1); + }); +} From 945feefed7a66e2b57b48ddaf7320cac8c30ca6a Mon Sep 17 00:00:00 2001 From: David Sanders <nilay2014@gmail.com> Date: Fri, 10 Oct 2025 22:28:09 -0700 Subject: [PATCH 126/268] ci: fix release branch name in build stats script (#48533) --- script/build-stats.mjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/script/build-stats.mjs b/script/build-stats.mjs index ff09b84f4ee3b..8079f3456bf93 100644 --- a/script/build-stats.mjs +++ b/script/build-stats.mjs @@ -45,7 +45,13 @@ async function main () { if (process.env.TARGET_ARCH) tags.push(`target-arch:${process.env.TARGET_ARCH}`); if (process.env.TARGET_PLATFORM) tags.push(`target-platform:${process.env.TARGET_PLATFORM}`); - if (process.env.GITHUB_HEAD_REF) tags.push(`branch:${process.env.GITHUB_HEAD_REF}`); + if (process.env.GITHUB_HEAD_REF) { + // Will be set in pull requests + tags.push(`branch:${process.env.GITHUB_HEAD_REF}`); + } else if (process.env.GITHUB_REF_NAME) { + // Will be set for release branches + tags.push(`branch:${process.env.GITHUB_REF_NAME}`); + } const series = [ { From 3a2ccb4036709df8ab7b923de80d95227d3f6ee5 Mon Sep 17 00:00:00 2001 From: Zuohui Yang <nilay2014@gmail.com> Date: Sun, 12 Oct 2025 06:00:04 +0800 Subject: [PATCH 127/268] fix: launch crash when null device is disabled on Windows (#47870) fix: fix launch crash when null device is disabled on Windows add node flag node::ProcessInitializationFlags::kNoStdioInitialization Co-authored-by: yangzuohui <yangzuohui@bytedance.com> Co-authored-by: yangliu <yangliu.leo@bytedance.com> --- docs/api/command-line-switches.md | 5 +++ shell/app/node_main.cc | 31 ++++++++++++++++--- .../api/electron_api_utility_process.cc | 1 + shell/browser/electron_browser_client.cc | 3 +- shell/common/node_bindings.cc | 15 +++++++++ shell/common/options_switches.h | 4 +++ shell/common/platform_util.h | 3 ++ shell/common/platform_util_win.cc | 13 ++++++++ 8 files changed, 69 insertions(+), 6 deletions(-) diff --git a/docs/api/command-line-switches.md b/docs/api/command-line-switches.md index 314b39a8e7c29..725144c1a4aad 100644 --- a/docs/api/command-line-switches.md +++ b/docs/api/command-line-switches.md @@ -193,6 +193,11 @@ Disables the Chromium [sandbox](https://www.chromium.org/developers/design-docum Forces renderer process and Chromium helper processes to run un-sandboxed. Should only be used for testing. +### --no-stdio-init + +Disable stdio initialization during node initialization. +Used to avoid node initialization crash when the nul device is disabled on Windows platform. + ### --proxy-bypass-list=`hosts` Instructs Electron to bypass the proxy server for the given semi-colon-separated diff --git a/shell/app/node_main.cc b/shell/app/node_main.cc index ddc61c0257631..7cd0a71eea8e8 100644 --- a/shell/app/node_main.cc +++ b/shell/app/node_main.cc @@ -35,6 +35,8 @@ #include "shell/common/node_bindings.h" #include "shell/common/node_includes.h" #include "shell/common/node_util.h" +#include "shell/common/options_switches.h" +#include "shell/common/platform_util.h" #if BUILDFLAG(IS_WIN) #include "chrome/child/v8_crashpad_support_win.h" @@ -153,9 +155,10 @@ int NodeMain() { v8_crashpad_support::SetUp(); #endif + auto* command_line = base::CommandLine::ForCurrentProcess(); + #if BUILDFLAG(IS_LINUX) int pid = -1; - auto* command_line = base::CommandLine::ForCurrentProcess(); std::optional<std::string> fd_string = os_env->GetVar("CRASHDUMP_SIGNAL_FD"); std::optional<std::string> pid_string = os_env->GetVar("CRASHPAD_HANDLER_PID"); @@ -189,14 +192,32 @@ int NodeMain() { NodeBindings::RegisterBuiltinBindings(); // Parse Node.js cli flags and strip out disallowed options. - const std::vector<std::string> args = ElectronCommandLine::AsUtf8(); + std::vector<std::string> args = ElectronCommandLine::AsUtf8(); ExitIfContainsDisallowedFlags(args); + uint64_t process_flags = + node::ProcessInitializationFlags::kNoInitializeV8 | + node::ProcessInitializationFlags::kNoInitializeNodeV8Platform; + + if (command_line->HasSwitch(switches::kNoStdioInit)) { + process_flags |= node::ProcessInitializationFlags::kNoStdioInitialization; + // remove the option to avoid node error "bad option: --no-stdio-init" + std::string option = std::string("--") + switches::kNoStdioInit; + std::erase(args, option); + } else { +#if BUILDFLAG(IS_WIN) + if (!platform_util::IsNulDeviceEnabled()) { + LOG(FATAL) << "Unable to open nul device needed for initialization," + "aborting startup. As a workaround, try starting with --" + << switches::kNoStdioInit; + } +#endif + } + std::shared_ptr<node::InitializationResult> result = node::InitializeOncePerProcess( - args, - {node::ProcessInitializationFlags::kNoInitializeV8, - node::ProcessInitializationFlags::kNoInitializeNodeV8Platform}); + args, static_cast<node::ProcessInitializationFlags::Flags>( + process_flags)); for (const std::string& error : result->errors()) std::cerr << args[0] << ": " << error << '\n'; diff --git a/shell/browser/api/electron_api_utility_process.cc b/shell/browser/api/electron_api_utility_process.cc index 08bd1c95d7447..2fa5bb17503a4 100644 --- a/shell/browser/api/electron_api_utility_process.cc +++ b/shell/browser/api/electron_api_utility_process.cc @@ -132,6 +132,7 @@ UtilityProcessWrapper::UtilityProcessWrapper( OPEN_EXISTING, 0, nullptr); if (handle == INVALID_HANDLE_VALUE) { PLOG(ERROR) << "Failed to create null handle"; + Emit("error", "Failed to create null handle for ignoring stdio"); return; } if (io_handle == IOHandle::STDOUT) { diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index ea0db0c3091bc..1d51f7b7ab6f1 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -549,7 +549,7 @@ void ElectronBrowserClient::AppendExtraCommandLineSwitches( if (process_type == ::switches::kUtilityProcess || process_type == ::switches::kRendererProcess) { // Copy following switches to child process. - static constexpr std::array<const char*, 9U> kCommonSwitchNames = { + static constexpr std::array<const char*, 10U> kCommonSwitchNames = { switches::kStandardSchemes.c_str(), switches::kEnableSandbox.c_str(), switches::kSecureSchemes.c_str(), @@ -558,6 +558,7 @@ void ElectronBrowserClient::AppendExtraCommandLineSwitches( switches::kFetchSchemes.c_str(), switches::kServiceWorkerSchemes.c_str(), switches::kStreamingSchemes.c_str(), + switches::kNoStdioInit.c_str(), switches::kCodeCacheSchemes.c_str()}; command_line->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(), kCommonSwitchNames); diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc index bde0c03105cb4..c0dd63583951b 100644 --- a/shell/common/node_bindings.cc +++ b/shell/common/node_bindings.cc @@ -40,6 +40,8 @@ #include "shell/common/mac/main_application_bundle.h" #include "shell/common/node_includes.h" #include "shell/common/node_util.h" +#include "shell/common/options_switches.h" +#include "shell/common/platform_util.h" #include "shell/common/process_util.h" #include "shell/common/world_ids.h" #include "third_party/blink/public/common/web_preferences/web_preferences.h" @@ -672,6 +674,19 @@ void NodeBindings::Initialize(v8::Isolate* const isolate, if (!fuses::IsNodeOptionsEnabled()) process_flags |= node::ProcessInitializationFlags::kDisableNodeOptionsEnv; + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + if (command_line->HasSwitch(switches::kNoStdioInit)) { + process_flags |= node::ProcessInitializationFlags::kNoStdioInitialization; + } else { +#if BUILDFLAG(IS_WIN) + if (!platform_util::IsNulDeviceEnabled()) { + LOG(FATAL) << "Unable to open nul device needed for initialization," + "aborting startup. As a workaround, try starting with --" + << switches::kNoStdioInit; + } +#endif + } + std::shared_ptr<node::InitializationResult> result = node::InitializeOncePerProcess( args, diff --git a/shell/common/options_switches.h b/shell/common/options_switches.h index 7b0cb2bb969dd..6cffc099c6999 100644 --- a/shell/common/options_switches.h +++ b/shell/common/options_switches.h @@ -309,6 +309,10 @@ inline constexpr base::cstring_view kDisableNTLMv2 = "disable-ntlm-v2"; inline constexpr base::cstring_view kServiceWorkerPreload = "service-worker-preload"; +// If set, flag node::ProcessInitializationFlags::kNoStdioInitialization would +// be set for node initialization. +inline constexpr base::cstring_view kNoStdioInit = "no-stdio-init"; + } // namespace switches } // namespace electron diff --git a/shell/common/platform_util.h b/shell/common/platform_util.h index c20376e5c3139..ccca2f778b4c3 100644 --- a/shell/common/platform_util.h +++ b/shell/common/platform_util.h @@ -47,6 +47,9 @@ void Beep(); #if BUILDFLAG(IS_WIN) // SHGetFolderPath calls not covered by Chromium bool GetFolderPath(int key, base::FilePath* result); + +// Check if nul device can be used. +bool IsNulDeviceEnabled(); #endif #if BUILDFLAG(IS_MAC) diff --git a/shell/common/platform_util_win.cc b/shell/common/platform_util_win.cc index a4333d7f1b4ff..b20b66db9c69d 100644 --- a/shell/common/platform_util_win.cc +++ b/shell/common/platform_util_win.cc @@ -12,6 +12,8 @@ #include <comdef.h> #include <commdlg.h> #include <dwmapi.h> +#include <fcntl.h> +#include <io.h> #include <objbase.h> #include <shellapi.h> #include <shlobj.h> @@ -450,4 +452,15 @@ void Beep() { MessageBeep(MB_OK); } +bool IsNulDeviceEnabled() { + bool ret = true; + int fd = _open("nul", _O_RDWR); + if (fd < 0) { + ret = false; + } else { + _close(fd); + } + return ret; +} + } // namespace platform_util From 26c236ad0ec934135649699c04637315209eacc6 Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Mon, 13 Oct 2025 10:13:32 +0200 Subject: [PATCH 128/268] fix: auth required websocket crash (#48510) --- shell/browser/net/proxying_websocket.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/browser/net/proxying_websocket.cc b/shell/browser/net/proxying_websocket.cc index 02ae781d0bb74..e9cfd0878762c 100644 --- a/shell/browser/net/proxying_websocket.cc +++ b/shell/browser/net/proxying_websocket.cc @@ -401,7 +401,7 @@ void ProxyingWebSocket::OnHeadersReceivedCompleteForAuth( auto continuation = base::BindRepeating( &ProxyingWebSocket::OnAuthRequiredComplete, weak_factory_.GetWeakPtr()); - auto auth_rv = AuthRequiredResponse::kIoPending; + auto auth_rv = AuthRequiredResponse::kCancelAuth; PauseIncomingMethodCallProcessing(); OnAuthRequiredComplete(auth_rv); From 02d0da4b6566e112f06f1fecf0eb63ca0421e757 Mon Sep 17 00:00:00 2001 From: Samuel Attard <nilay2014@gmail.com> Date: Mon, 13 Oct 2025 03:53:52 -0700 Subject: [PATCH 129/268] build: fail publish when upload fatal errors (#48537) We logged a fatal error but didn't exit with code 1 so the publish kept going. This was caught by a sanity check later down the release process but would have been quicker to fail out here. Also adds some code to maybe workaround the underlying auth error --- script/release/uploaders/upload-to-github.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/script/release/uploaders/upload-to-github.ts b/script/release/uploaders/upload-to-github.ts index b801ded782a7d..6be8147736f4c 100644 --- a/script/release/uploaders/upload-to-github.ts +++ b/script/release/uploaders/upload-to-github.ts @@ -48,7 +48,7 @@ const targetRepo = getRepo(); const uploadUrl = `https://uploads.github.com/repos/electron/${targetRepo}/releases/${releaseId}/assets{?name,label}`; let retry = 0; -const octokit = new Octokit({ +let octokit = new Octokit({ authStrategy: createGitHubTokenStrategy(targetRepo), log: console }); @@ -73,6 +73,12 @@ function uploadToGitHub () { console.log(`Error uploading ${fileName} to GitHub, will retry. Error was:`, err); retry++; + // Reset octokit in case it cached an auth error somehow + octokit = new Octokit({ + authStrategy: createGitHubTokenStrategy(targetRepo), + log: console + }); + octokit.repos.listReleaseAssets({ owner: ELECTRON_ORG, repo: targetRepo, @@ -98,6 +104,7 @@ function uploadToGitHub () { } }).catch((getReleaseErr) => { console.log('Fatal: Unable to get current release assets via getRelease! Error was:', getReleaseErr); + process.exitCode = 1; }); } else { console.log(`Error retrying uploading ${fileName} to GitHub:`, err); From 75048e86bb693a889d294d7591688f3d37c57bbb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Mon, 13 Oct 2025 16:02:16 +0200 Subject: [PATCH 130/268] build(deps): bump github/codeql-action from 3.30.5 to 3.30.6 (#48478) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.30.5 to 3.30.6. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/3599b3baa15b485a2e49ef411a7a4bb2452e7f93...64d10c13136e1c5bce3e5fbde8d4906eeaafc885) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 3.30.6 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/scorecards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index ab7aae98d0eda..278da3f8997ac 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -50,6 +50,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5 + uses: github/codeql-action/upload-sarif@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.29.5 with: sarif_file: results.sarif From c0beeb51c6ab302802bb42e364ccb444d583ae5e Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Mon, 13 Oct 2025 12:21:54 -0400 Subject: [PATCH 131/268] chore: bump chromium to 143.0.7451.0 (main) (#48362) * chore: bump chromium in DEPS to 142.0.7429.0 * chore: bump chromium in DEPS to 142.0.7430.0 * 6954508: Reland Migrate WrappableWithNamedPropertyInterceptor to gin::Wrappable | https://chromium-review.googlesource.com/c/chromium/src/+/6954508 * https://chromium-review.googlesource.com/c/chromium/src/+/6955633 * 5584820: Fix font face resolution when renderer is blocked | https://chromium-review.googlesource.com/c/chromium/src/+/5584820 * chore: export patches * chore: remove patch that keeley says is ok to remove in comments * chore: bump chromium in DEPS to 142.0.7432.0 * chore: export patches * chore: bump chromium in DEPS to 142.0.7434.0 * 6973697: Use type tags for data stored in V8 internal fields | https://chromium-review.googlesource.com/c/chromium/src/+/6973697 * 6976272: Revert Reland mac: click through content area in main window | https://chromium-review.googlesource.com/c/chromium/src/+/6976272 * chore: export patches * 6938086: Rename native_widget_types.h -> native_ui_types.h | https://chromium-review.googlesource.com/c/chromium/src/+/6938086 * 6951252: Correct PersistentCache backed code cache context grouping * chore: bump chromium in DEPS to 142.0.7436.0 * 6981628: Reland Use unordered_map in AcceleratorMap | https://chromium-review.googlesource.com/c/chromium/src/+/6981628 * chore: export patches * chore: resolve patch conflict with main * chore: merge conflict with main * chore: bump chromium in DEPS to 142.0.7438.0 * chore: bump chromium in DEPS to 142.0.7440.0 * chore: bump chromium in DEPS to 142.0.7442.0 * chore: bump chromium in DEPS to 142.0.7444.0 * chore: bump chromium in DEPS to 143.0.7445.0 * chore: bump chromium in DEPS to 143.0.7447.0 * chore: bump chromium in DEPS to 143.0.7449.0 * chore: bump chromium in DEPS to 143.0.7451.0 * 7001364: Migrate GURL accessors to Get* variants in //content | https://chromium-review.googlesource.com/c/chromium/src/+/7001364 * 6986521: Implicit second value 'any' instead of 'span-all' for fallback query | https://chromium-review.googlesource.com/c/chromium/src/+/6986521 * chore: update chromium patches * chore: update chromium patches * chore: update patches * fix: parse macOS SDK version across line break https://chromium-review.googlesource.com/c/chromium/src/+/6980166 * fix: replace v8::Object::SetPrototype() usage https://chromium-review.googlesource.com/c/v8/v8/+/6983465 https://github.com/nodejs/node/pull/55453 * fix: regenerate filenames.libcxx.gni https://chromium-review.googlesource.com/c/chromium/src/+/6980307 * fix: replace additional usages of SetPrototype https://chromium-review.googlesource.com/c/v8/v8/+/6983465 * build: use macos 15 minimum https://chromium-review.googlesource.com/c/chromium/src/+/6980166 * ci: ignore missing dir for strip_universal_deep * fix: js2c compilation failure https://chromium-review.googlesource.com/c/chromium/src/+/6950738 See patch description explaining MacOS 26 SDK headers incompatibility. * fixup! chore: export patches * feat: add new memory-eviction exit reason https://chromium-review.googlesource.com/c/chromium/src/+/6991933 * fix: set JSON reader parsing options https://chromium-review.googlesource.com/c/chromium/src/+/6992114 * fix: provide DeviceEmulationCacheBehavior param https://chromium-review.googlesource.com/c/chromium/src/+/6965238 * fix: views::NonClientFrameView -> views::FrameView https://chromium-review.googlesource.com/c/chromium/src/+/7005027 https://chromium-review.googlesource.com/c/chromium/src/+/6966937 * fix: check new forced colors enum value https://chromium-review.googlesource.com/c/chromium/src/+/6944403 * fix: migrate NetworkConditions -> MatchedNetworkConditions https://chromium-review.googlesource.com/c/chromium/src/+/6827307 * fix: migrate GURL string methods to Get*() https://chromium-review.googlesource.com/c/chromium/src/+/7007010 * fix: disable C++ modules in electron_lib builds https://chromium-review.googlesource.com/c/chromium/src/+/6950738 * fix: partially revert is_headless_mode removal https://chromium-review.googlesource.com/c/chromium/src/+/6955633 This patch should likely be reworked. For now, this partially reverts the removal of a required class property to restore behavior. * Revert "build: use macos 15 minimum" This reverts commit 2fc12d6acc1b24f3cbd0adb03122bf6b21eb14b9. Initially this change was made to test if it fixes libcxx compilation issues. As that's now resolved by disabling libcxx modules, this can be reverted. * fix: disable C++ modules in libnode builds * fixup! fix: replace v8::Object::SetPrototype() usage https://chromium-review.googlesource.com/c/v8/v8/+/6983465 https://github.com/nodejs/node/pull/55453 * fixup! fix: replace v8::Object::SetPrototype() usage https://chromium-review.googlesource.com/c/v8/v8/+/6983465 https://github.com/nodejs/node/pull/55453 * build: switch to macos-15 runner build/mac/find_sdk.py now requires macOS 15 SDK as a minimum version. The macos 15 runners default to an Xcode using the 15 SDK and removes older versions. * fixup! fix: check new forced colors enum value https://chromium-review.googlesource.com/c/chromium/src/+/6944403 * fixup! fix: migrate GURL string methods to Get*() https://chromium-review.googlesource.com/c/chromium/src/+/7007010 * fix: use std::u16string for Extension::Create() error parameter https://chromium-review.googlesource.com/c/chromium/src/+/6975452 * fix: add missing image_skia include https://chromium-review.googlesource.com/c/chromium/src/+/6986762 * fixup! fix: add missing image_skia include https://chromium-review.googlesource.com/c/chromium/src/+/6986762 * fix: remove outdated V8 flag https://chromium-review.googlesource.com/c/v8/v8/+/6948286 * fix: disable protocol handler DCHECK https://chromium-review.googlesource.com/c/chromium/src/+/6727594 Ignore the extension custom protocol handler registry DCHECK until we invest in supporting it. Replacing this DCHECK seems harmless and will unblock the roll. * fix: replace deprecated usage of SetPrototype https://chromium-review.googlesource.com/c/v8/v8/+/6983465 * fixup! fix: migrate NetworkConditions -> MatchedNetworkConditions https://chromium-review.googlesource.com/c/chromium/src/+/6827307 * fixup! fix: migrate GURL string methods to Get*() https://chromium-review.googlesource.com/c/chromium/src/+/7007010 * chore: remove patch already included in roll * chore: remove extraneous formatting added to patch * chore: remove fix_harden_blink_scriptstate_maybefrom.patch https://chromium-review.googlesource.com/c/chromium/src/+/6973697 No longer needed since the above CL landed. * 6973697: Use type tags for data stored in V8 internal fields https://chromium-review.googlesource.com/c/chromium/src/+/6973697 * chore: update patches * fixup! chore: export patches * chore: restore electron embedder data tag patch --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Alice Zhao <alicelovescake@anthropic.com> Co-authored-by: Keeley Hammond <vertedinde@electronjs.org> Co-authored-by: Samuel Maddock <smaddock@slack-corp.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> --- .github/actions/free-space-macos/action.yml | 43 ++--- .../actions/install-build-tools/action.yml | 2 +- .github/workflows/build.yml | 6 +- BUILD.gn | 5 + DEPS | 2 +- docs/api/app.md | 1 + .../structures/render-process-gone-details.md | 1 + filenames.libcxx.gni | 1 + patches/angle/.patches | 1 - patches/angle/cherry-pick-2f564f1ca07b.patch | 125 ------------- ...ack_ssl_error_zero_return_explicitly.patch | 4 +- patches/chromium/.patches | 5 +- patches/chromium/accelerator.patch | 16 +- ...client_precreatemessageloop_callback.patch | 6 +- .../add_didinstallconditionalfeatures.patch | 16 +- ...lectron_deps_to_license_credits_file.patch | 4 +- ...pedcliboardwriter_writeunsaferawdata.patch | 4 +- ..._scheduler_throttling_per_renderview.patch | 16 +- ...o_depend_on_components_os_crypt_sync.patch | 2 +- patches/chromium/blink_local_frame.patch | 6 +- .../build_add_electron_tracing_category.patch | 2 +- .../chromium/build_disable_thin_lto_mac.patch | 2 +- ..._depend_on_packed_resource_integrity.patch | 16 +- patches/chromium/build_gn.patch | 2 +- .../build_libc_as_static_library.patch | 4 +- .../build_set_mac_sdk_minimum_to_10.patch | 26 --- patches/chromium/can_create_window.patch | 38 ++-- ...hore_add_electron_deps_to_gitignores.patch | 10 +- ...ctron_objects_to_wrappablepointertag.patch | 10 +- ...hore_disable_protocol_handler_dcheck.patch | 29 +++ ...ameter_in_script_lifecycle_observers.patch | 28 +-- ...ther_in_electron_views_and_delegates.patch | 6 +- ...fy_chromium_handling_of_mouse_events.patch | 20 +- .../chromium/chore_partial_revert_of.patch | 4 +- ...tition_attribute_dcheck_for_webviews.patch | 4 +- .../chore_patch_out_profile_methods.patch | 6 +- ...screationoverridden_with_full_params.patch | 60 +++--- ..._is_test_on_script_injection_tracker.patch | 2 +- ...me_deprecated_wrapper_utility_in_gin.patch | 4 +- patches/chromium/command-ismediakey.patch | 8 +- .../crash_allow_setting_more_options.patch | 20 +- .../custom_protocols_plzserviceworker.patch | 12 +- patches/chromium/desktop_media_list.patch | 2 +- .../disable_compositor_recycling.patch | 2 +- patches/chromium/disable_hidden.patch | 4 +- ...ofillheuristiccontroller_on_macos_26.patch | 53 ------ .../chromium/enable_reset_aspect_ratio.patch | 10 +- ...xpose_setuseragent_on_networkcontext.patch | 22 +-- .../extend_apply_webpreferences.patch | 4 +- ...dd_set_theme_source_to_allow_apps_to.patch | 22 +-- ...n_embedder_cleanup_callbacks_run_for.patch | 6 +- ...ing_dialog_features_to_shell_dialogs.patch | 18 +- ...t_allow_code_cache_in_custom_schemes.patch | 60 +++--- ...ecttemplate_to_objecttemplatebuilder.patch | 8 +- ...sharingpicker_on_supported_platforms.patch | 10 +- ...e_launch_options_for_service_process.patch | 20 +- ...moothing_css_rule_and_blink_painting.patch | 30 +-- ...screen_rendering_with_viz_compositor.patch | 12 +- ...g_exit_code_on_service_process_crash.patch | 2 +- ..._raw_response_headers_from_urlloader.patch | 10 +- ...allback_for_sync_and_async_clipboard.patch | 8 +- ...dless_mode_handling_in_native_widget.patch | 62 ++++++- .../fix_aspect_ratio_with_max_size.patch | 8 +- ...ding_non-standard_schemes_in_iframes.patch | 10 +- ..._resolution_when_renderer_is_blocked.patch | 59 ------ ...x_harden_blink_scriptstate_maybefrom.patch | 22 +-- ...ingshelper_behind_branding_buildflag.patch | 18 +- ...king_and_message_bubbling_on_windows.patch | 6 +- ...board_hides_on_input_blur_in_webview.patch | 8 +- ...x_remove_caption-removing_style_call.patch | 4 +- ..._material_update_issue_on_windows_11.patch | 14 +- ...original_resize_performance_on_macos.patch | 2 +- ...from_localframe_requestexecutescript.patch | 20 +- ...t_menu_item_when_opened_via_keyboard.patch | 4 +- ...ated_generic_capturer_when_available.patch | 6 +- patches/chromium/frame_host_manager.patch | 8 +- .../gin_enable_disable_v8_platform.patch | 4 +- .../chromium/gritsettings_resource_ids.patch | 4 +- ...nt_provisional_frame_speculative_fix.patch | 116 ------------ patches/chromium/isolate_holder.patch | 6 +- ..._avoid_private_macos_api_usage.patch.patch | 88 ++++----- ...emote_certificate_verification_logic.patch | 14 +- .../chromium/notification_provenance.patch | 10 +- ...xture_remove_keyed_mutex_on_win_dxgi.patch | 12 +- patches/chromium/picture-in-picture.patch | 2 +- ...utofill_colors_to_the_color_pipeline.patch | 4 +- patches/chromium/printing.patch | 4 +- ...r_changes_to_the_webcontentsobserver.patch | 22 +-- ..._expose_file_system_access_blocklist.patch | 14 +- ...pose_hostimportmoduledynamically_and.patch | 12 +- ..._electron_permissiontypes_into_blink.patch | 8 +- ...efactor_unfilter_unresponsive_events.patch | 4 +- .../render_widget_host_view_mac.patch | 12 +- patches/chromium/resource_file_conflict.patch | 6 +- ...ean_up_stale_macwebcontentsocclusion.patch | 8 +- ...al_remove_unused_prehandlemouseevent.patch | 12 +- ...windowtreehostwin_window_enlargement.patch | 14 +- .../support_mixed_sandbox_with_zygote.patch | 10 +- patches/chromium/web_contents.patch | 6 +- patches/chromium/webview_fullscreen.patch | 12 +- .../worker_context_will_destroy.patch | 10 +- ...feat_add_hook_to_notify_script_ready.patch | 10 +- patches/config.json | 3 +- ...i_to_allow_electron_to_set_dock_side.patch | 4 +- patches/nan/.patches | 1 + ..._replace_deprecated_get_setprototype.patch | 35 ++++ patches/node/.patches | 3 + ...cli_move_--trace-atomics-wait_to_eol.patch | 2 +- .../node/fix_cppgc_initializing_twice.patch | 2 +- ...x_redefined_macos_sdk_header_symbols.patch | 39 ++++ ...emove_outdated_v8_flags_from_node_cc.patch | 15 +- .../fix_replace_deprecated_setprototype.patch | 61 ++++++ ...ch_cppgc_heap_on_v8_isolate_creation.patch | 2 +- ...t_setprototype_to_get_setprototypev2.patch | 173 ++++++++++++++++++ patches/v8/.patches | 1 - patches/v8/cherry-pick-ec6c18478382.patch | 45 ----- .../browser/api/electron_api_native_theme.cc | 6 +- shell/browser/api/electron_api_session.cc | 24 ++- .../browser/api/electron_api_web_contents.cc | 7 +- shell/browser/electron_browser_client.cc | 10 +- .../extensions/electron_extension_system.cc | 4 +- .../extensions/electron_messaging_delegate.cc | 2 +- shell/browser/native_window_mac.h | 2 +- shell/browser/native_window_mac.mm | 4 +- shell/browser/native_window_views.cc | 8 +- shell/browser/native_window_views.h | 4 +- shell/browser/osr/osr_host_display_client.h | 2 +- shell/browser/osr/osr_paint_event.h | 2 +- .../osr/osr_render_widget_host_view.cc | 2 +- .../ui/devtools_ui_bundle_data_source.cc | 2 +- shell/browser/ui/drag_util.h | 2 +- .../ui/inspectable_web_contents_view.h | 2 +- shell/browser/ui/tray_icon_linux.h | 1 + .../ui/views/client_frame_view_linux.cc | 2 +- .../ui/views/client_frame_view_linux.h | 2 +- .../ui/views/electron_views_delegate.cc | 4 +- .../ui/views/electron_views_delegate.h | 2 +- shell/browser/ui/views/frameless_view.cc | 2 +- shell/browser/ui/views/frameless_view.h | 6 +- shell/browser/ui/views/global_menu_bar_x11.h | 2 +- shell/browser/ui/views/opaque_frame_view.cc | 4 +- shell/browser/ui/views/opaque_frame_view.h | 2 +- shell/browser/ui/views/win_frame_view.cc | 4 +- shell/browser/ui/views/win_frame_view.h | 2 +- shell/browser/web_contents_zoom_controller.cc | 6 +- shell/common/asar/archive.cc | 3 +- shell/common/asar/archive_win.cc | 3 +- shell/common/gin_converters/base_converter.h | 2 + 148 files changed, 1032 insertions(+), 1041 deletions(-) delete mode 100644 patches/angle/.patches delete mode 100644 patches/angle/cherry-pick-2f564f1ca07b.patch delete mode 100644 patches/chromium/build_set_mac_sdk_minimum_to_10.patch create mode 100644 patches/chromium/chore_disable_protocol_handler_dcheck.patch delete mode 100644 patches/chromium/disable_nsautofillheuristiccontroller_on_macos_26.patch delete mode 100644 patches/chromium/fix_font_face_resolution_when_renderer_is_blocked.patch delete mode 100644 patches/chromium/inspectorpageagent_provisional_frame_speculative_fix.patch create mode 100644 patches/nan/fix_replace_deprecated_get_setprototype.patch create mode 100644 patches/node/fix_redefined_macos_sdk_header_symbols.patch create mode 100644 patches/node/fix_replace_deprecated_setprototype.patch create mode 100644 patches/node/src_switch_from_get_setprototype_to_get_setprototypev2.patch delete mode 100644 patches/v8/cherry-pick-ec6c18478382.patch diff --git a/.github/actions/free-space-macos/action.yml b/.github/actions/free-space-macos/action.yml index efdea79f1ed5b..d0251e6802bdd 100644 --- a/.github/actions/free-space-macos/action.yml +++ b/.github/actions/free-space-macos/action.yml @@ -17,28 +17,30 @@ runs: } strip_universal_deep() { - opwd=$(pwd) - cd $1 - f=$(find . -perm +111 -type f) - for fp in $f - do - if [[ $(file "$fp") == *"universal binary"* ]]; then - if [ "`arch`" == "arm64" ]; then - if [[ $(file "$fp") == *"x86_64"* ]]; then - sudo lipo -remove x86_64 "$fp" -o "$fp" || true - fi - else - if [[ $(file "$fp") == *"arm64e)"* ]]; then - sudo lipo -remove arm64e "$fp" -o "$fp" || true - fi - if [[ $(file "$fp") == *"arm64)"* ]]; then - sudo lipo -remove arm64 "$fp" -o "$fp" || true + if [ -d "$1" ]; then + opwd=$(pwd) + cd $1 + f=$(find . -perm +111 -type f) + for fp in $f + do + if [[ $(file "$fp") == *"universal binary"* ]]; then + if [ "`arch`" == "arm64" ]; then + if [[ $(file "$fp") == *"x86_64"* ]]; then + sudo lipo -remove x86_64 "$fp" -o "$fp" || true + fi + else + if [[ $(file "$fp") == *"arm64e)"* ]]; then + sudo lipo -remove arm64e "$fp" -o "$fp" || true + fi + if [[ $(file "$fp") == *"arm64)"* ]]; then + sudo lipo -remove arm64 "$fp" -o "$fp" || true + fi fi fi - fi - done + done - cd $opwd + cd $opwd + fi } tmpify /Library/Developer/CoreSimulator @@ -60,10 +62,9 @@ runs: sudo rm -rf /Applications/Safari.app sudo rm -rf /Applications/Xcode_16.1.app - sudo rm -rf /Applications/Xcode_16.3.app sudo rm -rf /Applications/Xcode_16.2.app + sudo rm -rf /Applications/Xcode_16.3.app sudo rm -rf /Applications/Google Chrome.app - sudo rm -rf /Applications/Xcode_16.4.app sudo rm -rf /Applications/Google Chrome for Testing.app sudo rm -rf /Applications/Firefox.app sudo rm -rf ~/project/src/third_party/catapult/tracing/test_data diff --git a/.github/actions/install-build-tools/action.yml b/.github/actions/install-build-tools/action.yml index 868cdc63a44b6..2dc60d1f0ba5b 100644 --- a/.github/actions/install-build-tools/action.yml +++ b/.github/actions/install-build-tools/action.yml @@ -15,7 +15,7 @@ runs: git config --global core.preloadindex true git config --global core.longpaths true fi - export BUILD_TOOLS_SHA=706147b2376f55078f718576b28129a0457f1795 + export BUILD_TOOLS_SHA=a5d9f9052dcc36ee88bef5c8b13acbefd87b7d8d npm i -g @electron/build-tools # Update depot_tools to ensure python e d update_depot_tools diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7dec7e0a490c9..17cc18a1d9778 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -189,7 +189,7 @@ jobs: with: target-platform: macos target-archs: x64 arm64 - check-runs-on: macos-14 + check-runs-on: macos-15 gn-build-type: testing secrets: inherit @@ -225,7 +225,7 @@ jobs: uses: ./.github/workflows/pipeline-electron-build-and-test.yml needs: checkout-macos with: - build-runs-on: macos-14-xlarge + build-runs-on: macos-15-xlarge test-runs-on: macos-15-large target-platform: macos target-arch: x64 @@ -244,7 +244,7 @@ jobs: uses: ./.github/workflows/pipeline-electron-build-and-test.yml needs: checkout-macos with: - build-runs-on: macos-14-xlarge + build-runs-on: macos-15-xlarge test-runs-on: macos-15 target-platform: macos target-arch: arm64 diff --git a/BUILD.gn b/BUILD.gn index 2a6ee90e5faa7..2347766ae994c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -586,6 +586,11 @@ source_set("electron_lib") { } if (is_mac) { + # Disable C++ modules to resolve linking error when including MacOS SDK + # headers from third_party/electron_node/deps/uv/include/uv/darwin.h + # TODO(samuelmaddock): consider revisiting this in the future + use_libcxx_modules = false + deps += [ "//components/remote_cocoa/app_shim", "//components/remote_cocoa/browser", diff --git a/DEPS b/DEPS index 90c9be2a68408..23bcac452c3f9 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '142.0.7417.0', + '143.0.7451.0', 'node_version': 'v22.20.0', 'nan_version': diff --git a/docs/api/app.md b/docs/api/app.md index 9dcb4835aaded..3e0da669086b1 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -421,6 +421,7 @@ Returns: * `oom` - Process ran out of memory * `launch-failed` - Process never successfully launched * `integrity-failure` - Windows code integrity checks failed + * `memory-eviction` - Process proactively terminated to prevent a future out-of-memory (OOM) situation * `exitCode` number - The exit code for the process (e.g. status from waitpid if on POSIX, from GetExitCodeProcess on Windows). * `serviceName` string (optional) - The non-localized name of the process. diff --git a/docs/api/structures/render-process-gone-details.md b/docs/api/structures/render-process-gone-details.md index e48800a5b87d7..633d9bbc9ddb6 100644 --- a/docs/api/structures/render-process-gone-details.md +++ b/docs/api/structures/render-process-gone-details.md @@ -8,6 +8,7 @@ * `oom` - Process ran out of memory * `launch-failed` - Process never successfully launched * `integrity-failure` - Windows code integrity checks failed + * `memory-eviction` - Process proactively terminated to prevent a future out-of-memory (OOM) situation * `exitCode` Integer - The exit code of the process, unless `reason` is `launch-failed`, in which case `exitCode` will be a platform-specific launch failure error code. diff --git a/filenames.libcxx.gni b/filenames.libcxx.gni index 3142c0376f792..f7aa6a7bdb25c 100644 --- a/filenames.libcxx.gni +++ b/filenames.libcxx.gni @@ -217,6 +217,7 @@ libcxx_headers = [ "//third_party/libc++/src/include/__atomic/check_memory_order.h", "//third_party/libc++/src/include/__atomic/contention_t.h", "//third_party/libc++/src/include/__atomic/fence.h", + "//third_party/libc++/src/include/__atomic/floating_point_helper.h", "//third_party/libc++/src/include/__atomic/is_always_lock_free.h", "//third_party/libc++/src/include/__atomic/kill_dependency.h", "//third_party/libc++/src/include/__atomic/memory_order.h", diff --git a/patches/angle/.patches b/patches/angle/.patches deleted file mode 100644 index 30503ef3561d6..0000000000000 --- a/patches/angle/.patches +++ /dev/null @@ -1 +0,0 @@ -cherry-pick-2f564f1ca07b.patch diff --git a/patches/angle/cherry-pick-2f564f1ca07b.patch b/patches/angle/cherry-pick-2f564f1ca07b.patch deleted file mode 100644 index 06060e5968f33..0000000000000 --- a/patches/angle/cherry-pick-2f564f1ca07b.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mark Mentovai <mark@chromium.org> -Date: Tue, 16 Sep 2025 16:46:36 -0400 -Subject: mac: handle Metal toolchain being unbundled from Xcode 26 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The Metal toolchain was formerly part of Xcode, but in Xcode 26, it has -been unbundled and is now a separate install. Attempting to use the -Metal toolchain without installing it results in a build error, such as: - -error: error: cannot execute tool 'metal' due to missing Metal -Toolchain; use: xcodebuild -downloadComponent MetalToolchain - -By running the suggested command, the Metal toolchain can be installed, -but the existing angle build does not know how to find it correctly. - -For system Xcode installations, tools from the Metal toolchain (`metal` -and `metallib`) can be run via `xcrun`. This construct should work -equally well for older Xcode versions, for situations where it’s still -in use. - -For the hermetic toolchain, we’ll continue splicing the Metal toolchain -into the location it had previously been avialable (see -https://chromium-review.googlesource.com/c/6950738), although this is -subject to change in the future. - -Bug: chromium:423933062, chromium:445400016 -Change-Id: I139eca51938f7cecfec9b90fd488947160ef4ec9 -Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6955000 -Auto-Submit: Mark Mentovai <mark@chromium.org> -Commit-Queue: Mark Mentovai <mark@chromium.org> -Reviewed-by: Geoff Lang <geofflang@chromium.org> - -diff --git a/src/libANGLE/renderer/metal/BUILD.gn b/src/libANGLE/renderer/metal/BUILD.gn -index 96e9ee8420810f6a3ca9a0c290d4a654200eb7b9..50ac42a5b9a0f7c8b3b161af40c598cb34ff132a 100644 ---- a/src/libANGLE/renderer/metal/BUILD.gn -+++ b/src/libANGLE/renderer/metal/BUILD.gn -@@ -24,20 +24,56 @@ config("angle_metal_backend_config") { - } - - if (metal_internal_shader_compilation_supported) { -+ template("run_metal_tool") { -+ action(target_name) { -+ forward_variables_from(invoker, -+ [ -+ "deps", -+ "sources", -+ "outputs", -+ "metal_tool", -+ ]) -+ script = "shaders/metal_wrapper.py" -+ if (use_system_xcode) { -+ # System Xcode: run metal and metallib via xcrun. Since Xcode 26.0, the -+ # Metal toolchain has been unbundled from Xcode, and must be installed -+ # separately by running `xcodebuild -downloadComponent MetalToolchain`. -+ # There is a vestigial metal executable in mac_bin_path, but it’s -+ # incapable of running successfuly without the -+ # rest of the Metal toolchain surrounding it. `xcrun` is able to find -+ # and run the correct Metal toolchain when properly installed. -+ # -+ # If you’re using system Xcode and your build fails with this message: -+ # error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain -+ # then do what the error message suggests, and then retry your build. -+ args = [ -+ "xcrun", -+ metal_tool, -+ ] -+ } else { -+ # Hermetic Xcode: at least for now, the Metal toolchain is -+ # “spliced” into the location in the hermetic toolchain where it lived -+ # before Xcode 26.0, so it can be run directly from there. -+ args = [ mac_bin_path + metal_tool ] -+ } -+ -+ args += invoker.args -+ } -+ } -+ - _metal_internal_shaders_air_file = - "$root_gen_dir/angle/mtl_internal_shaders_autogen.air" - -- action("angle_metal_internal_shaders_to_air") { -- script = "shaders/metal_wrapper.py" -- -- outputs = [ _metal_internal_shaders_air_file ] -- -+ run_metal_tool("angle_metal_internal_shaders_to_air") { - _metal_internal_shaders_metal_source = - "shaders/mtl_internal_shaders_autogen.metal" - sources = [ _metal_internal_shaders_metal_source ] - -+ outputs = [ _metal_internal_shaders_air_file ] -+ -+ metal_tool = "metal" -+ - args = [ -- mac_bin_path + "metal", - "-c", - rebase_path(_metal_internal_shaders_metal_source, root_build_dir), - "-o", -@@ -60,17 +96,16 @@ if (metal_internal_shader_compilation_supported) { - _metal_internal_shaders_metallib_file = - "$root_gen_dir/angle/mtl_internal_shaders_autogen.metallib" - -- action("angle_metal_internal_shaders_to_mtllib") { -- script = "shaders/metal_wrapper.py" -- -- outputs = [ _metal_internal_shaders_metallib_file ] -+ run_metal_tool("angle_metal_internal_shaders_to_mtllib") { -+ deps = [ ":angle_metal_internal_shaders_to_air" ] - - sources = [ _metal_internal_shaders_air_file ] - -- deps = [ ":angle_metal_internal_shaders_to_air" ] -+ outputs = [ _metal_internal_shaders_metallib_file ] -+ -+ metal_tool = "metallib" - - args = [ -- mac_bin_path + "metallib", - rebase_path(_metal_internal_shaders_air_file, root_build_dir), - "-o", - rebase_path(_metal_internal_shaders_metallib_file, root_build_dir), diff --git a/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch b/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch index 503305951370d..be7e74afb2a9d 100644 --- a/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch +++ b/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch @@ -20,7 +20,7 @@ index 2cdcbc346175eeee69402ecee7f169e61c655199..f7226fe711e4214b216ea2c5173a0212 case ssl_open_record_error: diff --git a/ssl/ssl_lib.cc b/ssl/ssl_lib.cc -index 2e0db357135d54bc416bc94f4e3849267932c3b4..35f0430b5d1c1ed1676ea7a9e7e94e820126607b 100644 +index bbe428f20af5e67cf1335c7f1e42516638234af2..507f85f983bdc4a8c654dd10caf38a42634f5026 100644 --- a/ssl/ssl_lib.cc +++ b/ssl/ssl_lib.cc @@ -1211,7 +1211,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) { @@ -32,7 +32,7 @@ index 2e0db357135d54bc416bc94f4e3849267932c3b4..35f0430b5d1c1ed1676ea7a9e7e94e82 return SSL_ERROR_ZERO_RETURN; } // An EOF was observed which violates the protocol, and the underlying -@@ -2602,13 +2602,7 @@ void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx) { +@@ -2672,13 +2672,7 @@ void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx) { return CRYPTO_get_ex_data(&ctx->ex_data, idx); } diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 63f4be9b196d3..6c87b070d5616 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -110,7 +110,6 @@ fix_getcursorscreenpoint_wrongly_returns_0_0.patch fix_add_support_for_skipping_first_2_no-op_refreshes_in_thumb_cap.patch refactor_expose_file_system_access_blocklist.patch feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch -fix_font_face_resolution_when_renderer_is_blocked.patch feat_enable_passing_exit_code_on_service_process_crash.patch chore_remove_reference_to_chrome_browser_themes.patch feat_enable_customizing_symbol_color_in_framecaptionbutton.patch @@ -132,7 +131,6 @@ chore_grandfather_in_electron_views_and_delegates.patch refactor_patch_electron_permissiontypes_into_blink.patch revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch build_partial_revert_mac_fullscreen_top_chrome_mouse_events.patch -build_set_mac_sdk_minimum_to_10.patch fix_add_macos_memory_query_fallback_to_avoid_crash.patch fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch feat_add_support_for_embedder_snapshot_validation.patch @@ -141,6 +139,5 @@ chore_add_electron_objects_to_wrappablepointertag.patch chore_expose_isolate_parameter_in_script_lifecycle_observers.patch revert_partial_remove_unused_prehandlemouseevent.patch allow_electron_to_depend_on_components_os_crypt_sync.patch -disable_nsautofillheuristiccontroller_on_macos_26.patch expose_referrerscriptinfo_hostdefinedoptionsindex.patch -inspectorpageagent_provisional_frame_speculative_fix.patch +chore_disable_protocol_handler_dcheck.patch diff --git a/patches/chromium/accelerator.patch b/patches/chromium/accelerator.patch index 65aea0d48e53f..662c361566d94 100644 --- a/patches/chromium/accelerator.patch +++ b/patches/chromium/accelerator.patch @@ -53,19 +53,19 @@ index 5ad9332dd27ceda7d67cd3f571b12218a4415a40..ffe083836c39fb60b4bff1f9fbdd6ceb } diff --git a/ui/base/accelerators/accelerator.h b/ui/base/accelerators/accelerator.h -index e7d5adfac920c97df8bab9bf4ed69a835ee314a9..9aeea7cb4c48d1ccc27304fa99238151b2811c87 100644 +index 666ecbc118bec6d51465644ae4e573846c33610b..5f578ea153477379bac69e48fbd4f41a9a24885e 100644 --- a/ui/base/accelerators/accelerator.h +++ b/ui/base/accelerators/accelerator.h -@@ -18,6 +18,7 @@ - #include <vector> - - #include "base/component_export.h" -+#include "third_party/abseil-cpp/absl/types/optional.h" +@@ -21,6 +21,7 @@ #include "base/time/time.h" #include "build/blink_buildflags.h" #include "build/build_config.h" -@@ -189,6 +190,8 @@ class COMPONENT_EXPORT(UI_BASE) Accelerator { - return interrupted_by_mouse_event_; ++#include "third_party/abseil-cpp/absl/types/optional.h" + #include "ui/events/event_constants.h" + #include "ui/events/keycodes/keyboard_codes.h" + +@@ -199,6 +200,8 @@ class COMPONENT_EXPORT(UI_BASE) Accelerator { + << 18); // masked to 6 bits } + absl::optional<char16_t> shifted_char; diff --git a/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch b/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch index 0644ba85b1823..cc67817d07f80 100644 --- a/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch +++ b/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch @@ -10,10 +10,10 @@ Allows Electron to restore WER when ELECTRON_DEFAULT_ERROR_MODE is set. This should be upstreamed. diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc -index a827f072e72d76dd52378cca4368932a4b2f4f3d..cc1b6cca3009e876f84f48df942df02fddd91e80 100644 +index 30cc1d4a179f9da59824cb98415baed8493fc843..2272eaa7e0e3306201e5e32226a0115f6f6636e5 100644 --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc -@@ -273,6 +273,10 @@ int GpuMain(MainFunctionParams parameters) { +@@ -272,6 +272,10 @@ int GpuMain(MainFunctionParams parameters) { // to the GpuProcessHost once the GpuServiceImpl has started. viz::GpuLogMessageManager::GetInstance()->InstallPreInitializeLogHandler(); @@ -24,7 +24,7 @@ index a827f072e72d76dd52378cca4368932a4b2f4f3d..cc1b6cca3009e876f84f48df942df02f // We are experiencing what appear to be memory-stomp issues in the GPU // process. These issues seem to be impacting the task executor and listeners // registered to it. Create the task executor on the heap to guard against -@@ -382,7 +386,6 @@ int GpuMain(MainFunctionParams parameters) { +@@ -381,7 +385,6 @@ int GpuMain(MainFunctionParams parameters) { #endif const bool dead_on_arrival = !init_success; diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index 84e4c89162809..3aed5d022abc6 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -10,10 +10,10 @@ DidCreateScriptContext is called, not all JS APIs are available in the context, which can cause some preload scripts to trip. diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h -index 284da783658bec333be748941784d43b13f6f244..18714ce8fc27c8d56c5deac27ba335078c452d0a 100644 +index 9728f3c38c27f93188d1aa9026552a5cebbdcb60..0cba9fb59a62f00fb726850ba9901c2887cc8431 100644 --- a/content/public/renderer/render_frame_observer.h +++ b/content/public/renderer/render_frame_observer.h -@@ -139,6 +139,8 @@ class CONTENT_EXPORT RenderFrameObserver { +@@ -141,6 +141,8 @@ class CONTENT_EXPORT RenderFrameObserver { virtual void DidHandleOnloadEvents() {} virtual void DidCreateScriptContext(v8::Local<v8::Context> context, int32_t world_id) {} @@ -23,10 +23,10 @@ index 284da783658bec333be748941784d43b13f6f244..18714ce8fc27c8d56c5deac27ba33507 int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index a0aa3ec64b54b99508d1ba9cd52e2fe0e53ed56c..f337d61906651359eeb5228c112ad948f4f7a752 100644 +index dcfe69d2c719db9e9b1f612275ea2e95f5e632b0..230697a116c26b137c05e234824aded3ae5295af 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4678,6 +4678,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, +@@ -4701,6 +4701,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, observer.DidCreateScriptContext(context, world_id); } @@ -40,10 +40,10 @@ index a0aa3ec64b54b99508d1ba9cd52e2fe0e53ed56c..f337d61906651359eeb5228c112ad948 int world_id) { for (auto& observer : observers_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index 2950a6f600aab24226ef59acabddc74c9b67cac8..f0f4335aa815ea50dbf9b720b41e4eb31f27fb90 100644 +index a87e628da2e1f906352ad1559a26830ed361ecb8..611283f006f96af3c40cbf947505b02ad8ee3438 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -602,6 +602,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -603,6 +603,8 @@ class CONTENT_EXPORT RenderFrameImpl void DidObserveLayoutShift(double score, bool after_input_or_scroll) override; void DidCreateScriptContext(v8::Local<v8::Context> context, int world_id) override; @@ -53,10 +53,10 @@ index 2950a6f600aab24226ef59acabddc74c9b67cac8..f0f4335aa815ea50dbf9b720b41e4eb3 int world_id) override; void DidChangeScrollOffset() override; diff --git a/third_party/blink/public/web/web_local_frame_client.h b/third_party/blink/public/web/web_local_frame_client.h -index 101e727b3a97bc764315eb694dc3975f9a408f9c..52e8828d8fffaba8ab05436cb4d727595f18238a 100644 +index 5e40b324ee3a5147bb5911373147aa9add878899..d5a86fa3b41c9f4bf294cfdf7e210da05f7ae2e9 100644 --- a/third_party/blink/public/web/web_local_frame_client.h +++ b/third_party/blink/public/web/web_local_frame_client.h -@@ -661,6 +661,9 @@ class BLINK_EXPORT WebLocalFrameClient { +@@ -667,6 +667,9 @@ class BLINK_EXPORT WebLocalFrameClient { virtual void DidCreateScriptContext(v8::Local<v8::Context>, int32_t world_id) {} diff --git a/patches/chromium/add_electron_deps_to_license_credits_file.patch b/patches/chromium/add_electron_deps_to_license_credits_file.patch index 68f3913a888be..eaf00146856de 100644 --- a/patches/chromium/add_electron_deps_to_license_credits_file.patch +++ b/patches/chromium/add_electron_deps_to_license_credits_file.patch @@ -7,10 +7,10 @@ Ensure that licenses for the dependencies introduced by Electron are included in `LICENSES.chromium.html` diff --git a/tools/licenses/licenses.py b/tools/licenses/licenses.py -index b0807ee3d8ebcf34f0d740362aa46c8631562d38..118d200b74953c0068ad59300ccc0e3041d77a10 100755 +index a8afd4c9a95ad62fa0c8adb6fd53c2783d6eee96..ef8ab7dd5368d79c4bcf1e22fb539029956d4c67 100755 --- a/tools/licenses/licenses.py +++ b/tools/licenses/licenses.py -@@ -337,6 +337,31 @@ SPECIAL_CASES = { +@@ -342,6 +342,31 @@ SPECIAL_CASES = { "License": "Apache 2.0", "License File": ["//third_party/dawn/third_party/khronos/LICENSE"], }, diff --git a/patches/chromium/add_ui_scopedcliboardwriter_writeunsaferawdata.patch b/patches/chromium/add_ui_scopedcliboardwriter_writeunsaferawdata.patch index 2c316f73b7d17..a7f762497c0c6 100644 --- a/patches/chromium/add_ui_scopedcliboardwriter_writeunsaferawdata.patch +++ b/patches/chromium/add_ui_scopedcliboardwriter_writeunsaferawdata.patch @@ -8,10 +8,10 @@ was removed as part of the Raw Clipboard API scrubbing. https://bugs.chromium.org/p/chromium/issues/detail?id=1217643 diff --git a/ui/base/clipboard/scoped_clipboard_writer.cc b/ui/base/clipboard/scoped_clipboard_writer.cc -index 2d612b3a8ceb61f02fbd96023140bc2c702db589..bb5b17fc884b78aa65c3885e11309a9c50f8e786 100644 +index e104f4d7814b6f6a0e1f5cf49ae24d5571e30fb1..cc7e9064b21f8f2c45690454805901c0c56e2aa1 100644 --- a/ui/base/clipboard/scoped_clipboard_writer.cc +++ b/ui/base/clipboard/scoped_clipboard_writer.cc -@@ -246,6 +246,16 @@ void ScopedClipboardWriter::WriteData(std::u16string_view format, +@@ -244,6 +244,16 @@ void ScopedClipboardWriter::WriteData(std::u16string_view format, } } diff --git a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch index 00d2c96c9ef4c..1c0ecc52f7b9b 100644 --- a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -6,7 +6,7 @@ Subject: allow disabling blink scheduler throttling per RenderView This allows us to disable throttling for hidden windows. diff --git a/content/browser/renderer_host/navigation_controller_impl_unittest.cc b/content/browser/renderer_host/navigation_controller_impl_unittest.cc -index 318031e17f212b0e9a651dcc0e86e16af957ed8e..e68dcdc8039217ec59a60ef02c27b4f80f661d2a 100644 +index 94a67b61edb0bc2f3faa5db44e99d1493f38d5a0..e4a953c199f8c1e5d68e552f73c593d308946957 100644 --- a/content/browser/renderer_host/navigation_controller_impl_unittest.cc +++ b/content/browser/renderer_host/navigation_controller_impl_unittest.cc @@ -168,6 +168,12 @@ class MockPageBroadcast : public blink::mojom::PageBroadcast { @@ -51,7 +51,7 @@ index 7944fe64e0da112fc670358b75506bb199bb5e4a..0e3c16c6af2a078943e9f39808134ab2 void SendRendererPreferencesToRenderer( const blink::RendererPreferences& preferences); diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index e95a313945397c6eff5514932ce15c5d4b6a8e1f..edb2638deb85dfd37651a00d4c370e51d94fcc6a 100644 +index e8a0554c4d84a16fc2122cb3e48199b4f43ecf88..34fca79b7c87b2fd098271fb5a4f83c015eeb2bc 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -578,8 +578,8 @@ void RenderWidgetHostViewAura::ShowImpl(PageVisibilityState page_visibility) { @@ -116,10 +116,10 @@ index 9c0fe6ad62872f05cfb1179b4b979139008976d2..6aca43e61ef7f1caea74c30e5c3ce449 // Visibility ----------------------------------------------------------- diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index cd57d63a452cb4444d5d0b11b06c65c5bc11f5f1..68a102327e22302587f7cc402cb26ef2f02b261e 100644 +index 58a676a50707a3c0a16dd47981dedc246c095728..a004db1a30b6138dbeda5da3f4301bca86ec6ad2 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -2504,6 +2504,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( +@@ -2513,6 +2513,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( TRACE_EVENT2("navigation", "WebViewImpl::SetPageLifecycleStateInternal", "old_state", old_state, "new_state", new_state); @@ -130,7 +130,7 @@ index cd57d63a452cb4444d5d0b11b06c65c5bc11f5f1..68a102327e22302587f7cc402cb26ef2 bool storing_in_bfcache = new_state->is_in_back_forward_cache && !old_state->is_in_back_forward_cache; bool restoring_from_bfcache = !new_state->is_in_back_forward_cache && -@@ -4012,10 +4016,23 @@ PageScheduler* WebViewImpl::Scheduler() const { +@@ -4031,10 +4035,23 @@ PageScheduler* WebViewImpl::Scheduler() const { return GetPage()->GetPageScheduler(); } @@ -155,10 +155,10 @@ index cd57d63a452cb4444d5d0b11b06c65c5bc11f5f1..68a102327e22302587f7cc402cb26ef2 // Do not throttle if the page should be painting. bool is_visible = diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h -index 7879bd064e9ef324e12b5c2f522f9c8a4fa29ad5..950df20815a607b678e0e67a19d22d37b579b85d 100644 +index 83e4be6692496d1d05dcd4110009c68763683128..f8deed2f22387c5dcc35d93c7b45ba54a77625e5 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h -@@ -450,6 +450,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, +@@ -452,6 +452,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, LocalDOMWindow* PagePopupWindow() const; PageScheduler* Scheduler() const override; @@ -166,7 +166,7 @@ index 7879bd064e9ef324e12b5c2f522f9c8a4fa29ad5..950df20815a607b678e0e67a19d22d37 void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state, bool is_initial_state) override; mojom::blink::PageVisibilityState GetVisibilityState() override; -@@ -943,6 +944,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, +@@ -945,6 +946,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, // If true, we send IPC messages when |preferred_size_| changes. bool send_preferred_size_changes_ = false; diff --git a/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch b/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch index 9b228c21fb2af..7b2b5e6060493 100644 --- a/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch +++ b/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch @@ -10,7 +10,7 @@ so we can remove this patch once we migrate our code to use os_crypt async. diff --git a/components/os_crypt/sync/BUILD.gn b/components/os_crypt/sync/BUILD.gn -index 81fc444043b67858371142075f98ad9aff162fc3..7ab1c6d1422e19afa603d9b3eeeb30044fb9c7b3 100644 +index e9fffc2e3f0520a56ff5753a4a1abfc11c795b83..e22733af7b6a5c9269a41cfb5934ae6ce0777869 100644 --- a/components/os_crypt/sync/BUILD.gn +++ b/components/os_crypt/sync/BUILD.gn @@ -10,6 +10,7 @@ import("//components/os_crypt/sync/features.gni") diff --git a/patches/chromium/blink_local_frame.patch b/patches/chromium/blink_local_frame.patch index 441d2bee5cecb..3082638137199 100644 --- a/patches/chromium/blink_local_frame.patch +++ b/patches/chromium/blink_local_frame.patch @@ -49,10 +49,10 @@ index cdb5b9246087b5678cf6a0f2713f6238dafc13de..7efbe7524c5ddd3785fff0e2d8901f93 // its owning reference back to our owning LocalFrame. client_->Detached(type); diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index 72f642cb098bb6bbb445b49823663a7deb316842..902f472c8c52dd4fe52f46fbb97034b041153f65 100644 +index dc1464afab92e4148d8c61f2098d5172e236651b..e96fca375fc3eb2504dd6f82e5be2c025d23089e 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc -@@ -751,10 +751,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { +@@ -746,10 +746,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { } DCHECK(!view_ || !view_->IsAttached()); @@ -63,7 +63,7 @@ index 72f642cb098bb6bbb445b49823663a7deb316842..902f472c8c52dd4fe52f46fbb97034b0 if (!Client()) return false; -@@ -808,6 +804,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { +@@ -803,6 +799,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { DCHECK(!view_->IsAttached()); Client()->WillBeDetached(); diff --git a/patches/chromium/build_add_electron_tracing_category.patch b/patches/chromium/build_add_electron_tracing_category.patch index 3a5d014862c14..a2392cdb8426d 100644 --- a/patches/chromium/build_add_electron_tracing_category.patch +++ b/patches/chromium/build_add_electron_tracing_category.patch @@ -8,7 +8,7 @@ categories in use are known / declared. This patch is required for us to introduce a new Electron category for Electron-specific tracing. diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h -index 67b5911d7815b47aafe1df1030c96a903e495df1..4813b0dc361219ad30a7e745a7906fa396c3950c 100644 +index b89448c88ca896247a6c3e12c858d6d13856c5b7..ed60fbfc350d546834a26e74ee5bd6e6c0579ed4 100644 --- a/base/trace_event/builtin_categories.h +++ b/base/trace_event/builtin_categories.h @@ -128,6 +128,7 @@ PERFETTO_DEFINE_CATEGORIES_IN_NAMESPACE_WITH_ATTRS( diff --git a/patches/chromium/build_disable_thin_lto_mac.patch b/patches/chromium/build_disable_thin_lto_mac.patch index 7633c53f6ca59..bfd759159ead3 100644 --- a/patches/chromium/build_disable_thin_lto_mac.patch +++ b/patches/chromium/build_disable_thin_lto_mac.patch @@ -11,7 +11,7 @@ This patch can (and should) be removed when we can prevent those symbols from being stripped in the release build. diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni -index 21bd22896d7bca4d4a133677286f7f8ad1b224f2..53654e4467fa4ae57ce42bd971b1be3a11654aaf 100644 +index 2cf6def300d9d92d476ca4ca792347a49bafc26a..8e54f1d3e50a2c56b0cf35a8e56f97f6622401d5 100644 --- a/build/config/compiler/compiler.gni +++ b/build/config/compiler/compiler.gni @@ -85,7 +85,7 @@ declare_args() { diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index 87522628ff215..b420ac279f8b7 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -11,10 +11,10 @@ if we ever align our .pak file generation with Chrome we can remove this patch. diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index e648bb4ed2ff72441faa8773e449e0b6174f5af5..fd2c1d3ac575d10de7d5c09e4418d17217a43b77 100644 +index 9bffa9c8272a81059eb05fa79107bb326029402c..d286e9ab4edf86570418d4b3699c8f2d720597e5 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn -@@ -195,11 +195,16 @@ if (!is_android && !is_mac) { +@@ -197,11 +197,16 @@ if (!is_android && !is_mac) { "common/crash_keys.h", ] @@ -33,10 +33,10 @@ index e648bb4ed2ff72441faa8773e449e0b6174f5af5..fd2c1d3ac575d10de7d5c09e4418d172 "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 790764062094479f25b33a0dfa3e143472e0a077..a9997872138b2d58d279103e4cac3c92f2091f0a 100644 +index 94eae061ad314f536385f0f05ac345d502f60c7a..d65ac84e049de5da0b3b537defc4aaff52be65be 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4807,7 +4807,7 @@ static_library("browser") { +@@ -4800,7 +4800,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index 790764062094479f25b33a0dfa3e143472e0a077..a9997872138b2d58d279103e4cac3c92 # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 8bcc85cfd507f23c9651ea0a006fd6464ecd134f..92e88e0c8f764a779d7c899b423b589a0302b4bd 100644 +index 5dcaa1182c70ecf3f66d962da699005d0667c974..5542c65bd5bf2adba3c0f0a5a5019fea8077ac38 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7516,9 +7516,12 @@ test("unit_tests") { +@@ -7560,9 +7560,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index 8bcc85cfd507f23c9651ea0a006fd6464ecd134f..92e88e0c8f764a779d7c899b423b589a "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8430,6 +8433,10 @@ test("unit_tests") { +@@ -8492,6 +8495,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index 8bcc85cfd507f23c9651ea0a006fd6464ecd134f..92e88e0c8f764a779d7c899b423b589a sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8486,7 +8493,6 @@ test("unit_tests") { +@@ -8548,7 +8555,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/build_gn.patch b/patches/chromium/build_gn.patch index 232bd3bb28e9d..c5bf815419783 100644 --- a/patches/chromium/build_gn.patch +++ b/patches/chromium/build_gn.patch @@ -7,7 +7,7 @@ These are variables we add to the root BUILDCONFIG so that they're available everywhere, without having to import("//electron/.../flags.gni"). diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn -index 24a1d143954ae05ae0b79b0994b76ef9218fb848..5c9b2ed8ba48a1056560ca1cd1d5b976aee4815c 100644 +index 29b0bbeae4dd412876fdaa15688bd248c93216b4..1a1b2fa45cf6e565359ae84256e6dbe5246322c5 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -123,6 +123,9 @@ if (current_os == "") { diff --git a/patches/chromium/build_libc_as_static_library.patch b/patches/chromium/build_libc_as_static_library.patch index ea4ccf914b463..3a76bbc171799 100644 --- a/patches/chromium/build_libc_as_static_library.patch +++ b/patches/chromium/build_libc_as_static_library.patch @@ -7,10 +7,10 @@ Build libc++ as static library to compile and pass nan tests diff --git a/buildtools/third_party/libc++/BUILD.gn b/buildtools/third_party/libc++/BUILD.gn -index 7dcefd2bceb209c6e74445259fac00e3e2280ff7..3a233d2e9dafc2093ead8f9c9104d06fe6176252 100644 +index c0c6cfb94338c6a75010e1b5de4cb6323b5afd12..903a5a0d9f7b7a7f9f4c44ef69e85eb922569365 100644 --- a/buildtools/third_party/libc++/BUILD.gn +++ b/buildtools/third_party/libc++/BUILD.gn -@@ -841,6 +841,7 @@ target(libcxx_target_type, "libc++") { +@@ -481,6 +481,7 @@ target(libcxx_target_type, "libc++") { # need to explicitly depend on libc++. visibility = [ "//build/config:common_deps", diff --git a/patches/chromium/build_set_mac_sdk_minimum_to_10.patch b/patches/chromium/build_set_mac_sdk_minimum_to_10.patch deleted file mode 100644 index 532be18ac425a..0000000000000 --- a/patches/chromium/build_set_mac_sdk_minimum_to_10.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Keeley Hammond <khammond@slack-corp.com> -Date: Tue, 1 Jul 2025 15:40:02 -0700 -Subject: build: Set MacOS SDK minimum back to 10 - -This commit reverts 6493969: Update mac_sdk_min to -match minimum required SDK version | -https://chromium-review.googlesource.com/c/chromium/src/+/6493969 - -This patch is purely to unblock nightlies while -we merge an upstream fix and allocate additional space -on the Mac runners. If this patch is still in main -anytime after July 30, 2025, find @VerteDinde and yell -at her. - -diff --git a/build/config/mac/mac_sdk_overrides.gni b/build/config/mac/mac_sdk_overrides.gni -index 8f8ac1c218ce15fa5c1aecbbcd0b93281f6c52f2..15ddfd5cffbaba0704b3217e1ae4f2825f399d96 100644 ---- a/build/config/mac/mac_sdk_overrides.gni -+++ b/build/config/mac/mac_sdk_overrides.gni -@@ -7,5 +7,5 @@ - - declare_args() { - # Minimum supported version of the Mac SDK. -- mac_sdk_min = "15" -+ mac_sdk_min = "10.15" - } diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 50b6f011f1f4f..afc2217f45a46 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,10 +9,10 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 25bc5fd2f2158b95a7d6dff6a9a30c967c052149..ff0406154e44a3b12ec732e836fc1e65dadfd326 100644 +index d694d115b452e1cf9fd803d2d32e797001fc8181..15e2f327060adeb32e977a8a371604819fe01108 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -9826,6 +9826,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -9865,6 +9865,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To<Referrer>(), params->frame_name, params->disposition, *params->features, @@ -21,10 +21,10 @@ index 25bc5fd2f2158b95a7d6dff6a9a30c967c052149..ff0406154e44a3b12ec732e836fc1e65 &no_javascript_access); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 29597a3a6f01fcff65de5624e583b03a1e34dd6f..6c067803c35a4e98ec99df6e28015f3b36e67e4f 100644 +index d7f46a132a23473615ac10184bffa00df6853758..655b289b783a8c35fb85fed715501b25a23acc85 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5319,6 +5319,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5323,6 +5323,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( create_params.initially_hidden = renderer_started_hidden; create_params.initial_popup_url = params.target_url; @@ -35,7 +35,7 @@ index 29597a3a6f01fcff65de5624e583b03a1e34dd6f..6c067803c35a4e98ec99df6e28015f3b // Even though all codepaths leading here are in response to a renderer // trying to open a new window, if the new window ends up in a different // browsing instance, then the RenderViewHost, RenderWidgetHost, -@@ -5373,6 +5377,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5377,6 +5381,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( // Sets the newly created WebContents WindowOpenDisposition. new_contents_impl->original_window_open_disposition_ = params.disposition; @@ -48,7 +48,7 @@ index 29597a3a6f01fcff65de5624e583b03a1e34dd6f..6c067803c35a4e98ec99df6e28015f3b // If the new frame has a name, make sure any SiteInstances that can find // this named frame have proxies for it. Must be called after // SetSessionStorageNamespace, since this calls CreateRenderView, which uses -@@ -5414,12 +5424,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5418,12 +5428,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( AddWebContentsDestructionObserver(new_contents_impl); } @@ -77,10 +77,10 @@ index 15a83f61ed4e31ba34cbc19995cd9d68b1599f1d..9cf9fefad46a6c2ead4085adc76e0c07 // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 9d950e48dca63c6ec6899674cdfa98b1b4847542..fd15151cbe0c67164f07a730668f9b5ad0af2f40 100644 +index 68bafbcd65301fd26f18e433057d69ae9d63a078..8a199da3b79672d900efa3ae2a721ef74481d7fc 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -885,6 +885,8 @@ bool ContentBrowserClient::CanCreateWindow( +@@ -875,6 +875,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -90,10 +90,10 @@ index 9d950e48dca63c6ec6899674cdfa98b1b4847542..fd15151cbe0c67164f07a730668f9b5a bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 6dbfa4f14a5a610b49e58193f50d7337c998e7e1..f93858d6cb4cb89075e9ed7ee50f4e86df37c279 100644 +index 7658c8045ad4687ffc2923061ee8310bf76c1190..22b1bcac984a5f0e7140693a9c8ff586f12afe24 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -201,6 +201,7 @@ class NetworkService; +@@ -196,6 +196,7 @@ class NetworkService; class TrustedURLLoaderHeaderClient; } // namespace mojom struct ResourceRequest; @@ -101,7 +101,7 @@ index 6dbfa4f14a5a610b49e58193f50d7337c998e7e1..f93858d6cb4cb89075e9ed7ee50f4e86 } // namespace network namespace sandbox { -@@ -1458,6 +1459,8 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -1448,6 +1449,8 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -111,7 +111,7 @@ index 6dbfa4f14a5a610b49e58193f50d7337c998e7e1..f93858d6cb4cb89075e9ed7ee50f4e86 bool opener_suppressed, bool* no_javascript_access); diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index 87e310a5473bec20b1326f3202cf2bf603227c04..968cddc769e2bf0bb56359b36bc03cbce6539da1 100644 +index edee20df7f5bb087df9c134c7892f4befe2f14b9..df972f1ce594f2d4651202b650ff2d41fe19ecd0 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc @@ -34,6 +34,17 @@ namespace content { @@ -133,7 +133,7 @@ index 87e310a5473bec20b1326f3202cf2bf603227c04..968cddc769e2bf0bb56359b36bc03cbc WebContents* source, const OpenURLParams& params, diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 16ce42f605513b641cc2ac07e34bfe3a017c5a7a..23b9c84175fd44f0da2ef398c8bf68cf6e3d3ef8 100644 +index caf97e0c94edfa1106b465e793190c82f646ebdb..38b61d04446736bcc44a412f633c01ed9aca5399 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -18,6 +18,7 @@ @@ -170,10 +170,10 @@ index 16ce42f605513b641cc2ac07e34bfe3a017c5a7a..23b9c84175fd44f0da2ef398c8bf68cf // typically happens when popups are created. virtual void WebContentsCreated(WebContents* source_contents, diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 12047149fcd73050b5ee6645fa269153daf1836f..a0aa3ec64b54b99508d1ba9cd52e2fe0e53ed56c 100644 +index 9d56818917c764d0c78861e3ce58e4507640bf97..dcfe69d2c719db9e9b1f612275ea2e95f5e632b0 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -6776,6 +6776,10 @@ WebView* RenderFrameImpl::CreateNewWindow( +@@ -6800,6 +6800,10 @@ WebView* RenderFrameImpl::CreateNewWindow( request.HasUserGesture(), GetWebFrame()->IsAdFrame(), GetWebFrame()->IsAdScriptInStack()); @@ -185,10 +185,10 @@ index 12047149fcd73050b5ee6645fa269153daf1836f..a0aa3ec64b54b99508d1ba9cd52e2fe0 // moved on send. bool is_background_tab = diff --git a/content/web_test/browser/web_test_content_browser_client.cc b/content/web_test/browser/web_test_content_browser_client.cc -index 66a10226b043a490295e518230c20bba0ed71d6c..14b78014d93ce459789fd497dfcfb71e2cc769bd 100644 +index 576fd50ec4c27c6c2da9674e68f65fd0a21d1d68..b44304f128fb97523c9c9046b5edece8c09c5c0f 100644 --- a/content/web_test/browser/web_test_content_browser_client.cc +++ b/content/web_test/browser/web_test_content_browser_client.cc -@@ -537,6 +537,8 @@ bool WebTestContentBrowserClient::CanCreateWindow( +@@ -538,6 +538,8 @@ bool WebTestContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -232,10 +232,10 @@ index 82e9d3dfb5f7da76d89fe15ae61d379fa46e177d..fd035512099a54dff6cc951a2226c23a } // namespace blink diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc -index 68ab3d483fe60671de50ec8952a0f71f103e4ad3..7ea5e45c08d7af439cf3eec041391ed7902ec865 100644 +index 0dcd971d7176e45ae24112f015e69868fc2cd247..2f757adca556d6a038cba0c1f13265eaf1a41ec4 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc -@@ -2333,6 +2333,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, +@@ -2363,6 +2363,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, WebWindowFeatures window_features = GetWindowFeaturesFromString(features, entered_window); diff --git a/patches/chromium/chore_add_electron_deps_to_gitignores.patch b/patches/chromium/chore_add_electron_deps_to_gitignores.patch index 95dcb3362dede..0989313d3805b 100644 --- a/patches/chromium/chore_add_electron_deps_to_gitignores.patch +++ b/patches/chromium/chore_add_electron_deps_to_gitignores.patch @@ -6,10 +6,10 @@ Subject: chore: add electron deps to gitignores Makes things like "git status" quicker when developing electron locally diff --git a/.gitignore b/.gitignore -index 5eb6e4d1815a7a56c7fff1d6f095e6c7e8127b84..808d897ba80abb9cced32a02cb7026305afe0dd2 100644 +index 22985d0edf211adc576c14ddb0fb21192a636d99..210132f7864c04ac7ffab70875b1c8905bd00e62 100644 --- a/.gitignore +++ b/.gitignore -@@ -226,6 +226,7 @@ vs-chromium-project.txt +@@ -228,6 +228,7 @@ vs-chromium-project.txt /data /delegate_execute /device/serial/device_serial_mojo.xml @@ -18,7 +18,7 @@ index 5eb6e4d1815a7a56c7fff1d6f095e6c7e8127b84..808d897ba80abb9cced32a02cb702630 /google_apis/gcm/gcm.xml /googleurl diff --git a/third_party/.gitignore b/third_party/.gitignore -index 21adf9c5bd1887e765659a81192338de49028c71..1e64aca78c8609dd9de22d023622f14f58489364 100644 +index 6be9e9e6feeedd0d1f566758e8da75870bc1d9c7..a0bacf9e5c4809d76093c449065d7f4f5bb47b02 100644 --- a/third_party/.gitignore +++ b/third_party/.gitignore @@ -45,7 +45,9 @@ @@ -31,7 +31,7 @@ index 21adf9c5bd1887e765659a81192338de49028c71..1e64aca78c8609dd9de22d023622f14f /espresso/lib/ /eyesfree/src /fast_float/src -@@ -93,6 +95,7 @@ +@@ -94,6 +96,7 @@ /mocha /mockito/src /nacl_sdk_binaries/ @@ -39,7 +39,7 @@ index 21adf9c5bd1887e765659a81192338de49028c71..1e64aca78c8609dd9de22d023622f14f /ninja /node/*.tar.gz /node/linux/ -@@ -138,7 +141,7 @@ +@@ -139,7 +142,7 @@ /spirv-cross/src /spirv-headers/src /spirv-tools/src diff --git a/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch b/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch index d34c190f251d0..f1a97c8284234 100644 --- a/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch +++ b/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch @@ -8,13 +8,13 @@ electron objects that extend gin::Wrappable and gets allocated on the cpp heap diff --git a/gin/public/wrappable_pointer_tags.h b/gin/public/wrappable_pointer_tags.h -index 80ec409efe1635390887d1324be661643818abff..7b23fbcb16958a37a3ad4d313326c0cd37bf05d4 100644 +index a507d1d837ab3ec2b2d3ae7978d9d410ab2ec2d1..6918722e9a3bc0fc885c6ed87ed12dcc07d2cc72 100644 --- a/gin/public/wrappable_pointer_tags.h +++ b/gin/public/wrappable_pointer_tags.h -@@ -66,7 +66,13 @@ enum WrappablePointerTag : uint16_t { - kTextInputControllerBindings, // content::TextInputControllerBindings - kWebAXObjectProxy, // content::WebAXObjectProxy - kWrappedExceptionHandler, // extensions::WrappedExceptionHandler +@@ -72,7 +72,13 @@ enum WrappablePointerTag : uint16_t { + kTextInputControllerBindings, // content::TextInputControllerBindings + kWebAXObjectProxy, // content::WebAXObjectProxy + kWrappedExceptionHandler, // extensions::WrappedExceptionHandler - kLastPointerTag = kWrappedExceptionHandler, + kElectronApp, // electron::api::App + kElectronDebugger, // electron::api::Debugger diff --git a/patches/chromium/chore_disable_protocol_handler_dcheck.patch b/patches/chromium/chore_disable_protocol_handler_dcheck.patch new file mode 100644 index 0000000000000..98a7fa4019475 --- /dev/null +++ b/patches/chromium/chore_disable_protocol_handler_dcheck.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Samuel Maddock <smaddock@slack-corp.com> +Date: Thu, 9 Oct 2025 22:07:38 -0400 +Subject: chore: disable protocol handler dcheck + +https://chromium-review.googlesource.com/c/chromium/src/+/6727594 + +The above CL introduces a new extensions API to register custom protocol +handlers. A DCHECK causes Electron to crash until we provide our own +registry. This patch disables the check until we support this. + +diff --git a/extensions/browser/api/protocol_handlers/protocol_handlers_manager.cc b/extensions/browser/api/protocol_handlers/protocol_handlers_manager.cc +index 902cf488c7d84923365c4197a70b06e61e3af038..dce80684853f89a68a2d21997102f48feb3df8f8 100644 +--- a/extensions/browser/api/protocol_handlers/protocol_handlers_manager.cc ++++ b/extensions/browser/api/protocol_handlers/protocol_handlers_manager.cc +@@ -129,7 +129,12 @@ void ProtocolHandlersManager::ProtocolHandlersSanityCheck() { + auto* ph_registry = + ExtensionsBrowserClient::Get()->GetProtocolHandlerRegistry( + browser_context_); +- DCHECK(ph_registry); ++ ++ // TODO(samuelmaddock): Add support for extensions protocol handler. For now, ++ // let's ignore this. ++ if (!ph_registry) ++ return; ++ + for (const auto& handler : ph_registry->GetExtensionProtocolHandlers()) { + DCHECK(handler.extension_id()); + if (!enabled_ids.contains(*handler.extension_id())) { diff --git a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch index 542b72f1693fc..2d8f9f31f54da 100644 --- a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch +++ b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch @@ -20,10 +20,10 @@ index 79d59c3f4d3d2d5ff39bd65ded489183247656a8..20b49742578ccf363738ee032228f30a int64_t service_worker_version_id, const GURL& service_worker_scope, diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h -index 18714ce8fc27c8d56c5deac27ba335078c452d0a..263405c605a0477b7a39bc274d7ee03be0b9cac5 100644 +index 0cba9fb59a62f00fb726850ba9901c2887cc8431..855a1f3633c7b4dae539930e979d2dbb8a1b4e83 100644 --- a/content/public/renderer/render_frame_observer.h +++ b/content/public/renderer/render_frame_observer.h -@@ -141,7 +141,8 @@ class CONTENT_EXPORT RenderFrameObserver { +@@ -143,7 +143,8 @@ class CONTENT_EXPORT RenderFrameObserver { int32_t world_id) {} virtual void DidInstallConditionalFeatures(v8::Local<v8::Context> context, int32_t world_id) {} @@ -34,10 +34,10 @@ index 18714ce8fc27c8d56c5deac27ba335078c452d0a..263405c605a0477b7a39bc274d7ee03b virtual void DidClearWindowObject() {} virtual void DidChangeScrollOffset() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index f337d61906651359eeb5228c112ad948f4f7a752..82cbd10f0817a85d1275519a3f93c687c0314aaa 100644 +index 230697a116c26b137c05e234824aded3ae5295af..00f38d0e17449c6c05f2ff9609d3719215f59bfa 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4684,10 +4684,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( +@@ -4707,10 +4707,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( observer.DidInstallConditionalFeatures(context, world_id); } @@ -52,10 +52,10 @@ index f337d61906651359eeb5228c112ad948f4f7a752..82cbd10f0817a85d1275519a3f93c687 void RenderFrameImpl::DidChangeScrollOffset() { diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index f0f4335aa815ea50dbf9b720b41e4eb31f27fb90..319f222565e4ef25206cc44d33ec5e291b8ea089 100644 +index 611283f006f96af3c40cbf947505b02ad8ee3438..b7574fc57c43b6d85fb3b6e2c7e7e34f1bd79257 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -604,7 +604,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -605,7 +605,8 @@ class CONTENT_EXPORT RenderFrameImpl int world_id) override; void DidInstallConditionalFeatures(v8::Local<v8::Context> context, int world_id) override; @@ -66,10 +66,10 @@ index f0f4335aa815ea50dbf9b720b41e4eb31f27fb90..319f222565e4ef25206cc44d33ec5e29 void DidChangeScrollOffset() override; blink::WebMediaStreamDeviceObserver* MediaStreamDeviceObserver() override; diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc -index 37691ecee7a72b2ec47ff575239f628116cf136b..c67e3faf7440514e203e5b15a68fc34525a045a2 100644 +index bf221ce102ea9ca25655f14a7cd90c625799d4b0..c4d81b211016616f6cbbdfcfae6620d4931ce775 100644 --- a/content/renderer/service_worker/service_worker_context_client.cc +++ b/content/renderer/service_worker/service_worker_context_client.cc -@@ -318,6 +318,7 @@ void ServiceWorkerContextClient::WorkerContextStarted( +@@ -322,6 +322,7 @@ void ServiceWorkerContextClient::WorkerContextStarted( } void ServiceWorkerContextClient::WillEvaluateScript( @@ -77,7 +77,7 @@ index 37691ecee7a72b2ec47ff575239f628116cf136b..c67e3faf7440514e203e5b15a68fc345 v8::Local<v8::Context> v8_context) { DCHECK(worker_task_runner_->RunsTasksInCurrentSequence()); start_timing_->script_evaluation_start_time = base::TimeTicks::Now(); -@@ -336,8 +337,8 @@ void ServiceWorkerContextClient::WillEvaluateScript( +@@ -340,8 +341,8 @@ void ServiceWorkerContextClient::WillEvaluateScript( DCHECK(proxy_); GetContentClient()->renderer()->WillEvaluateServiceWorkerOnWorkerThread( @@ -89,10 +89,10 @@ index 37691ecee7a72b2ec47ff575239f628116cf136b..c67e3faf7440514e203e5b15a68fc345 void ServiceWorkerContextClient::DidEvaluateScript(bool success) { diff --git a/content/renderer/service_worker/service_worker_context_client.h b/content/renderer/service_worker/service_worker_context_client.h -index 1f5e24bc38d6ced52e4773236522e9520efc6f6d..a22ca5968fce5e6a0c436ec9b40f0e2f7c1482cf 100644 +index 2f3ba35491d17aa76f9baf8ba1cd53680a923654..477c6ac5a77c69cc4f062366c52adff3a36bdc76 100644 --- a/content/renderer/service_worker/service_worker_context_client.h +++ b/content/renderer/service_worker/service_worker_context_client.h -@@ -165,7 +165,8 @@ class ServiceWorkerContextClient +@@ -168,7 +168,8 @@ class ServiceWorkerContextClient void WorkerContextStarted( blink::WebServiceWorkerContextProxy* proxy, scoped_refptr<base::SequencedTaskRunner> worker_task_runner) override; @@ -103,7 +103,7 @@ index 1f5e24bc38d6ced52e4773236522e9520efc6f6d..a22ca5968fce5e6a0c436ec9b40f0e2f void WillInitializeWorkerContext() override; void WillDestroyWorkerContext(v8::Local<v8::Context> context) override; diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc -index 22fdb490c7803f3bf864d9e0e6dc618e4d83480b..3f3367b5039e28b07acd1b326724958d764171c2 100644 +index 7b5398b4199ce6df9e1c9624771a5444d7f07eb3..77f896aa6a53bf7d277b963fba54d623eed8068b 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc @@ -615,6 +615,7 @@ void Dispatcher::DidInitializeServiceWorkerContextOnWorkerThread( @@ -167,10 +167,10 @@ index f96781a047056876b030581b539be0507acc3a1c..cd9be80be2500a001b1895c81ee597dd // Called when initial script evaluation finished for the main script. // |success| is true if the evaluation completed with no uncaught exception. diff --git a/third_party/blink/public/web/web_local_frame_client.h b/third_party/blink/public/web/web_local_frame_client.h -index 52e8828d8fffaba8ab05436cb4d727595f18238a..6743653f5018c06d3e173aaacdca7275c6ec703f 100644 +index d5a86fa3b41c9f4bf294cfdf7e210da05f7ae2e9..faeacf7fc8aac20b950acebd3ff8d29c17f7b4b9 100644 --- a/third_party/blink/public/web/web_local_frame_client.h +++ b/third_party/blink/public/web/web_local_frame_client.h -@@ -665,7 +665,8 @@ class BLINK_EXPORT WebLocalFrameClient { +@@ -671,7 +671,8 @@ class BLINK_EXPORT WebLocalFrameClient { int32_t world_id) {} // WebKit is about to release its reference to a v8 context for a frame. diff --git a/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch b/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch index 85ceeb9344017..785a321a67e05 100644 --- a/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch +++ b/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch @@ -10,7 +10,7 @@ Subject: chore: "grandfather in" Electron Views and Delegates 6448510: Lock further access to View::set_owned_by_client(). | https://chromium-review.googlesource.com/c/chromium/src/+/6448510 diff --git a/ui/views/view.h b/ui/views/view.h -index 7f70b4f6062e369e2198fc12ff507786283a13c7..22cae8f202357d848bd57aff1ee22abfcc6efed6 100644 +index 4fada89e37b9c63f7690fbbdd2ef4ecf86b5d756..73dd5aa59d8d1bb05aaed080e27426cc58da2d61 100644 --- a/ui/views/view.h +++ b/ui/views/view.h @@ -81,6 +81,19 @@ class ArcNotificationContentView; @@ -49,7 +49,7 @@ index 7f70b4f6062e369e2198fc12ff507786283a13c7..22cae8f202357d848bd57aff1ee22abf // These existing cases are "grandfathered in", but there shouldn't be more. // See comments atop class. diff --git a/ui/views/widget/widget_delegate.h b/ui/views/widget/widget_delegate.h -index ff9c5abfdb02d9798b1491e2bbc296f2c7c74398..47d8a897d58b0d3829734105e81b887684dd009b 100644 +index 1f9c24adbdbe5d2bbd72099d234569c9fdbf863d..b437dd07f15f99cfaa35874f69fd4f19a1b343ba 100644 --- a/ui/views/widget/widget_delegate.h +++ b/ui/views/widget/widget_delegate.h @@ -168,6 +168,12 @@ namespace crostini { @@ -81,7 +81,7 @@ index ff9c5abfdb02d9798b1491e2bbc296f2c7c74398..47d8a897d58b0d3829734105e81b8876 // DO NOT ADD TO THIS LIST! // These existing cases are "grandfathered in", but there shouldn't be more. // See comments atop `RegisterDeleteDelegateCallback()`. -@@ -921,6 +929,7 @@ class VIEWS_EXPORT WidgetDelegateView : public WidgetDelegate, public View { +@@ -920,6 +928,7 @@ class VIEWS_EXPORT WidgetDelegateView : public WidgetDelegate, public View { View* GetContentsView() override; private: diff --git a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch index b5342d88212d0..124a50731be21 100644 --- a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch +++ b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch @@ -34,10 +34,10 @@ index 2dc44d4787d5198cff7be2cf98ad5acf2d3a9a0b..27a0335aac2bd4239616cf71f5d015c9 class ScrollEvent; diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index c60e51f4e1a789caf5ad9c54e496f3e72a327b51..f4fa30c1621e2eb78913ea97a993eb0a3528f36c 100644 +index d2651f4fcbb7991e9ec8f164e5bee51dab405c5a..d58b59288d881a2d74ea357f1e9e27870d24ac72 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -@@ -1363,6 +1363,10 @@ HBRUSH DesktopWindowTreeHostWin::GetBackgroundPaintBrush() { +@@ -1378,6 +1378,10 @@ HBRUSH DesktopWindowTreeHostWin::GetBackgroundPaintBrush() { return background_paint_brush_; } @@ -49,10 +49,10 @@ index c60e51f4e1a789caf5ad9c54e496f3e72a327b51..f4fa30c1621e2eb78913ea97a993eb0a DesktopWindowTreeHostWin::GetSingletonDesktopNativeCursorManager() { return new DesktopNativeCursorManagerWin(); diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -index baee602a2ce7207ba937c4e46ad8b896bec7ca92..cef7afbf408e38798c398c23dc3e964bd1d95d17 100644 +index b65ced55f997d5064b9d9338190567f8c264fce8..e8acd2828ed05deefa335ce2bb461f0c3be8d7b7 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -@@ -272,6 +272,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin +@@ -273,6 +273,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin void HandleWindowScaleFactorChanged(float window_scale_factor) override; void HandleHeadlessWindowBoundsChanged(const gfx::Rect& bounds) override; HBRUSH GetBackgroundPaintBrush() override; @@ -61,10 +61,10 @@ index baee602a2ce7207ba937c4e46ad8b896bec7ca92..cef7afbf408e38798c398c23dc3e964b Widget* GetWidget(); const Widget* GetWidget() const; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 8c70c5ecef8c352e7cd5b9a986bd45d670760069..b06c3ac425bb1f20b890447ed3315127195ed253 100644 +index 5376a8278a4cc784ad69cda6594c5055847c1f22..1005d553d39909bdf7c2c7b1b714c58861ba747d 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -3244,15 +3244,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -3240,15 +3240,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, } // We must let Windows handle the caption buttons if it's drawing them, or // they won't work. @@ -86,7 +86,7 @@ index 8c70c5ecef8c352e7cd5b9a986bd45d670760069..b06c3ac425bb1f20b890447ed3315127 return 0; } } -@@ -3275,6 +3279,7 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -3271,6 +3275,7 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, // handle alt-space, or in the frame itself. is_right_mouse_pressed_on_caption_ = false; ReleaseCapture(); @@ -94,7 +94,7 @@ index 8c70c5ecef8c352e7cd5b9a986bd45d670760069..b06c3ac425bb1f20b890447ed3315127 // |point| is in window coordinates, but WM_NCHITTEST and TrackPopupMenu() // expect screen coordinates. POINT screen_point = CR_POINT_INITIALIZER_FROM_LPARAM(l_param); -@@ -3282,7 +3287,17 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -3278,7 +3283,17 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, w_param = static_cast<WPARAM>(SendMessage( hwnd(), WM_NCHITTEST, 0, MAKELPARAM(screen_point.x, screen_point.y))); if (w_param == HTCAPTION || w_param == HTSYSMENU) { @@ -114,10 +114,10 @@ index 8c70c5ecef8c352e7cd5b9a986bd45d670760069..b06c3ac425bb1f20b890447ed3315127 } } else if (message == WM_NCLBUTTONDOWN && diff --git a/ui/views/win/hwnd_message_handler_delegate.h b/ui/views/win/hwnd_message_handler_delegate.h -index 5e075296a09099e419fcbf7af2772767592edcd8..459339a4c0f0534f4c0ca8ddcb087fc75465beca 100644 +index 20cfb50af8d5131ca87d1fafce6f2ab43771f67b..eee40a56bebe52187a35daacfc788bf2f1f27e29 100644 --- a/ui/views/win/hwnd_message_handler_delegate.h +++ b/ui/views/win/hwnd_message_handler_delegate.h -@@ -256,6 +256,10 @@ class VIEWS_EXPORT HWNDMessageHandlerDelegate { +@@ -260,6 +260,10 @@ class VIEWS_EXPORT HWNDMessageHandlerDelegate { // if the default should be used. virtual HBRUSH GetBackgroundPaintBrush() = 0; diff --git a/patches/chromium/chore_partial_revert_of.patch b/patches/chromium/chore_partial_revert_of.patch index 1dfc25fe46250..b63588068605a 100644 --- a/patches/chromium/chore_partial_revert_of.patch +++ b/patches/chromium/chore_partial_revert_of.patch @@ -14,10 +14,10 @@ track down the source of this problem & figure out if we can fix it by changing something in Electron. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index d30a9d94cfc30035b39d510ded65f271c9c51bb1..705e848acfc76a6b2e3a4dffb9e8ae8f86d54cbc 100644 +index 366399484c0ff72362fd246dc36182e611954283..a257bc1480369f24b05db19bd2bfce064b96407d 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5290,7 +5290,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5294,7 +5294,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( : IsGuest(); // While some guest types do not have a guest SiteInstance, the ones that // don't all override WebContents creation above. diff --git a/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch b/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch index c3d02ba0c34f2..51ad19374307d 100644 --- a/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch +++ b/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch @@ -14,10 +14,10 @@ This change patches it out to prevent the DCHECK. It can be removed once/if we see a better solution to the problem. diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc -index 19a127d46584ece213442b24beaa6ec45bf3fa14..d8045edd0a207b41e60dbae66a0f50eec31b2d8a 100644 +index 484e275ec026af5be17fea9b9dcc540a9aa67535..2eb1296d1e845341352e21445916857878a9d409 100644 --- a/content/browser/site_instance_impl.cc +++ b/content/browser/site_instance_impl.cc -@@ -226,7 +226,7 @@ scoped_refptr<SiteInstanceImpl> SiteInstanceImpl::CreateForGuest( +@@ -227,7 +227,7 @@ scoped_refptr<SiteInstanceImpl> SiteInstanceImpl::CreateForGuest( BrowserContext* browser_context, const StoragePartitionConfig& partition_config) { DCHECK(browser_context); diff --git a/patches/chromium/chore_patch_out_profile_methods.patch b/patches/chromium/chore_patch_out_profile_methods.patch index 0ac846aec6f25..94fccb3a56c84 100644 --- a/patches/chromium/chore_patch_out_profile_methods.patch +++ b/patches/chromium/chore_patch_out_profile_methods.patch @@ -7,7 +7,7 @@ Electron does not support Profiles, so we need to patch it out of any code that we use. diff --git a/chrome/browser/pdf/chrome_pdf_stream_delegate.cc b/chrome/browser/pdf/chrome_pdf_stream_delegate.cc -index c390a83277f564f1a67a7dcffa36b9d77a35bc0b..b13273a4b194ad5e8ca2d1639ebca831f9607b1e 100644 +index bd19708922b3d9224cc3a05f515c455ce4fb1e69..7198d9f9b22c8725c7ecdf6931ff36859ffaf506 100644 --- a/chrome/browser/pdf/chrome_pdf_stream_delegate.cc +++ b/chrome/browser/pdf/chrome_pdf_stream_delegate.cc @@ -45,6 +45,7 @@ namespace { @@ -27,10 +27,10 @@ index c390a83277f564f1a67a7dcffa36b9d77a35bc0b..b13273a4b194ad5e8ca2d1639ebca831 // When the enterprise policy is not set, use finch/feature flag choice. return base::FeatureList::IsEnabled( diff --git a/chrome/browser/pdf/pdf_extension_util.cc b/chrome/browser/pdf/pdf_extension_util.cc -index 8f124aa7a67717f3efc52d22dfcef0776ff4cad3..d21e5b49f3a06c5f78e38b45e8be89530fdfd435 100644 +index 8d881dc81d30babc5eed5bf512ad6b23858bab30..5ce3bea323d14d3d4a7b09ea08a477ae23439b53 100644 --- a/chrome/browser/pdf/pdf_extension_util.cc +++ b/chrome/browser/pdf/pdf_extension_util.cc -@@ -245,10 +245,13 @@ bool IsPrintingEnabled(content::BrowserContext* context) { +@@ -248,10 +248,13 @@ bool IsPrintingEnabled(content::BrowserContext* context) { #if BUILDFLAG(ENABLE_PDF_INK2) bool IsPdfAnnotationsEnabledByPolicy(content::BrowserContext* context) { diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index a2e92157eb6f6..afcd9e578a1b9 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -35,7 +35,7 @@ index 231e3595f218aeebe28d0b13ce6182e7a4d6f4e1..609bd205d1cd0404cab3471765bef8b0 content::RenderFrameHost* requesting_frame, const blink::mojom::FullscreenOptions& options) final; diff --git a/chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.cc b/chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.cc -index a17c406b59530a8f57f6cb48905a697dd208a41f..0e22e90c1d570eb4c86ac1f24c5a6e9159be8ea1 100644 +index 7f99bf8c0c79de2cb8a812a7bfe8b4255697444a..d39aee929900cca756a6293b782a44228725f6fc 100644 --- a/chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.cc +++ b/chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.cc @@ -80,8 +80,7 @@ class ChromeKeyboardContentsDelegate : public content::WebContentsDelegate, @@ -49,7 +49,7 @@ index a17c406b59530a8f57f6cb48905a697dd208a41f..0e22e90c1d570eb4c86ac1f24c5a6e91 } diff --git a/chrome/browser/ui/ash/web_view/ash_web_view_impl.cc b/chrome/browser/ui/ash/web_view/ash_web_view_impl.cc -index 08c84ca91f7e477e4e8d6370513d90d2fb9801f1..41e04444274f40fdedbf8d97bfd149f2ac682e53 100644 +index e4e42249c476ccae58f0ba42e7dbae299f1e36bd..670c30ed4b7f1a07eb4b8abaa95e5a8a9d94bd8d 100644 --- a/chrome/browser/ui/ash/web_view/ash_web_view_impl.cc +++ b/chrome/browser/ui/ash/web_view/ash_web_view_impl.cc @@ -121,10 +121,9 @@ bool AshWebViewImpl::IsWebContentsCreationOverridden( @@ -66,7 +66,7 @@ index 08c84ca91f7e477e4e8d6370513d90d2fb9801f1..41e04444274f40fdedbf8d97bfd149f2 /*from_user_gesture=*/true); return true; diff --git a/chrome/browser/ui/ash/web_view/ash_web_view_impl.h b/chrome/browser/ui/ash/web_view/ash_web_view_impl.h -index b6582b4013d9682d32bd524b4053b443a4df00f8..afcbce72e0f247b4d5a637b27c9f25d913cfa14b 100644 +index 39fa45f0a0f9076bd7ac0be6f455dd540a276512..3d0381d463eed73470b28085830f2a23751659a7 100644 --- a/chrome/browser/ui/ash/web_view/ash_web_view_impl.h +++ b/chrome/browser/ui/ash/web_view/ash_web_view_impl.h @@ -60,8 +60,7 @@ class AshWebViewImpl : public ash::AshWebView, @@ -80,20 +80,20 @@ index b6582b4013d9682d32bd524b4053b443a4df00f8..afcbce72e0f247b4d5a637b27c9f25d9 content::WebContents* source, const content::OpenURLParams& params, diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index 2b9d9a80fb34b5083b6b038ff12714ad6bd363d7..85197b1500bbcdfbd2286b32a0188c0ca2436e07 100644 +index 757db07950a0b179a105cb6201d21bed8b8fe3b8..6d45f2dcaff894836a0e8584ecb622275e02ae62 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc -@@ -2386,7 +2386,8 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2417,7 +2417,8 @@ bool Browser::IsWebContentsCreationOverridden( content::mojom::WindowContainerType window_container_type, const GURL& opener_url, const std::string& frame_name, - const GURL& target_url) { + const GURL& target_url, + const content::mojom::CreateNewWindowParams& params) { - if (actor::IsActorOperatingOnWebContents( - profile(), content::WebContents::FromRenderFrameHost(opener))) { - // If an ExecutionEngine is acting on the opener, prevent it from creating -@@ -2398,7 +2399,7 @@ bool Browser::IsWebContentsCreationOverridden( + if (HasActorTask(profile(), opener)) { + // If an ExecutionEngine is acting on the opener, prevent it from creating a + // new WebContents. We'll instead force the navigation to happen in the same +@@ -2430,7 +2431,7 @@ bool Browser::IsWebContentsCreationOverridden( return (window_container_type == content::mojom::WindowContainerType::BACKGROUND && ShouldCreateBackgroundContents(source_site_instance, opener_url, @@ -103,7 +103,7 @@ index 2b9d9a80fb34b5083b6b038ff12714ad6bd363d7..85197b1500bbcdfbd2286b32a0188c0c WebContents* Browser::CreateCustomWebContents( diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h -index b4ed72663324d359109813a5b22b6796568097f5..86153748bc72142aafc0b0b53d922e2d22d4d372 100644 +index 81a247cded1dd321f1003221f02a5c3a0c5a3312..037f5ecdf3a4437c935b90c45ef29536e0bfa2e3 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -954,8 +954,7 @@ class Browser : public TabStripModelObserver, @@ -145,10 +145,10 @@ index 3fc06be01f20e8cd314d95d73a3f58c2f0742fe9..c07910ae59a185442f37ea6e7b96fdf3 // The profile used for the presentation. raw_ptr<Profile, DanglingUntriaged> otr_profile_; diff --git a/chrome/browser/ui/views/hats/hats_next_web_dialog.cc b/chrome/browser/ui/views/hats/hats_next_web_dialog.cc -index 46382dbe43df6abb75ca7825de116d7ed2d1cea6..b07cfad74ec54ad251012dca57c8f44760ba13c1 100644 +index 3bbd4e568ba99245622a96f0801d2b6cd203025f..1e0b7d16b33daed980961dd49c667a3b254c186f 100644 --- a/chrome/browser/ui/views/hats/hats_next_web_dialog.cc +++ b/chrome/browser/ui/views/hats/hats_next_web_dialog.cc -@@ -103,8 +103,7 @@ class HatsNextWebDialog::HatsWebView : public views::WebView { +@@ -104,8 +104,7 @@ class HatsNextWebDialog::HatsWebView : public views::WebView { content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -159,7 +159,7 @@ index 46382dbe43df6abb75ca7825de116d7ed2d1cea6..b07cfad74ec54ad251012dca57c8f447 } content::WebContents* CreateCustomWebContents( diff --git a/components/embedder_support/android/delegate/web_contents_delegate_android.cc b/components/embedder_support/android/delegate/web_contents_delegate_android.cc -index 73008c08f2b4fd31636b0df232fc7cd66a69fcaf..a09bfe9af4cb4cd7e1e70b4df4900901a8336894 100644 +index 279f7501a197380dd63c8fe7827854b16d46e5f7..2b80f1970a067e91794a81fcc19e5be64b6b2944 100644 --- a/components/embedder_support/android/delegate/web_contents_delegate_android.cc +++ b/components/embedder_support/android/delegate/web_contents_delegate_android.cc @@ -205,14 +205,13 @@ bool WebContentsDelegateAndroid::IsWebContentsCreationOverridden( @@ -180,10 +180,10 @@ index 73008c08f2b4fd31636b0df232fc7cd66a69fcaf..a09bfe9af4cb4cd7e1e70b4df4900901 java_gurl); } diff --git a/components/embedder_support/android/delegate/web_contents_delegate_android.h b/components/embedder_support/android/delegate/web_contents_delegate_android.h -index fb21bd2cd47618838fb449df5fcf63ee28206146..b0faf6ee23fdc3b104e780e445202350fa155946 100644 +index 261d38394a9ff6f81848b94d6b183b2062c37ba9..0c6a26599bb8fef6f9ee6180fc0a98760d857b19 100644 --- a/components/embedder_support/android/delegate/web_contents_delegate_android.h +++ b/components/embedder_support/android/delegate/web_contents_delegate_android.h -@@ -84,8 +84,7 @@ class WebContentsDelegateAndroid : public content::WebContentsDelegate { +@@ -78,8 +78,7 @@ class WebContentsDelegateAndroid : public content::WebContentsDelegate { content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -222,10 +222,10 @@ index b969f1d97b7e3396119b579cfbe61e19ff7d2dd4..b8d6169652da28266a514938b45b39c5 content::WebContents* AddNewContents( content::WebContents* source, diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index d7cf36715b036c29d881c84a07c0d3b7f73d609f..11c0124b6f3f1599b5a56ba7817e946a871316cc 100644 +index e7a985973e1fd6ff51649d4e3fe802cc306c8f39..dfcb0be8195aab4df36c319c0996ec8a1a4f555e 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5253,8 +5253,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5257,8 +5257,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( if (delegate_ && delegate_->IsWebContentsCreationOverridden( opener, source_site_instance, params.window_container_type, @@ -236,7 +236,7 @@ index d7cf36715b036c29d881c84a07c0d3b7f73d609f..11c0124b6f3f1599b5a56ba7817e946a static_cast<WebContentsImpl*>(delegate_->CreateCustomWebContents( opener, source_site_instance, is_new_browsing_instance, diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index 968cddc769e2bf0bb56359b36bc03cbce6539da1..08c983ac6a8e5733431ba00e1288f6d6b087eee6 100644 +index df972f1ce594f2d4651202b650ff2d41fe19ecd0..a92305042eef86fbabeae6fe02b48668a349be99 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc @@ -160,8 +160,7 @@ bool WebContentsDelegate::IsWebContentsCreationOverridden( @@ -250,7 +250,7 @@ index 968cddc769e2bf0bb56359b36bc03cbce6539da1..08c983ac6a8e5733431ba00e1288f6d6 } diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 23b9c84175fd44f0da2ef398c8bf68cf6e3d3ef8..2e8e60c8ebe837fc68318bd5c13dbd0c873c4292 100644 +index 38b61d04446736bcc44a412f633c01ed9aca5399..3c982afb1af048618506a36ca3532b15720d8869 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -368,8 +368,7 @@ class CONTENT_EXPORT WebContentsDelegate { @@ -264,7 +264,7 @@ index 23b9c84175fd44f0da2ef398c8bf68cf6e3d3ef8..2e8e60c8ebe837fc68318bd5c13dbd0c // Allow delegate to creates a custom WebContents when // WebContents::CreateNewWindow() is called. This function is only called diff --git a/extensions/browser/guest_view/app_view/app_view_guest.cc b/extensions/browser/guest_view/app_view/app_view_guest.cc -index 3b1fe9ef59fbcd3684348fb518ce67210a639dc1..dc38462f8e29066bec4970cc820b8d6077106b85 100644 +index af80323215e2cb6ff7bdb802f8da4bdbe0067f71..187816751bde435e9c622921c457873d4b3172cd 100644 --- a/extensions/browser/guest_view/app_view/app_view_guest.cc +++ b/extensions/browser/guest_view/app_view/app_view_guest.cc @@ -153,8 +153,7 @@ bool AppViewGuest::IsWebContentsCreationOverridden( @@ -300,7 +300,7 @@ index 7695578f626f2a0c7fefae2bc1d5c35e5ac154f2..78958bff12ce41ae5ad77f43279a4b35 content::RenderFrameHost* opener, content::SiteInstance* source_site_instance, diff --git a/extensions/browser/guest_view/extension_options/extension_options_guest.cc b/extensions/browser/guest_view/extension_options/extension_options_guest.cc -index 5bd9d59a961a03f3cd3a806bc1af58c3eaee2b58..40d7ae8d6248163524a8c1350b625e107a8ae64a 100644 +index 0ab40dfd23d1071212c4d30d01fa8e7755458d4a..f032127a94c52beb3f509d6ea84c7e55f21084e2 100644 --- a/extensions/browser/guest_view/extension_options/extension_options_guest.cc +++ b/extensions/browser/guest_view/extension_options/extension_options_guest.cc @@ -263,8 +263,7 @@ bool ExtensionOptionsGuest::IsWebContentsCreationOverridden( @@ -328,7 +328,7 @@ index 56d86e3d1179df2d5f34eb6216989aef2687f49f..236f3ccf8354b156737e03929ee538f9 content::RenderFrameHost* opener, content::SiteInstance* source_site_instance, diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc -index 3e689ad6bdb51ccd7419eb87e4ba2cdbf2f1a8e9..c219b456721a43d9dfdf69612909a2d4f82cd33d 100644 +index 23705fa50cf79865b68d8352f6ec72444ca5233e..efa5e78ed92464a6d47319f7b2087555d683bd8c 100644 --- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc +++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc @@ -424,8 +424,7 @@ bool MimeHandlerViewGuest::IsWebContentsCreationOverridden( @@ -356,10 +356,10 @@ index 7eeffdfbda9611806c6f260f0c68f6d84689cb7e..5d8f6d132068d7fabaa52bc61354c71a content::RenderFrameHost* opener, content::SiteInstance* source_site_instance, diff --git a/fuchsia_web/webengine/browser/frame_impl.cc b/fuchsia_web/webengine/browser/frame_impl.cc -index fdc6afbf9048fa254d6f361b36765cf95d5eb521..16d297a3f6bde6bc4c038b79a057700aec68b689 100644 +index e3761e1de9031dafab2e26063d048ddfe784a682..d3ff31613f5ecfe3407d3088b25c0422e7e7a93c 100644 --- a/fuchsia_web/webengine/browser/frame_impl.cc +++ b/fuchsia_web/webengine/browser/frame_impl.cc -@@ -584,8 +584,7 @@ bool FrameImpl::IsWebContentsCreationOverridden( +@@ -585,8 +585,7 @@ bool FrameImpl::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -384,10 +384,10 @@ index 756d4192271d6a65cfe8e1511737c565b543cb1f..5688f6f745056565c3c01947f741c4d1 int opener_render_process_id, int opener_render_frame_id, diff --git a/headless/lib/browser/headless_web_contents_impl.cc b/headless/lib/browser/headless_web_contents_impl.cc -index 64ecdeb50b861825c9b55a930ff18c36818cad0b..e037d5607f8e1f3acb4ed018080de1b3357647be 100644 +index 00d3e4de6945e76761576eb95a66e4777f7f2f70..312559105d5de88d81edc917522aecb6a3890104 100644 --- a/headless/lib/browser/headless_web_contents_impl.cc +++ b/headless/lib/browser/headless_web_contents_impl.cc -@@ -206,8 +206,7 @@ class HeadlessWebContentsImpl::Delegate : public content::WebContentsDelegate { +@@ -207,8 +207,7 @@ class HeadlessWebContentsImpl::Delegate : public content::WebContentsDelegate { content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -398,10 +398,10 @@ index 64ecdeb50b861825c9b55a930ff18c36818cad0b..e037d5607f8e1f3acb4ed018080de1b3 ->options() ->block_new_web_contents(); diff --git a/ui/views/controls/webview/web_dialog_view.cc b/ui/views/controls/webview/web_dialog_view.cc -index 0e0f67908ca8c97bd0dfe4c4a8e008c74010c623..27ecb428739e2548a42f1485f8b7279a84f7190c 100644 +index f56882565de72fa9ab660b4a8d86f08c7392becd..439586a03288822bab8f5f21d0c38b678ed52fb6 100644 --- a/ui/views/controls/webview/web_dialog_view.cc +++ b/ui/views/controls/webview/web_dialog_view.cc -@@ -490,8 +490,7 @@ bool WebDialogView::IsWebContentsCreationOverridden( +@@ -489,8 +489,7 @@ bool WebDialogView::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -412,10 +412,10 @@ index 0e0f67908ca8c97bd0dfe4c4a8e008c74010c623..27ecb428739e2548a42f1485f8b7279a return delegate_->HandleShouldOverrideWebContentsCreation(); } diff --git a/ui/views/controls/webview/web_dialog_view.h b/ui/views/controls/webview/web_dialog_view.h -index 0fa7e807d22f6f04b84f2d949fbdf892b94996bf..b0490ae36c9999a766bbf346e35807740f4f9af6 100644 +index 720611a58300a0252d5dd66e1e7c98282dc82646..eb0abf978651266fe7e4d6a8e9af30024fceb7d1 100644 --- a/ui/views/controls/webview/web_dialog_view.h +++ b/ui/views/controls/webview/web_dialog_view.h -@@ -168,8 +168,7 @@ class WEBVIEW_EXPORT WebDialogView : public ClientView, +@@ -167,8 +167,7 @@ class WEBVIEW_EXPORT WebDialogView : public ClientView, content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, diff --git a/patches/chromium/chore_remove_check_is_test_on_script_injection_tracker.patch b/patches/chromium/chore_remove_check_is_test_on_script_injection_tracker.patch index 1fe8521334a1b..b42a7b6a64853 100644 --- a/patches/chromium/chore_remove_check_is_test_on_script_injection_tracker.patch +++ b/patches/chromium/chore_remove_check_is_test_on_script_injection_tracker.patch @@ -9,7 +9,7 @@ Electron when a session is non persistent we do not initialize the ExtensionSystem, so this check is not relevant for Electron. diff --git a/extensions/browser/script_injection_tracker.cc b/extensions/browser/script_injection_tracker.cc -index 09e5575f67c0a7484663d0ecbee5963be622cb8f..b206eca9426491921e6cacfad3fb764d474e7945 100644 +index 8331e06da9055fddd647dbe54051584b101286b0..6a9ddc0060dc272cd4511fc96f358005ad0ee043 100644 --- a/extensions/browser/script_injection_tracker.cc +++ b/extensions/browser/script_injection_tracker.cc @@ -177,7 +177,6 @@ std::vector<const UserScript*> GetLoadedDynamicScripts( diff --git a/patches/chromium/chore_restore_some_deprecated_wrapper_utility_in_gin.patch b/patches/chromium/chore_restore_some_deprecated_wrapper_utility_in_gin.patch index dea3bb87ee321..7aefe3cc744b1 100644 --- a/patches/chromium/chore_restore_some_deprecated_wrapper_utility_in_gin.patch +++ b/patches/chromium/chore_restore_some_deprecated_wrapper_utility_in_gin.patch @@ -9,10 +9,10 @@ Patch can be removed once cppgc migration is complete https://github.com/electron/electron/issues/47922 diff --git a/gin/function_template.h b/gin/function_template.h -index 84ab9585240a49048774811718f7ebd6f988e485..f062163cdd81def12fae7e507d18a9133dd0804d 100644 +index c80020b2bda2af39b38295dad3c6208cb8294b88..873015289db9709c00c32080e5387d9cdfea1f69 100644 --- a/gin/function_template.h +++ b/gin/function_template.h -@@ -77,6 +77,7 @@ class GIN_EXPORT CallbackHolderBase { +@@ -79,6 +79,7 @@ class GIN_EXPORT CallbackHolderBase { CallbackHolderBase* holder); ~DisposeObserver() override; void OnBeforeDispose(v8::Isolate* isolate) override; diff --git a/patches/chromium/command-ismediakey.patch b/patches/chromium/command-ismediakey.patch index d4a2145be0e61..cbf51b64bf9de 100644 --- a/patches/chromium/command-ismediakey.patch +++ b/patches/chromium/command-ismediakey.patch @@ -39,10 +39,10 @@ index e87c180342b967756efeb701c73207fcee8754f1..42e37564e585987d367921568f0f1d2b NOTREACHED(); } diff --git a/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_ozone.cc b/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_ozone.cc -index ac62aeecad617ce559d3248a61f3e19220d2e6bc..9e6b5b1c84ee1289fd3978fc7430f86b03165521 100644 +index ce768e551dd96678c04035503a481d375f5887bd..0cec5e73e4ae4441262461ba3c8446cdd8dc04a0 100644 --- a/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_ozone.cc +++ b/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener_ozone.cc -@@ -145,7 +145,8 @@ bool GlobalAcceleratorListenerOzone::StartListeningForAccelerator( +@@ -153,7 +153,8 @@ bool GlobalAcceleratorListenerOzone::StartListeningForAccelerator( const bool registered = platform_global_shortcut_listener_->RegisterAccelerator( accelerator.key_code(), accelerator.IsAltDown(), @@ -52,7 +52,7 @@ index ac62aeecad617ce559d3248a61f3e19220d2e6bc..9e6b5b1c84ee1289fd3978fc7430f86b if (registered) { registered_hot_keys_.insert(accelerator); } -@@ -160,14 +161,15 @@ void GlobalAcceleratorListenerOzone::StopListeningForAccelerator( +@@ -168,14 +169,15 @@ void GlobalAcceleratorListenerOzone::StopListeningForAccelerator( platform_global_shortcut_listener_->UnregisterAccelerator( accelerator.key_code(), accelerator.IsAltDown(), accelerator.IsCtrlDown(), @@ -70,7 +70,7 @@ index ac62aeecad617ce559d3248a61f3e19220d2e6bc..9e6b5b1c84ee1289fd3978fc7430f86b int modifiers = 0; if (is_alt_down) { modifiers |= ui::EF_ALT_DOWN; -@@ -178,6 +180,9 @@ void GlobalAcceleratorListenerOzone::OnKeyPressed(ui::KeyboardCode key_code, +@@ -186,6 +188,9 @@ void GlobalAcceleratorListenerOzone::OnKeyPressed(ui::KeyboardCode key_code, if (is_shift_down) { modifiers |= ui::EF_SHIFT_DOWN; } diff --git a/patches/chromium/crash_allow_setting_more_options.patch b/patches/chromium/crash_allow_setting_more_options.patch index 78b4b39481f6b..127611ad91a4c 100644 --- a/patches/chromium/crash_allow_setting_more_options.patch +++ b/patches/chromium/crash_allow_setting_more_options.patch @@ -63,10 +63,10 @@ index 7c890b331be4aaaf20c7efe8a4bcc2f6e9012b7a..c573524d05c07ec67d35046bc8548cc1 // Used by WebView to sample crashes without generating the unwanted dumps. If // the returned value is less than 100, crash dumping will be sampled to that diff --git a/components/crash/core/app/crashpad_linux.cc b/components/crash/core/app/crashpad_linux.cc -index 5d9b3bd5386ecbdb74cc470dbe65308c3afa0a61..dc29a4bedc0533e27affb26367cfcc2c3f9544f3 100644 +index d4d3555891b19d61676465c856055fb04e0168bc..3228888f5449df723f4385a0f2c9b456caa472f0 100644 --- a/components/crash/core/app/crashpad_linux.cc +++ b/components/crash/core/app/crashpad_linux.cc -@@ -218,6 +218,7 @@ bool PlatformCrashpadInitialization( +@@ -219,6 +219,7 @@ bool PlatformCrashpadInitialization( // where crash_reporter provides it's own values for lsb-release. annotations["lsb-release"] = base::GetLinuxDistro(); #endif @@ -74,7 +74,7 @@ index 5d9b3bd5386ecbdb74cc470dbe65308c3afa0a61..dc29a4bedc0533e27affb26367cfcc2c std::vector<std::string> arguments; if (crash_reporter_client->ShouldMonitorCrashHandlerExpensively()) { -@@ -239,6 +240,13 @@ bool PlatformCrashpadInitialization( +@@ -240,6 +241,13 @@ bool PlatformCrashpadInitialization( } #endif @@ -86,10 +86,10 @@ index 5d9b3bd5386ecbdb74cc470dbe65308c3afa0a61..dc29a4bedc0533e27affb26367cfcc2c + } + CHECK(client.StartHandler(handler_path, *database_path, metrics_path, url, - annotations, arguments, false, false)); - } else { + annotations, arguments, false, false, + attachments)); diff --git a/components/crash/core/app/crashpad_mac.mm b/components/crash/core/app/crashpad_mac.mm -index 42fe73aefe44f218d6a5e8cb1550ff48859c4b70..a1235f0c7ad44ae9c9fdc805af5b9dc5669f5aad 100644 +index 3b131e1fc804a55c80b3b2704686270211fcf9fb..f14ab66f240a236bd90ff4240089a0036ce7d460 100644 --- a/components/crash/core/app/crashpad_mac.mm +++ b/components/crash/core/app/crashpad_mac.mm @@ -86,6 +86,8 @@ @@ -101,7 +101,7 @@ index 42fe73aefe44f218d6a5e8cb1550ff48859c4b70..a1235f0c7ad44ae9c9fdc805af5b9dc5 return annotations; } -@@ -156,6 +158,13 @@ bool PlatformCrashpadInitialization( +@@ -159,6 +161,13 @@ bool PlatformCrashpadInitialization( std::vector<std::string> arguments; @@ -116,10 +116,10 @@ index 42fe73aefe44f218d6a5e8cb1550ff48859c4b70..a1235f0c7ad44ae9c9fdc805af5b9dc5 arguments.push_back("--monitor-self"); } diff --git a/components/crash/core/app/crashpad_win.cc b/components/crash/core/app/crashpad_win.cc -index 5b811cbbc51544cbff7c2e99c3a7ced824990002..f2376d74fbd2c8196184035fc0fb24a0a8ebfe0e 100644 +index a7af39181e259b4c793fa9a39cb95e4f86ac47d1..6101018813315074a1e06bea318ecf3f91188415 100644 --- a/components/crash/core/app/crashpad_win.cc +++ b/components/crash/core/app/crashpad_win.cc -@@ -93,6 +93,7 @@ bool PlatformCrashpadInitialization( +@@ -94,6 +94,7 @@ bool PlatformCrashpadInitialization( std::map<std::string, std::string> process_annotations; GetPlatformCrashpadAnnotations(&process_annotations); @@ -127,7 +127,7 @@ index 5b811cbbc51544cbff7c2e99c3a7ced824990002..f2376d74fbd2c8196184035fc0fb24a0 std::string url = crash_reporter_client->GetUploadUrl(); -@@ -133,6 +134,13 @@ bool PlatformCrashpadInitialization( +@@ -134,6 +135,13 @@ bool PlatformCrashpadInitialization( std::vector<std::string> arguments(start_arguments); diff --git a/patches/chromium/custom_protocols_plzserviceworker.patch b/patches/chromium/custom_protocols_plzserviceworker.patch index e36c46965e8da..c60e9519682d6 100644 --- a/patches/chromium/custom_protocols_plzserviceworker.patch +++ b/patches/chromium/custom_protocols_plzserviceworker.patch @@ -8,10 +8,10 @@ Allow registering custom protocols to handle service worker main script fetching Refs https://bugs.chromium.org/p/chromium/issues/detail?id=996511 diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc -index 25c9e17bd063cc07fd2727474395a9276c4a000d..413f3019bd55388e8ebc8fe39af766b7c61e9924 100644 +index cdd2f243082290767abbee39b4e80a67c705a789..7168d496663675455b417f709339aab08aabc9f0 100644 --- a/content/browser/service_worker/service_worker_context_wrapper.cc +++ b/content/browser/service_worker/service_worker_context_wrapper.cc -@@ -1957,6 +1957,26 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( +@@ -1972,6 +1972,26 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( loader_factory_bundle_info = context()->loader_factory_bundle_for_update_check()->Clone(); @@ -38,9 +38,9 @@ index 25c9e17bd063cc07fd2727474395a9276c4a000d..413f3019bd55388e8ebc8fe39af766b7 if (auto* config = content::WebUIConfigMap::GetInstance().GetConfig( browser_context(), scope)) { // If this is a Service Worker for a WebUI, the WebUI's URLDataSource -@@ -1976,9 +1996,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( +@@ -1991,9 +2011,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( features::kEnableServiceWorkersForChromeScheme) && - scope.scheme_piece() == kChromeUIScheme) { + scope.scheme() == kChromeUIScheme) { config->RegisterURLDataSource(browser_context()); - static_cast<blink::PendingURLLoaderFactoryBundle*>( - loader_factory_bundle_info.get()) @@ -49,9 +49,9 @@ index 25c9e17bd063cc07fd2727474395a9276c4a000d..413f3019bd55388e8ebc8fe39af766b7 .emplace(kChromeUIScheme, CreateWebUIServiceWorkerLoaderFactory( browser_context(), kChromeUIScheme, base::flat_set<std::string>())); -@@ -1986,9 +2004,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( +@@ -2001,9 +2019,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( features::kEnableServiceWorkersForChromeUntrusted) && - scope.scheme_piece() == kChromeUIUntrustedScheme) { + scope.scheme() == kChromeUIUntrustedScheme) { config->RegisterURLDataSource(browser_context()); - static_cast<blink::PendingURLLoaderFactoryBundle*>( - loader_factory_bundle_info.get()) diff --git a/patches/chromium/desktop_media_list.patch b/patches/chromium/desktop_media_list.patch index 97a8dbdc8a476..cfa9f056410f1 100644 --- a/patches/chromium/desktop_media_list.patch +++ b/patches/chromium/desktop_media_list.patch @@ -82,7 +82,7 @@ index 786c526588d81b8b5b1b5dd3760719a53e005995..f66b7d0b4dfcbb8ed3dde5a9ff463ae2 const Source& GetSource(int index) const override; DesktopMediaList::Type GetMediaListType() const override; diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.cc b/chrome/browser/media/webrtc/native_desktop_media_list.cc -index 1f5672f1aae610f2511a5a40885750f987871c8c..199a69a9c45e066a50f48298dae2dbcd06560d5b 100644 +index 3be638f1032815d39634b5725031d7f3124e1ad2..fce3e30bc736ac72a42d24956d4abf9f49c8fc41 100644 --- a/chrome/browser/media/webrtc/native_desktop_media_list.cc +++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc @@ -216,9 +216,13 @@ content::DesktopMediaID::Id GetUpdatedWindowId( diff --git a/patches/chromium/disable_compositor_recycling.patch b/patches/chromium/disable_compositor_recycling.patch index b0cdd8d495be7..3c513e1c02a99 100644 --- a/patches/chromium/disable_compositor_recycling.patch +++ b/patches/chromium/disable_compositor_recycling.patch @@ -6,7 +6,7 @@ Subject: fix: disabling compositor recycling Compositor recycling is useful for Chrome because there can be many tabs and spinning up a compositor for each one would be costly. In practice, Chrome uses the parent compositor code path of browser_compositor_view_mac.mm; the NSView of each tab is detached when it's hidden and attached when it's shown. For Electron, there is no parent compositor, so we're forced into the "own compositor" code path, which seems to be non-optimal and pretty ruthless in terms of the release of resources. Electron has no real concept of multiple tabs per window, so it should be okay to disable this ruthless recycling altogether in Electron. diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index 3798a24ce4aedb6aa2954d8f99b603bf08f1179d..3f466acfb286b44a8d1ecc7ffd4faf4635a66643 100644 +index 1fde0953bdc8bf3cd777206d7d340188ebf946fb..d9f6657a80b73ad7b7f3d8e4ced52dc474c417c9 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -558,7 +558,11 @@ diff --git a/patches/chromium/disable_hidden.patch b/patches/chromium/disable_hidden.patch index 2305c35b534ee..b2c92531ab391 100644 --- a/patches/chromium/disable_hidden.patch +++ b/patches/chromium/disable_hidden.patch @@ -6,7 +6,7 @@ Subject: disable_hidden.patch Electron uses this to disable background throttling for hidden windows. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index b70623b56267fb7df71519a2c19a04a658f766e2..0bae000a3491e03196bbba033621d389c6150225 100644 +index 3a0e028e3650e67337fde8fbad726d5333e8230e..1156ea5df2a390604b822b82cf42940029fea1f7 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -840,6 +840,10 @@ void RenderWidgetHostImpl::WasHidden() { @@ -34,7 +34,7 @@ index 636f09a8ac86e7c3f7b8dcdc285792f18f5c5989..276852573eade86f1bc9690e3c78a627 // |routing_id| must not be IPC::mojom::kRoutingIdNone. // If this object outlives |delegate|, DetachDelegate() must be called when diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index 7b6b19812f5f1989e39d9c33b387159380beb544..e95a313945397c6eff5514932ce15c5d4b6a8e1f 100644 +index b8f74e321a8bd8bd65e89cf9d794651c9f6f8705..e8a0554c4d84a16fc2122cb3e48199b4f43ecf88 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -642,7 +642,7 @@ void RenderWidgetHostViewAura::HideImpl() { diff --git a/patches/chromium/disable_nsautofillheuristiccontroller_on_macos_26.patch b/patches/chromium/disable_nsautofillheuristiccontroller_on_macos_26.patch deleted file mode 100644 index e8f0f5b6153e9..0000000000000 --- a/patches/chromium/disable_nsautofillheuristiccontroller_on_macos_26.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Perry <perryuwang@tencent.com> -Date: Wed, 24 Sep 2025 09:56:23 -0700 -Subject: Disable NSAutoFillHeuristicController on macOS 26 - -The reason for this issue is that NSAutoFillHeuristicController is -enabled by default on macOS 26. In pages with <input> tags, browser -process sends synchronized IPC messages to renderer process. At this -point, if the renderer process also sends synchronized IPC messages to -the browser process, it will cause a deadlock. - -This bug can be reproduced on many websites. From the perspective of -user experience, we should first disable this feature on macOS 26. - -Bug: 446070423, 446481994 -Change-Id: I2d3855648980a22678548e373756fc156e28ecd7 -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6965487 -Reviewed-by: Mark Mentovai <mark@chromium.org> -Commit-Queue: Mark Mentovai <mark@chromium.org> -Cr-Commit-Position: refs/heads/main@{#1520058} - -diff --git a/content/app/mac_init.mm b/content/app/mac_init.mm -index 603c25a1bd4a11b9dbe57ac6add81647302e63be..963f45a8936850b59013390faf7890bc4215f2d9 100644 ---- a/content/app/mac_init.mm -+++ b/content/app/mac_init.mm -@@ -6,6 +6,7 @@ - - #import <Cocoa/Cocoa.h> - -+#include "base/mac/mac_util.h" - #include "content/common/mac/system_policy.h" - - namespace content { -@@ -29,6 +30,19 @@ void InitializeMac() { - @"NSAppSleepDisabled" : @YES, - }]; - -+ if (base::mac::MacOSVersion() >= 26'00'00) { -+ [NSUserDefaults.standardUserDefaults registerDefaults:@{ -+ // Disable NSAutoFillHeuristicController on macOS 26. On macOS 26, the -+ // browser process sends synchronized IPC messages to the renderer process -+ // on pages with <input> tags. At this point, if the renderer process -+ // sends a synchronized IPC message to the browser process, it will cause -+ // a deadlock. -+ // https://crbug.com/446070423 -+ // https://crbug.com/446481994 -+ @"NSAutoFillHeuristicControllerEnabled" : @NO, -+ }]; -+ } -+ - SetSystemPolicyCrashKeys(); - } - diff --git a/patches/chromium/enable_reset_aspect_ratio.patch b/patches/chromium/enable_reset_aspect_ratio.patch index 9e002370e7856..7acc972e7488f 100644 --- a/patches/chromium/enable_reset_aspect_ratio.patch +++ b/patches/chromium/enable_reset_aspect_ratio.patch @@ -6,10 +6,10 @@ Subject: feat: enable setting aspect ratio to 0 Make SetAspectRatio accept 0 as valid input, which would reset to null. diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 86592f9197fa84cbce782ed237cdac74f60e77e1..c60e51f4e1a789caf5ad9c54e496f3e72a327b51 100644 +index 35469ecb01a680315b2f92e2599a3b56b5fc7549..d2651f4fcbb7991e9ec8f164e5bee51dab405c5a 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -@@ -615,7 +615,7 @@ void DesktopWindowTreeHostWin::SetOpacity(float opacity) { +@@ -614,7 +614,7 @@ void DesktopWindowTreeHostWin::SetOpacity(float opacity) { void DesktopWindowTreeHostWin::SetAspectRatio( const gfx::SizeF& aspect_ratio, const gfx::Size& excluded_margin) { @@ -19,10 +19,10 @@ index 86592f9197fa84cbce782ed237cdac74f60e77e1..c60e51f4e1a789caf5ad9c54e496f3e7 excluded_margin); } diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 0477bf1b33e5cd17e6d16ccd63f4bc53e303042f..f3f42f2c3ae4b185b0647902a2409bc9b25a152f 100644 +index 5246e5bb427f09bccdf53ee4de79bcf7c1c6a702..41b5219bdba3eba8bde935992fe60fc14898f68d 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -1049,8 +1049,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen, +@@ -1050,8 +1050,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen, void HWNDMessageHandler::SetAspectRatio(float aspect_ratio, const gfx::Size& excluded_margin) { @@ -35,4 +35,4 @@ index 0477bf1b33e5cd17e6d16ccd63f4bc53e303042f..f3f42f2c3ae4b185b0647902a2409bc9 + } aspect_ratio_ = aspect_ratio; - + excluded_margin_dip_ = excluded_margin; diff --git a/patches/chromium/expose_setuseragent_on_networkcontext.patch b/patches/chromium/expose_setuseragent_on_networkcontext.patch index ab63a0a553d84..74037b456a4d8 100644 --- a/patches/chromium/expose_setuseragent_on_networkcontext.patch +++ b/patches/chromium/expose_setuseragent_on_networkcontext.patch @@ -33,10 +33,10 @@ index 0ab8187b0db8ae6db46d81738f653a2bc4c566f6..de3d55e85c22317f7f9375eb94d0d5d4 } // namespace net diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index 95822f635b61da7c63b5a1babf93bb61cb786293..892fa1d8d340906d359685894da6553377cda73b 100644 +index 68ad4334b47b075ea6ed80f2f29e496089695f8d..2e8310cf11fe772b084036a493988de5d9605f95 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc -@@ -1907,6 +1907,13 @@ void NetworkContext::EnableDurableMessageCollector( +@@ -1910,6 +1910,13 @@ void NetworkContext::EnableDurableMessageCollector( it->second->AddReceiver(std::move(receiver)); } @@ -51,10 +51,10 @@ index 95822f635b61da7c63b5a1babf93bb61cb786293..892fa1d8d340906d359685894da65533 // This may only be called on NetworkContexts created with the constructor // that calls MakeURLRequestContext(). diff --git a/services/network/network_context.h b/services/network/network_context.h -index 56f1eec94a33c2c9a6289b12ac20323b4bef13d9..1b99211c9c96efba0713e953e708712d6c3714a6 100644 +index d73d6500b354805fa7436705801fa740dd01e8ea..5426624e27a58292ef760d07898c145f396cb343 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h -@@ -335,6 +335,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext +@@ -336,6 +336,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext const base::UnguessableToken& throttling_profile_id, mojo::PendingReceiver<network::mojom::DurableMessageCollector> receiver) override; @@ -63,10 +63,10 @@ index 56f1eec94a33c2c9a6289b12ac20323b4bef13d9..1b99211c9c96efba0713e953e708712d void SetEnableReferrers(bool enable_referrers) override; #if BUILDFLAG(IS_CT_SUPPORTED) diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index 840eff6ece73983a3b98673adbbb3cfd825565fe..5159d804c493bf2ae08d2786187c614efc96cf23 100644 +index cd4f5d711b31dac365b98f94a72c121a5a29f46d..5de330915c4f73c77f0582bcfdc2d2d15fcc304d 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -1337,6 +1337,9 @@ interface NetworkContext { +@@ -1354,6 +1354,9 @@ interface NetworkContext { mojo_base.mojom.UnguessableToken throttling_profile_id, pending_receiver<DurableMessageCollector> receiver); @@ -77,13 +77,13 @@ index 840eff6ece73983a3b98673adbbb3cfd825565fe..5159d804c493bf2ae08d2786187c614e SetAcceptLanguage(string new_accept_language); diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h -index 6f0fe6423e8be903d4e38b783d31443c6ce89db5..9a5d7ad5d6e84e8b824c1614ee006c4984817929 100644 +index 8648cafcc01af1d8835f782f1303df2b5a84a674..4e7472dbda6da1b7ed85026a9fd84e9fc4c521a8 100644 --- a/services/network/test/test_network_context.h +++ b/services/network/test/test_network_context.h -@@ -161,6 +161,7 @@ class TestNetworkContext : public mojom::NetworkContext { - void CloseIdleConnections(CloseIdleConnectionsCallback callback) override {} - void SetNetworkConditions(const base::UnguessableToken& throttling_profile_id, - mojom::NetworkConditionsPtr conditions) override {} +@@ -162,6 +162,7 @@ class TestNetworkContext : public mojom::NetworkContext { + void SetNetworkConditions( + const base::UnguessableToken& throttling_profile_id, + std::vector<mojom::MatchedNetworkConditionsPtr>) override {} + void SetUserAgent(const std::string& new_user_agent) override {} void SetAcceptLanguage(const std::string& new_accept_language) override {} void SetEnableReferrers(bool enable_referrers) override {} diff --git a/patches/chromium/extend_apply_webpreferences.patch b/patches/chromium/extend_apply_webpreferences.patch index 90b0ae0108100..9d605649742fc 100644 --- a/patches/chromium/extend_apply_webpreferences.patch +++ b/patches/chromium/extend_apply_webpreferences.patch @@ -15,10 +15,10 @@ Ideally we could add an embedder observer pattern here but that can be done in future work. diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index 68a102327e22302587f7cc402cb26ef2f02b261e..ccdbf101d07b9f8baa043894ea7f48a56e7d3ecb 100644 +index a004db1a30b6138dbeda5da3f4301bca86ec6ad2..42db2e15163e3410471bd22c03d9c05e73ff748e 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -1900,6 +1900,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, +@@ -1909,6 +1909,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, #if BUILDFLAG(IS_MAC) web_view_impl->SetMaximumLegibleScale( prefs.default_maximum_page_scale_factor); diff --git a/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch b/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch index 247d46d373d86..62b53c9aef8dc 100644 --- a/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch +++ b/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch @@ -13,11 +13,11 @@ uses internally for things like menus and devtools. We can remove this patch once it has in some shape been upstreamed. diff --git a/ui/native_theme/native_theme.h b/ui/native_theme/native_theme.h -index 8391cd1469516e83b2cc1466e121bfeed5497c8e..6bed02855d0917805a43fab111d41702af94368e 100644 +index d8c168edc6c92c8094bb37e4ac1eb703d9d1dc85..f103f2a095724f552b1917546a771168f64c53df 100644 --- a/ui/native_theme/native_theme.h +++ b/ui/native_theme/native_theme.h -@@ -493,6 +493,8 @@ class COMPONENT_EXPORT(NATIVE_THEME) NativeTheme { - void set_page_colors(PageColors page_colors) { page_colors_ = page_colors; } +@@ -500,6 +500,8 @@ class COMPONENT_EXPORT(NATIVE_THEME) NativeTheme { + } PreferredColorScheme preferred_color_scheme() const { + if (theme_source() == ThemeSource::kForcedLight) return PreferredColorScheme::kLight; @@ -25,9 +25,9 @@ index 8391cd1469516e83b2cc1466e121bfeed5497c8e..6bed02855d0917805a43fab111d41702 return preferred_color_scheme_; } void set_preferred_color_scheme(PreferredColorScheme preferred_color_scheme) { -@@ -536,6 +538,24 @@ class COMPONENT_EXPORT(NATIVE_THEME) NativeTheme { - // Whether dark mode is forced via command-line flag. - static bool IsForcedDarkMode(); +@@ -531,6 +533,24 @@ class COMPONENT_EXPORT(NATIVE_THEME) NativeTheme { + caret_blink_interval_ = caret_blink_interval; + } + enum ThemeSource { + kSystem, @@ -48,11 +48,11 @@ index 8391cd1469516e83b2cc1466e121bfeed5497c8e..6bed02855d0917805a43fab111d41702 + } + protected: - explicit NativeTheme( - ui::SystemTheme system_theme = ui::SystemTheme::kDefault); -@@ -590,6 +610,7 @@ class COMPONENT_EXPORT(NATIVE_THEME) NativeTheme { - std::optional<ui::ColorProviderKey::SchemeVariant> scheme_variant_; - bool should_use_system_accent_color_ = true; + explicit NativeTheme(SystemTheme system_theme = SystemTheme::kDefault); + virtual ~NativeTheme(); +@@ -604,6 +624,7 @@ class COMPONENT_EXPORT(NATIVE_THEME) NativeTheme { + ColorProviderKey::UserColorSource preferred_color_source_ = + ColorProviderKey::UserColorSource::kAccent; base::TimeDelta caret_blink_interval_; + ThemeSource theme_source_ = ThemeSource::kSystem; diff --git a/patches/chromium/feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch b/patches/chromium/feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch index c9cc322a9fca2..997a362bcd37b 100644 --- a/patches/chromium/feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch +++ b/patches/chromium/feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch @@ -56,10 +56,10 @@ index 656267caef2d515f8c3f77535b308108a0b30be1..083d59f78c542f4900e1b210a0935276 + } // namespace gin diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h -index dc3a5b0678b9c686e241b492e2c3b5ac833611a3..32a7ba4f557e65d9525d2ca07e8597e7bd070b12 100644 +index a4c766565bfcc47d1ef66570afa166b9c0c16312..02275338c070d4f48ac10d51e3a6d42368f52c9e 100644 --- a/gin/public/isolate_holder.h +++ b/gin/public/isolate_holder.h -@@ -132,6 +132,8 @@ class GIN_EXPORT IsolateHolder { +@@ -133,6 +133,8 @@ class GIN_EXPORT IsolateHolder { // Should only be called after v8::IsolateHolder::Initialize() is invoked. static std::unique_ptr<v8::Isolate::CreateParams> getDefaultIsolateParams(); @@ -68,7 +68,7 @@ index dc3a5b0678b9c686e241b492e2c3b5ac833611a3..32a7ba4f557e65d9525d2ca07e8597e7 v8::Isolate* isolate() { return isolate_; } // This method returns if v8::Locker is needed to access isolate. -@@ -145,6 +147,9 @@ class GIN_EXPORT IsolateHolder { +@@ -146,6 +148,9 @@ class GIN_EXPORT IsolateHolder { void EnableIdleTasks(std::unique_ptr<V8IdleTaskRunner> idle_task_runner); diff --git a/patches/chromium/feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch b/patches/chromium/feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch index 8c81618244583..a738ab0c8750d 100644 --- a/patches/chromium/feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch +++ b/patches/chromium/feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch @@ -16,10 +16,10 @@ It also: This may be partially upstreamed to Chromium in the future. diff --git a/ui/gtk/select_file_dialog_linux_gtk.cc b/ui/gtk/select_file_dialog_linux_gtk.cc -index 4a9118dcabbc0cffeea17dc26a8e1f2a54604766..4ae6001c0376822d41a77949ce05ea0328abcee4 100644 +index bf903ea436f5d0c8599f7a122828fc163a192247..e1c5c8e9241d29668d0c7dae12a46a5ded900fac 100644 --- a/ui/gtk/select_file_dialog_linux_gtk.cc +++ b/ui/gtk/select_file_dialog_linux_gtk.cc -@@ -261,8 +261,12 @@ void SelectFileDialogLinuxGtk::SelectFileImpl( +@@ -262,8 +262,12 @@ void SelectFileDialogLinuxGtk::SelectFileImpl( case SELECT_EXISTING_FOLDER: dialog = CreateSelectFolderDialog(type, title_string, default_path, owning_window); @@ -34,7 +34,7 @@ index 4a9118dcabbc0cffeea17dc26a8e1f2a54604766..4ae6001c0376822d41a77949ce05ea03 break; case SELECT_OPEN_FILE: dialog = CreateFileOpenDialog(title_string, default_path, owning_window); -@@ -409,9 +413,11 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateFileOpenHelper( +@@ -410,9 +414,11 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateFileOpenHelper( const std::string& title, const base::FilePath& default_path, gfx::NativeWindow parent) { @@ -47,7 +47,7 @@ index 4a9118dcabbc0cffeea17dc26a8e1f2a54604766..4ae6001c0376822d41a77949ce05ea03 SetGtkTransientForAura(dialog, parent); AddFilters(GTK_FILE_CHOOSER(dialog)); -@@ -427,6 +433,7 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateFileOpenHelper( +@@ -428,6 +434,7 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateFileOpenHelper( GtkFileChooserSetCurrentFolder(GTK_FILE_CHOOSER(dialog), *last_opened_path()); } @@ -55,7 +55,7 @@ index 4a9118dcabbc0cffeea17dc26a8e1f2a54604766..4ae6001c0376822d41a77949ce05ea03 return dialog; } -@@ -442,11 +449,15 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateSelectFolderDialog( +@@ -443,11 +450,15 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateSelectFolderDialog( ? l10n_util::GetStringUTF8(IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE) : l10n_util::GetStringUTF8(IDS_SELECT_FOLDER_DIALOG_TITLE); } @@ -76,7 +76,7 @@ index 4a9118dcabbc0cffeea17dc26a8e1f2a54604766..4ae6001c0376822d41a77949ce05ea03 GtkWidget* dialog = GtkFileChooserDialogNew( title_string.c_str(), nullptr, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, -@@ -468,7 +479,8 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateSelectFolderDialog( +@@ -469,7 +480,8 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateSelectFolderDialog( gtk_file_filter_add_mime_type(only_folders, "inode/directory"); gtk_file_filter_add_mime_type(only_folders, "text/directory"); gtk_file_chooser_add_filter(chooser, only_folders); @@ -86,7 +86,7 @@ index 4a9118dcabbc0cffeea17dc26a8e1f2a54604766..4ae6001c0376822d41a77949ce05ea03 return dialog; } -@@ -505,10 +517,11 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateSaveAsDialog( +@@ -506,10 +518,11 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateSaveAsDialog( std::string title_string = !title.empty() ? title : l10n_util::GetStringUTF8(IDS_SAVE_AS_DIALOG_TITLE); @@ -100,7 +100,7 @@ index 4a9118dcabbc0cffeea17dc26a8e1f2a54604766..4ae6001c0376822d41a77949ce05ea03 GTK_RESPONSE_ACCEPT); SetGtkTransientForAura(dialog, parent); -@@ -534,9 +547,10 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateSaveAsDialog( +@@ -535,9 +548,10 @@ GtkWidget* SelectFileDialogLinuxGtk::CreateSaveAsDialog( gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE); // Overwrite confirmation is always enabled in GTK4. if (!GtkCheckVersion(4)) { @@ -113,7 +113,7 @@ index 4a9118dcabbc0cffeea17dc26a8e1f2a54604766..4ae6001c0376822d41a77949ce05ea03 return dialog; } -@@ -591,15 +605,29 @@ void SelectFileDialogLinuxGtk::OnSelectSingleFolderDialogResponse( +@@ -592,15 +606,29 @@ void SelectFileDialogLinuxGtk::OnSelectSingleFolderDialogResponse( void SelectFileDialogLinuxGtk::OnSelectMultiFileDialogResponse( GtkWidget* dialog, int response_id) { diff --git a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch index 303ecee624a8f..6cc9fc5723777 100644 --- a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch +++ b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch @@ -9,7 +9,7 @@ embedders to make custom schemes allow V8 code cache. Chromium CL: https://chromium-review.googlesource.com/c/chromium/src/+/5019665 diff --git a/content/browser/code_cache/generated_code_cache.cc b/content/browser/code_cache/generated_code_cache.cc -index b798ae06446d68fe74e7fef3ade515e9c77f1f73..0b0ecebef9e34986a95e4d9f3b52fcce19f2d686 100644 +index 445661be8089c8d52ade8c24603024afde27cedd..22c95824b703d6248475071c6bb3de91550eb0fa 100644 --- a/content/browser/code_cache/generated_code_cache.cc +++ b/content/browser/code_cache/generated_code_cache.cc @@ -8,6 +8,7 @@ @@ -28,7 +28,7 @@ index b798ae06446d68fe74e7fef3ade515e9c77f1f73..0b0ecebef9e34986a95e4d9f3b52fcce using storage::BigIOBuffer; -@@ -53,39 +55,55 @@ void CheckValidResource(const GURL& resource_url, +@@ -53,40 +55,55 @@ void CheckValidResource(const GURL& resource_url, GeneratedCodeCache::CodeCacheType cache_type) { // If the resource url is invalid don't cache the code. DCHECK(resource_url.is_valid()); @@ -41,16 +41,17 @@ index b798ae06446d68fe74e7fef3ade515e9c77f1f73..0b0ecebef9e34986a95e4d9f3b52fcce + const bool resource_url_webui = resource_url.SchemeIs(content::kChromeUIScheme) || resource_url.SchemeIs(content::kChromeUIUntrustedScheme); -- DCHECK(resource_url.SchemeIsHTTPOrHTTPS() || -- resource_url_is_chrome_or_chrome_untrusted || -- blink::CommonSchemeRegistry::IsExtensionScheme(resource_url.scheme())); +- DCHECK( +- resource_url.SchemeIsHTTPOrHTTPS() || +- resource_url_is_chrome_or_chrome_untrusted || +- blink::CommonSchemeRegistry::IsExtensionScheme(resource_url.GetScheme())); - - // The chrome and chrome-untrusted schemes are only used with the WebUI - // code cache type. - DCHECK_EQ(resource_url_is_chrome_or_chrome_untrusted, - cache_type == GeneratedCodeCache::kWebUIJavaScript); + const bool resource_url_embedder = -+ base::Contains(url::GetCodeCacheSchemes(), resource_url.scheme()); ++ base::Contains(url::GetCodeCacheSchemes(), resource_url.GetScheme()); + DCHECK(resource_url_http || resource_url_webui || resource_url_embedder); } @@ -71,12 +72,12 @@ index b798ae06446d68fe74e7fef3ade515e9c77f1f73..0b0ecebef9e34986a95e4d9f3b52fcce + const bool origin_lock_for_webui = origin_lock.SchemeIs(content::kChromeUIScheme) || origin_lock.SchemeIs(content::kChromeUIUntrustedScheme); -- DCHECK( -- origin_lock.is_empty() || -- ((origin_lock.SchemeIsHTTPOrHTTPS() || -- origin_lock_is_chrome_or_chrome_untrusted || -- blink::CommonSchemeRegistry::IsExtensionScheme(origin_lock.scheme())) && -- !url::Origin::Create(origin_lock).opaque())); +- DCHECK(origin_lock.is_empty() || +- ((origin_lock.SchemeIsHTTPOrHTTPS() || +- origin_lock_is_chrome_or_chrome_untrusted || +- blink::CommonSchemeRegistry::IsExtensionScheme( +- origin_lock.GetScheme())) && +- !url::Origin::Create(origin_lock).opaque())); - - // The chrome and chrome-untrusted schemes are only used with the WebUI - // code cache type. @@ -84,7 +85,7 @@ index b798ae06446d68fe74e7fef3ade515e9c77f1f73..0b0ecebef9e34986a95e4d9f3b52fcce - cache_type == GeneratedCodeCache::kWebUIJavaScript); + + const bool origin_lock_for_embedder = -+ base::Contains(url::GetCodeCacheSchemes(), origin_lock.scheme()); ++ base::Contains(url::GetCodeCacheSchemes(), origin_lock.GetScheme()); + + DCHECK(origin_lock_empty || ((origin_lock_for_http || origin_lock_for_webui || + origin_lock_for_embedder) && @@ -133,7 +134,7 @@ index a01f0d96ef33ce9460a851b072b7ceed5227dee3..f7e39b28cc0ba2251123925c01083a79 // JavaScript from chrome and chrome-untrusted pages. The resource URLs are diff --git a/content/browser/code_cache/generated_code_cache_browsertest.cc b/content/browser/code_cache/generated_code_cache_browsertest.cc -index 28556e56f2fd591c46ce6f48d39eb907876a499d..f5737ba60fb9e182459066ffa62c7c589f379954 100644 +index fb3fdfca483ff5041ee98095af3f6ac2640adbaf..ada19d78ec1337b0c49a1597c877886f69f84f13 100644 --- a/content/browser/code_cache/generated_code_cache_browsertest.cc +++ b/content/browser/code_cache/generated_code_cache_browsertest.cc @@ -16,17 +16,22 @@ @@ -159,7 +160,7 @@ index 28556e56f2fd591c46ce6f48d39eb907876a499d..f5737ba60fb9e182459066ffa62c7c58 #include "net/base/features.h" #include "net/dns/mock_host_resolver.h" #include "third_party/blink/public/common/features.h" -@@ -37,6 +42,8 @@ namespace content { +@@ -38,6 +43,8 @@ namespace content { namespace { @@ -168,7 +169,7 @@ index 28556e56f2fd591c46ce6f48d39eb907876a499d..f5737ba60fb9e182459066ffa62c7c58 bool SupportsSharedWorker() { return base::FeatureList::IsEnabled(blink::features::kSharedWorker); } -@@ -1044,4 +1051,82 @@ IN_PROC_BROWSER_TEST_F(LocalCompileHintsBrowserTest, LocalCompileHints) { +@@ -1063,4 +1070,82 @@ IN_PROC_BROWSER_TEST_F(LocalCompileHintsBrowserTest, LocalCompileHints) { } } @@ -252,10 +253,10 @@ index 28556e56f2fd591c46ce6f48d39eb907876a499d..f5737ba60fb9e182459066ffa62c7c58 + } // namespace content diff --git a/content/browser/renderer_host/code_cache_host_impl.cc b/content/browser/renderer_host/code_cache_host_impl.cc -index 7b4408f3480bd062ab9221f524633c177a212790..8d283d84b0817a937845b221bb13c6ed12bfade6 100644 +index 5becc15b30b7e2c3fab289db50ad9774cb5fb17e..7de9e745f249137ecc3224b3b1f6ee70d90b96b6 100644 --- a/content/browser/renderer_host/code_cache_host_impl.cc +++ b/content/browser/renderer_host/code_cache_host_impl.cc -@@ -7,6 +7,7 @@ +@@ -8,6 +8,7 @@ #include <string_view> #include <utility> @@ -263,7 +264,7 @@ index 7b4408f3480bd062ab9221f524633c177a212790..8d283d84b0817a937845b221bb13c6ed #include "base/feature_list.h" #include "base/functional/bind.h" #include "base/functional/callback_helpers.h" -@@ -36,6 +37,7 @@ +@@ -38,6 +39,7 @@ #include "third_party/blink/public/mojom/loader/code_cache.mojom-data-view.h" #include "url/gurl.h" #include "url/origin.h" @@ -271,8 +272,8 @@ index 7b4408f3480bd062ab9221f524633c177a212790..8d283d84b0817a937845b221bb13c6ed using blink::mojom::CacheStorageError; -@@ -55,6 +57,11 @@ GeneratedCodeCache::CodeCacheType MojoCacheTypeToCodeCacheType( - } +@@ -112,6 +114,11 @@ std::optional<std::string> GetContextKeyForPersistentCacheCollection( + return context_key; } +bool ProcessLockURLIsCodeCacheScheme(const ProcessLock& process_lock) { @@ -283,7 +284,7 @@ index 7b4408f3480bd062ab9221f524633c177a212790..8d283d84b0817a937845b221bb13c6ed bool CheckSecurityForAccessingCodeCacheData( const GURL& resource_url, int render_process_id, -@@ -65,39 +72,56 @@ bool CheckSecurityForAccessingCodeCacheData( +@@ -122,40 +129,56 @@ bool CheckSecurityForAccessingCodeCacheData( // Code caching is only allowed for http(s) and chrome/chrome-untrusted // scripts. Furthermore, there is no way for http(s) pages to load chrome or @@ -347,7 +348,8 @@ index 7b4408f3480bd062ab9221f524633c177a212790..8d283d84b0817a937845b221bb13c6ed + return false; } - if (resource_url.SchemeIsHTTPOrHTTPS() || -- blink::CommonSchemeRegistry::IsExtensionScheme(resource_url.scheme())) { +- blink::CommonSchemeRegistry::IsExtensionScheme( +- resource_url.GetScheme())) { - if (process_lock.MatchesScheme(content::kChromeUIScheme) || - process_lock.MatchesScheme(content::kChromeUIUntrustedScheme)) { - // It is possible for WebUI pages to include open-web content, but such @@ -356,18 +358,18 @@ index 7b4408f3480bd062ab9221f524633c177a212790..8d283d84b0817a937845b221bb13c6ed - return false; - } - return true; -+ if (base::Contains(url::GetCodeCacheSchemes(), resource_url.scheme())) { ++ if (base::Contains(url::GetCodeCacheSchemes(), resource_url.GetScheme())) { + return ProcessLockURLIsCodeCacheScheme(process_lock); } if (operation == CodeCacheHostImpl::Operation::kWrite) { -@@ -530,6 +554,7 @@ std::optional<GURL> CodeCacheHostImpl::GetSecondaryKeyForCodeCache( +@@ -590,6 +613,7 @@ std::optional<GURL> CodeCacheHostImpl::GetSecondaryKeyForCodeCache( process_lock.MatchesScheme(url::kHttpsScheme) || process_lock.MatchesScheme(content::kChromeUIScheme) || process_lock.MatchesScheme(content::kChromeUIUntrustedScheme) || + ProcessLockURLIsCodeCacheScheme(process_lock) || blink::CommonSchemeRegistry::IsExtensionScheme( - process_lock.GetProcessLockURL().scheme())) { + process_lock.GetProcessLockURL().GetScheme())) { return process_lock.GetProcessLockURL(); diff --git a/content/common/url_schemes.cc b/content/common/url_schemes.cc index 225e017909b8869231b870eaaf161a0b5e93e2a0..846a5251429630b8528a84a3d67ed56cb28df5a1 100644 @@ -403,7 +405,7 @@ index 52f16979b05b692ef72762d0cbc16bcb361b047e..b658ebeb9c572158b27d94af56331be8 std::vector<std::string> extension_schemes; // Registers a URL scheme with a predefined default custom handler. diff --git a/url/url_util.cc b/url/url_util.cc -index f77ce7f6de0a183debfdf272aa17c35c8307c480..54cbc57dc5217447cdf2895d6918e27001a39b7e 100644 +index ad9d781f55cc20a2c80a743daaa1563e828cd7e1..bbb6674efdf39d43248620d6e66876d1750d7abe 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -136,6 +136,9 @@ struct SchemeRegistry { @@ -416,7 +418,7 @@ index f77ce7f6de0a183debfdf272aa17c35c8307c480..54cbc57dc5217447cdf2895d6918e270 // Schemes with a predefined default custom handler. std::vector<SchemeWithHandler> predefined_handler_schemes; -@@ -694,6 +697,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() { +@@ -706,6 +709,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() { return GetSchemeRegistry().empty_document_schemes; } @@ -433,7 +435,7 @@ index f77ce7f6de0a183debfdf272aa17c35c8307c480..54cbc57dc5217447cdf2895d6918e270 DoAddSchemeWithHandler( new_scheme, handler, diff --git a/url/url_util.h b/url/url_util.h -index 50c273fe9c2007ec5ac6675726ce0ae9811af9e2..5f7352ff5eba9c548aaaea63f75e9551c81ce305 100644 +index 8ca0eec8cd9b2e9501daa511acee4fc64d8898af..f888d25801ded67fa600ab2fd268029b26186f35 100644 --- a/url/url_util.h +++ b/url/url_util.h @@ -115,6 +115,15 @@ COMPONENT_EXPORT(URL) const std::vector<std::string>& GetCSPBypassingSchemes(); diff --git a/patches/chromium/feat_allow_passing_of_objecttemplate_to_objecttemplatebuilder.patch b/patches/chromium/feat_allow_passing_of_objecttemplate_to_objecttemplatebuilder.patch index b3f38261de488..8f27c60811032 100644 --- a/patches/chromium/feat_allow_passing_of_objecttemplate_to_objecttemplatebuilder.patch +++ b/patches/chromium/feat_allow_passing_of_objecttemplate_to_objecttemplatebuilder.patch @@ -10,10 +10,10 @@ Electron needs this constructor, namely for gin_helper::Constructible objects. diff --git a/gin/object_template_builder.cc b/gin/object_template_builder.cc -index a694f7dc4da4f1bba579ab8c032eea21d8459995..8aaaba327166b1d3b884fe390a389c0c50890af9 100644 +index 90966dc917099ae749118f3e740b76ff477cf92d..b84f5fd336bc4b61b2cd0b2fc92382b00e928701 100644 --- a/gin/object_template_builder.cc +++ b/gin/object_template_builder.cc -@@ -146,6 +146,13 @@ ObjectTemplateBuilder::ObjectTemplateBuilder(v8::Isolate* isolate, +@@ -144,6 +144,13 @@ ObjectTemplateBuilder::ObjectTemplateBuilder(v8::Isolate* isolate, template_->SetInternalFieldCount(kNumberOfInternalFields); } @@ -28,10 +28,10 @@ index a694f7dc4da4f1bba579ab8c032eea21d8459995..8aaaba327166b1d3b884fe390a389c0c const ObjectTemplateBuilder& other) = default; diff --git a/gin/object_template_builder.h b/gin/object_template_builder.h -index 9d8f6e5de793ea419875d99a0b46898f2e40ead5..c803363b8050f4084c9250fce9b5b8b171082703 100644 +index cf4f1ae6598fdede655d33baccda254965566ea5..a4c16dc0ec3ff16413fc2a04225a2401989a084b 100644 --- a/gin/object_template_builder.h +++ b/gin/object_template_builder.h -@@ -46,6 +46,9 @@ class GIN_EXPORT ObjectTemplateBuilder { +@@ -48,6 +48,9 @@ class GIN_EXPORT ObjectTemplateBuilder { public: explicit ObjectTemplateBuilder(v8::Isolate* isolate); ObjectTemplateBuilder(v8::Isolate* isolate, const char* type_name); diff --git a/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch b/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch index 22584e3475f9e..4920a766f9df3 100644 --- a/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch +++ b/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch @@ -311,10 +311,10 @@ index c2d8bbafa39c05f25641f2fd3491ef7f84f4f6a1..5506583824e10d664f32c71d63fda1aa // Although ScreenCaptureKit is available in 12.3 there were some bugs that diff --git a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc -index 77f6994c9963b57f7e9334bce6fefabdc6ee63e7..a02ca47ea5dea272640737cfffedc8529087c12e 100644 +index c07b61c6736798b3b8efd79a27fb6546dde24cc2..889c0876394bc973f86cc6f5f2d3ce3902103b41 100644 --- a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc +++ b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc -@@ -321,8 +321,16 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( +@@ -310,8 +310,16 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( break; } @@ -332,7 +332,7 @@ index 77f6994c9963b57f7e9334bce6fefabdc6ee63e7..a02ca47ea5dea272640737cfffedc852 // For the other capturers, when a bug reports the type of capture it's // easy enough to determine which capturer was used, but it's a little // fuzzier with window capture. -@@ -338,13 +346,15 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( +@@ -327,13 +335,15 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( } #endif // defined(USE_AURA) || BUILDFLAG(IS_MAC) @@ -363,10 +363,10 @@ index b90a88a115247bd0c62abb18771220e37a441d2f..f908a95727633e903bd56d2bc8608bba #if defined(USE_AURA) || BUILDFLAG(IS_MAC) // Assigns integer identifier to the |window| and returns its DesktopMediaID. diff --git a/media/capture/video_capture_types.h b/media/capture/video_capture_types.h -index 949af1a45ab1b0180a767d89f8837df531041dfe..81d0550107f1d5f38b5ef7d658099ea2ca35d3a6 100644 +index 092bd4524b81734d1b428ab0b201887d411f8277..d0300a4b1a2265d1db977b9bf0ffdd6d0a9d9d37 100644 --- a/media/capture/video_capture_types.h +++ b/media/capture/video_capture_types.h -@@ -364,6 +364,8 @@ struct CAPTURE_EXPORT VideoCaptureParams { +@@ -365,6 +365,8 @@ struct CAPTURE_EXPORT VideoCaptureParams { // of the capture is dynamically changed, as for example when using // share-this-tab-instead. uint32_t capture_version_source = 0; diff --git a/patches/chromium/feat_configure_launch_options_for_service_process.patch b/patches/chromium/feat_configure_launch_options_for_service_process.patch index c560798b2a4c1..49183aea6e4b3 100644 --- a/patches/chromium/feat_configure_launch_options_for_service_process.patch +++ b/patches/chromium/feat_configure_launch_options_for_service_process.patch @@ -19,7 +19,7 @@ to STDOUT_FILENO/STD_OUTPUT_HANDLE and STDERR_FILENO/STD_ERROR_HANDLE allowing t parent process to read from the pipe. diff --git a/content/browser/child_process_launcher.h b/content/browser/child_process_launcher.h -index 4490b007072cbdb5d5d42bc74ad1eb3c183e86ed..0f365510982d897bc089ab3c97643109a4fcc8af 100644 +index dbbf190cbbb24d07b338a991b2432aae70247b05..66d114b5cf1fcf8237a49ae6e61c3b0580c735bb 100644 --- a/content/browser/child_process_launcher.h +++ b/content/browser/child_process_launcher.h @@ -33,6 +33,7 @@ @@ -187,7 +187,7 @@ index d9c14f91747bde0e76056d7f2f2ada166e67f994..53be16879777a3b9bef58ead5f7e420c UtilityProcessHost::Start(std::move(utility_options), diff --git a/content/browser/service_host/utility_process_host.cc b/content/browser/service_host/utility_process_host.cc -index ab48c8b88a7cf311205b221169308d96e95f239f..d714d2022f685052e1def3b0d242d2ea596d790b 100644 +index b4d84672b85e7c070eafacc602acae5590337854..0d7c270217a7906a7f3c4c6e0afdc1386613578c 100644 --- a/content/browser/service_host/utility_process_host.cc +++ b/content/browser/service_host/utility_process_host.cc @@ -245,13 +245,13 @@ UtilityProcessHost::Options& UtilityProcessHost::Options::WithFileToPreload( @@ -707,10 +707,10 @@ index c5fee4ad8b246bc1113a383794c6101bade24df3..61f0a0f62795b30105c42da363205284 #if BUILDFLAG(IS_MAC) // Whether or not to disclaim TCC responsibility for the process, defaults to diff --git a/sandbox/policy/win/sandbox_win.cc b/sandbox/policy/win/sandbox_win.cc -index 23b090edef2457e0dbe96a58b392d03bde05f5c1..545805a97fa4c7fa9318f243588da6a59a58a837 100644 +index 6cc21567af6e65261d5cbbba067d23bd5514692c..a8d3199eae58a4427f1de4a32504187e36a507a6 100644 --- a/sandbox/policy/win/sandbox_win.cc +++ b/sandbox/policy/win/sandbox_win.cc -@@ -592,11 +592,9 @@ base::win::ScopedHandle CreateUnsandboxedJob() { +@@ -605,11 +605,9 @@ base::win::ScopedHandle CreateUnsandboxedJob() { // command line flag. ResultCode LaunchWithoutSandbox( const base::CommandLine& cmd_line, @@ -723,7 +723,7 @@ index 23b090edef2457e0dbe96a58b392d03bde05f5c1..545805a97fa4c7fa9318f243588da6a5 options.feedback_cursor_off = true; // Network process runs in a job even when unsandboxed. This is to ensure it // does not outlive the browser, which could happen if there is a lot of I/O -@@ -899,7 +897,7 @@ bool SandboxWin::InitTargetServices(TargetServices* target_services) { +@@ -914,7 +912,7 @@ bool SandboxWin::InitTargetServices(TargetServices* target_services) { // static ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( const base::CommandLine& cmd_line, @@ -732,7 +732,7 @@ index 23b090edef2457e0dbe96a58b392d03bde05f5c1..545805a97fa4c7fa9318f243588da6a5 SandboxDelegate* delegate, TargetPolicy* policy) { const base::CommandLine& launcher_process_command_line = -@@ -913,7 +911,7 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( +@@ -928,7 +926,7 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( } // Add any handles to be inherited to the policy. @@ -741,7 +741,7 @@ index 23b090edef2457e0dbe96a58b392d03bde05f5c1..545805a97fa4c7fa9318f243588da6a5 policy->AddHandleToShare(handle); if (!policy->GetConfig()->IsConfigured()) { -@@ -928,6 +926,13 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( +@@ -943,6 +941,13 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( // have no effect. These calls can fail with SBOX_ERROR_BAD_PARAMS. policy->SetStdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE)); policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE)); @@ -755,7 +755,7 @@ index 23b090edef2457e0dbe96a58b392d03bde05f5c1..545805a97fa4c7fa9318f243588da6a5 #endif if (!delegate->PreSpawnTarget(policy)) -@@ -939,7 +944,7 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( +@@ -954,7 +959,7 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( // static ResultCode SandboxWin::StartSandboxedProcess( const base::CommandLine& cmd_line, @@ -764,7 +764,7 @@ index 23b090edef2457e0dbe96a58b392d03bde05f5c1..545805a97fa4c7fa9318f243588da6a5 SandboxDelegate* delegate, StartSandboxedProcessCallback result_callback) { SandboxLaunchTimer timer; -@@ -949,7 +954,7 @@ ResultCode SandboxWin::StartSandboxedProcess( +@@ -964,7 +969,7 @@ ResultCode SandboxWin::StartSandboxedProcess( *base::CommandLine::ForCurrentProcess())) { base::Process process; ResultCode result = @@ -773,7 +773,7 @@ index 23b090edef2457e0dbe96a58b392d03bde05f5c1..545805a97fa4c7fa9318f243588da6a5 DWORD last_error = GetLastError(); std::move(result_callback).Run(std::move(process), last_error, result); return SBOX_ALL_OK; -@@ -959,7 +964,7 @@ ResultCode SandboxWin::StartSandboxedProcess( +@@ -974,7 +979,7 @@ ResultCode SandboxWin::StartSandboxedProcess( timer.OnPolicyCreated(); ResultCode result = GeneratePolicyForSandboxedProcess( diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index 3823a5d079d62..09f3940996a90 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -20,7 +20,7 @@ making three primary changes to Blink: * Controls whether the CSS rule is available. diff --git a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom -index 55b9d698a53e8cc7bc4422b0dbe8a5df71e23e11..b0ce80b13c8f214db027765048170bd40851f68a 100644 +index 880e5f9800b7b32ced2e1ae8e60f1115ccd1b038..aea957c186de970c71c97da1efd5228967566741 100644 --- a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom +++ b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom @@ -48,6 +48,7 @@ enum CSSSampleId { @@ -45,10 +45,10 @@ index e189d584f05f2ce6354c03a9b19f56985df8a15e..41b430e8f2416be098494f5c49fb97ca 'internal-forced-visited-'): internal_visited_order = 0 diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 -index 2df4e7b0d00dacfe0b31640da59f4d4a4aa951bd..446853fbb199c1dbe321f0a3652c57e609aed11f 100644 +index e1e6a90d3035e1aaedafbf129d2154e84777bd3f..d9fc85153bd0bd980ae2383acda99d79f00b3e2a 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5 -@@ -9010,6 +9010,26 @@ +@@ -9032,6 +9032,26 @@ property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], }, @@ -76,7 +76,7 @@ index 2df4e7b0d00dacfe0b31640da59f4d4a4aa951bd..446853fbb199c1dbe321f0a3652c57e6 { name: "-internal-visited-color", diff --git a/third_party/blink/renderer/core/css/css_property_equality.cc b/third_party/blink/renderer/core/css/css_property_equality.cc -index 4f2eff535fe0a74f612fa67ba0c88442350a0473..b4c8bfe3cf2652b4f9b79ff7b13bf22c1a5880db 100644 +index 362c4d558ad0c1af4f905bee759096c7afdf5e6b..7b764dc1988f8992d2b88e9d4d68d8b13c595f8b 100644 --- a/third_party/blink/renderer/core/css/css_property_equality.cc +++ b/third_party/blink/renderer/core/css/css_property_equality.cc @@ -354,6 +354,8 @@ bool CSSPropertyEquality::PropertiesEqual(const PropertyHandle& property, @@ -89,10 +89,10 @@ index 4f2eff535fe0a74f612fa67ba0c88442350a0473..b4c8bfe3cf2652b4f9b79ff7b13bf22c return a.EmptyCells() == b.EmptyCells(); case CSSPropertyID::kFill: diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -index ca097bf7d6334fe281f0af2015701b0af7036194..9c5bca32a5ebbfc666e1f941ac99b25fb59fa0c3 100644 +index 77350eb608ab3af30f9eac3bb0f16ba57b79d049..bea246503fc77eb3c9f2a5dbc67094ccda0f36c0 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -@@ -12367,5 +12367,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( +@@ -12447,5 +12447,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( CSSValueID::kNone>(stream); } @@ -130,10 +130,10 @@ index ca097bf7d6334fe281f0af2015701b0af7036194..9c5bca32a5ebbfc666e1f941ac99b25f } // namespace css_longhand } // namespace blink diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc -index b6968dd7370614c4a32e015da09b22db55b4143b..53ddeac758bfb89b4a77039a5e2d583e5d600f73 100644 +index aaf3b23f63e6bd5d5c8259feeff9f6202ea07f17..64772649927c94949cae132e502ef882c92d8f14 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc -@@ -4049,6 +4049,15 @@ PositionTryFallback StyleBuilderConverter::ConvertSinglePositionTryFallback( +@@ -4080,6 +4080,15 @@ PositionTryFallback StyleBuilderConverter::ConvertSinglePositionTryFallback( return PositionTryFallback(scoped_name, tactic_list); } @@ -150,13 +150,13 @@ index b6968dd7370614c4a32e015da09b22db55b4143b..53ddeac758bfb89b4a77039a5e2d583e const CSSValue& value) { const auto& list = To<CSSValueList>(value); diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.h b/third_party/blink/renderer/core/css/resolver/style_builder_converter.h -index 1f98f1086257c02f653f7e6acafc32a165668f52..9a1a436607a3d8c91a49e99d3eabef971e2fea9f 100644 +index 4b08af59fc8e4b2721e343d0dbf3270c0df24326..052435ac938069a734f5bbb984006c5d6b9b19b2 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.h +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.h -@@ -441,6 +441,7 @@ class StyleBuilderConverter { - static PositionTryFallback ConvertSinglePositionTryFallback( +@@ -448,6 +448,7 @@ class StyleBuilderConverter { StyleResolverState&, - const CSSValue&); + const CSSValue&, + bool allow_any_keyword_in_position_area = false); + static Length ConvertCornerSmoothing(StyleResolverState&, const CSSValue&); static FitText ConvertFitText(StyleResolverState&, const CSSValue&); static TextOverflowData ConvertTextOverflow(StyleResolverState&, @@ -201,10 +201,10 @@ index 0802c73aa4aaf4e1fb5efd367758f19c36691f71..5f06c0af277a7c937e694470beac707a return result; } diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn -index 09065ad3e03dddb25863ad7ef2e0e8e51af56a9d..08853e8624545824bade5061f6b8394f6309ecb7 100644 +index 009aede9ab946ac2a0b661611e9e6832c3b50c00..be3af08956d6b4c60547e6a6722342b4591b555d 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn -@@ -1673,6 +1673,8 @@ component("platform") { +@@ -1676,6 +1676,8 @@ component("platform") { "widget/widget_base.h", "widget/widget_base_client.h", "windows_keyboard_codes.h", @@ -312,7 +312,7 @@ index 7e3d46902fbf736b4240eb3fcb89975a7b222197..57fdc89fc265ad70cb0bff8443cc1026 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index 9ecc66cab0d9640835b1075ead0f4ae12bb92937..3cbdebcfcb0b6b30a1cd55e45121d77f8c32220f 100644 +index 2551bd7880118119921379f932cd6af5feee9a05..940a7f9eb953f8c0868ef1fdd8e3261befdbc511 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch index 2bc014ec1e312..706e117f54607 100644 --- a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch +++ b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch @@ -62,7 +62,7 @@ index 07fe1ea0e8e5f28428a164eedc28d4e5150ab13b..1a20c4b5765ce504c64c0dabfe3080fb #endif diff --git a/components/viz/host/layered_window_updater_impl.cc b/components/viz/host/layered_window_updater_impl.cc -index 8f726bde2cb5da6acfe630006af0fc3a09811d6c..45d8cae3ba0fca9a1514f83032a10c8820b3126d 100644 +index 36b9e09ca63aeec83c381918be2dbc933611e6ee..e58cb70d07cc61478bbd4e9a0233a11af6148c20 100644 --- a/components/viz/host/layered_window_updater_impl.cc +++ b/components/viz/host/layered_window_updater_impl.cc @@ -46,7 +46,9 @@ void LayeredWindowUpdaterImpl::OnAllocatedSharedMemory( @@ -90,7 +90,7 @@ index 8af69cac78b7488d28f1f05ccb174793fe5148cd..9f74e511c263d147b5fbe81fe100d217 private: const HWND hwnd_; diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn -index 88b4d3e2d965ee6930b4d5dd49c75af079c1bcff..17846f135a333b0f0a2755ad55d2492a4fd33693 100644 +index 89f08e2693d9101e89dd007df80881ff726195ad..1becf5ba595e60d1fb270ca2596b474c24682952 100644 --- a/components/viz/service/BUILD.gn +++ b/components/viz/service/BUILD.gn @@ -176,6 +176,8 @@ viz_component("service") { @@ -509,10 +509,10 @@ index 0000000000000000000000000000000000000000..e1a22ee881c0fd679ac2d2d4d11a3c93 + +#endif // COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_SOFTWARE_OUTPUT_DEVICE_PROXY_H_ diff --git a/components/viz/service/display_embedder/software_output_device_win.cc b/components/viz/service/display_embedder/software_output_device_win.cc -index 9119e302ad073a3b22ba47f800e7214b580e122b..0d5b95a424a62a77785088dbd759af4f977b010e 100644 +index 838031388c4c20bbcf068210559cb2018a661cd6..ec12dcfdc34891ecd107facc93c8f650c46f11d7 100644 --- a/components/viz/service/display_embedder/software_output_device_win.cc +++ b/components/viz/service/display_embedder/software_output_device_win.cc -@@ -157,7 +157,7 @@ void SoftwareOutputDeviceWinProxy::EndPaintDelegated( +@@ -156,7 +156,7 @@ void SoftwareOutputDeviceWinProxy::EndPaintDelegated( if (!canvas_) return; @@ -522,10 +522,10 @@ index 9119e302ad073a3b22ba47f800e7214b580e122b..0d5b95a424a62a77785088dbd759af4f waiting_on_draw_ack_ = true; diff --git a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc -index 346e41638ffefe5e5945aa3cfe0ec38887041a0b..38ed2eb97132201eb0adfd8b855c1611eab777f0 100644 +index 03f18d799eb8887f8435624eb7da4547e85aef08..744700c84b7ef79091a7ad590e086564f2109720 100644 --- a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc +++ b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc -@@ -131,7 +131,8 @@ RootCompositorFrameSinkImpl::Create( +@@ -130,7 +130,8 @@ RootCompositorFrameSinkImpl::Create( params->gpu_compositing, params->widget); auto output_surface = output_surface_provider->CreateOutputSurface( params->widget, params->gpu_compositing, display_client.get(), diff --git a/patches/chromium/feat_enable_passing_exit_code_on_service_process_crash.patch b/patches/chromium/feat_enable_passing_exit_code_on_service_process_crash.patch index bb84370fafa4d..d487bb8c01af8 100644 --- a/patches/chromium/feat_enable_passing_exit_code_on_service_process_crash.patch +++ b/patches/chromium/feat_enable_passing_exit_code_on_service_process_crash.patch @@ -84,7 +84,7 @@ index 2648adb1cf38ab557b66ffd0e3034b26b04d76d6..98eab587f343f6ca472efc3d4e7b31b2 private: const std::string service_interface_name_; diff --git a/content/browser/service_host/utility_process_host.cc b/content/browser/service_host/utility_process_host.cc -index d714d2022f685052e1def3b0d242d2ea596d790b..fb4cee1416836c4d0b807a862507a52347f24dd2 100644 +index 0d7c270217a7906a7f3c4c6e0afdc1386613578c..61ceacb989f049f7134a3c2279042bf4344d992e 100644 --- a/content/browser/service_host/utility_process_host.cc +++ b/content/browser/service_host/utility_process_host.cc @@ -629,7 +629,7 @@ void UtilityProcessHost::OnProcessCrashed(int exit_code) { diff --git a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch index 60ff89c4a1c68..ceee9cbe37b95 100644 --- a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch +++ b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch @@ -90,7 +90,7 @@ index 950d6e0fa3e5304b2d28db0e284f9697d0c9f45c..048900b092875f3dd01b8a3cd813f5a4 // when it receives the AcceptCHFrame. EnabledClientHints? enabled_client_hints; diff --git a/services/network/public/mojom/url_response_head.mojom b/services/network/public/mojom/url_response_head.mojom -index 3a5fbaea905e7c01caee3659ff3be06e8def5615..89da9461e8290b8099456e5222f278770e09f883 100644 +index 96fe8a372fa6a166db928c61b2c983b86a74b1a3..2a10810d50d083ab0a7340757d544a40484a4b7e 100644 --- a/services/network/public/mojom/url_response_head.mojom +++ b/services/network/public/mojom/url_response_head.mojom @@ -14,6 +14,7 @@ import "services/network/public/mojom/encoded_body_length.mojom"; @@ -112,10 +112,10 @@ index 3a5fbaea905e7c01caee3659ff3be06e8def5615..89da9461e8290b8099456e5222f27877 string mime_type; diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc -index 9c6f41c82539ec428defa5e093b8a2d780f6e0ee..5214e695c71ccdaf995bc21f30bf1a16d4f5082c 100644 +index 7834c23474416f7af4db75d24fc613c3913eee77..3d32e5d540deea75a453f603a2902c44a1b82287 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc -@@ -403,6 +403,9 @@ URLLoader::URLLoader( +@@ -406,6 +406,9 @@ URLLoader::URLLoader( mojo::SimpleWatcher::ArmingPolicy::MANUAL, TaskRunner(request.priority)), per_factory_orb_state_(context.GetMutableOrbState()), @@ -125,7 +125,7 @@ index 9c6f41c82539ec428defa5e093b8a2d780f6e0ee..5214e695c71ccdaf995bc21f30bf1a16 devtools_request_id_(request.devtools_request_id), options_(PopulateOptions(options, factory_params_->is_orb_enabled, -@@ -542,7 +545,7 @@ void URLLoader::SetUpUrlRequestCallbacks( +@@ -545,7 +548,7 @@ void URLLoader::SetUpUrlRequestCallbacks( &URLLoader::IsSharedDictionaryReadAllowed, base::Unretained(this))); } @@ -134,7 +134,7 @@ index 9c6f41c82539ec428defa5e093b8a2d780f6e0ee..5214e695c71ccdaf995bc21f30bf1a16 url_request_->SetResponseHeadersCallback(base::BindRepeating( &URLLoader::SetRawResponseHeaders, base::Unretained(this))); } -@@ -1161,6 +1164,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) { +@@ -1164,6 +1167,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) { } response_ = BuildResponseHead(); diff --git a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch index 28fe09fe3784b..06e2b467d8f31 100644 --- a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch +++ b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch @@ -20,7 +20,7 @@ This patch will be removed when the deprecated sync api support is removed. diff --git a/components/permissions/permission_util.cc b/components/permissions/permission_util.cc -index a82088f96079c3d5ddfbd35df98b2ebb2c0e62a4..668012a5e422059f52815fadf3c7d1d99af55032 100644 +index e243b7202505075658e04adc1eeacc01c7d7d72d..7078014e6db7c43d66b1448b2b36500f206ec4a0 100644 --- a/components/permissions/permission_util.cc +++ b/components/permissions/permission_util.cc @@ -536,6 +536,7 @@ ContentSettingsType PermissionUtil::PermissionTypeToContentSettingsTypeSafe( @@ -32,10 +32,10 @@ index a82088f96079c3d5ddfbd35df98b2ebb2c0e62a4..668012a5e422059f52815fadf3c7d1d9 break; } diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc -index 17a10ffc53c5700bb907f68142a6d6f403415099..dda07e1d45bf49b1fc3970a34a17bf65abc79e60 100644 +index f6c3e8d9139ca22e885979d7fa72edbccac182e1..0a72093709ae8f56cc7b8d1649efe23050423054 100644 --- a/content/browser/permissions/permission_controller_impl.cc +++ b/content/browser/permissions/permission_controller_impl.cc -@@ -89,6 +89,7 @@ PermissionToSchedulingFeature(PermissionType permission_name) { +@@ -94,6 +94,7 @@ PermissionToSchedulingFeature(PermissionType permission_name) { case PermissionType::AUTOMATIC_FULLSCREEN: case PermissionType::WEB_APP_INSTALLATION: case PermissionType::LOCAL_NETWORK_ACCESS: @@ -91,7 +91,7 @@ index 5c82a641538802bc459782ea422a1186045b054a..c286d87043ec4cb2e51ec9d82d08e4c8 // Always keep this at the end. NUM, diff --git a/third_party/blink/public/mojom/permissions/permission.mojom b/third_party/blink/public/mojom/permissions/permission.mojom -index 1591cba375920ef3bdaa5698658ac386cbed248c..6fc349a2f4633d1338fbfcf8d0d0fb6fa3180b0d 100644 +index 411412e3e9c08afad09321d8105dd4d628fe508a..549f9079c004ce8427ab2be0dba2e5b24471a8c9 100644 --- a/third_party/blink/public/mojom/permissions/permission.mojom +++ b/third_party/blink/public/mojom/permissions/permission.mojom @@ -43,7 +43,8 @@ enum PermissionName { diff --git a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch index d5be2ad823819..e08c741021c57 100644 --- a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch +++ b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch @@ -18,33 +18,79 @@ Additionally, this patch reverts https://chromium-review.googlesource.com/c/chromium/src/+/6936895 as we depend on the removed functionality in this patch. +diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm +index f651286bc85f3640ec072b05eb2f0d118e02417a..94ee607bc9de2bf388a736c438613b51de1a5ac2 100644 +--- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm ++++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm +@@ -522,7 +522,7 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) { + is_translucent_window_ = params->is_translucent; + pending_restoration_data_ = params->state_restoration_data; + +- if (display::Screen::Get()->IsHeadless()) { ++ if (params->is_headless_mode_window) { + headless_mode_window_ = std::make_optional<HeadlessModeWindow>(); + } + +diff --git a/components/remote_cocoa/common/native_widget_ns_window.mojom b/components/remote_cocoa/common/native_widget_ns_window.mojom +index 11954a3adfb6d517b6dc8e780a4a9aba8a0bf98a..1ddc1f34055c8b42177703ccc2f0d006294430da 100644 +--- a/components/remote_cocoa/common/native_widget_ns_window.mojom ++++ b/components/remote_cocoa/common/native_widget_ns_window.mojom +@@ -81,6 +81,8 @@ struct NativeWidgetNSWindowInitParams { + // NSWindowCollectionBehaviorParticipatesInCycle (this is not the + // default for NSWindows with NSWindowStyleMaskBorderless). + bool force_into_collection_cycle; ++ // If true, the window was created in headless mode. ++ bool is_headless_mode_window; + // An opaque blob of AppKit data which includes, among other things, a + // window's workspace and fullscreen state, and can be retrieved from or + // applied to a window. +diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.h b/ui/views/cocoa/native_widget_mac_ns_window_host.h +index e523151fb670af28cf2c54548c5009825fdbed92..66d5724f848b328a19362a3c0f6346704ddb50ac 100644 +--- a/ui/views/cocoa/native_widget_mac_ns_window_host.h ++++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h +@@ -554,6 +554,7 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost + bool is_miniaturized_ = false; + bool is_window_key_ = false; + bool is_mouse_capture_active_ = false; ++ bool is_headless_mode_window_ = false; + bool is_zoomed_ = false; + gfx::Rect window_bounds_before_fullscreen_; + diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -index 7befaf18ae9c922ccd8d36a006b9105cb55b1a32..953a683a7057e3be8181be197486709a55d04e9a 100644 +index 7459d4c241e914248261c62b63652fd7139dd54e..97b1f34a655c87bf888ea16e7ab6897132afdaae 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -@@ -464,7 +464,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -465,6 +465,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, if (!is_tooltip) { tooltip_manager_ = std::make_unique<TooltipManagerMac>(GetNSWindowMojo()); } -- is_headless_mode_window_ = display::Screen::Get()->IsHeadless(); + is_headless_mode_window_ = params.ShouldInitAsHeadless(); if (params.workspace.length()) { std::string restoration_data; -@@ -664,9 +664,10 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -482,6 +483,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, + window_params->modal_type = widget->widget_delegate()->GetModalType(); + window_params->is_translucent = + params.opacity == Widget::InitParams::WindowOpacity::kTranslucent; ++ window_params->is_headless_mode_window = is_headless_mode_window_; + window_params->is_tooltip = is_tooltip; + + // macOS likes to put shadows on most things. However, frameless windows +@@ -663,9 +665,10 @@ void HandleAccelerator(const ui::Accelerator& accelerator, // case it will never become visible but we want its compositor to produce // frames for screenshooting and screencasting. UpdateCompositorProperties(); - layer()->SetVisible(is_visible_); +- if (is_visible_ || display::Screen::Get()->IsHeadless()) { + layer()->SetVisible(is_visible_ || is_headless_mode_window_); - if (is_visible_ || is_headless_mode_window_) { ++ if (is_visible_ || is_headless_mode_window_) { compositor_->Unsuspend(); + layer()->SchedulePaint(layer()->bounds()); } // Register the CGWindowID (used to identify this window for video capture) diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc -index d24b78b50700f9f627c12cd5f339c7dcc0c173e5..77fd8b2f409e8f9151eb81c6a0da786babcdee6b 100644 +index 7e1bfe1f3754562a77615ab7ba83c23f719050b7..8a84abb915d3d0123f996eb027b357c953233a9c 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -222,6 +222,18 @@ ui::ZOrderLevel Widget::InitParams::EffectiveZOrderLevel() const { @@ -75,7 +121,7 @@ index d24b78b50700f9f627c12cd5f339c7dcc0c173e5..77fd8b2f409e8f9151eb81c6a0da786b if (params.opacity == views::Widget::InitParams::WindowOpacity::kInferred && diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h -index 89e00e8d2a456634beee8c72fcb753ab67e16c9e..473240be0c9168dc7a5fe771f1d473d9e2a9d978 100644 +index ce34d038564570f4edc8e36fd29524bd93c0b462..808abf2ce1c797591304a8ece9e8a169f034273e 100644 --- a/ui/views/widget/widget.h +++ b/ui/views/widget/widget.h @@ -324,6 +324,11 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, @@ -112,7 +158,7 @@ index 89e00e8d2a456634beee8c72fcb753ab67e16c9e..473240be0c9168dc7a5fe771f1d473d9 // True if the window size will follow the content preferred size. bool is_autosized() const { return is_autosized_; } -@@ -1718,6 +1731,9 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, +@@ -1715,6 +1728,9 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, // If true, the mouse is currently down. bool is_mouse_button_pressed_ = false; diff --git a/patches/chromium/fix_aspect_ratio_with_max_size.patch b/patches/chromium/fix_aspect_ratio_with_max_size.patch index 1b2e61f538ce9..2589b601380a1 100644 --- a/patches/chromium/fix_aspect_ratio_with_max_size.patch +++ b/patches/chromium/fix_aspect_ratio_with_max_size.patch @@ -11,10 +11,10 @@ enlarge window above dimensions set during creation of the BrowserWindow. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index f3f42f2c3ae4b185b0647902a2409bc9b25a152f..8c70c5ecef8c352e7cd5b9a986bd45d670760069 100644 +index 41b5219bdba3eba8bde935992fe60fc14898f68d..5376a8278a4cc784ad69cda6594c5055847c1f22 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -3848,15 +3848,30 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param, +@@ -3844,17 +3844,30 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param, delegate_->GetMinMaxSize(&min_window_size, &max_window_size); min_window_size = delegate_->DIPToScreenSize(min_window_size); max_window_size = delegate_->DIPToScreenSize(max_window_size); @@ -39,10 +39,12 @@ index f3f42f2c3ae4b185b0647902a2409bc9b25a152f..8c70c5ecef8c352e7cd5b9a986bd45d6 max_size_param = max_window_size; } +- gfx::Size excluded_margin = delegate_->DIPToScreenSize(excluded_margin_dip_); +- - gfx::SizeRectToAspectRatioWithExcludedMargin( + gfx::SizeRectToAspectRatio( GetWindowResizeEdge(param), aspect_ratio_.value(), min_window_size, -- max_size_param, excluded_margin_, *window_rect); +- max_size_param, excluded_margin, *window_rect); + max_size_param, window_rect); } diff --git a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch index 0d456b6702209..60be0a88278ce 100644 --- a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch +++ b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch @@ -28,10 +28,10 @@ The patch should be removed in favor of either: Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397. diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index 9dd046c064cf127846913deb0ce4582b291ffde9..d9dbaa5819e35a9fde95449ad2968fb2d940a015 100644 +index c39536aa73916af5063f1ed0259d0e8006dd791b..50ab987697d406a010c91f55b0298a049ecacb73 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc -@@ -11354,6 +11354,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { +@@ -11402,6 +11402,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { target_rph_id); } @@ -44,10 +44,10 @@ index 9dd046c064cf127846913deb0ce4582b291ffde9..d9dbaa5819e35a9fde95449ad2968fb2 // origin of |common_params.url| and/or |common_params.initiator_origin|. url::Origin resolved_origin = url::Origin::Resolve( diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc -index 061d87450ce7a157dff622eda112df7fd94fd9a4..e4b12b1327da816c3015d98ec93c6922417d5d1a 100644 +index 347137f6e28054860d3616a8559c4e38374465e6..546044c8b2479f601f6620617f902d3899b5d28c 100644 --- a/third_party/blink/renderer/core/loader/document_loader.cc +++ b/third_party/blink/renderer/core/loader/document_loader.cc -@@ -2337,6 +2337,10 @@ Frame* DocumentLoader::CalculateOwnerFrame() { +@@ -2324,6 +2324,10 @@ Frame* DocumentLoader::CalculateOwnerFrame() { scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin( Document* owner_document) { scoped_refptr<SecurityOrigin> origin; @@ -58,7 +58,7 @@ index 061d87450ce7a157dff622eda112df7fd94fd9a4..e4b12b1327da816c3015d98ec93c6922 // Whether the origin is newly created within this call, instead of copied // from an existing document's origin or from `origin_to_commit_`. If this is // true, we won't try to compare the nonce of this origin (if it's opaque) to -@@ -2373,6 +2377,9 @@ scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin( +@@ -2360,6 +2364,9 @@ scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin( // non-renderer only origin bits will be the same, which will be asserted at // the end of this function. origin = origin_to_commit_; diff --git a/patches/chromium/fix_font_face_resolution_when_renderer_is_blocked.patch b/patches/chromium/fix_font_face_resolution_when_renderer_is_blocked.patch deleted file mode 100644 index 714b48a48bfa9..0000000000000 --- a/patches/chromium/fix_font_face_resolution_when_renderer_is_blocked.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr <shelley.vohr@gmail.com> -Date: Tue, 4 Jun 2024 15:29:10 +0200 -Subject: Fix font face resolution when renderer is blocked - -Backports https://chromium-review.googlesource.com/c/chromium/src/+/5584820 - -As a result of https://chromium-review.googlesource.com/c/chromium/src/+/5290838, -the FontFaceSet promise in e.g. contentWindow.document.fonts.ready will never resolve -while the renderer is blocked. This Cl takes an approach similar to that taken in -MediaQueryList in order to enable the promise to be resolved. - -diff --git a/third_party/blink/renderer/core/css/font_face_set_document.cc b/third_party/blink/renderer/core/css/font_face_set_document.cc -index 79d15ae4d9de6350429b9b907d5136266d02c579..7e26808b3ef4437940ee6745d2651037c1bba9a2 100644 ---- a/third_party/blink/renderer/core/css/font_face_set_document.cc -+++ b/third_party/blink/renderer/core/css/font_face_set_document.cc -@@ -27,6 +27,7 @@ - - #include "base/metrics/histogram_functions.h" - #include "third_party/blink/public/common/features.h" -+#include "third_party/blink/public/common/metrics/document_update_reason.h" - #include "third_party/blink/renderer/bindings/core/v8/dictionary.h" - #include "third_party/blink/renderer/core/css/css_font_face.h" - #include "third_party/blink/renderer/core/css/css_font_selector.h" -@@ -141,21 +142,27 @@ FontFaceSetDocument::CSSConnectedFontFaceList() const { - } - - void FontFaceSetDocument::FireDoneEventIfPossible() { -- if (should_fire_loading_event_) { -+ Document* d = GetDocument(); -+ if (!d || !d->View()) { - return; - } -+ - if (!ShouldSignalReady()) { - return; - } -- Document* d = GetDocument(); -- if (!d) { -+ -+ // FireDoneEventIfPossible gets scheduled via PostTask at the end of a -+ // successful style+layout update. An invalidation may have occurred in -+ // the interim, so update style and layout synchronously here. -+ d->UpdateStyleAndLayout(DocumentUpdateReason::kUnknown); -+ -+ // These values can change during style+layout update, so check them -+ // *after* the call to UpdateStyleAndLayout. -+ if (should_fire_loading_event_) { - return; - } - -- // If the layout was invalidated in between when we thought layout -- // was updated and when we're ready to fire the event, just wait -- // until after the next layout before firing events. -- if (!d->View() || d->View()->NeedsLayout()) { -+ if (!ShouldSignalReady()) { - return; - } - diff --git a/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch b/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch index 9fc80aaa197bd..c10564d736499 100644 --- a/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch +++ b/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch @@ -40,7 +40,7 @@ accessing uninitialized lower indexes can return garbage values that cannot be n Refer to v8::EmbedderDataSlot::store_aligned_pointer for context. diff --git a/gin/public/gin_embedders.h b/gin/public/gin_embedders.h -index 8d7c5631fd8f1499c67384286f0e3c4037673b32..2b7bdfbac06a42e6bc51eb65e023c3673e6eb885 100644 +index cecf528475cb832ed1876381878eade582bc83d6..71308b2d963c2d083328aad6be356dc547ba5629 100644 --- a/gin/public/gin_embedders.h +++ b/gin/public/gin_embedders.h @@ -20,6 +20,8 @@ enum GinEmbedder : uint16_t { @@ -51,12 +51,12 @@ index 8d7c5631fd8f1499c67384286f0e3c4037673b32..2b7bdfbac06a42e6bc51eb65e023c367 + kEmbedderBlinkTag, }; - } // namespace gin + enum EmbedderDataTag : uint16_t { diff --git a/third_party/blink/renderer/platform/bindings/script_state.cc b/third_party/blink/renderer/platform/bindings/script_state.cc -index 2d5df763b6ebb2333ae4aef909865213fb9ad4df..2370f00a3f5ee70604c93a0999ea5cee3c9898f9 100644 +index 7c602990a3f9a3083308d282fe79bf858b642cdf..29222ecc17bf2e621c44f4b0f15a638326f3be38 100644 --- a/third_party/blink/renderer/platform/bindings/script_state.cc +++ b/third_party/blink/renderer/platform/bindings/script_state.cc -@@ -13,6 +13,10 @@ namespace blink { +@@ -14,6 +14,10 @@ namespace blink { ScriptState::CreateCallback ScriptState::s_create_callback_ = nullptr; @@ -67,26 +67,26 @@ index 2d5df763b6ebb2333ae4aef909865213fb9ad4df..2370f00a3f5ee70604c93a0999ea5cee // static void ScriptState::SetCreateCallback(CreateCallback create_callback) { DCHECK(create_callback); -@@ -37,6 +41,8 @@ ScriptState::ScriptState(v8::Local<v8::Context> context, - DCHECK(world_); +@@ -39,6 +43,8 @@ ScriptState::ScriptState(v8::Local<v8::Context> context, context_.SetWeak(this, &OnV8ContextCollectedCallback); - context->SetAlignedPointerInEmbedderData(kV8ContextPerContextDataIndex, this); + context->SetAlignedPointerInEmbedderData(kV8ContextPerContextDataIndex, this, + gin::kBlinkScriptState); + context->SetAlignedPointerInEmbedderData( + kV8ContextPerContextDataTagIndex, ScriptState::kScriptStateTagPtr); RendererResourceCoordinator::Get()->OnScriptStateCreated(this, execution_context); } -@@ -80,6 +86,8 @@ void ScriptState::DissociateContext() { +@@ -82,6 +88,8 @@ void ScriptState::DissociateContext() { // Cut the reference from V8 context to ScriptState. - GetContext()->SetAlignedPointerInEmbedderData(kV8ContextPerContextDataIndex, - nullptr); + GetContext()->SetAlignedPointerInEmbedderData( + kV8ContextPerContextDataIndex, nullptr, gin::kBlinkScriptState); + GetContext()->SetAlignedPointerInEmbedderData( + kV8ContextPerContextDataTagIndex, nullptr); reference_from_v8_context_.Clear(); // Cut the reference from ScriptState to V8 context. diff --git a/third_party/blink/renderer/platform/bindings/script_state.h b/third_party/blink/renderer/platform/bindings/script_state.h -index b3cc8d819b06108386aed9465cab4f27a28b675f..9c8818f10de59fdd2a3fd44d9cd23d40a93b53a7 100644 +index f06885f429a395b5c2eb55c89803837b550d765c..3340e4ec8d1ea20ea8310f288428b5869e85392a 100644 --- a/third_party/blink/renderer/platform/bindings/script_state.h +++ b/third_party/blink/renderer/platform/bindings/script_state.h @@ -185,7 +185,12 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> { diff --git a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch index ac2379859e70e..318ecef93a8d2 100644 --- a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch +++ b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch @@ -9,7 +9,7 @@ to support content settings UI. The support pulls in chrome content settings and UI code which are not valid in the scope of Electron. diff --git a/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc b/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc -index 387a75ac7b0c7be1e38c3ba2b357f729f1e09229..fecf72a6d434f7c22159420c1cbbf34a285838c8 100644 +index 28b9c9789b4f477c1007e2c55efa90d01f8c21a7..57506f2fa6d31abdc4c50abd0dbf1749c2b4087e 100644 --- a/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc +++ b/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc @@ -6,6 +6,7 @@ @@ -20,7 +20,7 @@ index 387a75ac7b0c7be1e38c3ba2b357f729f1e09229..fecf72a6d434f7c22159420c1cbbf34a #include "chrome/browser/picture_in_picture/picture_in_picture_bounds_cache.h" #include "chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker.h" #include "chrome/browser/ui/browser_navigator_params.h" -@@ -28,8 +29,10 @@ +@@ -32,8 +33,10 @@ #include "base/task/sequenced_task_runner.h" // TODO(crbug.com/421608904): include auto_picture_in_picture_tab_helper for // Android when supporting document PiP. @@ -31,7 +31,7 @@ index 387a75ac7b0c7be1e38c3ba2b357f729f1e09229..fecf72a6d434f7c22159420c1cbbf34a #include "chrome/browser/picture_in_picture/picture_in_picture_window.h" #include "media/base/media_switches.h" #include "net/base/url_util.h" -@@ -64,6 +67,7 @@ constexpr double kMaxWindowSizeRatio = 0.8; +@@ -68,6 +71,7 @@ constexpr double kMaxWindowSizeRatio = 0.8; // `kMaxWindowSizeRatio`. constexpr double kMaxSiteRequestedWindowSizeRatio = 0.25; @@ -39,7 +39,7 @@ index 387a75ac7b0c7be1e38c3ba2b357f729f1e09229..fecf72a6d434f7c22159420c1cbbf34a // Returns true if a document picture-in-picture window should be focused upon // opening it. bool ShouldFocusPictureInPictureWindow(const NavigateParams& params) { -@@ -80,6 +84,7 @@ bool ShouldFocusPictureInPictureWindow(const NavigateParams& params) { +@@ -84,6 +88,7 @@ bool ShouldFocusPictureInPictureWindow(const NavigateParams& params) { // AutoPictureInPictureTabHelper. return !auto_picture_in_picture_tab_helper->IsInAutoPictureInPicture(); } @@ -47,7 +47,7 @@ index 387a75ac7b0c7be1e38c3ba2b357f729f1e09229..fecf72a6d434f7c22159420c1cbbf34a // Returns the maximum area in pixels that the site can request a // picture-in-picture window to be. -@@ -217,7 +222,7 @@ bool PictureInPictureWindowManager::ExitPictureInPictureViaWindowUi( +@@ -221,7 +226,7 @@ bool PictureInPictureWindowManager::ExitPictureInPictureViaWindowUi( return false; } @@ -56,7 +56,7 @@ index 387a75ac7b0c7be1e38c3ba2b357f729f1e09229..fecf72a6d434f7c22159420c1cbbf34a // The user manually closed the pip window, so let the tab helper know in case // the auto-pip permission dialog was visible. if (auto* tab_helper = AutoPictureInPictureTabHelper::FromWebContents( -@@ -556,7 +561,7 @@ gfx::Size PictureInPictureWindowManager::GetMaximumWindowSize( +@@ -572,7 +577,7 @@ gfx::Size PictureInPictureWindowManager::GetMaximumWindowSize( // static void PictureInPictureWindowManager::SetWindowParams(NavigateParams& params) { @@ -65,7 +65,7 @@ index 387a75ac7b0c7be1e38c3ba2b357f729f1e09229..fecf72a6d434f7c22159420c1cbbf34a // Always show document picture-in-picture in a new window. When this is // not opened via the AutoPictureInPictureTabHelper, focus the window. params.window_action = ShouldFocusPictureInPictureWindow(params) -@@ -657,6 +662,7 @@ PictureInPictureWindowManager::GetOverlayView( +@@ -679,6 +684,7 @@ PictureInPictureWindowManager::GetOverlayView( return nullptr; } @@ -73,7 +73,7 @@ index 387a75ac7b0c7be1e38c3ba2b357f729f1e09229..fecf72a6d434f7c22159420c1cbbf34a // It would be nice to create this in `EnterPictureInPicture*`, but detecting // auto-pip while pip is in the process of opening doesn't work. // -@@ -695,6 +701,8 @@ PictureInPictureWindowManager::GetOverlayView( +@@ -717,6 +723,8 @@ PictureInPictureWindowManager::GetOverlayView( } return overlay_view; @@ -83,7 +83,7 @@ index 387a75ac7b0c7be1e38c3ba2b357f729f1e09229..fecf72a6d434f7c22159420c1cbbf34a PictureInPictureOcclusionTracker* diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -index c5552aa0dedf6adbe10409f32c6eeca28f11c0b6..be2b51295d08f468b416aa5755e6498942878de8 100644 +index 117b6b94f54f7629b5233cfdf988608476e7321c..8ac7f669984b47d4ec831ae9e2617eb2ea4ae36a 100644 --- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc @@ -471,11 +471,13 @@ std::unique_ptr<VideoOverlayWindowViews> VideoOverlayWindowViews::Create( diff --git a/patches/chromium/fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch b/patches/chromium/fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch index 6ae3218c31b0e..5ee738cfe276d 100644 --- a/patches/chromium/fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch +++ b/patches/chromium/fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch @@ -13,10 +13,10 @@ messages in the legacy window handle layer. These conditions are regularly hit with WCO-enabled windows on Windows. diff --git a/content/browser/renderer_host/legacy_render_widget_host_win.cc b/content/browser/renderer_host/legacy_render_widget_host_win.cc -index adf8545f5690223df73d61918dc3022fe63b6b8f..35ad59782691d2d254907df1d4f07788c927a37a 100644 +index 4723dee0cc086daac1419396b381a7298f97cebc..f76eac469e3966894430080085b2ba63740fa098 100644 --- a/content/browser/renderer_host/legacy_render_widget_host_win.cc +++ b/content/browser/renderer_host/legacy_render_widget_host_win.cc -@@ -376,12 +376,12 @@ LRESULT LegacyRenderWidgetHostHWND::OnKeyboardRange(UINT message, +@@ -368,12 +368,12 @@ LRESULT LegacyRenderWidgetHostHWND::OnKeyboardRange(UINT message, LRESULT LegacyRenderWidgetHostHWND::OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param) { @@ -31,7 +31,7 @@ index adf8545f5690223df73d61918dc3022fe63b6b8f..35ad59782691d2d254907df1d4f07788 tme.hwndTrack = hwnd(); tme.dwHoverTime = 0; TrackMouseEvent(&tme); -@@ -414,7 +414,10 @@ LRESULT LegacyRenderWidgetHostHWND::OnMouseRange(UINT message, +@@ -406,7 +406,10 @@ LRESULT LegacyRenderWidgetHostHWND::OnMouseRange(UINT message, // the picture. if (!msg_handled && (message >= WM_NCMOUSEMOVE && message <= WM_NCXBUTTONDBLCLK)) { diff --git a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch index 9c75b688323b9..221a9d79c3fd9 100644 --- a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch +++ b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch @@ -9,10 +9,10 @@ focus node change via TextInputManager. chromium-bug: https://crbug.com/1369605 diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index edb2638deb85dfd37651a00d4c370e51d94fcc6a..224694b638df5fa4c1498c7d010b4613459f0a40 100644 +index 34fca79b7c87b2fd098271fb5a4f83c015eeb2bc..12363555481b504ea69f822319aadadee5b03a2f 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -3247,6 +3247,12 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( +@@ -3245,6 +3245,12 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( } } @@ -87,10 +87,10 @@ index 75df43e3cd2721a92c90c18154d53d5c203e2465..ce42c75c8face36d21f53f44c0201ac4 // The view with active text input state, i.e., a focused <input> element. // It will be nullptr if no such view exists. Note that the active view diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index b97e039449bc43233c0388f9ae277341d6fde967..d30a9d94cfc30035b39d510ded65f271c9c51bb1 100644 +index 5bca1c0fbaa4dc3c6294fa206463ca3190a0367d..366399484c0ff72362fd246dc36182e611954283 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10115,7 +10115,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( +@@ -10119,7 +10119,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( "WebContentsImpl::OnFocusedElementChangedInFrame", "render_frame_host", frame); RenderWidgetHostViewBase* root_view = diff --git a/patches/chromium/fix_remove_caption-removing_style_call.patch b/patches/chromium/fix_remove_caption-removing_style_call.patch index f85c6bd3618ef..4cf483cb96e6d 100644 --- a/patches/chromium/fix_remove_caption-removing_style_call.patch +++ b/patches/chromium/fix_remove_caption-removing_style_call.patch @@ -18,10 +18,10 @@ or resizing, but Electron does not seem to run into that issue for opaque frameless windows even with that block commented out. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index b06c3ac425bb1f20b890447ed3315127195ed253..efbc967ef5f7501e3cccfbc084b60b3fd73dfc8e 100644 +index 1005d553d39909bdf7c2c7b1b714c58861ba747d..74ae0fa48721fbf19631294d92ae9326ad902c99 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -1856,7 +1856,23 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) { +@@ -1857,7 +1857,23 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) { SendMessage(hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0); diff --git a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch index 82e84992d8e10..189147d9e5332 100644 --- a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch +++ b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch @@ -8,7 +8,7 @@ such as the background turning black when maximizing the window and dynamic background material settings not taking effect. diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index f142ce65c5c0e22b968c98082d11d9922e3a0cfa..52f39a8ecb21a10aff991cc9072756d11472d55f 100644 +index 956dc87cb07559038a63cec0b5174cec09619bdb..68635b0c0153c3464ab6c7d317177098a7ec644c 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -183,6 +183,10 @@ void DesktopWindowTreeHostWin::FinishTouchDrag(gfx::Point screen_point) { @@ -23,7 +23,7 @@ index f142ce65c5c0e22b968c98082d11d9922e3a0cfa..52f39a8ecb21a10aff991cc9072756d1 void DesktopWindowTreeHostWin::Init(const Widget::InitParams& params) { diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -index 74f0f6e485f4cc6be2c292f4b364d9796d9ce20b..f02c82befc140bda5b5c54f6577472190cbaae15 100644 +index 0cd07fd5fb55dcc0d972de4c027fcb895d156592..0f4d335e1d54b5e92fc217080d86513db94d4122 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h @@ -93,6 +93,8 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin @@ -36,10 +36,10 @@ index 74f0f6e485f4cc6be2c292f4b364d9796d9ce20b..f02c82befc140bda5b5c54f657747219 // Overridden from DesktopWindowTreeHost: void Init(const Widget::InitParams& params) override; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index efbc967ef5f7501e3cccfbc084b60b3fd73dfc8e..55ba3b459ac57a453464f0dbb4681f4afb51eefe 100644 +index 74ae0fa48721fbf19631294d92ae9326ad902c99..1a26051de18f336db1ef7b1a4a60db9052e97b5e 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -993,13 +993,13 @@ void HWNDMessageHandler::FrameTypeChanged() { +@@ -994,13 +994,13 @@ void HWNDMessageHandler::FrameTypeChanged() { void HWNDMessageHandler::PaintAsActiveChanged() { if (!delegate_->HasNonClientView() || !delegate_->CanActivate() || @@ -55,7 +55,7 @@ index efbc967ef5f7501e3cccfbc084b60b3fd73dfc8e..55ba3b459ac57a453464f0dbb4681f4a } void HWNDMessageHandler::SetWindowIcons(const gfx::ImageSkia& window_icon, -@@ -1083,7 +1083,14 @@ void HWNDMessageHandler::SizeConstraintsChanged() { +@@ -1081,7 +1081,14 @@ void HWNDMessageHandler::SizeConstraintsChanged() { // allowing ui::GetResizableFrameThickness() to be used consistently when // removing the visible system frame. const bool had_caption_on_init = window_style() & WS_CAPTION; @@ -71,7 +71,7 @@ index efbc967ef5f7501e3cccfbc084b60b3fd73dfc8e..55ba3b459ac57a453464f0dbb4681f4a const bool can_maximize = can_resize && delegate_->CanMaximize(); auto set_style_func = [&style](LONG bit, bool should_set) { -@@ -1678,11 +1685,16 @@ void HWNDMessageHandler::ResetWindowRegion(bool force, bool redraw) { +@@ -1679,11 +1686,16 @@ void HWNDMessageHandler::ResetWindowRegion(bool force, bool redraw) { // through, but that isn't the case when using Direct3D to draw transparent // windows. So we route translucent windows throught to the delegate to // allow for a custom hit mask. @@ -89,7 +89,7 @@ index efbc967ef5f7501e3cccfbc084b60b3fd73dfc8e..55ba3b459ac57a453464f0dbb4681f4a return; } -@@ -2420,17 +2432,18 @@ LRESULT HWNDMessageHandler::OnNCActivate(UINT message, +@@ -2416,17 +2428,18 @@ LRESULT HWNDMessageHandler::OnNCActivate(UINT message, delegate_->SchedulePaint(); } diff --git a/patches/chromium/fix_restore_original_resize_performance_on_macos.patch b/patches/chromium/fix_restore_original_resize_performance_on_macos.patch index 82dd01df611e4..ea478524da7f5 100644 --- a/patches/chromium/fix_restore_original_resize_performance_on_macos.patch +++ b/patches/chromium/fix_restore_original_resize_performance_on_macos.patch @@ -11,7 +11,7 @@ This patch should be upstreamed as a conditional revert of the logic in desktop vs mobile runtimes. i.e. restore the old logic only on desktop platforms diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index a6abe25611c82da8c55998f74c9822746d87875c..d211d8dc92c16e8ad2e9b1b37cb25dd05bf7e3e1 100644 +index e07b2d171bbc33e271c5cef7e49e3451a8cdff84..0e2b978b3f35e5805d380da398bba58fcd256310 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -2153,9 +2153,8 @@ RenderWidgetHostImpl::GetWidgetInputHandler() { diff --git a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch index 2c95ae9b4c4e1..31ead3ae50956 100644 --- a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch +++ b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch @@ -59,10 +59,10 @@ index cba373664bec3a32abad6fe0396bd67b53b7e67f..a54f1b3351efd2d8f324436f7f35cd43 #endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_SCRIPT_EXECUTION_CALLBACK_H_ diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index 902f472c8c52dd4fe52f46fbb97034b041153f65..bebd52c6868b78588ded811b621e9c30b0152ad2 100644 +index e96fca375fc3eb2504dd6f82e5be2c025d23089e..62615df61435da20f7c93adf71a98c91ae151d5d 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc -@@ -3194,6 +3194,7 @@ void LocalFrame::RequestExecuteScript( +@@ -3185,6 +3185,7 @@ void LocalFrame::RequestExecuteScript( mojom::blink::EvaluationTiming evaluation_timing, mojom::blink::LoadEventBlockingOption blocking_option, WebScriptExecutionCallback callback, @@ -70,7 +70,7 @@ index 902f472c8c52dd4fe52f46fbb97034b041153f65..bebd52c6868b78588ded811b621e9c30 BackForwardCacheAware back_forward_cache_aware, mojom::blink::WantResultOption want_result_option, mojom::blink::PromiseResultOption promise_behavior) { -@@ -3251,7 +3252,7 @@ void LocalFrame::RequestExecuteScript( +@@ -3242,7 +3243,7 @@ void LocalFrame::RequestExecuteScript( PausableScriptExecutor::CreateAndRun( script_state, std::move(script_sources), execute_script_policy, user_gesture, evaluation_timing, blocking_option, want_result_option, @@ -80,10 +80,10 @@ index 902f472c8c52dd4fe52f46fbb97034b041153f65..bebd52c6868b78588ded811b621e9c30 void LocalFrame::SetEvictCachedSessionStorageOnFreezeOrUnload() { diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h -index 27a48a7ccdee3a15bd42e7ebb01cf109ec80fbf3..fc0dc28d97dc7e73ec0b86ed221179b1f538de9d 100644 +index 71eb863235ef37ef3a9671a825ef25c1b444bae4..e8870377d3c822a341fb9bec98c7cd67c184f20d 100644 --- a/third_party/blink/renderer/core/frame/local_frame.h +++ b/third_party/blink/renderer/core/frame/local_frame.h -@@ -831,6 +831,7 @@ class CORE_EXPORT LocalFrame final +@@ -826,6 +826,7 @@ class CORE_EXPORT LocalFrame final mojom::blink::EvaluationTiming, mojom::blink::LoadEventBlockingOption, WebScriptExecutionCallback, @@ -92,10 +92,10 @@ index 27a48a7ccdee3a15bd42e7ebb01cf109ec80fbf3..fc0dc28d97dc7e73ec0b86ed221179b1 mojom::blink::WantResultOption, mojom::blink::PromiseResultOption); diff --git a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc -index 6516d0bc1a2a1891e59268bc29ca20bf27ec4789..c2d7ac40b253135c5d0342863e88a60d721afd00 100644 +index 3a1da2ef67d9b551cb162ba7eee62383107f651a..71a45aa41b6fe475f9e265857b990fdaa875b72a 100644 --- a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc +++ b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc -@@ -968,6 +968,7 @@ void LocalFrameMojoHandler::JavaScriptExecuteRequestInIsolatedWorld( +@@ -998,6 +998,7 @@ void LocalFrameMojoHandler::JavaScriptExecuteRequestInIsolatedWorld( std::move(callback).Run(value ? std::move(*value) : base::Value()); }, std::move(callback)), @@ -203,7 +203,7 @@ index fa65331f40b90d812b71a489fd560e9359152d2b..390714d631dc88ef92d59ef9618a5706 const mojom::blink::UserActivationOption user_activation_option_; const mojom::blink::LoadEventBlockingOption blocking_option_; diff --git a/third_party/blink/renderer/core/frame/web_frame_test.cc b/third_party/blink/renderer/core/frame/web_frame_test.cc -index afee60b061eb816286f34323f6dad8cb81d8f203..0d81f7e997225f25c17f3ec2c16962ab5ecfe465 100644 +index 389ba18d5c709156f0c8da2e578825ba59ce6190..1dcfee3a5f43a4be6a57511b194aa68518c1b090 100644 --- a/third_party/blink/renderer/core/frame/web_frame_test.cc +++ b/third_party/blink/renderer/core/frame/web_frame_test.cc @@ -295,6 +295,7 @@ void ExecuteScriptsInMainWorld( @@ -215,10 +215,10 @@ index afee60b061eb816286f34323f6dad8cb81d8f203..0d81f7e997225f25c17f3ec2c16962ab mojom::blink::WantResultOption::kWantResult, wait_for_promise); } diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -index 8035d2ee0dbef988f87de48a6aa5371b74377637..30e3a7613bc7c951faccc44b5989d2840a6ce6ad 100644 +index 6f5745a56ad0a64649c726355808095e96567915..0cc0203f0bf1016c29ca508a7fc23f21f5c85234 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -@@ -1122,14 +1122,15 @@ void WebLocalFrameImpl::RequestExecuteScript( +@@ -1123,14 +1123,15 @@ void WebLocalFrameImpl::RequestExecuteScript( mojom::blink::EvaluationTiming evaluation_timing, mojom::blink::LoadEventBlockingOption blocking_option, WebScriptExecutionCallback callback, diff --git a/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch b/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch index c3f5a46ed96c5..af9b9d1036a5f 100644 --- a/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch +++ b/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch @@ -6,7 +6,7 @@ Subject: fix: select the first menu item when opened via keyboard This fixes an accessibility issue where the root view is 'focused' to the screen reader instead of the first menu item as with all other native menus. This patch will be upstreamed. diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc -index 6228ee44dfceacdbe2b176bd28fb8e89d4acdd41..9679a94d76dd0d6dd820268a210fe20bf47bb12d 100644 +index 9bb09e12baa7fc8f6ae71f2e64af05dc8236d803..d76282aed81e51f4301222db55c97dd0a705fe8b 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc @@ -740,6 +740,16 @@ void MenuController::Run(Widget* parent, @@ -26,7 +26,7 @@ index 6228ee44dfceacdbe2b176bd28fb8e89d4acdd41..9679a94d76dd0d6dd820268a210fe20b if (button_controller) { pressed_lock_ = button_controller->TakeLock( false, ui::LocatedEvent::FromIfValid(event)); -@@ -2482,18 +2492,15 @@ void MenuController::OpenMenuImpl(MenuItemView* item, bool show) { +@@ -2496,18 +2506,15 @@ void MenuController::OpenMenuImpl(MenuItemView* item, bool show) { } item->GetSubmenu()->ShowAt(params); diff --git a/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch b/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch index 553812f7e4a50..0d7032c2f3ec2 100644 --- a/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch +++ b/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch @@ -15,10 +15,10 @@ capturer was window or screen-specific, as the IDs remain valid for generic capturer as well. diff --git a/content/browser/media/capture/desktop_capture_device.cc b/content/browser/media/capture/desktop_capture_device.cc -index 963110fef8f60e23cd5b6b13fd39b1e10dd7e854..05e366456689e7d3c43df96fdf40d913bb770fe9 100644 +index d69a82b80bf621b1546f376cd7bc6588327f70a9..d3fc15ddcd7bdaf46016a3d7ad46da19b0fd6644 100644 --- a/content/browser/media/capture/desktop_capture_device.cc +++ b/content/browser/media/capture/desktop_capture_device.cc -@@ -954,9 +954,16 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( +@@ -964,9 +964,16 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( switch (source.type) { case DesktopMediaID::TYPE_SCREEN: { @@ -38,7 +38,7 @@ index 963110fef8f60e23cd5b6b13fd39b1e10dd7e854..05e366456689e7d3c43df96fdf40d913 if (screen_capturer && screen_capturer->SelectSource(source.id)) { capturer = std::make_unique<webrtc::DesktopAndCursorComposer>( std::move(screen_capturer), options); -@@ -969,8 +976,15 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( +@@ -979,8 +986,15 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( } case DesktopMediaID::TYPE_WINDOW: { diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index d420fb4077252..521127296c139 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -6,10 +6,10 @@ Subject: frame_host_manager.patch Allows embedder to intercept site instances created by chromium. diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc -index 376fa172533f3d421aced54df992e1e60a5fa317..b51214da88e8c7c046abfe8d251b411bd5997ed3 100644 +index 8b25708f074cbf0e0aa9c750bf54af58aadf4358..93ae522c5cb5dd3e03097d8631562d25dc0063ef 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc -@@ -4789,6 +4789,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -4792,6 +4792,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( request->ResetStateForSiteInstanceChange(); } @@ -20,10 +20,10 @@ index 376fa172533f3d421aced54df992e1e60a5fa317..b51214da88e8c7c046abfe8d251b411b } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index f93858d6cb4cb89075e9ed7ee50f4e86df37c279..d996356ed060e2762c8008c2376a00bdc88481ba 100644 +index 22b1bcac984a5f0e7140693a9c8ff586f12afe24..86cea3713135261fdc3e68ce3396f89682e22e6f 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -339,6 +339,11 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -334,6 +334,11 @@ class CONTENT_EXPORT ContentBrowserClient { virtual ~ContentBrowserClient() = default; diff --git a/patches/chromium/gin_enable_disable_v8_platform.patch b/patches/chromium/gin_enable_disable_v8_platform.patch index c5b9746fe3f68..d332f17e0e30d 100644 --- a/patches/chromium/gin_enable_disable_v8_platform.patch +++ b/patches/chromium/gin_enable_disable_v8_platform.patch @@ -27,10 +27,10 @@ index 8a9be905bcbe9ccc8afaae2795605f87b81465d9..ab574fd81bc08e109123f07f095d26e1 g_reference_table = reference_table; g_fatal_error_callback = fatal_error_callback; diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h -index ff42cfbb6a228e902317c7e3ab035d8437d5dd62..e27f177ce27e177abf6cee84cd466e7a8a829ee7 100644 +index 2c6eee95c8ddfbd08d934ac8ddd0b0edb0fa177a..45edc6c8930aede7a89cb1a3afbb9406f3c9158e 100644 --- a/gin/public/isolate_holder.h +++ b/gin/public/isolate_holder.h -@@ -119,7 +119,8 @@ class GIN_EXPORT IsolateHolder { +@@ -120,7 +120,8 @@ class GIN_EXPORT IsolateHolder { std::string js_command_line_flags = {}, bool disallow_v8_feature_flag_overrides = false, v8::FatalErrorCallback fatal_error_callback = nullptr, diff --git a/patches/chromium/gritsettings_resource_ids.patch b/patches/chromium/gritsettings_resource_ids.patch index 95de66eab6b3f..e864d9f53d299 100644 --- a/patches/chromium/gritsettings_resource_ids.patch +++ b/patches/chromium/gritsettings_resource_ids.patch @@ -6,10 +6,10 @@ Subject: gritsettings_resource_ids.patch Add electron resources file to the list of resource ids generation. diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec -index 36f9760734818c6769d20d97c01f7058617bc7d0..2d7b422c31b0d849e2c07c62d186a71d393ea9f2 100644 +index dd44a6f6850fe36d9a159e98cd1ffb23df10876d..9850329b7dfdabb00463a570932ff50911556011 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec -@@ -1575,6 +1575,11 @@ +@@ -1585,6 +1585,11 @@ "messages": [10120], }, diff --git a/patches/chromium/inspectorpageagent_provisional_frame_speculative_fix.patch b/patches/chromium/inspectorpageagent_provisional_frame_speculative_fix.patch deleted file mode 100644 index aaa26e9b1ee5a..0000000000000 --- a/patches/chromium/inspectorpageagent_provisional_frame_speculative_fix.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Joey Arhar <jarhar@chromium.org> -Date: Wed, 1 Oct 2025 02:03:37 -0700 -Subject: InspectorPageAgent provisional frame speculative fix - -According to crash reports, addScriptToEvaluateOnNewDocument is running -on provisional frames. - -Fixed: 390710982 -Change-Id: I5cecf63c9517d0b28fff40361c607b0aa54e68cf -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6216479 -Reviewed-by: Alex Rudenko <alexrudenko@chromium.org> -Commit-Queue: Alex Rudenko <alexrudenko@chromium.org> -Auto-Submit: Joey Arhar <jarhar@chromium.org> -Cr-Commit-Position: refs/heads/main@{#1523418} - -diff --git a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc -index 386df6dc728e5a1b1aac9865c1687db03f48d9ee..77bcd0f9f8155d1c9ddc167f594791abf48fcfb9 100644 ---- a/third_party/blink/renderer/core/inspector/inspector_page_agent.cc -+++ b/third_party/blink/renderer/core/inspector/inspector_page_agent.cc -@@ -603,7 +603,11 @@ protocol::Response InspectorPageAgent::addScriptToEvaluateOnNewDocument( - // Runtime.enable that forces main context creation. In this case, we would - // not normally evaluate the script, but we should. - for (LocalFrame* frame : *inspected_frames_) { -- EvaluateScriptOnNewDocument(*frame, *identifier); -+ // Don't evaluate scripts on provisional frames: -+ // https://crbug.com/390710982 -+ if (!frame->IsProvisional()) { -+ EvaluateScriptOnNewDocument(*frame, *identifier); -+ } - } - } - -diff --git a/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials b/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials -index 8df5aa4252464bd4bf06d04b1b4f100453954082..a58b683bd7f2bea8b059f096b48e61d9cd9302d7 100644 ---- a/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials -+++ b/third_party/blink/web_tests/FlagExpectations/disable-site-isolation-trials -@@ -63,6 +63,7 @@ http/tests/inspector-protocol/target/target-filter.js [ Skip ] - virtual/fenced-frame-mparch/http/tests/inspector-protocol/fenced-frame/fenced-frame-in-oopif-auto-attach.js [ Skip ] - http/tests/inspector-protocol/target/target-info-changed-auto-attach.js [ Skip ] - http/tests/inspector-protocol/page/frame-detached-oopif.js [ Skip ] -+http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload.js [ Skip ] - - # Rely on OOPIF for an iframe to be a separate devtools target - http/tests/inspector-protocol/timeline/auction-worklet-frame.js [ Skip ] -diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload-expected.txt -new file mode 100644 -index 0000000000000000000000000000000000000000..0131df6c227e1803741e654d42b15f589275061a ---- /dev/null -+++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload-expected.txt -@@ -0,0 +1,28 @@ -+Tests that Page.addScriptToEvaluateOnNewDocument on auto-attach with runImmediately=true. -+Regression test for crbug.com/390710982. -+console called: { -+ method : Runtime.consoleAPICalled -+ params : { -+ args : [ -+ [0] : { -+ type : string -+ value : evaluated -+ } -+ ] -+ executionContextId : <number> -+ stackTrace : { -+ callFrames : [ -+ [0] : { -+ columnNumber : 8 -+ functionName : -+ lineNumber : 0 -+ scriptId : <string> -+ url : -+ } -+ ] -+ } -+ timestamp : <number> -+ type : log -+ } -+ sessionId : <string> -+} -diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload.js b/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload.js -new file mode 100644 -index 0000000000000000000000000000000000000000..52ebe845c323c6d692147052f3458777dcd7f966 ---- /dev/null -+++ b/third_party/blink/web_tests/http/tests/inspector-protocol/page/addScriptToEvaluateOnNewDocument-reload.js -@@ -0,0 +1,31 @@ -+(async function(/** @type {import('test_runner').TestRunner} */ testRunner) { -+ const { session, dp } = await testRunner.startBlank( -+ `Tests that Page.addScriptToEvaluateOnNewDocument on auto-attach with runImmediately=true. -+Regression test for crbug.com/390710982.`); -+ -+ await dp.Page.enable(); -+ await dp.Target.enable(); -+ await dp.Target.setAutoAttach({ flatten: true, autoAttach: true, waitForDebuggerOnStart: true }); -+ -+ dp.Target.onAttachedToTarget(async event => { -+ const dp2 = session.createChild(event.params.sessionId).protocol; -+ dp2.Page.enable(); -+ dp2.Runtime.enable(); -+ dp2.Runtime.onConsoleAPICalled(event => { -+ testRunner.log(event, 'console called: '); -+ }); -+ dp2.Page.addScriptToEvaluateOnNewDocument({ -+ source: 'console.log("evaluated")', -+ runImmediately: true, -+ }); -+ await dp2.Runtime.runIfWaitingForDebugger(); -+ }); -+ -+ const loaded = dp.Page.onceLoadEventFired(); -+ await dp.Page.navigate({ -+ url: testRunner.url('resources/iframe-src.html') -+ }); -+ await loaded; -+ -+ testRunner.completeTest(); -+}); diff --git a/patches/chromium/isolate_holder.patch b/patches/chromium/isolate_holder.patch index 75aa3b9884dc7..9517feda1bd5b 100644 --- a/patches/chromium/isolate_holder.patch +++ b/patches/chromium/isolate_holder.patch @@ -58,10 +58,10 @@ index ab574fd81bc08e109123f07f095d26e19504baa0..656267caef2d515f8c3f77535b308108 isolate_, allocator, access_mode_, task_runner, std::move(user_visible_task_runner), std::move(best_effort_task_runner)); diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h -index e27f177ce27e177abf6cee84cd466e7a8a829ee7..dc3a5b0678b9c686e241b492e2c3b5ac833611a3 100644 +index 45edc6c8930aede7a89cb1a3afbb9406f3c9158e..a4c766565bfcc47d1ef66570afa166b9c0c16312 100644 --- a/gin/public/isolate_holder.h +++ b/gin/public/isolate_holder.h -@@ -88,7 +88,8 @@ class GIN_EXPORT IsolateHolder { +@@ -89,7 +89,8 @@ class GIN_EXPORT IsolateHolder { nullptr, scoped_refptr<base::SingleThreadTaskRunner> best_effort_task_runner = nullptr, @@ -71,7 +71,7 @@ index e27f177ce27e177abf6cee84cd466e7a8a829ee7..dc3a5b0678b9c686e241b492e2c3b5ac IsolateHolder( scoped_refptr<base::SingleThreadTaskRunner> task_runner, AccessMode access_mode, -@@ -98,7 +99,8 @@ class GIN_EXPORT IsolateHolder { +@@ -99,7 +100,8 @@ class GIN_EXPORT IsolateHolder { scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner = nullptr, scoped_refptr<base::SingleThreadTaskRunner> best_effort_task_runner = diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index bfa1c74492470..f499b20df0526 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -35,10 +35,10 @@ system font by checking if it's kCTFontPriorityAttribute is set to system priority. diff --git a/base/BUILD.gn b/base/BUILD.gn -index 7f98c195c12b141a792913b3e9888d8eeabc74ed..901119f3fdc81800592b6f5a987054c3c62374c6 100644 +index f96e2575849490fa8b2060b00c092ce90d540324..3babc3bbf4b7af1833254e8b92d7cd669877e168 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn -@@ -1059,6 +1059,7 @@ component("base") { +@@ -1060,6 +1060,7 @@ component("base") { "//build:ios_buildflags", "//build/config/compiler:compiler_buildflags", "//third_party/modp_b64", @@ -195,10 +195,10 @@ index e12c1d078147d956a1d9b1bc498c1b1d6fe7b974..233362259dc4e728ed37435e65041764 } // namespace base diff --git a/components/os_crypt/sync/BUILD.gn b/components/os_crypt/sync/BUILD.gn -index bbaf1143e725a1b6c49eef705b1e62c4133bfa27..81fc444043b67858371142075f98ad9aff162fc3 100644 +index 45d8e77cdfe6539563d16dd93fd48f8241f4bfca..e9fffc2e3f0520a56ff5753a4a1abfc11c795b83 100644 --- a/components/os_crypt/sync/BUILD.gn +++ b/components/os_crypt/sync/BUILD.gn -@@ -75,6 +75,8 @@ component("sync") { +@@ -76,6 +76,8 @@ component("sync") { "os_crypt_mac.mm", ] deps += [ "//crypto:mock_apple_keychain" ] @@ -452,7 +452,7 @@ index 433f12928857e288b6b0d4f4dd3d1f29da08cf6c..bb95aabec2e0d5c7b3a5d315c9a3f8cb bool shouldShowWindowTitle = YES; if (_bridge) diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm -index e90c5a7cbb852ba33df47209cfb7890472f1fbb1..53881e0efdf8f868245dbca7040cd6aac899d50c 100644 +index f9f453e713b1beff8fda2fcd2a21907640c19817..f651286bc85f3640ec072b05eb2f0d118e02417a 100644 --- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm +++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm @@ -42,6 +42,7 @@ @@ -463,7 +463,7 @@ index e90c5a7cbb852ba33df47209cfb7890472f1fbb1..53881e0efdf8f868245dbca7040cd6aa #include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "net/cert/x509_util_apple.h" #include "ui/accelerated_widget_mac/window_resize_helper_mac.h" -@@ -691,10 +692,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) { +@@ -692,10 +693,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) { // this should be treated as an error and caught early. CHECK(bridged_view_); @@ -477,10 +477,10 @@ index e90c5a7cbb852ba33df47209cfb7890472f1fbb1..53881e0efdf8f868245dbca7040cd6aa // Beware: This view was briefly removed (in favor of a bare CALayer) in // https://crrev.com/c/1236675. The ordering of unassociated layers relative diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn -index 9f487674f174e69c749c93e030de66e954947a73..88b4d3e2d965ee6930b4d5dd49c75af079c1bcff 100644 +index 40718df4d3d7092309ea7027ae6c59a7963fd03c..89f08e2693d9101e89dd007df80881ff726195ad 100644 --- a/components/viz/service/BUILD.gn +++ b/components/viz/service/BUILD.gn -@@ -385,6 +385,7 @@ viz_component("service") { +@@ -387,6 +387,7 @@ viz_component("service") { "frame_sinks/external_begin_frame_source_mac.h", ] } @@ -488,7 +488,7 @@ index 9f487674f174e69c749c93e030de66e954947a73..88b4d3e2d965ee6930b4d5dd49c75af0 } if (is_ios) { -@@ -708,6 +709,7 @@ viz_source_set("unit_tests") { +@@ -710,6 +711,7 @@ viz_source_set("unit_tests") { "display_embedder/software_output_device_mac_unittest.mm", ] frameworks = [ "IOSurface.framework" ] @@ -548,7 +548,7 @@ index 010c713090e5038dc90db131c8f621422d30c03b..20c35e887a0496ee609c077e3b0494bd void ForwardKeyboardEvent(const input::NativeWebKeyboardEvent& key_event, diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -index d3f833904a7a056235d4bd4b3e7c5297a60861f5..8986ec2405541a43ca34d47f9ac0ffbf875ae63a 100644 +index e2b316223ee5cbd99cb5f9f69c5454600cb8f74f..3d5cf1f31281e8412e6cdb441e6aa7954ad2d601 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -34,6 +34,7 @@ @@ -559,7 +559,7 @@ index d3f833904a7a056235d4bd4b3e7c5297a60861f5..8986ec2405541a43ca34d47f9ac0ffbf #include "skia/ext/skia_utils_mac.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/mojom/input/input_handler.mojom.h" -@@ -2095,15 +2096,21 @@ - (NSAccessibilityRole)accessibilityRole { +@@ -2085,15 +2086,21 @@ - (NSAccessibilityRole)accessibilityRole { // Since this implementation doesn't have to wait any IPC calls, this doesn't // make any key-typing jank. --hbono 7/23/09 // @@ -582,7 +582,7 @@ index d3f833904a7a056235d4bd4b3e7c5297a60861f5..8986ec2405541a43ca34d47f9ac0ffbf return kAttributes; } diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index bb12a1600ddda11abb6485f685564e2d5a7a5837..a1bcbbaca764ae901dad961c94a8a33432a92bd2 100644 +index fbcca47f273a226fbed885f7dc56662778ecff8c..37b070c55bdda55136e1ed76771e10eb883a3a0e 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn @@ -347,6 +347,7 @@ source_set("browser") { @@ -628,7 +628,7 @@ index 319e58e5c3cad4ec47fca2c7cb0d59d4c5fd460c..d17bdb51081cee80f6f43199057de557 // Used to force the NSApplication's focused accessibility element to be the // content::BrowserAccessibilityCocoa accessibility tree when the NSView for diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index 8b53385eacb73bbafa1a095bd2db833ecfd930bb..3798a24ce4aedb6aa2954d8f99b603bf08f1179d 100644 +index 439cb7e93e802c689e16a24853f3ce75216ec74f..1fde0953bdc8bf3cd777206d7d340188ebf946fb 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -52,6 +52,7 @@ @@ -650,7 +650,7 @@ index 8b53385eacb73bbafa1a095bd2db833ecfd930bb..3798a24ce4aedb6aa2954d8f99b603bf // Reset `ns_view_` before resetting `remote_ns_view_` to avoid dangling // pointers. `ns_view_` gets reinitialized later in this method. -@@ -1638,10 +1641,12 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1652,10 +1655,12 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, gfx::NativeViewAccessible RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() { @@ -663,7 +663,7 @@ index 8b53385eacb73bbafa1a095bd2db833ecfd930bb..3798a24ce4aedb6aa2954d8f99b603bf return gfx::NativeViewAccessible([GetInProcessNSView() window]); } -@@ -1693,9 +1698,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1707,9 +1712,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, } void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) { @@ -675,7 +675,7 @@ index 8b53385eacb73bbafa1a095bd2db833ecfd930bb..3798a24ce4aedb6aa2954d8f99b603bf } bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame( -@@ -2198,20 +2205,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -2212,20 +2219,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, void RenderWidgetHostViewMac::GetRenderWidgetAccessibilityToken( GetRenderWidgetAccessibilityTokenCallback callback) { base::ProcessId pid = getpid(); @@ -715,10 +715,10 @@ index 8c293f5bb0e859f438a7ab50b70b4d5449dc1358..d58c73427935127fdec173224bcb9709 defines = [] diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn -index b31aef089e03d530831df59327936785f026a300..457f5c907169da132cfd6304241dcecae779fc69 100644 +index b6a99875ce151b5a517e2c850ba50d8ba9749e0f..b88b411d7d5430200c88203e727c49ab90233140 100644 --- a/content/renderer/BUILD.gn +++ b/content/renderer/BUILD.gn -@@ -320,6 +320,7 @@ target(link_target_type, "renderer") { +@@ -323,6 +323,7 @@ target(link_target_type, "renderer") { "//ui/surface", "//url", "//v8", @@ -797,10 +797,10 @@ index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbe } // namespace content diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn -index 6232ce7ac3676b0b7e15e5a3f41e2e44c4dab787..21d29e74a9c3a5d085bf451b2b5ae2fdae165c50 100644 +index c9e14f94e0f713b09db8ec3e29702f7b948f1e3b..f52984c0ad9611933a75b7e359bc2d35ff0cd575 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn -@@ -673,6 +673,7 @@ static_library("test_support") { +@@ -703,6 +703,7 @@ static_library("test_support") { "//url", "//url/mojom:url_mojom_gurl", "//v8", @@ -808,7 +808,7 @@ index 6232ce7ac3676b0b7e15e5a3f41e2e44c4dab787..21d29e74a9c3a5d085bf451b2b5ae2fd ] data_deps = [ -@@ -1143,6 +1144,8 @@ static_library("browsertest_support") { +@@ -1175,6 +1176,8 @@ static_library("browsertest_support") { # TODO(crbug.com/40031409): Fix code that adds exit-time destructors and # enable the diagnostic by removing this line. configs += [ "//build/config/compiler:no_exit_time_destructors" ] @@ -817,7 +817,7 @@ index 6232ce7ac3676b0b7e15e5a3f41e2e44c4dab787..21d29e74a9c3a5d085bf451b2b5ae2fd } mojom("content_test_mojo_bindings") { -@@ -2030,6 +2033,7 @@ test("content_browsertests") { +@@ -2065,6 +2068,7 @@ test("content_browsertests") { "//ui/shell_dialogs", "//ui/snapshot", "//ui/webui:test_support", @@ -825,7 +825,7 @@ index 6232ce7ac3676b0b7e15e5a3f41e2e44c4dab787..21d29e74a9c3a5d085bf451b2b5ae2fd ] if (!(is_chromeos && target_cpu == "arm64" && current_cpu == "arm")) { -@@ -3356,6 +3360,7 @@ test("content_unittests") { +@@ -3395,6 +3399,7 @@ test("content_unittests") { "//ui/shell_dialogs", "//ui/webui:test_support", "//url", @@ -846,10 +846,10 @@ index ab961bccc3e4f0f5a40ac74df97447118b256c68..43f00bf0879809e986308a2cb26145c4 if (is_mac) { diff --git a/device/bluetooth/BUILD.gn b/device/bluetooth/BUILD.gn -index fdb2993ab0879c5693008fdabc10566d11e471aa..2af4bf9975385ea8080cd9bd2b55f24e3ab7a2f1 100644 +index 3504d7197bd3225b6b83d7e057f389d8327b9ff7..92547d8bc700f3139f4bbc77d621152e0bc2a81c 100644 --- a/device/bluetooth/BUILD.gn +++ b/device/bluetooth/BUILD.gn -@@ -256,6 +256,7 @@ component("bluetooth") { +@@ -257,6 +257,7 @@ component("bluetooth") { "CoreBluetooth.framework", "Foundation.framework", ] @@ -904,10 +904,10 @@ index f300e8d331057e894b43b74944e5052c39206844..4ff5277d550485cd79c5b5316d89c730 base::WeakPtr<BluetoothLowEnergyAdapterApple> diff --git a/gpu/ipc/service/BUILD.gn b/gpu/ipc/service/BUILD.gn -index 1e35afb74f7a149fb01ec2a2c62547a8aa6f1de1..05f4628930e74ea668a85968f74c678e57a6429d 100644 +index 74134d9b3d6d50146b97086385b8b4ee71d6cca4..014ce3738f354e360519d52b5ec2f99feebf3afe 100644 --- a/gpu/ipc/service/BUILD.gn +++ b/gpu/ipc/service/BUILD.gn -@@ -128,6 +128,7 @@ component("service") { +@@ -122,6 +122,7 @@ component("service") { "QuartzCore.framework", ] defines += [ "GL_SILENCE_DEPRECATION" ] @@ -938,7 +938,7 @@ index d288ffce5c1265adbdefc571f840851026e7479e..e9a6e8c31401750d270fcc55ef1116b2 namespace ui { diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn -index 7bc208697690ac36a3fc546748a05cbe952f1003..2fa14c45a5f3ce23985b7e9e9b2c2a14d3596d63 100644 +index cbda18b7646aacd6f15284faaefeafd452bb5ce9..9e60819fd389aed880b314f7152190c7cacf4429 100644 --- a/media/audio/BUILD.gn +++ b/media/audio/BUILD.gn @@ -203,6 +203,7 @@ source_set("audio") { @@ -1396,10 +1396,10 @@ index eb81a70e4d5d5cd3e6ae9b45f8cd1c795ea76c51..9921ccb10d3455600eddd85f77f10228 } // namespace sandbox diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn -index 96b487da179dd60e325194335cb091b36ec08d35..33efac95559d5ae91a377077b8df357dfa5b7edc 100644 +index 267e8ddfe2905f169a7cf9a819a4baa82b47770e..3a9fe67e684df903c256b396ce024c0c6f7c92a7 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn -@@ -428,6 +428,7 @@ component("core") { +@@ -427,6 +427,7 @@ component("core") { "//ui/gfx/geometry", "//ui/gfx/geometry:geometry_skia", "//ui/strings", @@ -1556,7 +1556,7 @@ index 54d483d6b3f1a56573e21b1f873b8dee8fc25a0f..33bc8c9ef097a907060ed347dca2ad46 if (is_ios) { diff --git a/ui/accessibility/platform/browser_accessibility_manager_mac.mm b/ui/accessibility/platform/browser_accessibility_manager_mac.mm -index 8ef5c8c7ac9a555fe41e6146997833ae43164951..4c17f1d29dac780195e07bcdb7e12a8fdd3f2130 100644 +index 3e6426f895b55168834809ed6b91916f447d7ea3..33ec3f6ce4e5a69760779d28a3ae2b07a183afa4 100644 --- a/ui/accessibility/platform/browser_accessibility_manager_mac.mm +++ b/ui/accessibility/platform/browser_accessibility_manager_mac.mm @@ -14,6 +14,7 @@ @@ -1776,7 +1776,7 @@ index ca9b2b6f9a4e070d2fd40a6fec672d612ff757e0..87eee402eb38270690b798b67a368e11 deps += [ "//build:ios_buildflags" ] } diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm -index a76d09dd2a2a71d0b8397f4abe30fe7bbb6e513d..eba69f4c6e72b36e799ce902cdffd2dd1f2387d6 100644 +index 4be0d3508981ca6e7f06134b9c44e8eff39799fc..688c60025bd5ce14f9b790760e537bf7b5651268 100644 --- a/ui/display/mac/screen_mac.mm +++ b/ui/display/mac/screen_mac.mm @@ -33,6 +33,7 @@ @@ -1806,7 +1806,7 @@ index a76d09dd2a2a71d0b8397f4abe30fe7bbb6e513d..eba69f4c6e72b36e799ce902cdffd2dd // Query the display's refresh rate. double refresh_rate = 1.0 / screen.minimumRefreshInterval; diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn -index 300079ed71ff990396d419ed55755f128dda6695..464682fd86764adbef54faaa5894a55be87ee5cf 100644 +index a00134fb815bd413dca8ae9581f488a3d3f42910..26c83b597a3e6846c1c1c11eefe6f9d7a8ac2619 100644 --- a/ui/gfx/BUILD.gn +++ b/ui/gfx/BUILD.gn @@ -335,6 +335,12 @@ component("gfx") { @@ -1861,10 +1861,10 @@ index bbe355cf69f160866188216cc274d75bd35603db..06ee100d7ea2e892dbf3c0b1adc96c50 // enough. return PlatformFontMac::SystemFontType::kGeneral; diff --git a/ui/views/BUILD.gn b/ui/views/BUILD.gn -index f4651d57e9f1ac76c0e93ce3859f4169cd689200..d07439f78ac914d6daeb54dbc5beea80f1fb11bd 100644 +index 95a2d5d04ac69b48f59fa4c8c940b1075436bca7..1af7790524bd0c25f6384f7fb55f3df0fe03cfc1 100644 --- a/ui/views/BUILD.gn +++ b/ui/views/BUILD.gn -@@ -720,6 +720,8 @@ component("views") { +@@ -722,6 +722,8 @@ component("views") { "IOSurface.framework", "QuartzCore.framework", ] @@ -1873,7 +1873,7 @@ index f4651d57e9f1ac76c0e93ce3859f4169cd689200..d07439f78ac914d6daeb54dbc5beea80 } if (is_win) { -@@ -1150,6 +1152,8 @@ source_set("test_support") { +@@ -1152,6 +1154,8 @@ source_set("test_support") { "//ui/base/mojom:ui_base_types", ] @@ -1883,7 +1883,7 @@ index f4651d57e9f1ac76c0e93ce3859f4169cd689200..d07439f78ac914d6daeb54dbc5beea80 sources += [ "test/desktop_window_tree_host_win_test_api.cc", diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.h b/ui/views/cocoa/native_widget_mac_ns_window_host.h -index 4cc9db3ae1ef2443b1ecf923c9c572b7d0e85662..f7bf6a6bb63f9c38cc21c03da1c884d6bee8ab9a 100644 +index e855d05f466059f20a31022a1a2810eeadeb4fff..e523151fb670af28cf2c54548c5009825fdbed92 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.h +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h @@ -19,6 +19,7 @@ @@ -1904,7 +1904,7 @@ index 4cc9db3ae1ef2443b1ecf923c9c572b7d0e85662..f7bf6a6bb63f9c38cc21c03da1c884d6 @class NSView; namespace remote_cocoa { -@@ -502,10 +505,12 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost +@@ -504,10 +507,12 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost mojo::AssociatedRemote<remote_cocoa::mojom::NativeWidgetNSWindow> remote_ns_window_remote_; @@ -1918,7 +1918,7 @@ index 4cc9db3ae1ef2443b1ecf923c9c572b7d0e85662..f7bf6a6bb63f9c38cc21c03da1c884d6 // Used to force the NSApplication's focused accessibility element to be the // views::Views accessibility tree when the NSView for this is focused. diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -index 5fc62f87b842f6aca7082b3957f2adb9f44e2114..7befaf18ae9c922ccd8d36a006b9105cb55b1a32 100644 +index 240bf8ce57ffce734263ecc62bda1ad70b1b60ce..7459d4c241e914248261c62b63652fd7139dd54e 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm @@ -21,6 +21,7 @@ @@ -1929,7 +1929,7 @@ index 5fc62f87b842f6aca7082b3957f2adb9f44e2114..7befaf18ae9c922ccd8d36a006b9105c #include "mojo/public/cpp/bindings/self_owned_associated_receiver.h" #include "ui/accelerated_widget_mac/window_resize_helper_mac.h" #include "ui/accessibility/accessibility_features.h" -@@ -359,8 +360,12 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -360,8 +361,12 @@ void HandleAccelerator(const ui::Accelerator& accelerator, if (in_process_ns_window_bridge_) { return gfx::NativeViewAccessible(in_process_ns_window_bridge_->ns_view()); } @@ -1942,7 +1942,7 @@ index 5fc62f87b842f6aca7082b3957f2adb9f44e2114..7befaf18ae9c922ccd8d36a006b9105c } gfx::NativeViewAccessible -@@ -376,8 +381,12 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -377,8 +382,12 @@ void HandleAccelerator(const ui::Accelerator& accelerator, [in_process_ns_window_bridge_->ns_view() window]); } @@ -1955,7 +1955,7 @@ index 5fc62f87b842f6aca7082b3957f2adb9f44e2114..7befaf18ae9c922ccd8d36a006b9105c } remote_cocoa::mojom::NativeWidgetNSWindow* -@@ -1439,9 +1448,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -1445,9 +1454,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator, // for PWAs. However this breaks accessibility on in-process windows, // so set it back to NO when a local window gains focus. See // https://crbug.com/41485830. @@ -1967,7 +1967,7 @@ index 5fc62f87b842f6aca7082b3957f2adb9f44e2114..7befaf18ae9c922ccd8d36a006b9105c // Explicitly set the keyboard accessibility state on regaining key // window status. if (is_key && is_content_first_responder) { -@@ -1582,17 +1593,20 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -1588,17 +1599,20 @@ void HandleAccelerator(const ui::Accelerator& accelerator, void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens( const std::vector<uint8_t>& window_token, const std::vector<uint8_t>& view_token) { @@ -1988,7 +1988,7 @@ index 5fc62f87b842f6aca7082b3957f2adb9f44e2114..7befaf18ae9c922ccd8d36a006b9105c *pid = getpid(); id element_id = GetNativeViewAccessible(); -@@ -1605,6 +1619,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -1611,6 +1625,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, } *token = ui::RemoteAccessibility::GetTokenForLocalElement(element_id); diff --git a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch index 91b9908b2bb44..a8cb0a94a44cf 100644 --- a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch +++ b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch @@ -7,7 +7,7 @@ This adds a callback from the network service that's used to implement session.setCertificateVerifyCallback. diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index c2f19cf408ebcd0bc5311cf221acde09ab558ed4..95822f635b61da7c63b5a1babf93bb61cb786293 100644 +index a02161899767745c6ddfeafecdeec0181105e8a6..68ad4334b47b075ea6ed80f2f29e496089695f8d 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc @@ -166,6 +166,11 @@ @@ -148,7 +148,7 @@ index c2f19cf408ebcd0bc5311cf221acde09ab558ed4..95822f635b61da7c63b5a1babf93bb61 void NetworkContext::CreateURLLoaderFactory( mojo::PendingReceiver<mojom::URLLoaderFactory> receiver, mojom::URLLoaderFactoryParamsPtr params) { -@@ -2679,6 +2796,10 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( +@@ -2687,6 +2804,10 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( cert_verifier = std::make_unique<net::CachingCertVerifier>( std::make_unique<net::CoalescingCertVerifier>( std::move(cert_verifier))); @@ -160,7 +160,7 @@ index c2f19cf408ebcd0bc5311cf221acde09ab558ed4..95822f635b61da7c63b5a1babf93bb61 builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier( diff --git a/services/network/network_context.h b/services/network/network_context.h -index 5998b6a64a0bbfa22723d57a9fe1f31afd6e7435..56f1eec94a33c2c9a6289b12ac20323b4bef13d9 100644 +index 02378d3f3e501d006fba8f9c7026b6699b69912c..d73d6500b354805fa7436705801fa740dd01e8ea 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h @@ -117,6 +117,7 @@ class URLMatcher; @@ -180,7 +180,7 @@ index 5998b6a64a0bbfa22723d57a9fe1f31afd6e7435..56f1eec94a33c2c9a6289b12ac20323b void ResetURLLoaderFactories() override; void GetViaObliviousHttp( mojom::ObliviousHttpRequestPtr request, -@@ -988,6 +991,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext +@@ -991,6 +994,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext std::vector<base::OnceClosure> dismount_closures_; #endif // BUILDFLAG(IS_DIRECTORY_TRANSFER_REQUIRED) @@ -190,7 +190,7 @@ index 5998b6a64a0bbfa22723d57a9fe1f31afd6e7435..56f1eec94a33c2c9a6289b12ac20323b std::unique_ptr<HostResolver> internal_host_resolver_; std::set<std::unique_ptr<HostResolver>, base::UniquePtrComparator> diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index 422024e12926ea70450b43253fbb60c2ce217c11..840eff6ece73983a3b98673adbbb3cfd825565fe 100644 +index 1c11b3538ee2082200b7d17e1c724a52ec2e7937..cd4f5d711b31dac365b98f94a72c121a5a29f46d 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom @@ -317,6 +317,17 @@ struct SocketBrokerRemotes { @@ -211,7 +211,7 @@ index 422024e12926ea70450b43253fbb60c2ce217c11..840eff6ece73983a3b98673adbbb3cfd // Parameters for constructing a network context. struct NetworkContextParams { // The user agent string. -@@ -992,6 +1003,9 @@ interface NetworkContext { +@@ -1010,6 +1021,9 @@ interface NetworkContext { // Sets a client for this network context. SetClient(pending_remote<NetworkContextClient> client); @@ -222,7 +222,7 @@ index 422024e12926ea70450b43253fbb60c2ce217c11..840eff6ece73983a3b98673adbbb3cfd CreateURLLoaderFactory( pending_receiver<URLLoaderFactory> url_loader_factory, diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h -index 9139ca8b0139b19804bc2efe866f2019e8ef5652..6f0fe6423e8be903d4e38b783d31443c6ce89db5 100644 +index 95276b525cb08748ce5b9f4e256e5e25b653715a..8648cafcc01af1d8835f782f1303df2b5a84a674 100644 --- a/services/network/test/test_network_context.h +++ b/services/network/test/test_network_context.h @@ -63,6 +63,8 @@ class TestNetworkContext : public mojom::NetworkContext { diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index 171caa4562326..b73749345d963 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -7,7 +7,7 @@ Pass RenderFrameHost through to PlatformNotificationService so Electron can identify which renderer a notification came from. diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc -index 03d15ec6e6f4adb6339501472de27b7bec5f50e3..364c95a765a0cbf568f14ebd4dce347e3c54f70d 100644 +index 3c6b6c0bfb41dc8daf39780469134baf5372aa8e..903ff32264f514ed547d8719c88a9070e50f3857 100644 --- a/chrome/browser/notifications/platform_notification_service_impl.cc +++ b/chrome/browser/notifications/platform_notification_service_impl.cc @@ -252,6 +252,7 @@ bool PlatformNotificationServiceImpl::WasClosedProgrammatically( @@ -19,7 +19,7 @@ index 03d15ec6e6f4adb6339501472de27b7bec5f50e3..364c95a765a0cbf568f14ebd4dce347e const GURL& origin, const GURL& document_url, diff --git a/chrome/browser/notifications/platform_notification_service_impl.h b/chrome/browser/notifications/platform_notification_service_impl.h -index ec5ca87810d590fc95eda2006b8653bb12711b8e..203cd9645523c4f0adf90e78fa3d8f3d0aad54dc 100644 +index e94fccc1b564c349eb2d2c9acd0574c3589a2eaf..a75a55b6c54f5aacc915a27d2aa99395a44da34e 100644 --- a/chrome/browser/notifications/platform_notification_service_impl.h +++ b/chrome/browser/notifications/platform_notification_service_impl.h @@ -57,6 +57,7 @@ class PlatformNotificationServiceImpl @@ -133,10 +133,10 @@ index 5be62a3fb27e37f3c1db6b811172f6dfebe18f61..34349f9832fe4b9a3d48db613a789afb const GURL& document_url, const WeakDocumentPtr& weak_document_ptr, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 0496f406bf0083fc75cf4d9cc3560a30155ea2e0..a76db23484dabda64b7eaf2e8b6c6f22faf2719f 100644 +index 1bc649d5382bbfd9565dcca8a25dfa06d6bc9735..b01a2051cee154cc002e4c0274e8955b4eccfe38 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -2267,7 +2267,7 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2305,7 +2305,7 @@ void RenderProcessHostImpl::CreateNotificationService( case RenderProcessHost::NotificationServiceCreatorType::kSharedWorker: case RenderProcessHost::NotificationServiceCreatorType::kDedicatedWorker: { storage_partition_impl_->GetPlatformNotificationContext()->CreateService( @@ -145,7 +145,7 @@ index 0496f406bf0083fc75cf4d9cc3560a30155ea2e0..a76db23484dabda64b7eaf2e8b6c6f22 creator_type, std::move(receiver)); break; } -@@ -2275,7 +2275,7 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2313,7 +2313,7 @@ void RenderProcessHostImpl::CreateNotificationService( CHECK(rfh); storage_partition_impl_->GetPlatformNotificationContext()->CreateService( diff --git a/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch b/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch index 6174775d5d0f4..ed8ae4f833ac8 100644 --- a/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch +++ b/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch @@ -10,11 +10,11 @@ The keyed mutex introduce extra performance cost and spikes. However, at offscre For resolving complex conflict please pin @reitowo For more reason please see: https://crrev.com/c/5465148 -diff --git a/gpu/ipc/service/gpu_memory_buffer_factory_dxgi.cc b/gpu/ipc/service/gpu_memory_buffer_factory_dxgi.cc -index bb33e469e2d38ee4a23b19acfa52f962a5e9c854..6e83c65334f1ce0134dc4efc1dc40eb7ffed028d 100644 ---- a/gpu/ipc/service/gpu_memory_buffer_factory_dxgi.cc -+++ b/gpu/ipc/service/gpu_memory_buffer_factory_dxgi.cc -@@ -152,7 +152,8 @@ gfx::GpuMemoryBufferHandle GpuMemoryBufferFactoryDXGI::CreateNativeGmbHandle( +diff --git a/gpu/command_buffer/service/shared_image/gpu_memory_buffer_factory_dxgi.cc b/gpu/command_buffer/service/shared_image/gpu_memory_buffer_factory_dxgi.cc +index e0b94914e0cf7dc83503fa4a4b7fa75442e5b404..b8ffc6ce4973a3d2ef194e4289ad8bba122f315a 100644 +--- a/gpu/command_buffer/service/shared_image/gpu_memory_buffer_factory_dxgi.cc ++++ b/gpu/command_buffer/service/shared_image/gpu_memory_buffer_factory_dxgi.cc +@@ -170,7 +170,8 @@ gfx::GpuMemoryBufferHandle GpuMemoryBufferFactoryDXGI::CreateNativeGmbHandle( // so make sure that the usage is one that we support. DCHECK(usage == gfx::BufferUsage::GPU_READ || usage == gfx::BufferUsage::SCANOUT || @@ -24,7 +24,7 @@ index bb33e469e2d38ee4a23b19acfa52f962a5e9c854..6e83c65334f1ce0134dc4efc1dc40eb7 << "Incorrect usage, usage=" << gfx::BufferUsageToString(usage); D3D11_TEXTURE2D_DESC desc = { -@@ -166,7 +167,9 @@ gfx::GpuMemoryBufferHandle GpuMemoryBufferFactoryDXGI::CreateNativeGmbHandle( +@@ -184,7 +185,9 @@ gfx::GpuMemoryBufferHandle GpuMemoryBufferFactoryDXGI::CreateNativeGmbHandle( D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET, 0, D3D11_RESOURCE_MISC_SHARED_NTHANDLE | diff --git a/patches/chromium/picture-in-picture.patch b/patches/chromium/picture-in-picture.patch index 3010b6c0107e8..486aa601d40e2 100644 --- a/patches/chromium/picture-in-picture.patch +++ b/patches/chromium/picture-in-picture.patch @@ -38,7 +38,7 @@ index 85df555841ac0d32d2f097547c9991cecf0f4b1a..7a108339448fad3105e87c9d9af678c2 ui::ImageModel::FromVectorIcon(*icon, kColorPipWindowForeground, kCloseButtonIconSize)); diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -index 5c978e3dcc862456d129e85e82236d899dbb5504..c5552aa0dedf6adbe10409f32c6eeca28f11c0b6 100644 +index d54cc1a443e3b2d869dc148f532b3138a6d02d29..117b6b94f54f7629b5233cfdf988608476e7321c 100644 --- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc @@ -18,12 +18,16 @@ diff --git a/patches/chromium/port_autofill_colors_to_the_color_pipeline.patch b/patches/chromium/port_autofill_colors_to_the_color_pipeline.patch index 2f7af1c5ad11e..1ae35ff24eb4e 100644 --- a/patches/chromium/port_autofill_colors_to_the_color_pipeline.patch +++ b/patches/chromium/port_autofill_colors_to_the_color_pipeline.patch @@ -8,7 +8,7 @@ needed in chromium but our autofill implementation uses them. This patch can be our autofill implementation to work like Chromium's. diff --git a/ui/color/color_id.h b/ui/color/color_id.h -index b6fe461a04dfabab9b114b4a0c0c6cc08718cdaf..e57d928023a2defe5c2586aa6bd8385be6687f99 100644 +index e340ccdfb4c364774679c1b68df4b1340286d41a..72ebf04033e4ec67acb26780d4f252fc0b1d9917 100644 --- a/ui/color/color_id.h +++ b/ui/color/color_id.h @@ -431,6 +431,10 @@ @@ -61,7 +61,7 @@ index 8817142344cc9abed442f07b5cbe759b82901c06..edf6d4ca1bfce93f8dcbeb2585c9ec07 CompleteDefaultWebNativeRendererColorIdsDefinition( mixer, dark_mode, diff --git a/ui/color/win/native_color_mixers_win.cc b/ui/color/win/native_color_mixers_win.cc -index f18031fa9ff490edc690cb3a79654ddfde4f1000..58e49a832b64dd45ff08775021e6f049c5679833 100644 +index dadb94f18feccb570680fc74a899a957f8f7ce1b..dac1ab13e5bb91d5a0901b7988d4ee02a725837d 100644 --- a/ui/color/win/native_color_mixers_win.cc +++ b/ui/color/win/native_color_mixers_win.cc @@ -145,6 +145,10 @@ void AddNativeUiColorMixer(ColorProvider* provider, diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch index 4089e87653a53..ec969a5a4a3b9 100644 --- a/patches/chromium/printing.patch +++ b/patches/chromium/printing.patch @@ -577,7 +577,7 @@ index 824d6d8a9242302c2ab0c0c517d0cc329e607100..d3b25c90c90fe860990789aa96c872b4 // Indication that the job is getting canceled. bool canceling_job_ = false; diff --git a/chrome/browser/printing/printer_query.cc b/chrome/browser/printing/printer_query.cc -index 4b1775f4a882fbabfe65df7784baebe6d8bee788..5a3e71dc3894fa96ac7a6b93b3552a90f36fe7a2 100644 +index 20bbbeddd18ef26b68defcdbd4a7c62706c43d0b..7b0071c169556a080ecbf5e8a6a3b878675f6bf7 100644 --- a/chrome/browser/printing/printer_query.cc +++ b/chrome/browser/printing/printer_query.cc @@ -356,17 +356,19 @@ void PrinterQuery::UpdatePrintSettings(base::Value::Dict new_settings, @@ -899,7 +899,7 @@ index 746a056e1c7980803323739c51cedb930c62de25..34a9e45a3407612d6960a7cad798cf30 std::unique_ptr<PrintSettings> settings = PrintSettingsFromJobSettings(job_settings); diff --git a/printing/printing_context.h b/printing/printing_context.h -index 3a98838e27621e34ab050a0f5dce7110f0d88641..3cce0abe2a2893f1ad5ee747008b66c74e2c2434 100644 +index 2f34f45aaf89e6f4600be1d2b8444c636b0cc83f..5bfd45c5efbf300a36e016af80e18fb9ad376d41 100644 --- a/printing/printing_context.h +++ b/printing/printing_context.h @@ -208,6 +208,9 @@ class COMPONENT_EXPORT(PRINTING) PrintingContext { diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index 1b6bb761fc821..c9661272a61f2 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -8,17 +8,17 @@ Chrome moved the SetCursor IPC message to mojo, which we use to tell OSR about ` Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2172779 diff --git a/content/browser/renderer_host/render_widget_host_delegate.h b/content/browser/renderer_host/render_widget_host_delegate.h -index 9a4195a3e53353342c75d6c4372ed4c27ef13fd3..ce071c6acd6027ad27cee597f56e865f0d5172f9 100644 +index 9a4195a3e53353342c75d6c4372ed4c27ef13fd3..bc1bfa1ac381ec94121a264d9dcbae9e02ab5a81 100644 --- a/content/browser/renderer_host/render_widget_host_delegate.h +++ b/content/browser/renderer_host/render_widget_host_delegate.h -@@ -27,6 +27,7 @@ +@@ -26,6 +26,7 @@ + #include "third_party/blink/public/mojom/manifest/display_mode.mojom.h" #include "ui/base/mojom/window_show_state.mojom-forward.h" #include "ui/base/ui_base_types.h" - #include "ui/gfx/mojom/delegated_ink_point_renderer.mojom.h" +#include "ui/base/cursor/cursor.h" + #include "ui/gfx/mojom/delegated_ink_point_renderer.mojom.h" #include "ui/gfx/native_ui_types.h" - namespace blink { @@ -293,6 +294,9 @@ class CONTENT_EXPORT RenderWidgetHostDelegate { // Returns the associated RenderViewHostDelegateView*, if possible. virtual RenderViewHostDelegateView* GetDelegateView(); @@ -30,7 +30,7 @@ index 9a4195a3e53353342c75d6c4372ed4c27ef13fd3..ce071c6acd6027ad27cee597f56e865f // RenderWidgetHost on the primary main frame, and false otherwise. virtual bool IsWidgetForPrimaryMainFrame(RenderWidgetHostImpl*); diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 0bae000a3491e03196bbba033621d389c6150225..a6abe25611c82da8c55998f74c9822746d87875c 100644 +index 1156ea5df2a390604b822b82cf42940029fea1f7..e07b2d171bbc33e271c5cef7e49e3451a8cdff84 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -2072,6 +2072,9 @@ void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) { @@ -44,10 +44,10 @@ index 0bae000a3491e03196bbba033621d389c6150225..a6abe25611c82da8c55998f74c982274 void RenderWidgetHostImpl::ShowContextMenuAtPoint( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 6c067803c35a4e98ec99df6e28015f3b36e67e4f..d7cf36715b036c29d881c84a07c0d3b7f73d609f 100644 +index 655b289b783a8c35fb85fed715501b25a23acc85..e7a985973e1fd6ff51649d4e3fe802cc306c8f39 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -6130,6 +6130,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { +@@ -6134,6 +6134,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { return text_input_manager_.get(); } @@ -72,18 +72,18 @@ index 342a5f984838eba5aef7a535c3758bb96c0f89a3..034797826196560ab6b71f885d52c8e1 RenderWidgetHostImpl* render_widget_host) override; bool IsShowingContextMenuOnPage() const override; diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h -index c6af2619bf13c2a6982834c6b888ad15da275627..5ed2521d5cb21341cc4056cb1f1a69c9129967f5 100644 +index 62e5f908e2df02e5189bfb2e35e5311cd24f3948..167f0e2a69bd2d5bf3807edad7abe78873edaa1b 100644 --- a/content/public/browser/web_contents_observer.h +++ b/content/public/browser/web_contents_observer.h -@@ -35,6 +35,7 @@ +@@ -34,6 +34,7 @@ + #include "third_party/blink/public/mojom/frame/viewport_intersection_state.mojom-forward.h" #include "third_party/blink/public/mojom/loader/resource_load_info.mojom-forward.h" #include "third_party/blink/public/mojom/media/capture_handle_config.mojom-forward.h" - #include "third_party/skia/include/core/SkColor.h" +#include "ui/base/cursor/cursor.h" #include "ui/base/page_transition_types.h" #include "ui/base/window_open_disposition.h" -@@ -643,6 +644,9 @@ class CONTENT_EXPORT WebContentsObserver : public base::CheckedObserver { +@@ -642,6 +643,9 @@ class CONTENT_EXPORT WebContentsObserver : public base::CheckedObserver { // Invoked when the primary main frame changes size. virtual void PrimaryMainFrameWasResized(bool width_changed) {} diff --git a/patches/chromium/refactor_expose_file_system_access_blocklist.patch b/patches/chromium/refactor_expose_file_system_access_blocklist.patch index 89779bc57344c..3320173490463 100644 --- a/patches/chromium/refactor_expose_file_system_access_blocklist.patch +++ b/patches/chromium/refactor_expose_file_system_access_blocklist.patch @@ -8,7 +8,7 @@ it in Electron and prevent drift from Chrome's blocklist. We should look for a w to upstream this change to Chrome. diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc -index 570d768d017bdf235c31d919a9308e3c0e7390f0..7c930cf3b149410e2a5f9a93e666cf765e0fabc6 100644 +index 0c6a0751119ac303f85327f0ccb0e32b957b837a..150147638f7c6f1e87e9a7379af9ecf65ed4c4dc 100644 --- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc +++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc @@ -84,11 +84,13 @@ @@ -25,7 +25,7 @@ index 570d768d017bdf235c31d919a9308e3c0e7390f0..7c930cf3b149410e2a5f9a93e666cf76 #include "components/tabs/public/tab_interface.h" #if BUILDFLAG(ENABLE_PLATFORM_APPS) #include "extensions/browser/extension_registry.h" // nogncheck -@@ -264,190 +266,10 @@ bool MaybeIsLocalUNCPath(const base::FilePath& path) { +@@ -265,190 +267,10 @@ bool MaybeIsLocalUNCPath(const base::FilePath& path) { } #endif @@ -220,7 +220,7 @@ index 570d768d017bdf235c31d919a9308e3c0e7390f0..7c930cf3b149410e2a5f9a93e666cf76 // Checks if `path` should be blocked by the `rules`. // The BlockType of the nearest ancestor of a path to check is what -@@ -1362,16 +1184,6 @@ struct ChromeFileSystemAccessPermissionContext::OriginState { +@@ -1363,16 +1185,6 @@ struct ChromeFileSystemAccessPermissionContext::OriginState { std::unique_ptr<base::RetainingOneShotTimer> cleanup_timer; }; @@ -237,7 +237,7 @@ index 570d768d017bdf235c31d919a9308e3c0e7390f0..7c930cf3b149410e2a5f9a93e666cf76 ChromeFileSystemAccessPermissionContext:: ChromeFileSystemAccessPermissionContext(content::BrowserContext* context, const base::Clock* clock) -@@ -1390,7 +1202,7 @@ ChromeFileSystemAccessPermissionContext:: +@@ -1391,7 +1203,7 @@ ChromeFileSystemAccessPermissionContext:: #if BUILDFLAG(IS_ANDROID) one_time_permissions_tracker_.Observe( OneTimePermissionsTrackerFactory::GetForBrowserContext(context)); @@ -246,7 +246,7 @@ index 570d768d017bdf235c31d919a9308e3c0e7390f0..7c930cf3b149410e2a5f9a93e666cf76 auto* provider = web_app::WebAppProvider::GetForWebApps( Profile::FromBrowserContext(profile_)); if (provider) { -@@ -2775,7 +2587,7 @@ void ChromeFileSystemAccessPermissionContext::OnShutdown() { +@@ -2776,7 +2588,7 @@ void ChromeFileSystemAccessPermissionContext::OnShutdown() { one_time_permissions_tracker_.Reset(); } @@ -255,7 +255,7 @@ index 570d768d017bdf235c31d919a9308e3c0e7390f0..7c930cf3b149410e2a5f9a93e666cf76 void ChromeFileSystemAccessPermissionContext::OnWebAppInstalled( const webapps::AppId& app_id) { if (!base::FeatureList::IsEnabled( -@@ -3110,11 +2922,7 @@ bool ChromeFileSystemAccessPermissionContext:: +@@ -3111,11 +2923,7 @@ bool ChromeFileSystemAccessPermissionContext:: HandleType handle_type, UserAction user_action, GrantType grant_type) { @@ -268,7 +268,7 @@ index 570d768d017bdf235c31d919a9308e3c0e7390f0..7c930cf3b149410e2a5f9a93e666cf76 if (!base::FeatureList::IsEnabled( features::kFileSystemAccessPersistentPermissions)) { return false; -@@ -3165,6 +2973,7 @@ bool ChromeFileSystemAccessPermissionContext:: +@@ -3166,6 +2974,7 @@ bool ChromeFileSystemAccessPermissionContext:: return false; #endif // BUILDFLAG(IS_ANDROID) diff --git a/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch b/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch index 4997ec510e339..2e5ee4547643c 100644 --- a/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch +++ b/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch @@ -7,10 +7,10 @@ Subject: refactor: expose HostImportModuleDynamically and This is so that Electron can blend Blink's and Node's implementations of these isolate handlers. diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -index bab63bdebc0c52a45adbeb86b391898f944703a5..cd2cb4bb15349273719c366795fc4d9a1c6e9e89 100644 +index 31500795700bc257b1a05515a8d557b32b0a370d..54ec914fbff24421437a89c2e05e052b1385c633 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -@@ -635,8 +635,9 @@ bool WasmCustomDescriptorsEnabledCallback(v8::Local<v8::Context> context) { +@@ -645,8 +645,9 @@ bool WasmCustomDescriptorsEnabledCallback(v8::Local<v8::Context> context) { return RuntimeEnabledFeatures::WebAssemblyCustomDescriptorsEnabled( execution_context); } @@ -21,7 +21,7 @@ index bab63bdebc0c52a45adbeb86b391898f944703a5..cd2cb4bb15349273719c366795fc4d9a v8::Local<v8::Context> context, v8::Local<v8::Data> v8_host_defined_options, v8::Local<v8::Value> v8_referrer_resource_url, -@@ -714,20 +715,23 @@ v8::MaybeLocal<v8::Promise> HostImportModuleWithPhaseDynamically( +@@ -724,20 +725,23 @@ v8::MaybeLocal<v8::Promise> HostImportModuleWithPhaseDynamically( return resolver->Promise().V8Promise(); } @@ -47,7 +47,7 @@ index bab63bdebc0c52a45adbeb86b391898f944703a5..cd2cb4bb15349273719c366795fc4d9a v8::Local<v8::Module> module, v8::Local<v8::Object> meta) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); -@@ -754,6 +758,7 @@ void HostGetImportMetaProperties(v8::Local<v8::Context> context, +@@ -764,6 +768,7 @@ void HostGetImportMetaProperties(v8::Local<v8::Context> context, meta->CreateDataProperty(context, resolve_key, resolve_value).ToChecked(); } @@ -55,7 +55,7 @@ index bab63bdebc0c52a45adbeb86b391898f944703a5..cd2cb4bb15349273719c366795fc4d9a bool IsDOMExceptionWrapper(v8::Isolate* isolate, v8::Local<v8::Object> object) { return V8DOMException::HasInstance(isolate, object); } -@@ -784,7 +789,6 @@ void EmitDevToolsEvent(v8::Isolate* isolate) { +@@ -794,7 +799,6 @@ void EmitDevToolsEvent(v8::Isolate* isolate) { } // namespace @@ -63,7 +63,7 @@ index bab63bdebc0c52a45adbeb86b391898f944703a5..cd2cb4bb15349273719c366795fc4d9a void V8Initializer::InitializeV8Common(v8::Isolate* isolate) { // Set up garbage collection before setting up anything else as V8 may trigger // GCs during Blink setup. -@@ -800,9 +804,9 @@ void V8Initializer::InitializeV8Common(v8::Isolate* isolate) { +@@ -810,9 +814,9 @@ void V8Initializer::InitializeV8Common(v8::Isolate* isolate) { SharedArrayBufferConstructorEnabledCallback); isolate->SetHostImportModuleDynamicallyCallback(HostImportModuleDynamically); isolate->SetHostImportModuleWithPhaseDynamicallyCallback( diff --git a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch index 0382a646ed3c0..a0f367b865799 100644 --- a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch +++ b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch @@ -6,7 +6,7 @@ Subject: refactor: patch electron PermissionTypes into blink 6387077: [PermissionOptions] Generalize PermissionRequestDescription | https://chromium-review.googlesource.com/c/chromium/src/+/6387077 diff --git a/components/permissions/permission_util.cc b/components/permissions/permission_util.cc -index 668012a5e422059f52815fadf3c7d1d99af55032..753e519eb3ca094205b3e280b381960d805b3e24 100644 +index 7078014e6db7c43d66b1448b2b36500f206ec4a0..9decf37eaf32eb837141bc9ee96b688188dcc078 100644 --- a/components/permissions/permission_util.cc +++ b/components/permissions/permission_util.cc @@ -536,7 +536,17 @@ ContentSettingsType PermissionUtil::PermissionTypeToContentSettingsTypeSafe( @@ -28,10 +28,10 @@ index 668012a5e422059f52815fadf3c7d1d99af55032..753e519eb3ca094205b3e280b381960d break; } diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc -index dda07e1d45bf49b1fc3970a34a17bf65abc79e60..0e75eff7a65fc4eb921d41d0c4689b0157308ff6 100644 +index 0a72093709ae8f56cc7b8d1649efe23050423054..0d7ad32add07e4c8f61d8df08de9e1c176bba6d6 100644 --- a/content/browser/permissions/permission_controller_impl.cc +++ b/content/browser/permissions/permission_controller_impl.cc -@@ -89,7 +89,15 @@ PermissionToSchedulingFeature(PermissionType permission_name) { +@@ -94,7 +94,15 @@ PermissionToSchedulingFeature(PermissionType permission_name) { case PermissionType::AUTOMATIC_FULLSCREEN: case PermissionType::WEB_APP_INSTALLATION: case PermissionType::LOCAL_NETWORK_ACCESS: @@ -164,7 +164,7 @@ index c286d87043ec4cb2e51ec9d82d08e4c84f5a270c..164a2a446947dae687922363d324a6d3 // Always keep this at the end. NUM, diff --git a/third_party/blink/public/mojom/permissions/permission.mojom b/third_party/blink/public/mojom/permissions/permission.mojom -index 6fc349a2f4633d1338fbfcf8d0d0fb6fa3180b0d..ebb5d84848cee735990f06f6add2b38ebd8734ef 100644 +index 549f9079c004ce8427ab2be0dba2e5b24471a8c9..e7276b12b22035730fda18103dad604e87fff4a9 100644 --- a/third_party/blink/public/mojom/permissions/permission.mojom +++ b/third_party/blink/public/mojom/permissions/permission.mojom @@ -44,7 +44,15 @@ enum PermissionName { diff --git a/patches/chromium/refactor_unfilter_unresponsive_events.patch b/patches/chromium/refactor_unfilter_unresponsive_events.patch index c79917f3d8315..d1230cd7df4d1 100644 --- a/patches/chromium/refactor_unfilter_unresponsive_events.patch +++ b/patches/chromium/refactor_unfilter_unresponsive_events.patch @@ -15,10 +15,10 @@ This CL removes these filters so the unresponsive event can still be accessed from our JS event. The filtering is moved into Electron's code. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 705e848acfc76a6b2e3a4dffb9e8ae8f86d54cbc..87a3fc1ff0fdd3e25595b539b7f09b5b3e403beb 100644 +index a257bc1480369f24b05db19bd2bfce064b96407d..fefe40186f436f3117543f8c6d0c7c67f358bd2a 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10252,25 +10252,13 @@ void WebContentsImpl::RendererUnresponsive( +@@ -10257,25 +10257,13 @@ void WebContentsImpl::RendererUnresponsive( base::RepeatingClosure hang_monitor_restarter) { OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RendererUnresponsive", "render_widget_host", render_widget_host); diff --git a/patches/chromium/render_widget_host_view_mac.patch b/patches/chromium/render_widget_host_view_mac.patch index b22966a9e9fad..02d22d12db05b 100644 --- a/patches/chromium/render_widget_host_view_mac.patch +++ b/patches/chromium/render_widget_host_view_mac.patch @@ -8,7 +8,7 @@ respond to the first mouse click in their window, which is desirable for some kinds of utility windows. Similarly for `disableAutoHideCursor`. diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -index 2bf102472783b7d41419f2de301af048955c691c..d3f833904a7a056235d4bd4b3e7c5297a60861f5 100644 +index c2aeece6d8804b532808c614340577640f904e2b..e2b316223ee5cbd99cb5f9f69c5454600cb8f74f 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -167,6 +167,15 @@ void ExtractUnderlines(NSAttributedString* string, @@ -35,10 +35,10 @@ index 2bf102472783b7d41419f2de301af048955c691c..d3f833904a7a056235d4bd4b3e7c5297 + [self.window acceptsFirstMouse]) + return YES; + - switch ([self acceptsMouseEventsOption]) { - case AcceptMouseEvents::kWhenInActiveWindow: - // It is important to accept clicks when this window is the main window. -@@ -943,6 +956,8 @@ - (BOOL)shouldIgnoreMouseEvent:(NSEvent*)theEvent { + // Enable "click-through" if mouse clicks are accepted in inactive windows. + return + [self acceptsMouseEventsOption] > AcceptMouseEvents::kWhenInActiveWindow; +@@ -933,6 +946,8 @@ - (BOOL)shouldIgnoreMouseEvent:(NSEvent*)theEvent { // its parent view. BOOL hitSelf = NO; while (view) { @@ -47,7 +47,7 @@ index 2bf102472783b7d41419f2de301af048955c691c..d3f833904a7a056235d4bd4b3e7c5297 if (view == self) hitSelf = YES; if ([view isKindOfClass:[self class]] && ![view isEqual:self] && -@@ -1277,6 +1292,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv { +@@ -1267,6 +1282,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv { eventType == NSEventTypeKeyDown && !(modifierFlags & NSEventModifierFlagCommand); diff --git a/patches/chromium/resource_file_conflict.patch b/patches/chromium/resource_file_conflict.patch index 6d13b85c3a3fe..1525b4328a7ac 100644 --- a/patches/chromium/resource_file_conflict.patch +++ b/patches/chromium/resource_file_conflict.patch @@ -52,10 +52,10 @@ Some alternatives to this patch: None of these options seems like a substantial maintainability win over this patch to me (@nornagon). diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index 9fd2e83b2a7bc7e8dae09e45bec64ad41e06ee6a..e648bb4ed2ff72441faa8773e449e0b6174f5af5 100644 +index 0753724487493487c32955962105a8560892718b..9bffa9c8272a81059eb05fa79107bb326029402c 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn -@@ -1538,7 +1538,7 @@ if (is_chrome_branded && !is_android) { +@@ -1542,7 +1542,7 @@ if (is_chrome_branded && !is_android) { } } @@ -64,7 +64,7 @@ index 9fd2e83b2a7bc7e8dae09e45bec64ad41e06ee6a..e648bb4ed2ff72441faa8773e449e0b6 chrome_paks("packed_resources") { if (is_mac) { output_dir = "$root_gen_dir/repack" -@@ -1584,6 +1584,12 @@ repack("browser_tests_pak") { +@@ -1588,6 +1588,12 @@ repack("browser_tests_pak") { deps = [ "//chrome/test/data/webui:resources" ] } diff --git a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch index ace4468e5e331..94f0513a4e534 100644 --- a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch +++ b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch @@ -233,10 +233,10 @@ index d8167e854a3264b19a07544039fd01aba45e27a1..2e5a4ae715529e3b7b5c8fbb7195c7ce } diff --git a/content/common/features.cc b/content/common/features.cc -index 97f8f8088a149a6c20ea5cf0193cb48034a4d7fb..3e5ed6c1e9df1f6e56076b80c8be2b016f242635 100644 +index 788a0da0f67b5580192b9bf374839cade061aae4..2a14433d9d53d98c3cd51a4f7106fb8534efce51 100644 --- a/content/common/features.cc +++ b/content/common/features.cc -@@ -276,6 +276,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); +@@ -292,6 +292,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kIOSurfaceCapturer, base::FEATURE_ENABLED_BY_DEFAULT); #endif @@ -252,10 +252,10 @@ index 97f8f8088a149a6c20ea5cf0193cb48034a4d7fb..3e5ed6c1e9df1f6e56076b80c8be2b01 BASE_FEATURE(kKeepChildProcessAfterIPCReset, base::FEATURE_DISABLED_BY_DEFAULT); diff --git a/content/common/features.h b/content/common/features.h -index 933536411d1f1c2f2b7dec6dacd75a1c940a68aa..797937ce2d58d95a8aa5003323b5af8bd714ff01 100644 +index f6b18e1c45945126b530187342d2d00c68812338..38649d29fe945c11907e9ead88cd9ec2ca0b1f5a 100644 --- a/content/common/features.h +++ b/content/common/features.h -@@ -103,6 +103,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); +@@ -106,6 +106,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); #if BUILDFLAG(IS_MAC) CONTENT_EXPORT BASE_DECLARE_FEATURE(kIOSurfaceCapturer); #endif diff --git a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch index b4bae7da6c9cc..a0074c88399b1 100644 --- a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch +++ b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch @@ -22,7 +22,7 @@ index 74fea36ea7f9a345b3474ea18be00704831a685e..c75785d5a26fa52a39d1a3552da9a762 const input::NativeWebKeyboardEvent& event) { return KeyboardEventProcessingResult::NOT_HANDLED; diff --git a/content/browser/renderer_host/render_widget_host_delegate.h b/content/browser/renderer_host/render_widget_host_delegate.h -index ce071c6acd6027ad27cee597f56e865f0d5172f9..be4eb55837d2b9bda96b1408f84f646d7da18e59 100644 +index bc1bfa1ac381ec94121a264d9dcbae9e02ab5a81..c6fc03ae158b3ce87fd684d765a3f1b0e9f79212 100644 --- a/content/browser/renderer_host/render_widget_host_delegate.h +++ b/content/browser/renderer_host/render_widget_host_delegate.h @@ -103,6 +103,12 @@ class CONTENT_EXPORT RenderWidgetHostDelegate { @@ -39,7 +39,7 @@ index ce071c6acd6027ad27cee597f56e865f0d5172f9..be4eb55837d2b9bda96b1408f84f646d // event before sending it to the renderer. See enum for details on return // value. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index d211d8dc92c16e8ad2e9b1b37cb25dd05bf7e3e1..1756d5e81e9bf5ba20fc596901bb3cfe244ff903 100644 +index 0e2b978b3f35e5805d380da398bba58fcd256310..39dfc8593da452bc40caca94cbb38eca57364d92 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -1588,6 +1588,10 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( @@ -54,10 +54,10 @@ index d211d8dc92c16e8ad2e9b1b37cb25dd05bf7e3e1..1756d5e81e9bf5ba20fc596901bb3cfe if (mouse_event_callback.Run(mouse_event)) { return; diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 87a3fc1ff0fdd3e25595b539b7f09b5b3e403beb..20112cfa786e487811453947d0e2c797962484cb 100644 +index fefe40186f436f3117543f8c6d0c7c67f358bd2a..2bff527424f3aa98f032743e8ea5a33b439555ad 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4447,6 +4447,12 @@ void WebContentsImpl::RenderWidgetWasResized( +@@ -4451,6 +4451,12 @@ void WebContentsImpl::RenderWidgetWasResized( width_changed); } @@ -83,7 +83,7 @@ index 034797826196560ab6b71f885d52c8e1c94c1a67..55db63b3f99e465d2c77bb25dca5d500 const gfx::PointF& client_pt); void PreHandleDragExit(); diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index 08c983ac6a8e5733431ba00e1288f6d6b087eee6..3e2a9fb6a768c57ddb813c5c7a1df8bb3c2f8ddd 100644 +index a92305042eef86fbabeae6fe02b48668a349be99..5a50203f2df5724fe7bae5dc9ea211fd2cfe6171 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc @@ -126,6 +126,12 @@ bool WebContentsDelegate::HandleContextMenu(RenderFrameHost& render_frame_host, @@ -100,7 +100,7 @@ index 08c983ac6a8e5733431ba00e1288f6d6b087eee6..3e2a9fb6a768c57ddb813c5c7a1df8bb WebContents* source, const input::NativeWebKeyboardEvent& event) { diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 2e8e60c8ebe837fc68318bd5c13dbd0c873c4292..7bd26bc9460a11d717deb596722942ba55830c5d 100644 +index 3c982afb1af048618506a36ca3532b15720d8869..5966331e9fa7413ce8d8321a04f829e75361ec59 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -313,6 +313,13 @@ class CONTENT_EXPORT WebContentsDelegate { diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index 167e865b0351f..66e1af29d1b0b 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index 051104ddca1a1dbc89199a74d08b94b1134a6e60..378056aaa1e84125d8a2a8b464e2bdf226655722 100644 +index bce1e6ff07587e7f75d1925291872fe21ba5404c..c6e851033ca7da1ad3d9b108491ce5b38cfc71a4 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25209,6 +25209,21 @@ +@@ -25163,6 +25163,21 @@ ] } ], @@ -67,7 +67,7 @@ index 58063f2452dc484a97c79b382067d9b34875e344..d586436498263c595a17454f54644d2d } // namespace views::features diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index f4fa30c1621e2eb78913ea97a993eb0a3528f36c..f142ce65c5c0e22b968c98082d11d9922e3a0cfa 100644 +index d58b59288d881a2d74ea357f1e9e27870d24ac72..956dc87cb07559038a63cec0b5174cec09619bdb 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -84,6 +84,23 @@ namespace { @@ -154,7 +154,7 @@ index f4fa30c1621e2eb78913ea97a993eb0a3528f36c..f142ce65c5c0e22b968c98082d11d992 return display::win::GetScreenWin()->ScreenToDIPRect(GetHWND(), pixel_bounds); } -@@ -678,37 +710,44 @@ void DesktopWindowTreeHostWin::HideImpl() { +@@ -677,37 +709,44 @@ void DesktopWindowTreeHostWin::HideImpl() { // other get/set methods work in DIP. gfx::Rect DesktopWindowTreeHostWin::GetBoundsInPixels() const { @@ -219,7 +219,7 @@ index f4fa30c1621e2eb78913ea97a993eb0a3528f36c..f142ce65c5c0e22b968c98082d11d992 } gfx::Rect -@@ -918,21 +957,29 @@ int DesktopWindowTreeHostWin::GetNonClientComponent( +@@ -917,21 +956,29 @@ int DesktopWindowTreeHostWin::GetNonClientComponent( void DesktopWindowTreeHostWin::GetWindowMask(const gfx::Size& size_px, SkPath* path) { @@ -264,7 +264,7 @@ index f4fa30c1621e2eb78913ea97a993eb0a3528f36c..f142ce65c5c0e22b968c98082d11d992 } diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -index cef7afbf408e38798c398c23dc3e964bd1d95d17..74f0f6e485f4cc6be2c292f4b364d9796d9ce20b 100644 +index e8acd2828ed05deefa335ce2bb461f0c3be8d7b7..0cd07fd5fb55dcc0d972de4c027fcb895d156592 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h @@ -175,7 +175,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin @@ -276,7 +276,7 @@ index cef7afbf408e38798c398c23dc3e964bd1d95d17..74f0f6e485f4cc6be2c292f4b364d979 gfx::Rect GetBoundsInAcceleratedWidgetPixelCoordinates() override; gfx::Point GetLocationOnScreenInPixels() const override; void SetCapture() override; -@@ -327,6 +327,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin +@@ -328,6 +328,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin gfx::Vector2d window_expansion_top_left_delta_; gfx::Vector2d window_expansion_bottom_right_delta_; diff --git a/patches/chromium/support_mixed_sandbox_with_zygote.patch b/patches/chromium/support_mixed_sandbox_with_zygote.patch index 62c7e5849b534..9f997b8094f30 100644 --- a/patches/chromium/support_mixed_sandbox_with_zygote.patch +++ b/patches/chromium/support_mixed_sandbox_with_zygote.patch @@ -22,10 +22,10 @@ However, the patch would need to be reviewed by the security team, as it does touch a security-sensitive class. diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index a76db23484dabda64b7eaf2e8b6c6f22faf2719f..004bfd9456a1b235fd6d6abcd5d2a7ca5e070807 100644 +index b01a2051cee154cc002e4c0274e8955b4eccfe38..21bd24c3bf02f047a42daaddd155e83e2dc86963 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -1870,6 +1870,10 @@ bool RenderProcessHostImpl::Init() { +@@ -1896,6 +1896,10 @@ bool RenderProcessHostImpl::Init() { std::unique_ptr<SandboxedProcessLauncherDelegate> sandbox_delegate = std::make_unique<RendererSandboxedProcessLauncherDelegateWin>( *cmd_line, IsPdf(), IsJitDisabled()); @@ -37,7 +37,7 @@ index a76db23484dabda64b7eaf2e8b6c6f22faf2719f..004bfd9456a1b235fd6d6abcd5d2a7ca std::unique_ptr<SandboxedProcessLauncherDelegate> sandbox_delegate = std::make_unique<RendererSandboxedProcessLauncherDelegate>(); diff --git a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc -index 33c2fb1dde3cc92383c085fc1277c71ccfffedc0..033a3692e59e9a220a635462542f4f34e7a14f26 100644 +index 0936beb23188f0d07cd5750f3a2e56dc560fdef2..996eab5dae4ffa6b7898cc070de8162ad2130d70 100644 --- a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc +++ b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc @@ -35,6 +35,9 @@ namespace content { @@ -50,7 +50,7 @@ index 33c2fb1dde3cc92383c085fc1277c71ccfffedc0..033a3692e59e9a220a635462542f4f34 const base::CommandLine& browser_command_line = *base::CommandLine::ForCurrentProcess(); base::CommandLine::StringType renderer_prefix = -@@ -73,6 +76,9 @@ RendererSandboxedProcessLauncherDelegateWin:: +@@ -71,6 +74,9 @@ RendererSandboxedProcessLauncherDelegateWin:: ->ShouldRestrictCoreSharingOnRenderer()) { // PDF renderers must be jitless. CHECK(!is_pdf_renderer || is_jit_disabled); @@ -61,7 +61,7 @@ index 33c2fb1dde3cc92383c085fc1277c71ccfffedc0..033a3692e59e9a220a635462542f4f34 dynamic_code_can_be_disabled_ = true; return; diff --git a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h -index 85e9366a5bb28da302e475c99feb59863890ca09..ce29836e57dc72e0719998e1fa8734fd256e5633 100644 +index b98b23a95003c3e3dd7b2da6a48b956cdbeb5251..0597eca8efa2bea2cb800c6919b59dfb64c87083 100644 --- a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h +++ b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h @@ -18,6 +18,11 @@ class CONTENT_EXPORT RendererSandboxedProcessLauncherDelegate diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index d9e705f7860e3..5b9a28b6804b0 100644 --- a/patches/chromium/web_contents.patch +++ b/patches/chromium/web_contents.patch @@ -9,10 +9,10 @@ is needed for OSR. Originally landed in https://github.com/electron/libchromiumcontent/pull/226. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 11c0124b6f3f1599b5a56ba7817e946a871316cc..b45610acc74a069c12cec3d0e9e737923ba059b2 100644 +index dfcb0be8195aab4df36c319c0996ec8a1a4f555e..2eed5dbdda53e0d7ad8aa8cab08258cb2d3a1433 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4181,6 +4181,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -4182,6 +4182,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, params.main_frame_name, GetOpener(), primary_main_frame_policy, base::UnguessableToken::Create()); @@ -26,7 +26,7 @@ index 11c0124b6f3f1599b5a56ba7817e946a871316cc..b45610acc74a069c12cec3d0e9e73792 std::unique_ptr<WebContentsViewDelegate> delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -4191,6 +4198,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -4192,6 +4199,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, view_ = CreateWebContentsView(this, std::move(delegate), &render_view_host_delegate_view_); } diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index 95e2cd758ccb6..6de4df7d60068 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,10 +15,10 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index ff0406154e44a3b12ec732e836fc1e65dadfd326..8694b6dc3d3afe018830427ce07fe740f0d08e51 100644 +index 15e2f327060adeb32e977a8a371604819fe01108..f8649ef3b599b64dcbee26984f1136c137255f28 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -8932,6 +8932,17 @@ void RenderFrameHostImpl::EnterFullscreen( +@@ -8971,6 +8971,17 @@ void RenderFrameHostImpl::EnterFullscreen( } } @@ -37,10 +37,10 @@ index ff0406154e44a3b12ec732e836fc1e65dadfd326..8694b6dc3d3afe018830427ce07fe740 if (had_fullscreen_token && !GetView()->HasFocus()) GetView()->Focus(); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index b45610acc74a069c12cec3d0e9e737923ba059b2..b97e039449bc43233c0388f9ae277341d6fde967 100644 +index 2eed5dbdda53e0d7ad8aa8cab08258cb2d3a1433..5bca1c0fbaa4dc3c6294fa206463ca3190a0367d 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4464,21 +4464,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( +@@ -4468,21 +4468,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( const input::NativeWebKeyboardEvent& event) { OPTIONAL_TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("content.verbose"), "WebContentsImpl::PreHandleKeyboardEvent"); @@ -80,7 +80,7 @@ index b45610acc74a069c12cec3d0e9e737923ba059b2..b97e039449bc43233c0388f9ae277341 } bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) { -@@ -4637,7 +4641,7 @@ void WebContentsImpl::EnterFullscreenMode( +@@ -4641,7 +4645,7 @@ void WebContentsImpl::EnterFullscreenMode( OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::EnterFullscreenMode"); DCHECK(CanEnterFullscreenMode(requesting_frame)); DCHECK(requesting_frame->IsActive()); @@ -90,7 +90,7 @@ index b45610acc74a069c12cec3d0e9e737923ba059b2..b97e039449bc43233c0388f9ae277341 // inactive when sites request fullscreen via capability delegation, consume // transient activation from a gesture made before another window was focused, diff --git a/third_party/blink/renderer/core/fullscreen/fullscreen.cc b/third_party/blink/renderer/core/fullscreen/fullscreen.cc -index 951bbda2e7b4845606899e123a3b12fed80cbb3d..5e3aea39804bd519a26ad9dddfe3a209a2955631 100644 +index c533c80eb4eea180a2ef89a225d7c75390d40225..4c81dea15346b35a9a43c92fb3b778367888a6ca 100644 --- a/third_party/blink/renderer/core/fullscreen/fullscreen.cc +++ b/third_party/blink/renderer/core/fullscreen/fullscreen.cc @@ -105,7 +105,6 @@ void FullscreenElementChanged(Document& document, diff --git a/patches/chromium/worker_context_will_destroy.patch b/patches/chromium/worker_context_will_destroy.patch index cf81e18e91bb4..19883c3c7a5d4 100644 --- a/patches/chromium/worker_context_will_destroy.patch +++ b/patches/chromium/worker_context_will_destroy.patch @@ -26,10 +26,10 @@ index d794a461eedde1003c72f47af0517249ab20806d..6d2033d2023a7c4c936933a050d2372c // An empty URL is returned if the URL is not overriden. virtual GURL OverrideFlashEmbedWithHTML(const GURL& url); diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index 915bc8e9e05b875b7d86437b9992ca6753b516f5..08c3dda56e706174dab4661d4e7c15350ddfd5cf 100644 +index 93bb9ba86074d5105cca072d08588ff6e58caa6f..c3c795042c611b3ceb99d25dc255fbbe46ee9fcc 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -901,6 +901,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { +@@ -902,6 +902,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread(); } @@ -43,7 +43,7 @@ index 915bc8e9e05b875b7d86437b9992ca6753b516f5..08c3dda56e706174dab4661d4e7c1535 const v8::Local<v8::Context>& worker) { GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h -index e5ae92156ff264aed1ba7c6903083fe1dbba5781..4f399015a3290e8b0151f89096c53832553cb9b1 100644 +index 451dd8f53764d02906cdfdd42d4a09f676857280..82d9b2f234101aeddc9c20ffae0d8793a5902ced 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h @@ -206,6 +206,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { @@ -55,10 +55,10 @@ index e5ae92156ff264aed1ba7c6903083fe1dbba5781..4f399015a3290e8b0151f89096c53832 const blink::WebSecurityOrigin& script_origin) override; blink::ProtocolHandlerSecurityLevel GetProtocolHandlerSecurityLevel( diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h -index 58a179c48a3fa98d4e7dc2ae5fe37a68ab356989..b8acfdf8859f3ac7672a26e769c4adf7265d8d0a 100644 +index ee07da0b3073fa15f66058bdd06cd8bce6f46c6e..dc188f2ac6cdd718eb058af834ca8fdf5ae3c753 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -672,6 +672,7 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -673,6 +673,7 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void DidStartWorkerThread() {} virtual void WillStopWorkerThread() {} virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {} diff --git a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch index c25c5692a4857..9e15fc37b4421 100644 --- a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch +++ b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch @@ -35,10 +35,10 @@ index 6d2033d2023a7c4c936933a050d2372cf490eb44..79d59c3f4d3d2d5ff39bd65ded489183 // from the worker thread. virtual void WillDestroyWorkerContextOnWorkerThread( diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index 08c3dda56e706174dab4661d4e7c15350ddfd5cf..3550e6aadd0a279630b83f678e9f1820cde9dafa 100644 +index c3c795042c611b3ceb99d25dc255fbbe46ee9fcc..f9d5d5c633e35f562c9bfd83e90490737f48f563 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -913,6 +913,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated( +@@ -914,6 +914,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated( worker); } @@ -52,7 +52,7 @@ index 08c3dda56e706174dab4661d4e7c15350ddfd5cf..3550e6aadd0a279630b83f678e9f1820 const blink::WebSecurityOrigin& script_origin) { return GetContentClient()->renderer()->AllowScriptExtensionForServiceWorker( diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h -index 4f399015a3290e8b0151f89096c53832553cb9b1..f4977b8e092bbd6fda87b74c8f53bfc7116ea469 100644 +index 82d9b2f234101aeddc9c20ffae0d8793a5902ced..f266958af5641064fac8995f1e3786f178f2f7bd 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h @@ -206,6 +206,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { @@ -65,10 +65,10 @@ index 4f399015a3290e8b0151f89096c53832553cb9b1..f4977b8e092bbd6fda87b74c8f53bfc7 bool AllowScriptExtensionForServiceWorker( const blink::WebSecurityOrigin& script_origin) override; diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h -index b8acfdf8859f3ac7672a26e769c4adf7265d8d0a..feef07df8489e502beb9b80dd8e2fb01468fd708 100644 +index dc188f2ac6cdd718eb058af834ca8fdf5ae3c753..072a55c9c40c6cc1a44a2939e614950dceb1bb27 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -672,6 +672,8 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -673,6 +673,8 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void DidStartWorkerThread() {} virtual void WillStopWorkerThread() {} virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {} diff --git a/patches/config.json b/patches/config.json index 37f4600e246f4..8d297c0fd3e66 100644 --- a/patches/config.json +++ b/patches/config.json @@ -12,6 +12,5 @@ { "patch_dir": "src/electron/patches/ReactiveObjC", "repo": "src/third_party/squirrel.mac/vendor/ReactiveObjC" }, { "patch_dir": "src/electron/patches/webrtc", "repo": "src/third_party/webrtc" }, { "patch_dir": "src/electron/patches/reclient-configs", "repo": "src/third_party/engflow-reclient-configs" }, - { "patch_dir": "src/electron/patches/sqlite", "repo": "src/third_party/sqlite/src" }, - { "patch_dir": "src/electron/patches/angle", "repo": "src/third_party/angle" } + { "patch_dir": "src/electron/patches/sqlite", "repo": "src/third_party/sqlite/src" } ] diff --git a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch index 8b96f3e551e09..ea898e1cb4b60 100644 --- a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch +++ b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch @@ -10,10 +10,10 @@ to handle this without patching, but this is fairly clean for now and no longer patching legacy devtools code. diff --git a/front_end/entrypoints/main/MainImpl.ts b/front_end/entrypoints/main/MainImpl.ts -index a8fc444e89afc0ecc169e055ccab117c140d86a1..9fde1c092ff80ce2719ad920e4e885459f7b2e6c 100644 +index 59588e13341d954327c57af7dcf554d3a739ddc3..878cec17c3f79a00a2cffe12364f943c11f88676 100644 --- a/front_end/entrypoints/main/MainImpl.ts +++ b/front_end/entrypoints/main/MainImpl.ts -@@ -740,6 +740,8 @@ export class MainImpl { +@@ -752,6 +752,8 @@ export class MainImpl { globalThis.Main = globalThis.Main || {}; // @ts-expect-error Exported for Tests.js globalThis.Main.Main = MainImpl; diff --git a/patches/nan/.patches b/patches/nan/.patches index 0b1553be338c5..a8b0cedecdd75 100644 --- a/patches/nan/.patches +++ b/patches/nan/.patches @@ -6,3 +6,4 @@ apply_allcan_read_write.patch fix_support_new_variant_of_namedpropertyhandlerconfiguration_and.patch fix_correct_usages_of_v8_returnvalue_void_set_nonempty_for_new.patch chore_remove_deprecated_functioncallbackinfo_holder.patch +fix_replace_deprecated_get_setprototype.patch diff --git a/patches/nan/fix_replace_deprecated_get_setprototype.patch b/patches/nan/fix_replace_deprecated_get_setprototype.patch new file mode 100644 index 0000000000000..e1dc28af2e2c2 --- /dev/null +++ b/patches/nan/fix_replace_deprecated_get_setprototype.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Samuel Maddock <smaddock@slack-corp.com> +Date: Thu, 9 Oct 2025 23:25:59 -0400 +Subject: fix: replace deprecated Get/SetPrototype + +https://chromium-review.googlesource.com/c/v8/v8/+/6983465 + +Replaces the deprecated usage of SetPrototype. + +diff --git a/nan_maybe_43_inl.h b/nan_maybe_43_inl.h +index c04ce30d2fa3bfb555c96754d93de64e8a83e36b..aa06dbad2f0b3d564917dbcd29ac608ad468327b 100644 +--- a/nan_maybe_43_inl.h ++++ b/nan_maybe_43_inl.h +@@ -207,7 +207,7 @@ inline Maybe<bool> SetPrototype( + , v8::Local<v8::Value> prototype) { + v8::Isolate *isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(isolate); +- return obj->SetPrototype(isolate->GetCurrentContext(), prototype); ++ return obj->SetPrototypeV2(isolate->GetCurrentContext(), prototype); + } + + inline MaybeLocal<v8::String> ObjectProtoToString( +diff --git a/nan_maybe_pre_43_inl.h b/nan_maybe_pre_43_inl.h +index 83325ae0897f95f2fe5354e9ab720796a7cefd7c..c309ace8c69feb6d01f136d4c0a33443886c467a 100644 +--- a/nan_maybe_pre_43_inl.h ++++ b/nan_maybe_pre_43_inl.h +@@ -174,7 +174,7 @@ MaybeLocal<v8::Array> GetOwnPropertyNames(v8::Handle<v8::Object> obj) { + inline Maybe<bool> SetPrototype( + v8::Handle<v8::Object> obj + , v8::Handle<v8::Value> prototype) { +- return Just<bool>(obj->SetPrototype(prototype)); ++ return Just<bool>(obj->SetPrototypeV2(prototype)); + } + + inline MaybeLocal<v8::String> ObjectProtoToString( diff --git a/patches/node/.patches b/patches/node/.patches index 925963526a7ef..301adc7c48439 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -50,3 +50,6 @@ chore_add_missing_include_of_iterator.patch test_accomodate_v8_thenable_stack_trace_change_in_snapshot.patch chore_exclude_electron_node_folder_from_exit-time-destructors.patch api_remove_deprecated_getisolate.patch +src_switch_from_get_setprototype_to_get_setprototypev2.patch +fix_replace_deprecated_setprototype.patch +fix_redefined_macos_sdk_header_symbols.patch diff --git a/patches/node/cli_move_--trace-atomics-wait_to_eol.patch b/patches/node/cli_move_--trace-atomics-wait_to_eol.patch index 394ae7770d0cc..886a61ae99fc3 100644 --- a/patches/node/cli_move_--trace-atomics-wait_to_eol.patch +++ b/patches/node/cli_move_--trace-atomics-wait_to_eol.patch @@ -83,7 +83,7 @@ index e3b2c45af01b2e9b9522964da2572988edd2b9e9..64e975546285a1042dda6fdb54fdd502 Print stack traces for deprecations. . diff --git a/src/node.cc b/src/node.cc -index f0c0b6229048a2e9bc05684fab44ab09bc34e1f6..9027df9a321f7db76edd1218c194df519017dfaf 100644 +index 0725cc97510375bc616534ddf3de4b231bae6bf5..f21687ad9dfd69c829aaaf8f3ed66b6bf6713765 100644 --- a/src/node.cc +++ b/src/node.cc @@ -232,44 +232,6 @@ void Environment::WaitForInspectorFrontendByOptions() { diff --git a/patches/node/fix_cppgc_initializing_twice.patch b/patches/node/fix_cppgc_initializing_twice.patch index d33ea35c66949..851b68cac311f 100644 --- a/patches/node/fix_cppgc_initializing_twice.patch +++ b/patches/node/fix_cppgc_initializing_twice.patch @@ -12,7 +12,7 @@ This can be removed/refactored once Node.js upgrades to a version of V8 containing the above CL. diff --git a/src/node.cc b/src/node.cc -index 9027df9a321f7db76edd1218c194df519017dfaf..cc1c35da5601fffc3c53985c5d95cc466662649d 100644 +index f21687ad9dfd69c829aaaf8f3ed66b6bf6713765..17c29c759d4fa1a3b709c0844a80fbf509124d73 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1246,7 +1246,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, diff --git a/patches/node/fix_redefined_macos_sdk_header_symbols.patch b/patches/node/fix_redefined_macos_sdk_header_symbols.patch new file mode 100644 index 0000000000000..4e39d97cb8ae7 --- /dev/null +++ b/patches/node/fix_redefined_macos_sdk_header_symbols.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Samuel Maddock <smaddock@slack-corp.com> +Date: Wed, 8 Oct 2025 10:50:03 -0400 +Subject: fix: redefined macos sdk header symbols + +https://chromium-review.googlesource.com/c/chromium/src/+/6950738 + +Chromium has set the minimum MacOS SDK version to 26. With this +change, it seems to introduce an incompatibility when compiling +using clang modules. Disabling them resolves the issue. + +diff --git a/unofficial.gni b/unofficial.gni +index a64d2e4ac475abc049fff7ea62ec76de565a747d..ab456452d102088005fc4bfcb394d2de5ec44889 100644 +--- a/unofficial.gni ++++ b/unofficial.gni +@@ -195,6 +195,10 @@ template("node_gn_build") { + "CoreFoundation.framework", + "Security.framework", + ] ++ ++ # Fix for MacOSX26 SDK headers included twice due to usage of clang ++ # modules. Included once as a C header and again as C++. ++ use_libcxx_modules = false + } + if (is_posix) { + configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] +@@ -350,6 +354,12 @@ template("node_gn_build") { + include_dirs = [ "src", "tools" ] + configs += [ "//build/config/compiler:no_exit_time_destructors" ] + ++ # Fix for MacOSX26 SDK headers included twice due to usage of clang modules. ++ # Included once as a C header and again as C++. ++ if (is_mac) { ++ use_libcxx_modules = false ++ } ++ + if (!is_win) { + defines += [ "NODE_JS2C_USE_STRING_LITERALS" ] + } diff --git a/patches/node/fix_remove_outdated_v8_flags_from_node_cc.patch b/patches/node/fix_remove_outdated_v8_flags_from_node_cc.patch index 8eba2bbcbb479..5251bd1cfc1d6 100644 --- a/patches/node/fix_remove_outdated_v8_flags_from_node_cc.patch +++ b/patches/node/fix_remove_outdated_v8_flags_from_node_cc.patch @@ -5,15 +5,18 @@ Subject: fix: remove outdated V8 flags from node.cc Refs https://chromium-review.googlesource.com/c/v8/v8/+/5507047 Refs https://chromium-review.googlesource.com/c/v8/v8/+/6249026 +Refs https://chromium-review.googlesource.com/c/v8/v8/+/6948286 -The above CL removes the `--harmony-import-assertions` and ---experimental-wasm-memory64 flags from V8. +The above CLs remove the following flags from V8: +* --harmony-import-assertions +* --experimental-wasm-memory64 +* --experimental-wasm-imported-strings This patch can be removed when we upgrade to a V8 version that contains the above CLs. diff --git a/src/node.cc b/src/node.cc -index 07684482f855363e26c3d7299a585a8a5654015e..627337efae49319e2a77b4686176ce92a8493024 100644 +index 07684482f855363e26c3d7299a585a8a5654015e..5a7378890dc310bb3779974c79f387e7cdda15b0 100644 --- a/src/node.cc +++ b/src/node.cc @@ -816,7 +816,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args, @@ -25,11 +28,13 @@ index 07684482f855363e26c3d7299a585a8a5654015e..627337efae49319e2a77b4686176ce92 auto env_opts = per_process::cli_options->per_isolate->per_env; if (std::find(v8_args.begin(), v8_args.end(), -@@ -828,7 +828,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args, +@@ -827,8 +827,8 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args, + } // Support stable Phase 5 WebAssembly proposals - v8_args.emplace_back("--experimental-wasm-imported-strings"); +- v8_args.emplace_back("--experimental-wasm-imported-strings"); - v8_args.emplace_back("--experimental-wasm-memory64"); ++ // v8_args.emplace_back("--experimental-wasm-imported-strings"); + // v8_args.emplace_back("--experimental-wasm-memory64"); v8_args.emplace_back("--experimental-wasm-exnref"); diff --git a/patches/node/fix_replace_deprecated_setprototype.patch b/patches/node/fix_replace_deprecated_setprototype.patch new file mode 100644 index 0000000000000..44e193cd56e79 --- /dev/null +++ b/patches/node/fix_replace_deprecated_setprototype.patch @@ -0,0 +1,61 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Samuel Maddock <smaddock@slack-corp.com> +Date: Mon, 6 Oct 2025 16:34:43 -0400 +Subject: fix: replace deprecated Get/SetPrototype + +https://chromium-review.googlesource.com/c/v8/v8/+/6983465 + +This is already applied in newer versions of Node so we can drop +this patch once we upgrade to v23. + +diff --git a/src/api/environment.cc b/src/api/environment.cc +index 0a358735c331767e8eb563a80e9aaccfb544c27b..d7d18d5fcbf008ac131db189a141315af4f6410b 100644 +--- a/src/api/environment.cc ++++ b/src/api/environment.cc +@@ -835,7 +835,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context, + + Local<Object> private_symbols_object; + if (!private_symbols->NewInstance(context).ToLocal(&private_symbols_object) || +- private_symbols_object->SetPrototype(context, Null(isolate)) ++ private_symbols_object->SetPrototypeV2(context, Null(isolate)) + .IsNothing()) { + return MaybeLocal<Object>(); + } +@@ -861,7 +861,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context, + Local<Object> per_isolate_symbols_object; + if (!per_isolate_symbols->NewInstance(context).ToLocal( + &per_isolate_symbols_object) || +- per_isolate_symbols_object->SetPrototype(context, Null(isolate)) ++ per_isolate_symbols_object->SetPrototypeV2(context, Null(isolate)) + .IsNothing()) { + return MaybeLocal<Object>(); + } +diff --git a/src/node_constants.cc b/src/node_constants.cc +index 2f23cc63f148a792f1302e1d2d88822730abaa33..42678e5d11e5ff9543bf12ec02fee7d3263d7629 100644 +--- a/src/node_constants.cc ++++ b/src/node_constants.cc +@@ -1307,7 +1307,7 @@ void CreatePerContextProperties(Local<Object> target, + .FromJust()); + + Local<Object> internal_constants = Object::New(isolate); +- CHECK(internal_constants->SetPrototype(env->context(), ++ CHECK(internal_constants->SetPrototypeV2(env->context(), + Null(env->isolate())).FromJust()); + + DefineErrnoConstants(err_constants); +diff --git a/src/node_sqlite.cc b/src/node_sqlite.cc +index 96101167016573e80fff520256ebb78c71d83302..a76a68e50d81bddd80c02fa8263b788c098c887d 100644 +--- a/src/node_sqlite.cc ++++ b/src/node_sqlite.cc +@@ -2106,9 +2106,9 @@ void StatementSync::Iterate(const FunctionCallbackInfo<Value>& args) { + StatementSyncIterator::Create(env, BaseObjectPtr<StatementSync>(stmt)); + + if (iter->object() +- ->GetPrototype() ++ ->GetPrototypeV2() + .As<Object>() +- ->SetPrototype(context, js_iterator_prototype) ++ ->SetPrototypeV2(context, js_iterator_prototype) + .IsNothing()) { + return; + } diff --git a/patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch b/patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch index 991b0cfe3154e..32bfeaea784ce 100644 --- a/patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch +++ b/patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch @@ -102,7 +102,7 @@ index 2d5fa8dbd75851bca30453548f6cbe0159509f26..c346e3a9c827993036438685d758a734 worker::Worker* worker_context_ = nullptr; PerIsolateWrapperData* wrapper_data_; diff --git a/src/node.cc b/src/node.cc -index 627337efae49319e2a77b4686176ce92a8493024..f0c0b6229048a2e9bc05684fab44ab09bc34e1f6 100644 +index 5a7378890dc310bb3779974c79f387e7cdda15b0..0725cc97510375bc616534ddf3de4b231bae6bf5 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1295,6 +1295,14 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, diff --git a/patches/node/src_switch_from_get_setprototype_to_get_setprototypev2.patch b/patches/node/src_switch_from_get_setprototype_to_get_setprototypev2.patch new file mode 100644 index 0000000000000..79190df99fd44 --- /dev/null +++ b/patches/node/src_switch_from_get_setprototype_to_get_setprototypev2.patch @@ -0,0 +1,173 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aviv Keller <redyetidev@gmail.com> +Date: Tue, 22 Oct 2024 01:05:19 -0400 +Subject: src: switch from `Get/SetPrototype` to `Get/SetPrototypeV2` + +PR-URL: https://github.com/nodejs/node/pull/55453 +Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com> +Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> +Reviewed-By: Moshe Atlow <moshe@atlow.co.il> +Reviewed-By: James M Snell <jasnell@gmail.com> + +diff --git a/src/api/environment.cc b/src/api/environment.cc +index 82f53bba29613de212f64be440ca20d7c630fddf..0a358735c331767e8eb563a80e9aaccfb544c27b 100644 +--- a/src/api/environment.cc ++++ b/src/api/environment.cc +@@ -886,7 +886,7 @@ Maybe<void> InitializePrimordials(Local<Context> context, + CHECK(!exports->Has(context, primordials_string).FromJust()); + + Local<Object> primordials = Object::New(isolate); +- if (primordials->SetPrototype(context, Null(isolate)).IsNothing() || ++ if (primordials->SetPrototypeV2(context, Null(isolate)).IsNothing() || + exports->Set(context, primordials_string, primordials).IsNothing()) { + return Nothing<void>(); + } +diff --git a/src/internal_only_v8.cc b/src/internal_only_v8.cc +index 487b8b7adfd35646d20fdb15be5fd6f2bee9315b..6a3c4e6952a8f3250bf1b57652a1622e9f63ec52 100644 +--- a/src/internal_only_v8.cc ++++ b/src/internal_only_v8.cc +@@ -33,8 +33,8 @@ class PrototypeChainHas : public v8::QueryObjectPredicate { + if (creation_context != context_) { + return false; + } +- for (Local<Value> proto = object->GetPrototype(); proto->IsObject(); +- proto = proto.As<Object>()->GetPrototype()) { ++ for (Local<Value> proto = object->GetPrototypeV2(); proto->IsObject(); ++ proto = proto.As<Object>()->GetPrototypeV2()) { + if (search_ == proto) return true; + } + return false; +diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc +index de3d1f2f1832740b24480267f8c573794179859c..6e1680a74e21240ab99be86dcf23e60a05174888 100644 +--- a/src/js_native_api_v8.cc ++++ b/src/js_native_api_v8.cc +@@ -1577,7 +1577,7 @@ napi_status NAPI_CDECL napi_get_prototype(napi_env env, + CHECK_TO_OBJECT(env, context, obj, object); + + // This doesn't invokes Proxy's [[GetPrototypeOf]] handler. +- v8::Local<v8::Value> val = obj->GetPrototype(); ++ v8::Local<v8::Value> val = obj->GetPrototypeV2(); + *result = v8impl::JsValueFromV8LocalValue(val); + return GET_RETURN_STATUS(env); + } +diff --git a/src/node_buffer.cc b/src/node_buffer.cc +index c94b14741c827a81d69a6f036426a344e563ad72..15129e4455fdc8792f21511a04d534ba3a4ebb5f 100644 +--- a/src/node_buffer.cc ++++ b/src/node_buffer.cc +@@ -284,8 +284,9 @@ MaybeLocal<Uint8Array> New(Environment* env, + size_t length) { + CHECK(!env->buffer_prototype_object().IsEmpty()); + Local<Uint8Array> ui = Uint8Array::New(ab, byte_offset, length); +- if (ui->SetPrototype(env->context(), env->buffer_prototype_object()) +- .IsNothing()) { ++ Maybe<bool> mb = ++ ui->SetPrototypeV2(env->context(), env->buffer_prototype_object()); ++ if (mb.IsNothing()) { + return MaybeLocal<Uint8Array>(); + } + return ui; +diff --git a/src/node_constants.cc b/src/node_constants.cc +index b1ee513fc0873a51b4885f612dbf7b950b5cf2ca..2f23cc63f148a792f1302e1d2d88822730abaa33 100644 +--- a/src/node_constants.cc ++++ b/src/node_constants.cc +@@ -1267,43 +1267,44 @@ void CreatePerContextProperties(Local<Object> target, + Isolate* isolate = Isolate::GetCurrent(); + Environment* env = Environment::GetCurrent(context); + +- CHECK(target->SetPrototype(env->context(), Null(env->isolate())).FromJust()); ++ CHECK( ++ target->SetPrototypeV2(env->context(), Null(env->isolate())).FromJust()); + + Local<Object> os_constants = Object::New(isolate); +- CHECK(os_constants->SetPrototype(env->context(), +- Null(env->isolate())).FromJust()); ++ CHECK(os_constants->SetPrototypeV2(env->context(), Null(env->isolate())) ++ .FromJust()); + + Local<Object> err_constants = Object::New(isolate); +- CHECK(err_constants->SetPrototype(env->context(), +- Null(env->isolate())).FromJust()); ++ CHECK(err_constants->SetPrototypeV2(env->context(), Null(env->isolate())) ++ .FromJust()); + + Local<Object> sig_constants = Object::New(isolate); +- CHECK(sig_constants->SetPrototype(env->context(), +- Null(env->isolate())).FromJust()); ++ CHECK(sig_constants->SetPrototypeV2(env->context(), Null(env->isolate())) ++ .FromJust()); + + Local<Object> priority_constants = Object::New(isolate); +- CHECK(priority_constants->SetPrototype(env->context(), +- Null(env->isolate())).FromJust()); ++ CHECK(priority_constants->SetPrototypeV2(env->context(), Null(env->isolate())) ++ .FromJust()); + + Local<Object> fs_constants = Object::New(isolate); +- CHECK(fs_constants->SetPrototype(env->context(), +- Null(env->isolate())).FromJust()); ++ CHECK(fs_constants->SetPrototypeV2(env->context(), Null(env->isolate())) ++ .FromJust()); + + Local<Object> crypto_constants = Object::New(isolate); +- CHECK(crypto_constants->SetPrototype(env->context(), +- Null(env->isolate())).FromJust()); ++ CHECK(crypto_constants->SetPrototypeV2(env->context(), Null(env->isolate())) ++ .FromJust()); + + Local<Object> zlib_constants = Object::New(isolate); +- CHECK(zlib_constants->SetPrototype(env->context(), +- Null(env->isolate())).FromJust()); ++ CHECK(zlib_constants->SetPrototypeV2(env->context(), Null(env->isolate())) ++ .FromJust()); + + Local<Object> dlopen_constants = Object::New(isolate); +- CHECK(dlopen_constants->SetPrototype(env->context(), +- Null(env->isolate())).FromJust()); ++ CHECK(dlopen_constants->SetPrototypeV2(env->context(), Null(env->isolate())) ++ .FromJust()); + + Local<Object> trace_constants = Object::New(isolate); +- CHECK(trace_constants->SetPrototype(env->context(), +- Null(env->isolate())).FromJust()); ++ CHECK(trace_constants->SetPrototypeV2(env->context(), Null(env->isolate())) ++ .FromJust()); + + Local<Object> internal_constants = Object::New(isolate); + CHECK(internal_constants->SetPrototype(env->context(), +diff --git a/src/node_options.cc b/src/node_options.cc +index 556776b79282d953fdc371d1901f21ca301bec1a..b33193c4d017b35aec5e73c1ead04cfb3ba50d55 100644 +--- a/src/node_options.cc ++++ b/src/node_options.cc +@@ -1493,7 +1493,8 @@ void GetCLIOptionsInfo(const FunctionCallbackInfo<Value>& args) { + + Local<Map> options = Map::New(isolate); + if (options +- ->SetPrototype(context, env->primordials_safe_map_prototype_object()) ++ ->SetPrototypeV2(context, ++ env->primordials_safe_map_prototype_object()) + .IsNothing()) { + return; + } +@@ -1533,7 +1534,8 @@ void GetCLIOptionsInfo(const FunctionCallbackInfo<Value>& args) { + if (!ToV8Value(context, _ppop_instance.aliases_).ToLocal(&aliases)) return; + + if (aliases.As<Object>() +- ->SetPrototype(context, env->primordials_safe_map_prototype_object()) ++ ->SetPrototypeV2(context, ++ env->primordials_safe_map_prototype_object()) + .IsNothing()) { + return; + } +diff --git a/src/node_webstorage.cc b/src/node_webstorage.cc +index 1705e430099c5a363e02010f83d729b0aa54f8e5..0577777723747327dc57830ace316aebc0cfd891 100644 +--- a/src/node_webstorage.cc ++++ b/src/node_webstorage.cc +@@ -532,7 +532,7 @@ template <typename T> + static bool ShouldIntercept(Local<Name> property, + const PropertyCallbackInfo<T>& info) { + Environment* env = Environment::GetCurrent(info); +- Local<Value> proto = info.This()->GetPrototype(); ++ Local<Value> proto = info.This()->GetPrototypeV2(); + + if (proto->IsObject()) { + bool has_prop; diff --git a/patches/v8/.patches b/patches/v8/.patches index 19408f8045162..dc98544242e85 100644 --- a/patches/v8/.patches +++ b/patches/v8/.patches @@ -1,2 +1 @@ chore_allow_customizing_microtask_policy_per_context.patch -cherry-pick-ec6c18478382.patch diff --git a/patches/v8/cherry-pick-ec6c18478382.patch b/patches/v8/cherry-pick-ec6c18478382.patch deleted file mode 100644 index 453f6d61945e1..0000000000000 --- a/patches/v8/cherry-pick-ec6c18478382.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Darius Mercadier <dmercadier@chromium.org> -Date: Tue, 16 Sep 2025 16:40:24 +0200 -Subject: Don't assume that upper 32-bit of Int32MulOvfCheck are 0 - -Because Arm64 doesn't have a flag-setting 32-bit multiplication, -which means that instead with use a 64-bit multiplication, and compare -result.X() and result.W() to check if an overflow happened. But this -leads to the upper 32-bit not being zeroed. - -Fixed: 445380761 -Change-Id: I31287faf37dc615695047021324e9d1d802cbec2 -Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6954290 -Auto-Submit: Darius Mercadier <dmercadier@chromium.org> -Commit-Queue: Leszek Swirski <leszeks@chromium.org> -Reviewed-by: Leszek Swirski <leszeks@chromium.org> -Cr-Commit-Position: refs/heads/main@{#102530} - -diff --git a/src/compiler/backend/arm64/instruction-selector-arm64.cc b/src/compiler/backend/arm64/instruction-selector-arm64.cc -index 541b81352fb302dcac812df4da42a3c4ce3a0fb9..eed3ee9764e78fa6b0402a1b86165bd7a61edee9 100644 ---- a/src/compiler/backend/arm64/instruction-selector-arm64.cc -+++ b/src/compiler/backend/arm64/instruction-selector-arm64.cc -@@ -2966,9 +2966,19 @@ bool InstructionSelector::ZeroExtendsWord32ToWord64NoPhis(OpIndex node) { - return op.Cast<ShiftOp>().rep == WordRepresentation::Word32(); - case Opcode::kComparison: - return op.Cast<ComparisonOp>().rep == RegisterRepresentation::Word32(); -- case Opcode::kOverflowCheckedBinop: -- return op.Cast<OverflowCheckedBinopOp>().rep == -- WordRepresentation::Word32(); -+ case Opcode::kOverflowCheckedBinop: { -+ const OverflowCheckedBinopOp& binop = op.Cast<OverflowCheckedBinopOp>(); -+ if (binop.rep != WordRepresentation::Word32()) return false; -+ switch (binop.kind) { -+ case OverflowCheckedBinopOp::Kind::kSignedAdd: -+ case OverflowCheckedBinopOp::Kind::kSignedSub: -+ return true; -+ case OverflowCheckedBinopOp::Kind::kSignedMul: -+ // EmitInt32MulWithOverflow doesn't zero-extend because Arm64 doesn't -+ // have a flag-setting int32 multiplication. -+ return false; -+ } -+ } - case Opcode::kProjection: - return ZeroExtendsWord32ToWord64NoPhis(op.Cast<ProjectionOp>().input()); - case Opcode::kLoad: { diff --git a/shell/browser/api/electron_api_native_theme.cc b/shell/browser/api/electron_api_native_theme.cc index eaf0d6e228ad5..fa7f9fbbeff9f 100644 --- a/shell/browser/api/electron_api_native_theme.cc +++ b/shell/browser/api/electron_api_native_theme.cc @@ -93,7 +93,8 @@ bool NativeTheme::ShouldUseDarkColorsForSystemIntegratedUI() { } bool NativeTheme::InForcedColorsMode() { - return ui_theme_->forced_colors(); + return ui_theme_->forced_colors() != + ui::ColorProviderKey::ForcedColors::kNone; } bool NativeTheme::GetPrefersReducedTransparency() { @@ -116,7 +117,8 @@ bool NativeTheme::ShouldUseInvertedColorScheme() { return false; return is_inverted; #else - return ui_theme_->forced_colors() && + return ui_theme_->forced_colors() != + ui::ColorProviderKey::ForcedColors::kNone && ui_theme_->preferred_color_scheme() == ui::NativeTheme::PreferredColorScheme::kDark; #endif diff --git a/shell/browser/api/electron_api_session.cc b/shell/browser/api/electron_api_session.cc index 14f87ac72ee2e..e96a8962cb0b3 100644 --- a/shell/browser/api/electron_api_session.cc +++ b/shell/browser/api/electron_api_session.cc @@ -815,27 +815,33 @@ void Session::SetDownloadPath(const base::FilePath& path) { } void Session::EnableNetworkEmulation(const gin_helper::Dictionary& options) { - auto conditions = network::mojom::NetworkConditions::New(); - - options.Get("offline", &conditions->offline); - options.Get("downloadThroughput", &conditions->download_throughput); - options.Get("uploadThroughput", &conditions->upload_throughput); + std::vector<network::mojom::MatchedNetworkConditionsPtr> matched_conditions; + network::mojom::MatchedNetworkConditionsPtr network_conditions = + network::mojom::MatchedNetworkConditions::New(); + network_conditions->conditions = network::mojom::NetworkConditions::New(); + options.Get("offline", &network_conditions->conditions->offline); + options.Get("downloadThroughput", + &network_conditions->conditions->download_throughput); + options.Get("uploadThroughput", + &network_conditions->conditions->upload_throughput); double latency = 0.0; if (options.Get("latency", &latency) && latency) { - conditions->latency = base::Milliseconds(latency); + network_conditions->conditions->latency = base::Milliseconds(latency); } + matched_conditions.emplace_back(std::move(network_conditions)); auto* network_context = browser_context_->GetDefaultStoragePartition()->GetNetworkContext(); network_context->SetNetworkConditions(network_emulation_token_, - std::move(conditions)); + std::move(matched_conditions)); } void Session::DisableNetworkEmulation() { auto* network_context = browser_context_->GetDefaultStoragePartition()->GetNetworkContext(); - network_context->SetNetworkConditions( - network_emulation_token_, network::mojom::NetworkConditions::New()); + std::vector<network::mojom::MatchedNetworkConditionsPtr> network_conditions; + network_context->SetNetworkConditions(network_emulation_token_, + std::move(network_conditions)); } void Session::SetCertVerifyProc(v8::Local<v8::Value> val, diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index badb2b32cbcc6..14b2ee52e0da1 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -2840,7 +2840,8 @@ void WebContents::EnableDeviceEmulation( frame_host->GetView()->GetRenderWidgetHost()); if (widget_host_impl) { auto& frame_widget = widget_host_impl->GetAssociatedFrameWidget(); - frame_widget->EnableDeviceEmulation(params); + frame_widget->EnableDeviceEmulation( + params, blink::mojom::DeviceEmulationCacheBehavior::kClearCache); } } } @@ -4202,8 +4203,8 @@ void WebContents::DevToolsIndexPath( return; std::vector<std::string> excluded_folders; - std::optional<base::Value> parsed_excluded_folders = - base::JSONReader::Read(excluded_folders_message); + std::optional<base::Value> parsed_excluded_folders = base::JSONReader::Read( + excluded_folders_message, base::JSON_PARSE_CHROMIUM_EXTENSIONS); if (parsed_excluded_folders && parsed_excluded_folders->is_list()) { for (const base::Value& folder_path : parsed_excluded_folders->GetList()) { if (folder_path.is_string()) diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index 1d51f7b7ab6f1..2e33cb86eb656 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -305,7 +305,7 @@ const extensions::Extension* GetEnabledExtensionFromEffectiveURL( if (!registry) return nullptr; - return registry->enabled_extensions().GetByID(effective_url.host()); + return registry->enabled_extensions().GetByID(effective_url.GetHost()); } #endif // BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) @@ -427,7 +427,8 @@ void ElectronBrowserClient::OverrideWebPreferences( renderer_prefs->can_accept_load_drops = false; ui::NativeTheme* native_theme = ui::NativeTheme::GetInstanceForNativeUi(); - prefs->in_forced_colors = native_theme->forced_colors(); + prefs->in_forced_colors = native_theme->forced_colors() != + ui::ColorProviderKey::ForcedColors::kNone; prefs->preferred_color_scheme = native_theme->preferred_color_scheme() == ui::NativeTheme::PreferredColorScheme::kDark @@ -447,7 +448,8 @@ bool ElectronBrowserClient::WebPreferencesNeedUpdateForColorRelatedStateChanges( const content::SiteInstance& main_frame_site) const { const auto& prefs = web_contents.GetOrCreateWebPreferences(); ui::NativeTheme* native_theme = ui::NativeTheme::GetInstanceForNativeUi(); - bool in_forced_colors = native_theme->forced_colors(); + bool in_forced_colors = native_theme->forced_colors() != + ui::ColorProviderKey::ForcedColors::kNone; blink::mojom::PreferredColorScheme preferred_color_scheme = native_theme->preferred_color_scheme() == ui::NativeTheme::PreferredColorScheme::kDark @@ -1666,7 +1668,7 @@ void ElectronBrowserClient::RegisterBrowserInterfaceBindersForFrame( render_frame_host->GetProcess()->GetBrowserContext(); auto* extension = extensions::ExtensionRegistry::Get(browser_context) ->enabled_extensions() - .GetByID(site.host()); + .GetByID(site.GetHost()); if (!extension) return; extensions::ExtensionsBrowserClient::Get() diff --git a/shell/browser/extensions/electron_extension_system.cc b/shell/browser/extensions/electron_extension_system.cc index 74ccee197f952..47689d290a197 100644 --- a/shell/browser/extensions/electron_extension_system.cc +++ b/shell/browser/extensions/electron_extension_system.cc @@ -108,7 +108,7 @@ std::unique_ptr<base::Value::Dict> ParseManifest( void ElectronExtensionSystem::LoadComponentExtensions() { #if BUILDFLAG(ENABLE_PDF_VIEWER) - std::string utf8_error; + std::u16string error; std::string pdf_manifest_string = pdf_extension_util::GetManifest(); std::unique_ptr<base::Value::Dict> pdf_manifest = ParseManifest(pdf_manifest_string); @@ -119,7 +119,7 @@ void ElectronExtensionSystem::LoadComponentExtensions() { scoped_refptr<const Extension> pdf_extension = extensions::Extension::Create( root_directory, extensions::mojom::ManifestLocation::kComponent, - *pdf_manifest, extensions::Extension::REQUIRE_KEY, &utf8_error); + *pdf_manifest, extensions::Extension::REQUIRE_KEY, &error); extension_loader_->registrar()->AddExtension(pdf_extension); } #endif diff --git a/shell/browser/extensions/electron_messaging_delegate.cc b/shell/browser/extensions/electron_messaging_delegate.cc index 0ec714a4825d3..a76c85f2b2bbc 100644 --- a/shell/browser/extensions/electron_messaging_delegate.cc +++ b/shell/browser/extensions/electron_messaging_delegate.cc @@ -22,7 +22,7 @@ #include "extensions/common/api/messaging/port_id.h" #include "extensions/common/extension.h" #include "shell/browser/api/electron_api_web_contents.h" -#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/native_ui_types.h" #include "url/gurl.h" namespace extensions { diff --git a/shell/browser/native_window_mac.h b/shell/browser/native_window_mac.h index 2a0192aa9e6b5..66b647ff10e2c 100644 --- a/shell/browser/native_window_mac.h +++ b/shell/browser/native_window_mac.h @@ -225,7 +225,7 @@ class NativeWindowMac : public NativeWindow, // views::WidgetDelegate: views::View* GetContentsView() override; bool CanMaximize() const override; - std::unique_ptr<views::NonClientFrameView> CreateNonClientFrameView( + std::unique_ptr<views::FrameView> CreateFrameView( views::Widget* widget) override; void OnWidgetInitialized() override; diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index 8ddc2aa996fe4..30e0490bc3cfd 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -1718,8 +1718,8 @@ static bool FromV8(v8::Isolate* isolate, const raw_ptr<NativeWindowMac, DanglingUntriaged> native_app_window_; }; -std::unique_ptr<views::NonClientFrameView> -NativeWindowMac::CreateNonClientFrameView(views::Widget* widget) { +std::unique_ptr<views::FrameView> NativeWindowMac::CreateFrameView( + views::Widget* widget) { CHECK(!frame_view_client_); frame_view_client_ = std::make_unique<NativeAppWindowFrameViewMacClient>(widget, this); diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index 0aee88c7ac49d..d1c742fad85ce 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -42,7 +42,7 @@ #include "ui/compositor/compositor.h" #include "ui/display/screen.h" #include "ui/gfx/image/image.h" -#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/native_ui_types.h" #include "ui/ozone/public/ozone_platform.h" #include "ui/views/background.h" #include "ui/views/controls/webview/webview.h" @@ -1845,8 +1845,8 @@ views::ClientView* NativeWindowViews::CreateClientView(views::Widget* widget) { return new NativeWindowClientView{widget, &root_view_, this}; } -std::unique_ptr<views::NonClientFrameView> -NativeWindowViews::CreateNonClientFrameView(views::Widget* widget) { +std::unique_ptr<views::FrameView> NativeWindowViews::CreateFrameView( + views::Widget* widget) { #if BUILDFLAG(IS_WIN) auto frame_view = std::make_unique<WinFrameView>(); frame_view->Init(this, widget); @@ -1873,7 +1873,7 @@ electron::ClientFrameViewLinux* NativeWindowViews::GetClientFrameViewLinux() { // Check to make sure this window's non-client frame view is a // ClientFrameViewLinux. If either has_frame() or has_client_frame() // are false, it will be an OpaqueFrameView or NativeFrameView instead. - // See NativeWindowViews::CreateNonClientFrameView. + // See NativeWindowViews::CreateFrameView. if (!has_frame() || !has_client_frame()) return {}; return static_cast<ClientFrameViewLinux*>( diff --git a/shell/browser/native_window_views.h b/shell/browser/native_window_views.h index e2a6d04f305fa..874a9fda86610 100644 --- a/shell/browser/native_window_views.h +++ b/shell/browser/native_window_views.h @@ -191,7 +191,7 @@ class NativeWindowViews : public NativeWindow, SkColor overlay_symbol_color() const { return overlay_symbol_color_; } #if BUILDFLAG(IS_LINUX) - // returns the ClientFrameViewLinux iff that is our NonClientFrameView type, + // returns the ClientFrameViewLinux iff that is our FrameView type, // nullptr otherwise. ClientFrameViewLinux* GetClientFrameViewLinux(); #endif @@ -220,7 +220,7 @@ class NativeWindowViews : public NativeWindow, gfx::NativeView child, const gfx::Point& location) override; views::ClientView* CreateClientView(views::Widget* widget) override; - std::unique_ptr<views::NonClientFrameView> CreateNonClientFrameView( + std::unique_ptr<views::FrameView> CreateFrameView( views::Widget* widget) override; void OnWidgetMove() override; #if BUILDFLAG(IS_WIN) diff --git a/shell/browser/osr/osr_host_display_client.h b/shell/browser/osr/osr_host_display_client.h index e95eb43bd1ef3..fc914b52fd35a 100644 --- a/shell/browser/osr/osr_host_display_client.h +++ b/shell/browser/osr/osr_host_display_client.h @@ -14,7 +14,7 @@ #include "shell/browser/osr/osr_paint_event.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkCanvas.h" -#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/native_ui_types.h" class SkBitmap; class SkCanvas; diff --git a/shell/browser/osr/osr_paint_event.h b/shell/browser/osr/osr_paint_event.h index cd8f8710c6703..b3e37a6a16857 100644 --- a/shell/browser/osr/osr_paint_event.h +++ b/shell/browser/osr/osr_paint_event.h @@ -13,7 +13,7 @@ #include "services/viz/privileged/mojom/compositing/frame_sink_video_capture.mojom.h" #include "third_party/skia/include/core/SkCanvas.h" #include "ui/gfx/canvas.h" -#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/native_ui_types.h" #include <cstdint> diff --git a/shell/browser/osr/osr_render_widget_host_view.cc b/shell/browser/osr/osr_render_widget_host_view.cc index 48a1b1ed58cef..79b868c12a64e 100644 --- a/shell/browser/osr/osr_render_widget_host_view.cc +++ b/shell/browser/osr/osr_render_widget_host_view.cc @@ -45,7 +45,7 @@ #include "ui/gfx/geometry/dip_util.h" #include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/image/image_skia.h" -#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/native_ui_types.h" #include "ui/gfx/skbitmap_operations.h" #include "ui/latency/latency_info.h" diff --git a/shell/browser/ui/devtools_ui_bundle_data_source.cc b/shell/browser/ui/devtools_ui_bundle_data_source.cc index 2a73bfeb6e5f4..5733a7d8a161e 100644 --- a/shell/browser/ui/devtools_ui_bundle_data_source.cc +++ b/shell/browser/ui/devtools_ui_bundle_data_source.cc @@ -32,7 +32,7 @@ std::string PathWithoutParams(const std::string& path) { url::kStandardSchemeSeparator, chrome::kChromeUIDevToolsHost})) .Resolve(path) - .path() + .GetPath() .substr(1); } diff --git a/shell/browser/ui/drag_util.h b/shell/browser/ui/drag_util.h index 55fed34ca0d6c..fb4120c4476c3 100644 --- a/shell/browser/ui/drag_util.h +++ b/shell/browser/ui/drag_util.h @@ -9,7 +9,7 @@ #include <vector> #include "third_party/blink/public/mojom/page/draggable_region.mojom-forward.h" -#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/native_ui_types.h" class SkRegion; diff --git a/shell/browser/ui/inspectable_web_contents_view.h b/shell/browser/ui/inspectable_web_contents_view.h index 282d3bf805a97..30c2fef8e898e 100644 --- a/shell/browser/ui/inspectable_web_contents_view.h +++ b/shell/browser/ui/inspectable_web_contents_view.h @@ -10,7 +10,7 @@ #include "base/memory/raw_ptr.h" #include "chrome/browser/devtools/devtools_contents_resizing_strategy.h" -#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/native_ui_types.h" #include "ui/views/view.h" class DevToolsContentsResizingStrategy; diff --git a/shell/browser/ui/tray_icon_linux.h b/shell/browser/ui/tray_icon_linux.h index baff7a625a4da..d8cd0ef1e54e1 100644 --- a/shell/browser/ui/tray_icon_linux.h +++ b/shell/browser/ui/tray_icon_linux.h @@ -9,6 +9,7 @@ #include <string> #include "shell/browser/ui/tray_icon.h" +#include "ui/gfx/image/image_skia.h" #include "ui/linux/status_icon_linux.h" class StatusIconLinuxDbus; diff --git a/shell/browser/ui/views/client_frame_view_linux.cc b/shell/browser/ui/views/client_frame_view_linux.cc index 316752492b4fd..c03a1b51f74ee 100644 --- a/shell/browser/ui/views/client_frame_view_linux.cc +++ b/shell/browser/ui/views/client_frame_view_linux.cc @@ -495,7 +495,7 @@ gfx::Size ClientFrameViewLinux::SizeWithDecorations(gfx::Size size) const { views::View* ClientFrameViewLinux::TargetForRect(views::View* root, const gfx::Rect& rect) { - return views::NonClientFrameView::TargetForRect(root, rect); + return views::FrameView::TargetForRect(root, rect); } int ClientFrameViewLinux::GetTranslucentTopAreaHeight() const { diff --git a/shell/browser/ui/views/client_frame_view_linux.h b/shell/browser/ui/views/client_frame_view_linux.h index 0d8f4050b9500..54cbc9a1c35e7 100644 --- a/shell/browser/ui/views/client_frame_view_linux.h +++ b/shell/browser/ui/views/client_frame_view_linux.h @@ -64,7 +64,7 @@ class ClientFrameViewLinux : public FramelessView, // Overridden from FramelessView: int ResizingBorderHitTest(const gfx::Point& point) override; - // Overridden from views::NonClientFrameView: + // Overridden from views::FrameView: gfx::Rect GetBoundsForClientView() const override; gfx::Rect GetWindowBoundsForClientBounds( const gfx::Rect& client_bounds) const override; diff --git a/shell/browser/ui/views/electron_views_delegate.cc b/shell/browser/ui/views/electron_views_delegate.cc index eff63f089db7b..447951f42dbb2 100644 --- a/shell/browser/ui/views/electron_views_delegate.cc +++ b/shell/browser/ui/views/electron_views_delegate.cc @@ -60,8 +60,8 @@ gfx::ImageSkia* ViewsDelegate::GetDefaultWindowIcon() const { } #endif -std::unique_ptr<views::NonClientFrameView> -ViewsDelegate::CreateDefaultNonClientFrameView(views::Widget* widget) { +std::unique_ptr<views::FrameView> ViewsDelegate::CreateDefaultFrameView( + views::Widget* widget) { return nullptr; } diff --git a/shell/browser/ui/views/electron_views_delegate.h b/shell/browser/ui/views/electron_views_delegate.h index 62298e240de52..2b97b0906fffd 100644 --- a/shell/browser/ui/views/electron_views_delegate.h +++ b/shell/browser/ui/views/electron_views_delegate.h @@ -47,7 +47,7 @@ class ViewsDelegate : public views::ViewsDelegate { #elif BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) gfx::ImageSkia* GetDefaultWindowIcon() const override; #endif - std::unique_ptr<views::NonClientFrameView> CreateDefaultNonClientFrameView( + std::unique_ptr<views::FrameView> CreateDefaultFrameView( views::Widget* widget) override; void AddRef() override {} void ReleaseRef() override {} diff --git a/shell/browser/ui/views/frameless_view.cc b/shell/browser/ui/views/frameless_view.cc index dcfed5ef695f0..420a825f27577 100644 --- a/shell/browser/ui/views/frameless_view.cc +++ b/shell/browser/ui/views/frameless_view.cc @@ -96,7 +96,7 @@ views::View* FramelessView::TargetForRect(views::View* root, if (NonClientHitTest(rect.origin()) != HTCLIENT) return this; - return NonClientFrameView::TargetForRect(root, rect); + return FrameView::TargetForRect(root, rect); } gfx::Size FramelessView::CalculatePreferredSize( diff --git a/shell/browser/ui/views/frameless_view.h b/shell/browser/ui/views/frameless_view.h index bea0ba58482a8..e391cb9bd7c2f 100644 --- a/shell/browser/ui/views/frameless_view.h +++ b/shell/browser/ui/views/frameless_view.h @@ -17,8 +17,8 @@ namespace electron { class NativeWindowViews; -class FramelessView : public views::NonClientFrameView { - METADATA_HEADER(FramelessView, views::NonClientFrameView) +class FramelessView : public views::FrameView { + METADATA_HEADER(FramelessView, views::FrameView) public: FramelessView(); @@ -46,7 +46,7 @@ class FramelessView : public views::NonClientFrameView { int ResizingBorderHitTestImpl(const gfx::Point& point, const gfx::Insets& resize_border); - // views::NonClientFrameView: + // views::FrameView: gfx::Rect GetBoundsForClientView() const override; gfx::Rect GetWindowBoundsForClientBounds( const gfx::Rect& client_bounds) const override; diff --git a/shell/browser/ui/views/global_menu_bar_x11.h b/shell/browser/ui/views/global_menu_bar_x11.h index 0851822fc3f16..e086273dd6fe7 100644 --- a/shell/browser/ui/views/global_menu_bar_x11.h +++ b/shell/browser/ui/views/global_menu_bar_x11.h @@ -10,7 +10,7 @@ #include "base/memory/raw_ptr.h" #include "shell/browser/ui/electron_menu_model.h" #include "ui/base/glib/scoped_gsignal.h" -#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/native_ui_types.h" #include "ui/gfx/x/xproto.h" typedef struct _DbusmenuMenuitem DbusmenuMenuitem; diff --git a/shell/browser/ui/views/opaque_frame_view.cc b/shell/browser/ui/views/opaque_frame_view.cc index 43ce172504911..e80535a973d71 100644 --- a/shell/browser/ui/views/opaque_frame_view.cc +++ b/shell/browser/ui/views/opaque_frame_view.cc @@ -160,7 +160,7 @@ int OpaqueFrameView::NonClientHitTest(const gfx::Point& point) { } void OpaqueFrameView::ResetWindowControls() { - NonClientFrameView::ResetWindowControls(); + FrameView::ResetWindowControls(); if (restore_button_) restore_button_->SetState(views::Button::STATE_NORMAL); @@ -173,7 +173,7 @@ void OpaqueFrameView::ResetWindowControls() { views::View* OpaqueFrameView::TargetForRect(views::View* root, const gfx::Rect& rect) { - return views::NonClientFrameView::TargetForRect(root, rect); + return views::FrameView::TargetForRect(root, rect); } void OpaqueFrameView::Layout(PassKey) { diff --git a/shell/browser/ui/views/opaque_frame_view.h b/shell/browser/ui/views/opaque_frame_view.h index dae79d03f4931..94da7e876613f 100644 --- a/shell/browser/ui/views/opaque_frame_view.h +++ b/shell/browser/ui/views/opaque_frame_view.h @@ -40,7 +40,7 @@ class OpaqueFrameView : public FramelessView { int ResizingBorderHitTest(const gfx::Point& point) override; void InvalidateCaptionButtons() override; - // views::NonClientFrameView: + // views::FrameView: gfx::Rect GetBoundsForClientView() const override; gfx::Rect GetWindowBoundsForClientBounds( const gfx::Rect& client_bounds) const override; diff --git a/shell/browser/ui/views/win_frame_view.cc b/shell/browser/ui/views/win_frame_view.cc index 88a18703a00a9..1c158529db0c0 100644 --- a/shell/browser/ui/views/win_frame_view.cc +++ b/shell/browser/ui/views/win_frame_view.cc @@ -89,7 +89,7 @@ views::View* WinFrameView::TargetForRect(views::View* root, return this; } - return NonClientFrameView::TargetForRect(root, rect); + return FrameView::TargetForRect(root, rect); } int WinFrameView::NonClientHitTest(const gfx::Point& point) { @@ -170,7 +170,7 @@ void WinFrameView::Layout(PassKey) { if (window()->IsWindowControlsOverlayEnabled()) { LayoutWindowControlsOverlay(); } - LayoutSuperclass<NonClientFrameView>(this); + LayoutSuperclass<FrameView>(this); } int WinFrameView::FrameTopBorderThickness(bool restored) const { diff --git a/shell/browser/ui/views/win_frame_view.h b/shell/browser/ui/views/win_frame_view.h index 203b4055bddf9..679e24ba272b8 100644 --- a/shell/browser/ui/views/win_frame_view.h +++ b/shell/browser/ui/views/win_frame_view.h @@ -31,7 +31,7 @@ class WinFrameView : public FramelessView { SkColor GetReadableFeatureColor(SkColor background_color); - // views::NonClientFrameView: + // views::FrameView: gfx::Rect GetWindowBoundsForClientBounds( const gfx::Rect& client_bounds) const override; int NonClientHitTest(const gfx::Point& point) override; diff --git a/shell/browser/web_contents_zoom_controller.cc b/shell/browser/web_contents_zoom_controller.cc index b4c237d68f7ac..41bf6d4db7e0c 100644 --- a/shell/browser/web_contents_zoom_controller.cc +++ b/shell/browser/web_contents_zoom_controller.cc @@ -179,7 +179,7 @@ void WebContentsZoomController::SetZoomMode(ZoomMode new_mode) { if (!url.is_empty()) { const std::string host = net::GetHostOrSpecFromURL(url); - const std::string scheme = url.scheme(); + const std::string scheme = url.GetScheme(); if (zoom_map->HasZoomLevel(scheme, host)) { // If there are other tabs with the same origin, then set this tab's @@ -257,7 +257,7 @@ void WebContentsZoomController::ResetZoomModeOnNavigationIfNeeded( zoom_level_ = zoom_map->GetDefaultZoomLevel(); double old_zoom_level = zoom_map->GetZoomLevel(web_contents()); double new_zoom_level = zoom_map->GetZoomLevelForHostAndScheme( - url.scheme(), net::GetHostOrSpecFromURL(url)); + url.GetScheme(), net::GetHostOrSpecFromURL(url)); event_data_ = std::make_unique<ZoomChangedEventData>( web_contents(), old_zoom_level, new_zoom_level, false, ZOOM_MODE_DEFAULT); @@ -346,7 +346,7 @@ void WebContentsZoomController::SetZoomFactorOnNavigationIfNeeded( // then it takes precedence. // pref store < kZoomFactor < setZoomLevel std::string host = net::GetHostOrSpecFromURL(url); - std::string scheme = url.scheme(); + std::string scheme = url.GetScheme(); double zoom_factor = default_zoom_factor(); double zoom_level = blink::ZoomFactorToZoomLevel(zoom_factor); if (host_zoom_map_->HasZoomLevel(scheme, host)) { diff --git a/shell/common/asar/archive.cc b/shell/common/asar/archive.cc index 7951632806215..29c1a7e13704b 100644 --- a/shell/common/asar/archive.cc +++ b/shell/common/asar/archive.cc @@ -255,7 +255,8 @@ bool Archive::Init() { } #endif - std::optional<base::Value> value = base::JSONReader::Read(header); + std::optional<base::Value> value = + base::JSONReader::Read(header, base::JSON_PARSE_CHROMIUM_EXTENSIONS); if (!value || !value->is_dict()) { LOG(ERROR) << "Failed to parse header"; return false; diff --git a/shell/common/asar/archive_win.cc b/shell/common/asar/archive_win.cc index ae3e73797bf4f..2360493832f81 100644 --- a/shell/common/asar/archive_win.cc +++ b/shell/common/asar/archive_win.cc @@ -71,7 +71,8 @@ auto LoadIntegrityConfig() { // Parse integrity config payload std::optional<base::Value> root = - base::JSONReader::Read(std::string_view{res_data, res_size}); + base::JSONReader::Read(std::string_view{res_data, res_size}, + base::JSON_PARSE_CHROMIUM_EXTENSIONS); if (!root.has_value()) { LOG(FATAL) << "Invalid integrity config: NOT a valid JSON."; diff --git a/shell/common/gin_converters/base_converter.h b/shell/common/gin_converters/base_converter.h index 56c420d77d817..37aa2bd34ddfe 100644 --- a/shell/common/gin_converters/base_converter.h +++ b/shell/common/gin_converters/base_converter.h @@ -35,6 +35,8 @@ struct Converter<base::TerminationStatus> { case base::TERMINATION_STATUS_INTEGRITY_FAILURE: return gin::ConvertToV8(isolate, "integrity-failure"); #endif + case base::TERMINATION_STATUS_EVICTED_FOR_MEMORY: + return gin::ConvertToV8(isolate, "memory-eviction"); case base::TERMINATION_STATUS_MAX_ENUM: NOTREACHED(); } From 7620c38a0078237efe49cb4e3b51e18cb8458856 Mon Sep 17 00:00:00 2001 From: David Sanders <nilay2014@gmail.com> Date: Mon, 13 Oct 2025 10:46:34 -0700 Subject: [PATCH 132/268] build(deps): bump @electron/typescript-definitions to 9.1.5 (#48210) --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 4ef5e62a0d34b..243c71d48f5f0 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "@electron/fiddle-core": "^1.3.4", "@electron/github-app-auth": "^2.2.1", "@electron/lint-roller": "^3.1.2", - "@electron/typescript-definitions": "^9.1.2", + "@electron/typescript-definitions": "^9.1.5", "@octokit/rest": "^20.1.2", "@primer/octicons": "^10.0.0", "@types/minimist": "^1.2.5", diff --git a/yarn.lock b/yarn.lock index bd5c1017a43fe..55714825e5f1c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -272,10 +272,10 @@ vscode-uri "^3.0.8" yaml "^2.4.5" -"@electron/typescript-definitions@^9.1.2": - version "9.1.2" - resolved "https://registry.yarnpkg.com/@electron/typescript-definitions/-/typescript-definitions-9.1.2.tgz#a9b7bfaed60a528cf1f0ce4a30f01360a27839f2" - integrity sha512-BLxuLnvGqKUdesLXh9jB6Ll5Q4Vnb0NqJxuNY+GBz5Q8icxpW2EcHO7gIBpgX+t6sHdfRn9r6Wpwh/CKXoaJng== +"@electron/typescript-definitions@^9.1.5": + version "9.1.5" + resolved "https://registry.yarnpkg.com/@electron/typescript-definitions/-/typescript-definitions-9.1.5.tgz#7a7eee8b6aef532befcc2b7d4eaf14b770e54c03" + integrity sha512-BHLGCpy4SvOfoswRkHWTIlrhSN3z0aomSFWOFjNaEx1pvNPyC/l8Aed0LCpECDocV2PfYCv3BpYvXJGre+lRkw== dependencies: "@types/node" "^20.11.25" chalk "^5.3.0" From fa67c34e9b9a6aa42515998735f2f1242f62aa39 Mon Sep 17 00:00:00 2001 From: David Sanders <nilay2014@gmail.com> Date: Tue, 14 Oct 2025 00:57:47 -0700 Subject: [PATCH 133/268] ci: upload build cache hit rate on Windows as well (#48550) --- .github/actions/build-electron/action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/actions/build-electron/action.yml b/.github/actions/build-electron/action.yml index 51b1a1b069c9d..dddfe3a94fd64 100644 --- a/.github/actions/build-electron/action.yml +++ b/.github/actions/build-electron/action.yml @@ -66,7 +66,11 @@ runs: # Upload build stats to Datadog if ! [ -z $DD_API_KEY ]; then - npx node electron/script/build-stats.mjs out/Default/siso.INFO --upload-stats || true + if [ "$TARGET_PLATFORM" = "win" ]; then + npx node electron/script/build-stats.mjs out/Default/siso.exe.INFO --upload-stats || true + else + npx node electron/script/build-stats.mjs out/Default/siso.INFO --upload-stats || true + fi else echo "Skipping build-stats.mjs upload because DD_API_KEY is not set" fi From cb02315da6a44e92385bf3975359b101bc8493b3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Tue, 14 Oct 2025 11:29:55 +0200 Subject: [PATCH 134/268] build(deps): bump github/codeql-action from 3.30.6 to 4.30.8 (#48552) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.30.6 to 4.30.8. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/64d10c13136e1c5bce3e5fbde8d4906eeaafc885...f443b600d91635bebf5b0d9ebc620189c0d6fba5) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.30.8 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/scorecards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 278da3f8997ac..e129c5c356d71 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -50,6 +50,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.29.5 + uses: github/codeql-action/upload-sarif@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v3.29.5 with: sarif_file: results.sarif From e55e9e0b133ba9a7ca3884ba355a6cdc3fe5ab6c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Tue, 14 Oct 2025 14:45:03 +0200 Subject: [PATCH 135/268] build(deps): bump ossf/scorecard-action from 2.4.2 to 2.4.3 (#48551) Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.4.2 to 2.4.3. - [Release notes](https://github.com/ossf/scorecard-action/releases) - [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md) - [Commits](https://github.com/ossf/scorecard-action/compare/05b42c624433fc40578a4040d5cf5e36ddca8cde...4eaacf0543bb3f2c246792bd56e8cdeffafb205a) --- updated-dependencies: - dependency-name: ossf/scorecard-action dependency-version: 2.4.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/scorecards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index e129c5c356d71..1e006fb0846d6 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -28,7 +28,7 @@ jobs: # This is a pre-submit / pre-release. - name: "Run analysis" - uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2 + uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3 with: results_file: results.sarif results_format: sarif From a43c96a1f196aae157cc531c60ab2494465ca66d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8A=E9=A4=85=E3=81=AECreeeper?= <nilay2014@gmail.com> Date: Tue, 14 Oct 2025 22:46:12 +0900 Subject: [PATCH 136/268] fix: enable shader-f16 on windows (#48342) * fix: Enable shader-f16 on Windows * fix: include dxil.dll and dxcompiler.dll for windows x64 and arm64 * fix: modified to follow the chromium dawn build configuration * fix: include dxil.dll and dxcompiler.dll for windows x86 * fix: Modified to avoid explicitly specifying dawn_use_built_dxc --- build/args/all.gn | 4 ---- script/zip_manifests/dist_zip.win.arm64.manifest | 2 ++ script/zip_manifests/dist_zip.win.x64.manifest | 2 ++ 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/args/all.gn b/build/args/all.gn index b074e0ecb3c20..340e10b8962b5 100644 --- a/build/args/all.gn +++ b/build/args/all.gn @@ -24,10 +24,6 @@ enable_printing = true angle_enable_vulkan_validation_layers = false dawn_enable_vulkan_validation_layers = false -# Removes dxc dll's that are only used experimentally. -# See https://bugs.chromium.org/p/chromium/issues/detail?id=1474897 -dawn_use_built_dxc = false - # These are disabled because they cause the zip manifest to differ between # testing and release builds. # See https://chromium-review.googlesource.com/c/chromium/src/+/2774898. diff --git a/script/zip_manifests/dist_zip.win.arm64.manifest b/script/zip_manifests/dist_zip.win.arm64.manifest index 5d8deb41a53b8..fc2445e8885c9 100644 --- a/script/zip_manifests/dist_zip.win.arm64.manifest +++ b/script/zip_manifests/dist_zip.win.arm64.manifest @@ -8,6 +8,8 @@ ffmpeg.dll icudtl.dat libEGL.dll libGLESv2.dll +dxil.dll +dxcompiler.dll locales/af.pak locales/am.pak locales/ar.pak diff --git a/script/zip_manifests/dist_zip.win.x64.manifest b/script/zip_manifests/dist_zip.win.x64.manifest index 5d8deb41a53b8..fc2445e8885c9 100644 --- a/script/zip_manifests/dist_zip.win.x64.manifest +++ b/script/zip_manifests/dist_zip.win.x64.manifest @@ -8,6 +8,8 @@ ffmpeg.dll icudtl.dat libEGL.dll libGLESv2.dll +dxil.dll +dxcompiler.dll locales/af.pak locales/am.pak locales/ar.pak From 59dd254d12cfb9c620b7e64da48143e54686f3d2 Mon Sep 17 00:00:00 2001 From: CezaryKulakowski <nilay2014@gmail.com> Date: Tue, 14 Oct 2025 15:58:27 +0200 Subject: [PATCH 137/268] fix: fixed white flash on call to BrowserWindow.show (#47151) --- shell/browser/api/electron_api_base_window.h | 4 ++-- shell/browser/api/electron_api_browser_window.cc | 14 +++++++++++++- shell/browser/api/electron_api_browser_window.h | 2 ++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/shell/browser/api/electron_api_base_window.h b/shell/browser/api/electron_api_base_window.h index efb148e0cb69d..51d6ed0e58c35 100644 --- a/shell/browser/api/electron_api_base_window.h +++ b/shell/browser/api/electron_api_base_window.h @@ -106,8 +106,8 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>, virtual void Focus(); virtual void Blur(); bool IsFocused() const; - void Show(); - void ShowInactive(); + virtual void Show(); + virtual void ShowInactive(); void Hide(); bool IsVisible() const; bool IsEnabled() const; diff --git a/shell/browser/api/electron_api_browser_window.cc b/shell/browser/api/electron_api_browser_window.cc index 943530e697e41..ae94c5da90453 100644 --- a/shell/browser/api/electron_api_browser_window.cc +++ b/shell/browser/api/electron_api_browser_window.cc @@ -280,7 +280,6 @@ v8::Local<v8::Value> BrowserWindow::GetWebContents(v8::Isolate* isolate) { } void BrowserWindow::OnWindowShow() { - web_contents()->WasShown(); BaseWindow::OnWindowShow(); } @@ -289,6 +288,19 @@ void BrowserWindow::OnWindowHide() { BaseWindow::OnWindowHide(); } +void BrowserWindow::Show() { + web_contents()->WasShown(); + BaseWindow::Show(); +} + +void BrowserWindow::ShowInactive() { + // This method doesn't make sense for modal window. + if (IsModal()) + return; + web_contents()->WasShown(); + BaseWindow::ShowInactive(); +} + // static gin_helper::WrappableBase* BrowserWindow::New(gin_helper::ErrorThrower thrower, gin::Arguments* args) { diff --git a/shell/browser/api/electron_api_browser_window.h b/shell/browser/api/electron_api_browser_window.h index b13ffda8f8a18..02684f23b5c53 100644 --- a/shell/browser/api/electron_api_browser_window.h +++ b/shell/browser/api/electron_api_browser_window.h @@ -67,6 +67,8 @@ class BrowserWindow : public BaseWindow, void SetBackgroundMaterial(const std::string& material) override; void OnWindowShow() override; void OnWindowHide() override; + void Show() override; + void ShowInactive() override; // BrowserWindow APIs. void FocusOnWebView(); From 4b246883408faab5e433dc62c079aa60b319cb1c Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Tue, 14 Oct 2025 22:29:21 +0200 Subject: [PATCH 138/268] build: run on macOS 15 (#48563) --- .github/workflows/macos-publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/macos-publish.yml b/.github/workflows/macos-publish.yml index faf1aae291aa1..a932fb75629b9 100644 --- a/.github/workflows/macos-publish.yml +++ b/.github/workflows/macos-publish.yml @@ -47,7 +47,7 @@ jobs: needs: checkout-macos with: environment: production-release - build-runs-on: macos-14-xlarge + build-runs-on: macos-15-xlarge target-platform: macos target-arch: x64 target-variant: darwin @@ -62,7 +62,7 @@ jobs: needs: checkout-macos with: environment: production-release - build-runs-on: macos-14-xlarge + build-runs-on: macos-15-xlarge target-platform: macos target-arch: x64 target-variant: mas @@ -77,7 +77,7 @@ jobs: needs: checkout-macos with: environment: production-release - build-runs-on: macos-14-xlarge + build-runs-on: macos-15-xlarge target-platform: macos target-arch: arm64 target-variant: darwin @@ -92,7 +92,7 @@ jobs: needs: checkout-macos with: environment: production-release - build-runs-on: macos-14-xlarge + build-runs-on: macos-15-xlarge target-platform: macos target-arch: arm64 target-variant: mas From d7fd4e541c2ec193d5f89bc3bca0e809427be857 Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Wed, 15 Oct 2025 14:10:10 -0700 Subject: [PATCH 139/268] chore: bump chromium to 143.0.7469.0 (main) (#48548) * chore: bump chromium in DEPS to 143.0.7469.0 * 7021651: [//gpu] Fold handle creation into D3DImageBackingFactory Refs https://chromium-review.googlesource.com/c/chromium/src/+/7021651 * 7013047: Fix various C++23 build errors in //chrome Refs https://chromium-review.googlesource.com/c/chromium/src/+/7013047 * 7010850: [//ui] Port screen_mac.mm's calls to DisplayColorSpaces Refs https://chromium-review.googlesource.com/c/chromium/src/+/7010850 * 7007933: Remove superfluous mojom includes in //content/public headers Refs https://chromium-review.googlesource.com/c/chromium/src/+/7007933 * 7023196: Trim os_crypt/sync visibility list Refs https://chromium-review.googlesource.com/c/chromium/src/+/7023196 * 7008912: Remove GURL::*_piece() method Refs https://chromium-review.googlesource.com/c/chromium/src/+/7008912 * 7003989: Add wrapper struct for CopyFromSurface output Refs https://chromium-review.googlesource.com/c/chromium/src/+/7003989 * 7017889: [MemoryPressureListener] Remove type aliases Refs https://chromium-review.googlesource.com/c/chromium/src/+/7017889 * 7027780: Delete viz::ResourceSizes Refs https://chromium-review.googlesource.com/c/chromium/src/+/7027780 Refs https://chromium-review.googlesource.com/c/chromium/src/+/6989572 * 6495189: [api] Delete old String::Write* APIs Refs https://chromium-review.googlesource.com/c/v8/v8/+/6495189 * chore: update patches * chore: run script/gen-libc++-filenames.js --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> --- DEPS | 2 +- filenames.libcxx.gni | 2 + patches/boringssl/expose_ripemd160.patch | 2 +- .../add_didinstallconditionalfeatures.patch | 8 +- ...lectron_deps_to_license_credits_file.patch | 2 +- ...adjust_accessibility_ui_for_electron.patch | 2 +- ..._scheduler_throttling_per_renderview.patch | 10 +- ...o_depend_on_components_os_crypt_sync.patch | 4 +- patches/chromium/blink_local_frame.patch | 2 +- ..._depend_on_packed_resource_integrity.patch | 12 +- .../build_libc_as_static_library.patch | 2 +- ..._reclient_cfg_generator_after_chrome.patch | 4 +- patches/chromium/can_create_window.patch | 20 +- ...ctron_objects_to_wrappablepointertag.patch | 4 +- ...ameter_in_script_lifecycle_observers.patch | 8 +- ..._introduce_blocking_api_for_electron.patch | 4 +- .../chromium/chore_partial_revert_of.patch | 4 +- ...tition_attribute_dcheck_for_webviews.patch | 2 +- .../chore_patch_out_profile_methods.patch | 2 +- ...screationoverridden_with_full_params.patch | 14 +- ...me_deprecated_wrapper_utility_in_gin.patch | 2 +- .../disable_compositor_recycling.patch | 2 +- patches/chromium/disable_hidden.patch | 10 +- ...xpose_setuseragent_on_networkcontext.patch | 2 +- .../extend_apply_webpreferences.patch | 4 +- ...n_embedder_cleanup_callbacks_run_for.patch | 2 +- ...t_allow_code_cache_in_custom_schemes.patch | 10 +- ...sharingpicker_on_supported_platforms.patch | 10 +- ...e_launch_options_for_service_process.patch | 8 +- ...moothing_css_rule_and_blink_painting.patch | 24 +- ...screen_rendering_with_viz_compositor.patch | 25 +- ...g_exit_code_on_service_process_crash.patch | 4 +- ..._raw_response_headers_from_urlloader.patch | 6 +- ...allback_for_sync_and_async_clipboard.patch | 2 +- ...dless_mode_handling_in_native_widget.patch | 4 +- ..._background_throttling_in_compositor.patch | 12 +- ...ingshelper_behind_branding_buildflag.patch | 8 +- ...board_hides_on_input_blur_in_webview.patch | 12 +- ...original_resize_performance_on_macos.patch | 4 +- ...from_localframe_requestexecutescript.patch | 10 +- ...ated_generic_capturer_when_available.patch | 6 +- patches/chromium/frame_host_manager.patch | 4 +- .../gin_enable_disable_v8_platform.patch | 2 +- .../chromium/gritsettings_resource_ids.patch | 4 +- patches/chromium/isolate_holder.patch | 2 +- ..._avoid_private_macos_api_usage.patch.patch | 54 ++-- ...emote_certificate_verification_logic.patch | 2 +- .../chromium/notification_provenance.patch | 8 +- ...xture_remove_keyed_mutex_on_win_dxgi.patch | 12 +- ...r_changes_to_the_webcontentsobserver.patch | 14 +- ..._expose_file_system_access_blocklist.patch | 14 +- ...pose_hostimportmoduledynamically_and.patch | 2 +- ..._electron_permissiontypes_into_blink.patch | 2 +- ...efactor_unfilter_unresponsive_events.patch | 4 +- .../render_widget_host_view_mac.patch | 2 +- ...ean_up_stale_macwebcontentsocclusion.patch | 14 +- ...al_remove_unused_prehandlemouseevent.patch | 12 +- ...windowtreehostwin_window_enlargement.patch | 14 +- patches/chromium/scroll_bounce_flag.patch | 4 +- .../support_mixed_sandbox_with_zygote.patch | 2 +- patches/chromium/web_contents.patch | 6 +- patches/chromium/webview_fullscreen.patch | 10 +- ...i_to_allow_electron_to_set_dock_side.patch | 4 +- patches/nan/.patches | 1 + ...f_removed_writeutf8_with_writeutf8v2.patch | 72 +++++ patches/node/.patches | 9 + ...tev2_in_napi_get_value_string_latin1.patch | 60 ++++ ...itev2_in_napi_get_value_string_utf16.patch | 55 ++++ ...e_utf8_string_generation_performance.patch | 166 +++++++++++ ...grate_writeonebyte_to_writeonebytev2.patch | 276 ++++++++++++++++++ ..._writeucs2_and_remove_flags_argument.patch | 140 +++++++++ ...src_simplify_string_bytes_with_views.patch | 150 ++++++++++ ...e_non-deprecated_utf8lengthv2_method.patch | 87 ++++++ ...se_non-deprecated_writeutf8v2_method.patch | 138 +++++++++ ...c_use_string_writev2_in_twobytevalue.patch | 39 +++ ...pturer_initialization_and_management.patch | 12 +- .../browser/api/electron_api_web_contents.cc | 6 +- shell/browser/browser_linux.cc | 2 +- shell/browser/browser_win.cc | 2 +- .../electron_web_ui_controller_factory.cc | 4 +- shell/browser/extensions/api/tabs/tabs_api.cc | 2 +- .../net/proxying_url_loader_factory.cc | 2 +- shell/browser/osr/osr_host_display_client.cc | 9 +- .../osr/osr_render_widget_host_view.cc | 3 +- .../browser/osr/osr_render_widget_host_view.h | 3 +- shell/browser/ui/inspectable_web_contents.cc | 2 +- shell/common/api/electron_api_url_loader.cc | 2 +- shell/renderer/api/electron_api_web_frame.cc | 2 +- 88 files changed, 1454 insertions(+), 259 deletions(-) create mode 100644 patches/nan/fix_replace_usage_of_removed_writeutf8_with_writeutf8v2.patch create mode 100644 patches/node/node-api_use_writeonebytev2_in_napi_get_value_string_latin1.patch create mode 100644 patches/node/node-api_use_writev2_in_napi_get_value_string_utf16.patch create mode 100644 patches/node/src_improve_utf8_string_generation_performance.patch create mode 100644 patches/node/src_migrate_writeonebyte_to_writeonebytev2.patch create mode 100644 patches/node/src_refactor_writeucs2_and_remove_flags_argument.patch create mode 100644 patches/node/src_simplify_string_bytes_with_views.patch create mode 100644 patches/node/src_use_non-deprecated_utf8lengthv2_method.patch create mode 100644 patches/node/src_use_non-deprecated_writeutf8v2_method.patch create mode 100644 patches/node/src_use_string_writev2_in_twobytevalue.patch diff --git a/DEPS b/DEPS index 23bcac452c3f9..12b6ee3be3b40 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '143.0.7451.0', + '143.0.7469.0', 'node_version': 'v22.20.0', 'nan_version': diff --git a/filenames.libcxx.gni b/filenames.libcxx.gni index f7aa6a7bdb25c..026eb45ed200b 100644 --- a/filenames.libcxx.gni +++ b/filenames.libcxx.gni @@ -1426,6 +1426,7 @@ libcxx_headers = [ "//third_party/libc++/src/include/__type_traits/is_floating_point.h", "//third_party/libc++/src/include/__type_traits/is_function.h", "//third_party/libc++/src/include/__type_traits/is_fundamental.h", + "//third_party/libc++/src/include/__type_traits/is_generic_transparent_comparator.h", "//third_party/libc++/src/include/__type_traits/is_implicit_lifetime.h", "//third_party/libc++/src/include/__type_traits/is_implicitly_default_constructible.h", "//third_party/libc++/src/include/__type_traits/is_integral.h", @@ -1468,6 +1469,7 @@ libcxx_headers = [ "//third_party/libc++/src/include/__type_traits/make_32_64_or_128_bit.h", "//third_party/libc++/src/include/__type_traits/make_const_lvalue_ref.h", "//third_party/libc++/src/include/__type_traits/make_signed.h", + "//third_party/libc++/src/include/__type_traits/make_transparent.h", "//third_party/libc++/src/include/__type_traits/make_unsigned.h", "//third_party/libc++/src/include/__type_traits/maybe_const.h", "//third_party/libc++/src/include/__type_traits/nat.h", diff --git a/patches/boringssl/expose_ripemd160.patch b/patches/boringssl/expose_ripemd160.patch index 4f0feb3b25ebc..0e91bdcc7774a 100644 --- a/patches/boringssl/expose_ripemd160.patch +++ b/patches/boringssl/expose_ripemd160.patch @@ -22,7 +22,7 @@ index 345c94f6e26e88aac77b9feb92bd8d6665234981..8ef2ab8987da63f321d1dbb79f2eded8 // hash function when given a signature OID. To avoid unintended lax parsing // of hash OIDs, this is no longer supported for lookup by OID or NID. diff --git a/crypto/fipsmodule/digest/digests.cc.inc b/crypto/fipsmodule/digest/digests.cc.inc -index 99e3a66c0a47818ccb039f8ccc41ea50e529a16d..dc50fd05bed6cb40bffe1c0f6f3019d25d351ba2 100644 +index 3a3bfd3f0560fcd7b5fdbdf4cc29a56e0346b90a..a7335ca03b5b3b918c4321d890b45649679d772b 100644 --- a/crypto/fipsmodule/digest/digests.cc.inc +++ b/crypto/fipsmodule/digest/digests.cc.inc @@ -18,6 +18,7 @@ diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index 3aed5d022abc6..12c6072b92079 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -10,7 +10,7 @@ DidCreateScriptContext is called, not all JS APIs are available in the context, which can cause some preload scripts to trip. diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h -index 9728f3c38c27f93188d1aa9026552a5cebbdcb60..0cba9fb59a62f00fb726850ba9901c2887cc8431 100644 +index 5196f155cdc641b66c4faa77d8b00097145a1290..bbfac47a74f989482343c222b78f187b70297e4e 100644 --- a/content/public/renderer/render_frame_observer.h +++ b/content/public/renderer/render_frame_observer.h @@ -141,6 +141,8 @@ class CONTENT_EXPORT RenderFrameObserver { @@ -23,10 +23,10 @@ index 9728f3c38c27f93188d1aa9026552a5cebbdcb60..0cba9fb59a62f00fb726850ba9901c28 int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index dcfe69d2c719db9e9b1f612275ea2e95f5e632b0..230697a116c26b137c05e234824aded3ae5295af 100644 +index 2fca6bc42e218050ba325e07f771a3b7e2c6f322..ba670e2841e29f4fc0fd7732bcc89532e45ecb1c 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4701,6 +4701,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, +@@ -4732,6 +4732,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, observer.DidCreateScriptContext(context, world_id); } @@ -40,7 +40,7 @@ index dcfe69d2c719db9e9b1f612275ea2e95f5e632b0..230697a116c26b137c05e234824aded3 int world_id) { for (auto& observer : observers_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index a87e628da2e1f906352ad1559a26830ed361ecb8..611283f006f96af3c40cbf947505b02ad8ee3438 100644 +index 1b91ce91b859144680e23b2d3f9bdf514b8bb628..fd13b40fd61067a4b0374a12121a96294ea3cb7f 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h @@ -603,6 +603,8 @@ class CONTENT_EXPORT RenderFrameImpl diff --git a/patches/chromium/add_electron_deps_to_license_credits_file.patch b/patches/chromium/add_electron_deps_to_license_credits_file.patch index eaf00146856de..ac26567594ab7 100644 --- a/patches/chromium/add_electron_deps_to_license_credits_file.patch +++ b/patches/chromium/add_electron_deps_to_license_credits_file.patch @@ -7,7 +7,7 @@ Ensure that licenses for the dependencies introduced by Electron are included in `LICENSES.chromium.html` diff --git a/tools/licenses/licenses.py b/tools/licenses/licenses.py -index a8afd4c9a95ad62fa0c8adb6fd53c2783d6eee96..ef8ab7dd5368d79c4bcf1e22fb539029956d4c67 100755 +index f5bfe41e67b5f9a34db16377528e7fae58f642ab..58d0af6a561a9d309a5a49894786ea382149c034 100755 --- a/tools/licenses/licenses.py +++ b/tools/licenses/licenses.py @@ -342,6 +342,31 @@ SPECIAL_CASES = { diff --git a/patches/chromium/adjust_accessibility_ui_for_electron.patch b/patches/chromium/adjust_accessibility_ui_for_electron.patch index 9afc9650d83db..b1376e7588f2c 100644 --- a/patches/chromium/adjust_accessibility_ui_for_electron.patch +++ b/patches/chromium/adjust_accessibility_ui_for_electron.patch @@ -10,7 +10,7 @@ usage of BrowserList and Browser as we subclass related methods and use our WindowList. diff --git a/chrome/browser/ui/webui/accessibility/accessibility_ui.cc b/chrome/browser/ui/webui/accessibility/accessibility_ui.cc -index 8f425bd66fac7b36cee201c3e23c126dd14edf07..6216ad30ed15f11501e1d154258862f57941969e 100644 +index 049ae3881eff6426b37a1ba09cfd8a10a7e9a597..0cdb542da696e9fc85e9bf321182da2967073016 100644 --- a/chrome/browser/ui/webui/accessibility/accessibility_ui.cc +++ b/chrome/browser/ui/webui/accessibility/accessibility_ui.cc @@ -48,6 +48,7 @@ diff --git a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch index 1c0ecc52f7b9b..c64ee3ad15f73 100644 --- a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -51,7 +51,7 @@ index 7944fe64e0da112fc670358b75506bb199bb5e4a..0e3c16c6af2a078943e9f39808134ab2 void SendRendererPreferencesToRenderer( const blink::RendererPreferences& preferences); diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index e8a0554c4d84a16fc2122cb3e48199b4f43ecf88..34fca79b7c87b2fd098271fb5a4f83c015eeb2bc 100644 +index 9e7796a55f58b0bb04eb576f9d7ea3099ce08bdc..bbcf0a84cbb912279b6c698af0371cfee313c96c 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -578,8 +578,8 @@ void RenderWidgetHostViewAura::ShowImpl(PageVisibilityState page_visibility) { @@ -66,10 +66,10 @@ index e8a0554c4d84a16fc2122cb3e48199b4f43ecf88..34fca79b7c87b2fd098271fb5a4f83c0 void RenderWidgetHostViewAura::EnsurePlatformVisibility( diff --git a/content/public/browser/render_view_host.h b/content/public/browser/render_view_host.h -index a599bc306198de0e172134ce4623b32b8fcd72fa..4960c518d49f98b39873d166597bfb4b5619ee02 100644 +index 782bed0fdc08d57eceb059f398f253fab9233b1b..f1ab5b981ea68af1b11313e67f2c5060f0a640b1 100644 --- a/content/public/browser/render_view_host.h +++ b/content/public/browser/render_view_host.h -@@ -74,6 +74,9 @@ class CONTENT_EXPORT RenderViewHost { +@@ -73,6 +73,9 @@ class CONTENT_EXPORT RenderViewHost { virtual void WriteIntoTrace( perfetto::TracedProto<TraceProto> context) const = 0; @@ -116,10 +116,10 @@ index 9c0fe6ad62872f05cfb1179b4b979139008976d2..6aca43e61ef7f1caea74c30e5c3ce449 // Visibility ----------------------------------------------------------- diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index 58a676a50707a3c0a16dd47981dedc246c095728..a004db1a30b6138dbeda5da3f4301bca86ec6ad2 100644 +index f6d49b17d03a6e82965f5fe33ef1ae16051d7454..c610d4d9af1d8e5d2a12e2fc49fba145b17e086f 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -2513,6 +2513,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( +@@ -2514,6 +2514,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( TRACE_EVENT2("navigation", "WebViewImpl::SetPageLifecycleStateInternal", "old_state", old_state, "new_state", new_state); diff --git a/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch b/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch index 7b2b5e6060493..82e11dcadee4c 100644 --- a/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch +++ b/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch @@ -10,7 +10,7 @@ so we can remove this patch once we migrate our code to use os_crypt async. diff --git a/components/os_crypt/sync/BUILD.gn b/components/os_crypt/sync/BUILD.gn -index e9fffc2e3f0520a56ff5753a4a1abfc11c795b83..e22733af7b6a5c9269a41cfb5934ae6ce0777869 100644 +index 43d25c4826c00af26fad9b4ed3c3bf0fee091fd4..bc1c9d9fe49c54cb635b1ea75bd5bc23ba5e4df2 100644 --- a/components/os_crypt/sync/BUILD.gn +++ b/components/os_crypt/sync/BUILD.gn @@ -10,6 +10,7 @@ import("//components/os_crypt/sync/features.gni") @@ -19,5 +19,5 @@ index e9fffc2e3f0520a56ff5753a4a1abfc11c795b83..e22733af7b6a5c9269a41cfb5934ae6c visibility = [ + "//electron:*", "//chrome/browser", - "//chrome/browser/prefs:impl", "//chrome/browser/ui", + "//chrome/test:test_support", diff --git a/patches/chromium/blink_local_frame.patch b/patches/chromium/blink_local_frame.patch index 3082638137199..012a2fef0aec0 100644 --- a/patches/chromium/blink_local_frame.patch +++ b/patches/chromium/blink_local_frame.patch @@ -49,7 +49,7 @@ index cdb5b9246087b5678cf6a0f2713f6238dafc13de..7efbe7524c5ddd3785fff0e2d8901f93 // its owning reference back to our owning LocalFrame. client_->Detached(type); diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index dc1464afab92e4148d8c61f2098d5172e236651b..e96fca375fc3eb2504dd6f82e5be2c025d23089e 100644 +index 06053c55838982a72450375bbb62e6978f5acded..ac4623d35dc9d0765fef5aedfc635df14f95ced3 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc @@ -746,10 +746,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index b420ac279f8b7..a331ec48eac9e 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -33,10 +33,10 @@ index 9bffa9c8272a81059eb05fa79107bb326029402c..d286e9ab4edf86570418d4b3699c8f2d "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 94eae061ad314f536385f0f05ac345d502f60c7a..d65ac84e049de5da0b3b537defc4aaff52be65be 100644 +index e86a07e7f1722bb060e016f5644cd5f448ef5c4f..07abe8ca788af04d03ac729ac4b6ffe8216f07b2 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4800,7 +4800,7 @@ static_library("browser") { +@@ -4805,7 +4805,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index 94eae061ad314f536385f0f05ac345d502f60c7a..d65ac84e049de5da0b3b537defc4aaff # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 5dcaa1182c70ecf3f66d962da699005d0667c974..5542c65bd5bf2adba3c0f0a5a5019fea8077ac38 100644 +index 016f3d150a99ac222bb7e6b9b887ab655d461070..f23bcf4dee15bacf99077bcd6ab9286dbfe6c3c4 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7560,9 +7560,12 @@ test("unit_tests") { +@@ -7574,9 +7574,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index 5dcaa1182c70ecf3f66d962da699005d0667c974..5542c65bd5bf2adba3c0f0a5a5019fea "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8492,6 +8495,10 @@ test("unit_tests") { +@@ -8508,6 +8511,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index 5dcaa1182c70ecf3f66d962da699005d0667c974..5542c65bd5bf2adba3c0f0a5a5019fea sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8548,7 +8555,6 @@ test("unit_tests") { +@@ -8564,7 +8571,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/build_libc_as_static_library.patch b/patches/chromium/build_libc_as_static_library.patch index 3a76bbc171799..39d96eeb293d0 100644 --- a/patches/chromium/build_libc_as_static_library.patch +++ b/patches/chromium/build_libc_as_static_library.patch @@ -7,7 +7,7 @@ Build libc++ as static library to compile and pass nan tests diff --git a/buildtools/third_party/libc++/BUILD.gn b/buildtools/third_party/libc++/BUILD.gn -index c0c6cfb94338c6a75010e1b5de4cb6323b5afd12..903a5a0d9f7b7a7f9f4c44ef69e85eb922569365 100644 +index f1ac049db7df5637c94893009287b53c6127158f..ebf028bdb2934ca2f9f2ab7b7c3e6d3daa544d37 100644 --- a/buildtools/third_party/libc++/BUILD.gn +++ b/buildtools/third_party/libc++/BUILD.gn @@ -481,6 +481,7 @@ target(libcxx_target_type, "libc++") { diff --git a/patches/chromium/build_run_reclient_cfg_generator_after_chrome.patch b/patches/chromium/build_run_reclient_cfg_generator_after_chrome.patch index 58505e6a142e5..fe548a7a9ae1c 100644 --- a/patches/chromium/build_run_reclient_cfg_generator_after_chrome.patch +++ b/patches/chromium/build_run_reclient_cfg_generator_after_chrome.patch @@ -20,10 +20,10 @@ index 17103061c4752e6fcac07413dbf574e0c6fd6d39..848be71fa6dc81a64b7274b31d461f9d /win-cross/ reproxy.cfg diff --git a/buildtools/reclient_cfgs/configure_reclient_cfgs.py b/buildtools/reclient_cfgs/configure_reclient_cfgs.py -index 128bda296c91eac5f0c2fcfeed0c553deb5514dd..f1e33d36810dba80a42608655beb27c6e197a888 100755 +index 8779d4609c9eed155c414a1c97d3598906857b22..731ac034f85c8c5ebee6d29a0395f6e828b41ab0 100755 --- a/buildtools/reclient_cfgs/configure_reclient_cfgs.py +++ b/buildtools/reclient_cfgs/configure_reclient_cfgs.py -@@ -344,4 +344,13 @@ def main(): +@@ -334,4 +334,13 @@ def main(): if __name__ == "__main__": diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index afc2217f45a46..ee7af812020e9 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,10 +9,10 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index d694d115b452e1cf9fd803d2d32e797001fc8181..15e2f327060adeb32e977a8a371604819fe01108 100644 +index 25aab53f348352ac5712c9419a7b24d39d49ca63..ebe44040a554674058ee5307b7df32f224f09c17 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -9865,6 +9865,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -9854,6 +9854,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To<Referrer>(), params->frame_name, params->disposition, *params->features, @@ -21,10 +21,10 @@ index d694d115b452e1cf9fd803d2d32e797001fc8181..15e2f327060adeb32e977a8a37160481 &no_javascript_access); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index d7f46a132a23473615ac10184bffa00df6853758..655b289b783a8c35fb85fed715501b25a23acc85 100644 +index b484a953a22cf32e873ee27b2c1c342e99bbeea2..32d16bae9a25d06f410f51d3cc25c27ea83c6821 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5323,6 +5323,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5338,6 +5338,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( create_params.initially_hidden = renderer_started_hidden; create_params.initial_popup_url = params.target_url; @@ -35,7 +35,7 @@ index d7f46a132a23473615ac10184bffa00df6853758..655b289b783a8c35fb85fed715501b25 // Even though all codepaths leading here are in response to a renderer // trying to open a new window, if the new window ends up in a different // browsing instance, then the RenderViewHost, RenderWidgetHost, -@@ -5377,6 +5381,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5392,6 +5396,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( // Sets the newly created WebContents WindowOpenDisposition. new_contents_impl->original_window_open_disposition_ = params.disposition; @@ -48,7 +48,7 @@ index d7f46a132a23473615ac10184bffa00df6853758..655b289b783a8c35fb85fed715501b25 // If the new frame has a name, make sure any SiteInstances that can find // this named frame have proxies for it. Must be called after // SetSessionStorageNamespace, since this calls CreateRenderView, which uses -@@ -5418,12 +5428,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5433,12 +5443,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( AddWebContentsDestructionObserver(new_contents_impl); } @@ -170,10 +170,10 @@ index caf97e0c94edfa1106b465e793190c82f646ebdb..38b61d04446736bcc44a412f633c01ed // typically happens when popups are created. virtual void WebContentsCreated(WebContents* source_contents, diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 9d56818917c764d0c78861e3ce58e4507640bf97..dcfe69d2c719db9e9b1f612275ea2e95f5e632b0 100644 +index 4971952ae4ebe3518a4838752fa37ee3de54223e..2fca6bc42e218050ba325e07f771a3b7e2c6f322 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -6800,6 +6800,10 @@ WebView* RenderFrameImpl::CreateNewWindow( +@@ -6831,6 +6831,10 @@ WebView* RenderFrameImpl::CreateNewWindow( request.HasUserGesture(), GetWebFrame()->IsAdFrame(), GetWebFrame()->IsAdScriptInStack()); @@ -232,10 +232,10 @@ index 82e9d3dfb5f7da76d89fe15ae61d379fa46e177d..fd035512099a54dff6cc951a2226c23a } // namespace blink diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc -index 0dcd971d7176e45ae24112f015e69868fc2cd247..2f757adca556d6a038cba0c1f13265eaf1a41ec4 100644 +index a8f768190d649f528ba34a0203b80f8b9c0f4cee..997a22ed7a1f7870058b1da9c6eda2c319ff1e9d 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc -@@ -2363,6 +2363,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, +@@ -2353,6 +2353,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, WebWindowFeatures window_features = GetWindowFeaturesFromString(features, entered_window); diff --git a/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch b/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch index f1a97c8284234..6dfa065c191f9 100644 --- a/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch +++ b/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch @@ -8,10 +8,10 @@ electron objects that extend gin::Wrappable and gets allocated on the cpp heap diff --git a/gin/public/wrappable_pointer_tags.h b/gin/public/wrappable_pointer_tags.h -index a507d1d837ab3ec2b2d3ae7978d9d410ab2ec2d1..6918722e9a3bc0fc885c6ed87ed12dcc07d2cc72 100644 +index 82fc9e311ec84b19a15818a501b3a29329eff004..1199be7426139cdc77cee2e620eb8427092c74dd 100644 --- a/gin/public/wrappable_pointer_tags.h +++ b/gin/public/wrappable_pointer_tags.h -@@ -72,7 +72,13 @@ enum WrappablePointerTag : uint16_t { +@@ -74,7 +74,13 @@ enum WrappablePointerTag : uint16_t { kTextInputControllerBindings, // content::TextInputControllerBindings kWebAXObjectProxy, // content::WebAXObjectProxy kWrappedExceptionHandler, // extensions::WrappedExceptionHandler diff --git a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch index 2d8f9f31f54da..627ee10f12d03 100644 --- a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch +++ b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch @@ -20,7 +20,7 @@ index 79d59c3f4d3d2d5ff39bd65ded489183247656a8..20b49742578ccf363738ee032228f30a int64_t service_worker_version_id, const GURL& service_worker_scope, diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h -index 0cba9fb59a62f00fb726850ba9901c2887cc8431..855a1f3633c7b4dae539930e979d2dbb8a1b4e83 100644 +index bbfac47a74f989482343c222b78f187b70297e4e..3677ca3345fbc775d139684a12fe36241827a729 100644 --- a/content/public/renderer/render_frame_observer.h +++ b/content/public/renderer/render_frame_observer.h @@ -143,7 +143,8 @@ class CONTENT_EXPORT RenderFrameObserver { @@ -34,10 +34,10 @@ index 0cba9fb59a62f00fb726850ba9901c2887cc8431..855a1f3633c7b4dae539930e979d2dbb virtual void DidClearWindowObject() {} virtual void DidChangeScrollOffset() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 230697a116c26b137c05e234824aded3ae5295af..00f38d0e17449c6c05f2ff9609d3719215f59bfa 100644 +index ba670e2841e29f4fc0fd7732bcc89532e45ecb1c..128ffa612eda421f9d8c49c9324b3b52b782ba2c 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4707,10 +4707,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( +@@ -4738,10 +4738,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( observer.DidInstallConditionalFeatures(context, world_id); } @@ -52,7 +52,7 @@ index 230697a116c26b137c05e234824aded3ae5295af..00f38d0e17449c6c05f2ff9609d37192 void RenderFrameImpl::DidChangeScrollOffset() { diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index 611283f006f96af3c40cbf947505b02ad8ee3438..b7574fc57c43b6d85fb3b6e2c7e7e34f1bd79257 100644 +index fd13b40fd61067a4b0374a12121a96294ea3cb7f..e79c07abf2744c5461ce682a406954a2a23f03d0 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h @@ -605,7 +605,8 @@ class CONTENT_EXPORT RenderFrameImpl diff --git a/patches/chromium/chore_introduce_blocking_api_for_electron.patch b/patches/chromium/chore_introduce_blocking_api_for_electron.patch index 758369dec45b7..29ad9652dc014 100644 --- a/patches/chromium/chore_introduce_blocking_api_for_electron.patch +++ b/patches/chromium/chore_introduce_blocking_api_for_electron.patch @@ -7,7 +7,7 @@ This patch comes after Chromium removed the ScopedAllowIO API in favor of explicitly adding ScopedAllowBlocking calls as friends. diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h -index 71850795591e1a479620f1348c6adc705db9e839..8821ee4429727630e6600d7f85f0999d3f4b2270 100644 +index f10a4040b9460baf1b962f53b3dd54d01f49cdc7..ab2858e7a0fd7fcbc0c03b1a8c086ec4ce90c515 100644 --- a/base/threading/thread_restrictions.h +++ b/base/threading/thread_restrictions.h @@ -133,6 +133,7 @@ class KeyStorageLinux; @@ -36,7 +36,7 @@ index 71850795591e1a479620f1348c6adc705db9e839..8821ee4429727630e6600d7f85f0999d friend class ::ProfileImpl; friend class ::ScopedAllowBlockingForProfile; friend class ::StartupTabProviderImpl; -@@ -615,6 +620,7 @@ class BASE_EXPORT ScopedAllowBlocking { +@@ -616,6 +621,7 @@ class BASE_EXPORT ScopedAllowBlocking { friend class cronet::CronetPrefsManager; friend class crypto::ScopedAllowBlockingForNSS; // http://crbug.com/59847 friend class drive::FakeDriveService; diff --git a/patches/chromium/chore_partial_revert_of.patch b/patches/chromium/chore_partial_revert_of.patch index b63588068605a..95ba0f58154f9 100644 --- a/patches/chromium/chore_partial_revert_of.patch +++ b/patches/chromium/chore_partial_revert_of.patch @@ -14,10 +14,10 @@ track down the source of this problem & figure out if we can fix it by changing something in Electron. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 366399484c0ff72362fd246dc36182e611954283..a257bc1480369f24b05db19bd2bfce064b96407d 100644 +index a180b19360dd35f38a2927d01a3fd3ecd0c7dd4e..3489db5f1acfbd4d6fa6d3650e3e73498c728791 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5294,7 +5294,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5309,7 +5309,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( : IsGuest(); // While some guest types do not have a guest SiteInstance, the ones that // don't all override WebContents creation above. diff --git a/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch b/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch index 51ad19374307d..1938a00f54184 100644 --- a/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch +++ b/patches/chromium/chore_patch_out_partition_attribute_dcheck_for_webviews.patch @@ -14,7 +14,7 @@ This change patches it out to prevent the DCHECK. It can be removed once/if we see a better solution to the problem. diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc -index 484e275ec026af5be17fea9b9dcc540a9aa67535..2eb1296d1e845341352e21445916857878a9d409 100644 +index ff8cd27f46f49ff3b445becf7cb0c628af147899..8702ca4da61aa296c957a9c50b26e921c5e5b19f 100644 --- a/content/browser/site_instance_impl.cc +++ b/content/browser/site_instance_impl.cc @@ -227,7 +227,7 @@ scoped_refptr<SiteInstanceImpl> SiteInstanceImpl::CreateForGuest( diff --git a/patches/chromium/chore_patch_out_profile_methods.patch b/patches/chromium/chore_patch_out_profile_methods.patch index 94fccb3a56c84..8437d0128557e 100644 --- a/patches/chromium/chore_patch_out_profile_methods.patch +++ b/patches/chromium/chore_patch_out_profile_methods.patch @@ -27,7 +27,7 @@ index bd19708922b3d9224cc3a05f515c455ce4fb1e69..7198d9f9b22c8725c7ecdf6931ff3685 // When the enterprise policy is not set, use finch/feature flag choice. return base::FeatureList::IsEnabled( diff --git a/chrome/browser/pdf/pdf_extension_util.cc b/chrome/browser/pdf/pdf_extension_util.cc -index 8d881dc81d30babc5eed5bf512ad6b23858bab30..5ce3bea323d14d3d4a7b09ea08a477ae23439b53 100644 +index 328abdd79d287225d0e6ec6becc455e169d6e5d0..10e5e702a43dbb70e13d00b48000e0b4cc974e7a 100644 --- a/chrome/browser/pdf/pdf_extension_util.cc +++ b/chrome/browser/pdf/pdf_extension_util.cc @@ -248,10 +248,13 @@ bool IsPrintingEnabled(content::BrowserContext* context) { diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index afcd9e578a1b9..d41a14bbcf08e 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -80,10 +80,10 @@ index 39fa45f0a0f9076bd7ac0be6f455dd540a276512..3d0381d463eed73470b28085830f2a23 content::WebContents* source, const content::OpenURLParams& params, diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index 757db07950a0b179a105cb6201d21bed8b8fe3b8..6d45f2dcaff894836a0e8584ecb622275e02ae62 100644 +index dec03a1df14aa997dd1c6044fe0167e444a8c5f3..08889021e8ae25d48d542362a86faacc28005933 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc -@@ -2417,7 +2417,8 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2413,7 +2413,8 @@ bool Browser::IsWebContentsCreationOverridden( content::mojom::WindowContainerType window_container_type, const GURL& opener_url, const std::string& frame_name, @@ -93,7 +93,7 @@ index 757db07950a0b179a105cb6201d21bed8b8fe3b8..6d45f2dcaff894836a0e8584ecb62227 if (HasActorTask(profile(), opener)) { // If an ExecutionEngine is acting on the opener, prevent it from creating a // new WebContents. We'll instead force the navigation to happen in the same -@@ -2430,7 +2431,7 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2426,7 +2427,7 @@ bool Browser::IsWebContentsCreationOverridden( return (window_container_type == content::mojom::WindowContainerType::BACKGROUND && ShouldCreateBackgroundContents(source_site_instance, opener_url, @@ -222,10 +222,10 @@ index b969f1d97b7e3396119b579cfbe61e19ff7d2dd4..b8d6169652da28266a514938b45b39c5 content::WebContents* AddNewContents( content::WebContents* source, diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index e7a985973e1fd6ff51649d4e3fe802cc306c8f39..dfcb0be8195aab4df36c319c0996ec8a1a4f555e 100644 +index b568a66369e246322698630e495826f0c1109221..2adea6e88f5e09f3416e665039e83c367dca58af 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5257,8 +5257,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5272,8 +5272,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( if (delegate_ && delegate_->IsWebContentsCreationOverridden( opener, source_site_instance, params.window_container_type, @@ -384,10 +384,10 @@ index 756d4192271d6a65cfe8e1511737c565b543cb1f..5688f6f745056565c3c01947f741c4d1 int opener_render_process_id, int opener_render_frame_id, diff --git a/headless/lib/browser/headless_web_contents_impl.cc b/headless/lib/browser/headless_web_contents_impl.cc -index 00d3e4de6945e76761576eb95a66e4777f7f2f70..312559105d5de88d81edc917522aecb6a3890104 100644 +index 617d6cbd13ad3ce5eb9626bb54162e4afdfd24bd..85281656a467262076c081eb974e35590c573dab 100644 --- a/headless/lib/browser/headless_web_contents_impl.cc +++ b/headless/lib/browser/headless_web_contents_impl.cc -@@ -207,8 +207,7 @@ class HeadlessWebContentsImpl::Delegate : public content::WebContentsDelegate { +@@ -208,8 +208,7 @@ class HeadlessWebContentsImpl::Delegate : public content::WebContentsDelegate { content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, diff --git a/patches/chromium/chore_restore_some_deprecated_wrapper_utility_in_gin.patch b/patches/chromium/chore_restore_some_deprecated_wrapper_utility_in_gin.patch index 7aefe3cc744b1..770ef720c0037 100644 --- a/patches/chromium/chore_restore_some_deprecated_wrapper_utility_in_gin.patch +++ b/patches/chromium/chore_restore_some_deprecated_wrapper_utility_in_gin.patch @@ -21,7 +21,7 @@ index c80020b2bda2af39b38295dad3c6208cb8294b88..873015289db9709c00c32080e5387d9c private: diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc -index 083d59f78c542f4900e1b210a0935276516b894b..e32658e386853e2142c325a60ec385635256b758 100644 +index 1943413560f23c212d98fa1b368204c6e062bab2..bf0053833c782c9bc0187bb093a7ffd81ca9d754 100644 --- a/gin/isolate_holder.cc +++ b/gin/isolate_holder.cc @@ -225,6 +225,7 @@ void IsolateHolder::WillCreateMicrotasksRunner() { diff --git a/patches/chromium/disable_compositor_recycling.patch b/patches/chromium/disable_compositor_recycling.patch index 3c513e1c02a99..ff5f119a39d5f 100644 --- a/patches/chromium/disable_compositor_recycling.patch +++ b/patches/chromium/disable_compositor_recycling.patch @@ -6,7 +6,7 @@ Subject: fix: disabling compositor recycling Compositor recycling is useful for Chrome because there can be many tabs and spinning up a compositor for each one would be costly. In practice, Chrome uses the parent compositor code path of browser_compositor_view_mac.mm; the NSView of each tab is detached when it's hidden and attached when it's shown. For Electron, there is no parent compositor, so we're forced into the "own compositor" code path, which seems to be non-optimal and pretty ruthless in terms of the release of resources. Electron has no real concept of multiple tabs per window, so it should be okay to disable this ruthless recycling altogether in Electron. diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index 1fde0953bdc8bf3cd777206d7d340188ebf946fb..d9f6657a80b73ad7b7f3d8e4ced52dc474c417c9 100644 +index 9524be857c44a6523cf101d3cd24e69b30291c50..629216122514a1db80b452a6552b96ddb743eb32 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -558,7 +558,11 @@ diff --git a/patches/chromium/disable_hidden.patch b/patches/chromium/disable_hidden.patch index b2c92531ab391..ad3aeda57ea98 100644 --- a/patches/chromium/disable_hidden.patch +++ b/patches/chromium/disable_hidden.patch @@ -6,10 +6,10 @@ Subject: disable_hidden.patch Electron uses this to disable background throttling for hidden windows. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 3a0e028e3650e67337fde8fbad726d5333e8230e..1156ea5df2a390604b822b82cf42940029fea1f7 100644 +index 39121bd94e74440954d337fa8cb4ce3d6e14756b..755fa9cf571873072d67d97226e7d847c618afcf 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -840,6 +840,10 @@ void RenderWidgetHostImpl::WasHidden() { +@@ -841,6 +841,10 @@ void RenderWidgetHostImpl::WasHidden() { return; } @@ -21,10 +21,10 @@ index 3a0e028e3650e67337fde8fbad726d5333e8230e..1156ea5df2a390604b822b82cf429400 // Prompts should remain open and functional across tab switches. if (!delegate_ || !delegate_->IsWaitingForPointerLockPrompt(this)) { diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h -index 636f09a8ac86e7c3f7b8dcdc285792f18f5c5989..276852573eade86f1bc9690e3c78a6279e9ff5af 100644 +index d1c15f323f2c36dc12dbb8ac2a8f19c0f3365429..507231f8134f7b1bba031baafe6db584f9a47d5d 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h -@@ -1031,6 +1031,8 @@ class CONTENT_EXPORT RenderWidgetHostImpl +@@ -1035,6 +1035,8 @@ class CONTENT_EXPORT RenderWidgetHostImpl return synthetic_gesture_controller_.get(); } @@ -34,7 +34,7 @@ index 636f09a8ac86e7c3f7b8dcdc285792f18f5c5989..276852573eade86f1bc9690e3c78a627 // |routing_id| must not be IPC::mojom::kRoutingIdNone. // If this object outlives |delegate|, DetachDelegate() must be called when diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index b8f74e321a8bd8bd65e89cf9d794651c9f6f8705..e8a0554c4d84a16fc2122cb3e48199b4f43ecf88 100644 +index 39bbcb9f74d9d4fb4c2e81569b100f81837355b9..9e7796a55f58b0bb04eb576f9d7ea3099ce08bdc 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -642,7 +642,7 @@ void RenderWidgetHostViewAura::HideImpl() { diff --git a/patches/chromium/expose_setuseragent_on_networkcontext.patch b/patches/chromium/expose_setuseragent_on_networkcontext.patch index 74037b456a4d8..221d744b29d7b 100644 --- a/patches/chromium/expose_setuseragent_on_networkcontext.patch +++ b/patches/chromium/expose_setuseragent_on_networkcontext.patch @@ -33,7 +33,7 @@ index 0ab8187b0db8ae6db46d81738f653a2bc4c566f6..de3d55e85c22317f7f9375eb94d0d5d4 } // namespace net diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index 68ad4334b47b075ea6ed80f2f29e496089695f8d..2e8310cf11fe772b084036a493988de5d9605f95 100644 +index f1a7f4ab3d77415c22417bac0bb7dd9a5fa91342..71185e4b6ed4125c3343810bc9c41d887fcd4643 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc @@ -1910,6 +1910,13 @@ void NetworkContext::EnableDurableMessageCollector( diff --git a/patches/chromium/extend_apply_webpreferences.patch b/patches/chromium/extend_apply_webpreferences.patch index 9d605649742fc..4aeb01cfc10c8 100644 --- a/patches/chromium/extend_apply_webpreferences.patch +++ b/patches/chromium/extend_apply_webpreferences.patch @@ -15,10 +15,10 @@ Ideally we could add an embedder observer pattern here but that can be done in future work. diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index a004db1a30b6138dbeda5da3f4301bca86ec6ad2..42db2e15163e3410471bd22c03d9c05e73ff748e 100644 +index c610d4d9af1d8e5d2a12e2fc49fba145b17e086f..2e3ac83d16cd08372a4bdf48a5801a5bed1da220 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -1909,6 +1909,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, +@@ -1908,6 +1908,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, #if BUILDFLAG(IS_MAC) web_view_impl->SetMaximumLegibleScale( prefs.default_maximum_page_scale_factor); diff --git a/patches/chromium/feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch b/patches/chromium/feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch index 997a362bcd37b..6e9871f05d9a2 100644 --- a/patches/chromium/feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch +++ b/patches/chromium/feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch @@ -16,7 +16,7 @@ remove this patch once gin::Wrappable can be managed by V8 Oilpan via https://github.com/electron/electron/issues/47922 diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc -index 656267caef2d515f8c3f77535b308108a0b30be1..083d59f78c542f4900e1b210a0935276516b894b 100644 +index 05c899258143a958471f361b87324f7500d594c9..1943413560f23c212d98fa1b368204c6e062bab2 100644 --- a/gin/isolate_holder.cc +++ b/gin/isolate_holder.cc @@ -35,6 +35,8 @@ v8::ArrayBuffer::Allocator* g_array_buffer_allocator = nullptr; diff --git a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch index 6cc9fc5723777..fba11c008ee61 100644 --- a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch +++ b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch @@ -253,7 +253,7 @@ index fb3fdfca483ff5041ee98095af3f6ac2640adbaf..ada19d78ec1337b0c49a1597c877886f + } // namespace content diff --git a/content/browser/renderer_host/code_cache_host_impl.cc b/content/browser/renderer_host/code_cache_host_impl.cc -index 5becc15b30b7e2c3fab289db50ad9774cb5fb17e..7de9e745f249137ecc3224b3b1f6ee70d90b96b6 100644 +index 4a28c9618120b0b85b01687b3a231539fe1d9c34..91123e98ecb9aadf91d355947da8aa4dba7150fa 100644 --- a/content/browser/renderer_host/code_cache_host_impl.cc +++ b/content/browser/renderer_host/code_cache_host_impl.cc @@ -8,6 +8,7 @@ @@ -363,7 +363,7 @@ index 5becc15b30b7e2c3fab289db50ad9774cb5fb17e..7de9e745f249137ecc3224b3b1f6ee70 } if (operation == CodeCacheHostImpl::Operation::kWrite) { -@@ -590,6 +613,7 @@ std::optional<GURL> CodeCacheHostImpl::GetSecondaryKeyForCodeCache( +@@ -612,6 +635,7 @@ std::optional<GURL> CodeCacheHostImpl::GetSecondaryKeyForCodeCache( process_lock.MatchesScheme(url::kHttpsScheme) || process_lock.MatchesScheme(content::kChromeUIScheme) || process_lock.MatchesScheme(content::kChromeUIUntrustedScheme) || @@ -405,7 +405,7 @@ index 52f16979b05b692ef72762d0cbc16bcb361b047e..b658ebeb9c572158b27d94af56331be8 std::vector<std::string> extension_schemes; // Registers a URL scheme with a predefined default custom handler. diff --git a/url/url_util.cc b/url/url_util.cc -index ad9d781f55cc20a2c80a743daaa1563e828cd7e1..bbb6674efdf39d43248620d6e66876d1750d7abe 100644 +index e47605cd20719aef6f076419bbbc7a656e6dc590..0bf502c6ad8564ed66bb014e260a93230e62d992 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -136,6 +136,9 @@ struct SchemeRegistry { @@ -418,7 +418,7 @@ index ad9d781f55cc20a2c80a743daaa1563e828cd7e1..bbb6674efdf39d43248620d6e66876d1 // Schemes with a predefined default custom handler. std::vector<SchemeWithHandler> predefined_handler_schemes; -@@ -706,6 +709,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() { +@@ -688,6 +691,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() { return GetSchemeRegistry().empty_document_schemes; } @@ -435,7 +435,7 @@ index ad9d781f55cc20a2c80a743daaa1563e828cd7e1..bbb6674efdf39d43248620d6e66876d1 DoAddSchemeWithHandler( new_scheme, handler, diff --git a/url/url_util.h b/url/url_util.h -index 8ca0eec8cd9b2e9501daa511acee4fc64d8898af..f888d25801ded67fa600ab2fd268029b26186f35 100644 +index 035d8390c345c3d9b77fb8d2a30a98934c3a40e7..9681ed030bd53b435d27ae3c330abca2207040a7 100644 --- a/url/url_util.h +++ b/url/url_util.h @@ -115,6 +115,15 @@ COMPONENT_EXPORT(URL) const std::vector<std::string>& GetCSPBypassingSchemes(); diff --git a/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch b/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch index 4920a766f9df3..d2ff23afa20aa 100644 --- a/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch +++ b/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch @@ -311,10 +311,10 @@ index c2d8bbafa39c05f25641f2fd3491ef7f84f4f6a1..5506583824e10d664f32c71d63fda1aa // Although ScreenCaptureKit is available in 12.3 there were some bugs that diff --git a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc -index c07b61c6736798b3b8efd79a27fb6546dde24cc2..889c0876394bc973f86cc6f5f2d3ce3902103b41 100644 +index 2b58244d3d8ca03d900a8c4450ded607861b45f6..1c5b2650c7a1193fd9af74b3826e363a43b676ad 100644 --- a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc +++ b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc -@@ -310,8 +310,16 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( +@@ -316,8 +316,16 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( break; } @@ -332,7 +332,7 @@ index c07b61c6736798b3b8efd79a27fb6546dde24cc2..889c0876394bc973f86cc6f5f2d3ce39 // For the other capturers, when a bug reports the type of capture it's // easy enough to determine which capturer was used, but it's a little // fuzzier with window capture. -@@ -327,13 +335,15 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( +@@ -333,13 +341,15 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( } #endif // defined(USE_AURA) || BUILDFLAG(IS_MAC) @@ -350,10 +350,10 @@ index c07b61c6736798b3b8efd79a27fb6546dde24cc2..889c0876394bc973f86cc6f5f2d3ce39 kMaxNumberOfBuffers, std::move(receiver), std::move(receiver_on_io_thread)), diff --git a/content/public/browser/desktop_media_id.h b/content/public/browser/desktop_media_id.h -index b90a88a115247bd0c62abb18771220e37a441d2f..f908a95727633e903bd56d2bc8608bba167de4e7 100644 +index b10c5376caa9a832826868c72dbc44ee54705283..e9b27b53d9b34fbb0a3410eb2fcc15306497cdf4 100644 --- a/content/public/browser/desktop_media_id.h +++ b/content/public/browser/desktop_media_id.h -@@ -27,6 +27,8 @@ struct CONTENT_EXPORT DesktopMediaID { +@@ -28,6 +28,8 @@ struct CONTENT_EXPORT DesktopMediaID { static constexpr Id kNullId = 0; // Represents a fake id to create a dummy capturer for autotests. static constexpr Id kFakeId = -3; diff --git a/patches/chromium/feat_configure_launch_options_for_service_process.patch b/patches/chromium/feat_configure_launch_options_for_service_process.patch index 49183aea6e4b3..d9f7c6c98437a 100644 --- a/patches/chromium/feat_configure_launch_options_for_service_process.patch +++ b/patches/chromium/feat_configure_launch_options_for_service_process.patch @@ -187,10 +187,10 @@ index d9c14f91747bde0e76056d7f2f2ada166e67f994..53be16879777a3b9bef58ead5f7e420c UtilityProcessHost::Start(std::move(utility_options), diff --git a/content/browser/service_host/utility_process_host.cc b/content/browser/service_host/utility_process_host.cc -index b4d84672b85e7c070eafacc602acae5590337854..0d7c270217a7906a7f3c4c6e0afdc1386613578c 100644 +index ad963436db4e854f8caf388a2d11f2f45bd66094..1cb1195980915098ca5c44a013158e9d91a45774 100644 --- a/content/browser/service_host/utility_process_host.cc +++ b/content/browser/service_host/utility_process_host.cc -@@ -245,13 +245,13 @@ UtilityProcessHost::Options& UtilityProcessHost::Options::WithFileToPreload( +@@ -241,13 +241,13 @@ UtilityProcessHost::Options& UtilityProcessHost::Options::WithFileToPreload( } #endif // BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) @@ -207,7 +207,7 @@ index b4d84672b85e7c070eafacc602acae5590337854..0d7c270217a7906a7f3c4c6e0afdc138 #if BUILDFLAG(USE_ZYGOTE) UtilityProcessHost::Options& UtilityProcessHost::Options::WithZygoteForTesting( -@@ -261,6 +261,36 @@ UtilityProcessHost::Options& UtilityProcessHost::Options::WithZygoteForTesting( +@@ -257,6 +257,36 @@ UtilityProcessHost::Options& UtilityProcessHost::Options::WithZygoteForTesting( } #endif // BUILDFLAG(USE_ZYGOTE) @@ -244,7 +244,7 @@ index b4d84672b85e7c070eafacc602acae5590337854..0d7c270217a7906a7f3c4c6e0afdc138 UtilityProcessHost::Options& UtilityProcessHost::Options::WithBoundReceiverOnChildProcessForTesting( mojo::GenericPendingReceiver receiver) { -@@ -525,9 +555,26 @@ bool UtilityProcessHost::StartProcess() { +@@ -521,9 +551,26 @@ bool UtilityProcessHost::StartProcess() { } #endif // BUILDFLAG(ENABLE_GPU_CHANNEL_MEDIA_CAPTURE) && !BUILDFLAG(IS_WIN) diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index 09f3940996a90..f787c488ac37d 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -45,10 +45,10 @@ index e189d584f05f2ce6354c03a9b19f56985df8a15e..41b430e8f2416be098494f5c49fb97ca 'internal-forced-visited-'): internal_visited_order = 0 diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 -index e1e6a90d3035e1aaedafbf129d2154e84777bd3f..d9fc85153bd0bd980ae2383acda99d79f00b3e2a 100644 +index b8d8077e22d63fc08b8d7caf44ff0c181ce09c3b..a9098abaa3f92a86e723e6d20465ee5029ae0277 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5 -@@ -9032,6 +9032,26 @@ +@@ -9029,6 +9029,26 @@ property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], }, @@ -76,7 +76,7 @@ index e1e6a90d3035e1aaedafbf129d2154e84777bd3f..d9fc85153bd0bd980ae2383acda99d79 { name: "-internal-visited-color", diff --git a/third_party/blink/renderer/core/css/css_property_equality.cc b/third_party/blink/renderer/core/css/css_property_equality.cc -index 362c4d558ad0c1af4f905bee759096c7afdf5e6b..7b764dc1988f8992d2b88e9d4d68d8b13c595f8b 100644 +index 53fae0d3349df9a6baf19feeefd932e9ffaee3eb..a76f16fb33bd831cb946354a5d4d9da54d088f5c 100644 --- a/third_party/blink/renderer/core/css/css_property_equality.cc +++ b/third_party/blink/renderer/core/css/css_property_equality.cc @@ -354,6 +354,8 @@ bool CSSPropertyEquality::PropertiesEqual(const PropertyHandle& property, @@ -89,10 +89,10 @@ index 362c4d558ad0c1af4f905bee759096c7afdf5e6b..7b764dc1988f8992d2b88e9d4d68d8b1 return a.EmptyCells() == b.EmptyCells(); case CSSPropertyID::kFill: diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -index 77350eb608ab3af30f9eac3bb0f16ba57b79d049..bea246503fc77eb3c9f2a5dbc67094ccda0f36c0 100644 +index fc786d43c4c5d1e2ab0f6c0990e607b31ca254d7..88e0db3246cf96d6a682874de272a68a41aec32e 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -@@ -12447,5 +12447,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( +@@ -12467,5 +12467,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( CSSValueID::kNone>(stream); } @@ -130,10 +130,10 @@ index 77350eb608ab3af30f9eac3bb0f16ba57b79d049..bea246503fc77eb3c9f2a5dbc67094cc } // namespace css_longhand } // namespace blink diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc -index aaf3b23f63e6bd5d5c8259feeff9f6202ea07f17..64772649927c94949cae132e502ef882c92d8f14 100644 +index 18195a2597f4bfc598d2d545b91688611f48ce11..8f107b529818fc654465fbe41804e2656c0f568a 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc -@@ -4080,6 +4080,15 @@ PositionTryFallback StyleBuilderConverter::ConvertSinglePositionTryFallback( +@@ -4116,6 +4116,15 @@ PositionTryFallback StyleBuilderConverter::ConvertSinglePositionTryFallback( return PositionTryFallback(scoped_name, tactic_list); } @@ -201,10 +201,10 @@ index 0802c73aa4aaf4e1fb5efd367758f19c36691f71..5f06c0af277a7c937e694470beac707a return result; } diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn -index 009aede9ab946ac2a0b661611e9e6832c3b50c00..be3af08956d6b4c60547e6a6722342b4591b555d 100644 +index b055f218f600948204764f5fe9f5978c9f9fa4f4..2398af8635402706b11afda36b4510667661b74c 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn -@@ -1676,6 +1676,8 @@ component("platform") { +@@ -1672,6 +1672,8 @@ component("platform") { "widget/widget_base.h", "widget/widget_base_client.h", "windows_keyboard_codes.h", @@ -267,7 +267,7 @@ index 59031b23d3c50aa87db48a5c5a66c5ab04a8103a..1f83cf0dff83d748bf1caafd3685202c // A Corner is a axis-aligned quad, with the points ordered (start, outer, diff --git a/third_party/blink/renderer/platform/geometry/path_builder.cc b/third_party/blink/renderer/platform/geometry/path_builder.cc -index 7e3d46902fbf736b4240eb3fcb89975a7b222197..57fdc89fc265ad70cb0bff8443cc10268d154ed9 100644 +index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560fedc3667 100644 --- a/third_party/blink/renderer/platform/geometry/path_builder.cc +++ b/third_party/blink/renderer/platform/geometry/path_builder.cc @@ -4,6 +4,7 @@ @@ -278,7 +278,7 @@ index 7e3d46902fbf736b4240eb3fcb89975a7b222197..57fdc89fc265ad70cb0bff8443cc1026 #include "third_party/blink/renderer/platform/geometry/contoured_rect.h" #include "third_party/blink/renderer/platform/geometry/infinite_int_rect.h" #include "third_party/blink/renderer/platform/geometry/path.h" -@@ -244,6 +245,32 @@ PathBuilder& PathBuilder::AddContouredRect( +@@ -250,6 +251,32 @@ PathBuilder& PathBuilder::AddContouredRect( AddRoundedRect(target_rect); return *this; } @@ -312,7 +312,7 @@ index 7e3d46902fbf736b4240eb3fcb89975a7b222197..57fdc89fc265ad70cb0bff8443cc1026 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index 2551bd7880118119921379f932cd6af5feee9a05..940a7f9eb953f8c0868ef1fdd8e3261befdbc511 100644 +index 21ff121087a23deeeaf69593b69462c3a297b458..c1b444add778b390a267445bac2c2b6926dbd026 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch index 706e117f54607..9775effa86895 100644 --- a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch +++ b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch @@ -238,10 +238,10 @@ index 67d5ff67d74c107a867b39b306c6528425b87e05..5fd12a25c9e319e8e675955926271c9d diff --git a/components/viz/service/display_embedder/software_output_device_proxy.cc b/components/viz/service/display_embedder/software_output_device_proxy.cc new file mode 100644 -index 0000000000000000000000000000000000000000..ef5cb8ae4c398e5834496c8b24eb98c41b10a7b3 +index 0000000000000000000000000000000000000000..02872ac8658a58ea7a508a7063ee1e7e5d69ab0a --- /dev/null +++ b/components/viz/service/display_embedder/software_output_device_proxy.cc -@@ -0,0 +1,162 @@ +@@ -0,0 +1,161 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. @@ -252,7 +252,7 @@ index 0000000000000000000000000000000000000000..ef5cb8ae4c398e5834496c8b24eb98c4 +#include "base/threading/thread_checker.h" +#include "base/trace_event/trace_event.h" +#include "build/build_config.h" -+#include "components/viz/common/resources/resource_sizes.h" ++#include "components/viz/common/resources/shared_image_format_utils.h" +#include "mojo/public/cpp/system/platform_handle.h" +#include "services/viz/privileged/mojom/compositing/layered_window_updater.mojom.h" +#include "skia/ext/platform_canvas.h" @@ -337,18 +337,17 @@ index 0000000000000000000000000000000000000000..ef5cb8ae4c398e5834496c8b24eb98c4 +void SoftwareOutputDeviceProxy::ResizeDelegated() { + canvas_.reset(); + -+ size_t required_bytes; -+ if (!ResourceSizes::MaybeSizeInBytes(viewport_pixel_size_, -+ SinglePlaneFormat::kRGBA_8888, -+ &required_bytes)) { ++ auto required_bytes = SharedMemorySizeForSharedImageFormat( ++ SinglePlaneFormat::kRGBA_8888, viewport_pixel_size_); ++ if (!required_bytes) { + DLOG(ERROR) << "Invalid viewport size " << viewport_pixel_size_.ToString(); + return; + } + + base::UnsafeSharedMemoryRegion region = -+ base::UnsafeSharedMemoryRegion::Create(required_bytes); ++ base::UnsafeSharedMemoryRegion::Create(required_bytes.value()); + if (!region.IsValid()) { -+ DLOG(ERROR) << "Failed to allocate " << required_bytes << " bytes"; ++ DLOG(ERROR) << "Failed to allocate " << required_bytes.value() << " bytes"; + return; + } + @@ -359,7 +358,7 @@ index 0000000000000000000000000000000000000000..ef5cb8ae4c398e5834496c8b24eb98c4 +#else + shm_mapping_ = region.Map(); + if (!shm_mapping_.IsValid()) { -+ DLOG(ERROR) << "Failed to map " << required_bytes << " bytes"; ++ DLOG(ERROR) << "Failed to map " << required_bytes.value() << " bytes"; + return; + } + @@ -620,7 +619,7 @@ index 2f462f0deb5fc8a637457243fb5d5849fc214d14..695869b83cefaa24af93a2e11b39de05 + Draw(gfx.mojom.Rect damage_rect) => (); }; diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h -index 986569ff285a2a5be21e715dacf6072de92ebe79..2544d15677ac20c83118d5552c94eed103ac1eaa 100644 +index 010a30bcd09ca39215f0b31ec59425067a2392a4..7f428fe96da978aa951354eb41f9ebec46cc6e9c 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h @@ -87,6 +87,7 @@ class DisplayPrivate; @@ -647,7 +646,7 @@ index 986569ff285a2a5be21e715dacf6072de92ebe79..2544d15677ac20c83118d5552c94eed1 // Compositor object to take care of GPU painting. // A Browser compositor object is responsible for generating the final -@@ -195,6 +205,9 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, +@@ -189,6 +199,9 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, // Schedules a redraw of the layer tree associated with this compositor. void ScheduleDraw(); @@ -657,7 +656,7 @@ index 986569ff285a2a5be21e715dacf6072de92ebe79..2544d15677ac20c83118d5552c94eed1 // Sets the root of the layer tree drawn by this Compositor. The root layer // must have no parent. The compositor's root layer is reset if the root layer // is destroyed. NULL can be passed to reset the root layer, in which case the -@@ -635,6 +648,8 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, +@@ -630,6 +643,8 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, simple_begin_frame_observers_; std::unique_ptr<ui::HostBeginFrameObserver> host_begin_frame_observer_; diff --git a/patches/chromium/feat_enable_passing_exit_code_on_service_process_crash.patch b/patches/chromium/feat_enable_passing_exit_code_on_service_process_crash.patch index d487bb8c01af8..1f24721ab2a09 100644 --- a/patches/chromium/feat_enable_passing_exit_code_on_service_process_crash.patch +++ b/patches/chromium/feat_enable_passing_exit_code_on_service_process_crash.patch @@ -84,10 +84,10 @@ index 2648adb1cf38ab557b66ffd0e3034b26b04d76d6..98eab587f343f6ca472efc3d4e7b31b2 private: const std::string service_interface_name_; diff --git a/content/browser/service_host/utility_process_host.cc b/content/browser/service_host/utility_process_host.cc -index 0d7c270217a7906a7f3c4c6e0afdc1386613578c..61ceacb989f049f7134a3c2279042bf4344d992e 100644 +index 1cb1195980915098ca5c44a013158e9d91a45774..f09946a3c74e974d2234695841c56107a9ee9246 100644 --- a/content/browser/service_host/utility_process_host.cc +++ b/content/browser/service_host/utility_process_host.cc -@@ -629,7 +629,7 @@ void UtilityProcessHost::OnProcessCrashed(int exit_code) { +@@ -625,7 +625,7 @@ void UtilityProcessHost::OnProcessCrashed(int exit_code) { : Client::CrashType::kPreIpcInitialization; } #endif // BUILDFLAG(IS_WIN) diff --git a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch index ceee9cbe37b95..152516e9387d0 100644 --- a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch +++ b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch @@ -76,7 +76,7 @@ index 3a028b9a2ff0cac114bca857f3a87c4ed331e0a1..e53ed3ceef61961bce7b9ce45098f83c network::ResourceRequest::TrustedParams::EnabledClientHints>& enabled_client_hints( diff --git a/services/network/public/mojom/url_request.mojom b/services/network/public/mojom/url_request.mojom -index 950d6e0fa3e5304b2d28db0e284f9697d0c9f45c..048900b092875f3dd01b8a3cd813f5a44d1355e1 100644 +index df9bd2130004821582903699aac1b38403c785a6..8b10c16a10119f2628300b3c52cca0fe5a6bd6e4 100644 --- a/services/network/public/mojom/url_request.mojom +++ b/services/network/public/mojom/url_request.mojom @@ -111,6 +111,9 @@ struct TrustedUrlRequestParams { @@ -112,7 +112,7 @@ index 96fe8a372fa6a166db928c61b2c983b86a74b1a3..2a10810d50d083ab0a7340757d544a40 string mime_type; diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc -index 7834c23474416f7af4db75d24fc613c3913eee77..3d32e5d540deea75a453f603a2902c44a1b82287 100644 +index 622190e414ef1b4f3910ab09c99e7e27e15e5693..57f1532901e4ba4d1e71c38e232a693b3af9da44 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc @@ -406,6 +406,9 @@ URLLoader::URLLoader( @@ -155,7 +155,7 @@ index 7834c23474416f7af4db75d24fc613c3913eee77..3d32e5d540deea75a453f603a2902c44 ad_auction_event_record_request_helper_.HandleResponse( diff --git a/services/network/url_loader.h b/services/network/url_loader.h -index 21dc5e84807eb89a4e331e5cca5b38f08c41f72d..9f55ff05f239df939833d98d45d455e864f4f2c3 100644 +index 09c035a73fea5a328193c67a7906d3e8b455d619..1c1e59764fa6a701f61765060428f811029b3d6e 100644 --- a/services/network/url_loader.h +++ b/services/network/url_loader.h @@ -622,6 +622,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader diff --git a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch index 06e2b467d8f31..f1ba3a29c7a1b 100644 --- a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch +++ b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch @@ -32,7 +32,7 @@ index e243b7202505075658e04adc1eeacc01c7d7d72d..7078014e6db7c43d66b1448b2b36500f break; } diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc -index f6c3e8d9139ca22e885979d7fa72edbccac182e1..0a72093709ae8f56cc7b8d1649efe23050423054 100644 +index e4a4d129e8b7ea11d3825ab55a6a71706d94d34f..a43a28e60d87a446adc187121abbbeeecb50bac7 100644 --- a/content/browser/permissions/permission_controller_impl.cc +++ b/content/browser/permissions/permission_controller_impl.cc @@ -94,6 +94,7 @@ PermissionToSchedulingFeature(PermissionType permission_name) { diff --git a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch index e08c741021c57..c6ff5dcf44dc9 100644 --- a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch +++ b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch @@ -57,7 +57,7 @@ index e523151fb670af28cf2c54548c5009825fdbed92..66d5724f848b328a19362a3c0f634670 gfx::Rect window_bounds_before_fullscreen_; diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -index 7459d4c241e914248261c62b63652fd7139dd54e..97b1f34a655c87bf888ea16e7ab6897132afdaae 100644 +index e1a1cdb2ec192d2ee5a555ecccf041f757336f79..68a210eaf34d6d410a14478ad5bf0c78faa30388 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm @@ -465,6 +465,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, @@ -90,7 +90,7 @@ index 7459d4c241e914248261c62b63652fd7139dd54e..97b1f34a655c87bf888ea16e7ab68971 // Register the CGWindowID (used to identify this window for video capture) diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc -index 7e1bfe1f3754562a77615ab7ba83c23f719050b7..8a84abb915d3d0123f996eb027b357c953233a9c 100644 +index 55a5d241058f192091e34164880c0888504b30bd..c047e938a39fa2466fc95312ba7bc581a68b48e2 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -222,6 +222,18 @@ ui::ZOrderLevel Widget::InitParams::EffectiveZOrderLevel() const { diff --git a/patches/chromium/fix_disabling_background_throttling_in_compositor.patch b/patches/chromium/fix_disabling_background_throttling_in_compositor.patch index 75dbbf623d7db..a953a7849edf9 100644 --- a/patches/chromium/fix_disabling_background_throttling_in_compositor.patch +++ b/patches/chromium/fix_disabling_background_throttling_in_compositor.patch @@ -12,7 +12,7 @@ invisible state of the `viz::DisplayScheduler` owned by the `ui::Compositor`. diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc -index a0e6ea08b4918c057d69f15acad717f71d49747d..39e54cff7e13bddda0f37a4b87cbae2adc7d6170 100644 +index c0a2f822e38712eaad30c5d1104b149fa28d985d..b967896479c7fd0f71c7b9e5407d63e1d62bfadd 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc @@ -358,7 +358,8 @@ void Compositor::SetLayerTreeFrameSink( @@ -25,7 +25,7 @@ index a0e6ea08b4918c057d69f15acad717f71d49747d..39e54cff7e13bddda0f37a4b87cbae2a display_private_->SetDisplayColorSpaces(display_color_spaces_); display_private_->SetDisplayColorMatrix( gfx::SkM44ToTransform(display_color_matrix_)); -@@ -615,7 +616,9 @@ void Compositor::SetVisible(bool visible) { +@@ -609,7 +610,9 @@ void Compositor::SetVisible(bool visible) { // updated then. We need to call this even if the visibility hasn't changed, // for the same reason. if (display_private_) @@ -36,7 +36,7 @@ index a0e6ea08b4918c057d69f15acad717f71d49747d..39e54cff7e13bddda0f37a4b87cbae2a if (changed) { observer_list_.Notify(&CompositorObserver::OnCompositorVisibilityChanged, -@@ -1075,6 +1078,15 @@ void Compositor::MaybeUpdateObserveBeginFrame() { +@@ -1073,6 +1076,15 @@ void Compositor::MaybeUpdateObserveBeginFrame() { host_begin_frame_observer_->GetBoundRemote()); } @@ -53,10 +53,10 @@ index a0e6ea08b4918c057d69f15acad717f71d49747d..39e54cff7e13bddda0f37a4b87cbae2a void Compositor::SetSeamlessRefreshRates( const std::vector<float>& seamless_refresh_rates) { diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h -index 2544d15677ac20c83118d5552c94eed103ac1eaa..6a556d339b89f4ff6fc94f4f659219ea5b5a6a63 100644 +index 7f428fe96da978aa951354eb41f9ebec46cc6e9c..7e5a008d7b158c1af9a47f549426818bc22212f5 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h -@@ -519,6 +519,10 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, +@@ -514,6 +514,10 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, const cc::LayerTreeSettings& GetLayerTreeSettings() const; @@ -67,7 +67,7 @@ index 2544d15677ac20c83118d5552c94eed103ac1eaa..6a556d339b89f4ff6fc94f4f659219ea size_t saved_events_metrics_count_for_testing() const { return host_->saved_events_metrics_count_for_testing(); } -@@ -729,6 +733,12 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, +@@ -724,6 +728,12 @@ class COMPOSITOR_EXPORT Compositor : public base::PowerSuspendObserver, // See go/report-ux-metrics-at-painting for details. bool animation_started_ = false; diff --git a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch index 318ecef93a8d2..5b95c8ca1edb1 100644 --- a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch +++ b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch @@ -9,7 +9,7 @@ to support content settings UI. The support pulls in chrome content settings and UI code which are not valid in the scope of Electron. diff --git a/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc b/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc -index 28b9c9789b4f477c1007e2c55efa90d01f8c21a7..57506f2fa6d31abdc4c50abd0dbf1749c2b4087e 100644 +index de8cfaabed0e4ed3db9b55729f7ea22014f63dd2..45df203c236ed0f36f079ad0dcbe98e9fc177b08 100644 --- a/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc +++ b/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc @@ -6,6 +6,7 @@ @@ -18,9 +18,9 @@ index 28b9c9789b4f477c1007e2c55efa90d01f8c21a7..57506f2fa6d31abdc4c50abd0dbf1749 #include "base/numerics/safe_conversions.h" +#include "build/branding_buildflags.h" #include "chrome/browser/picture_in_picture/picture_in_picture_bounds_cache.h" - #include "chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker.h" #include "chrome/browser/ui/browser_navigator_params.h" -@@ -32,8 +33,10 @@ + #include "content/public/browser/document_picture_in_picture_window_controller.h" +@@ -31,8 +32,10 @@ #include "base/task/sequenced_task_runner.h" // TODO(crbug.com/421608904): include auto_picture_in_picture_tab_helper for // Android when supporting document PiP. @@ -28,9 +28,9 @@ index 28b9c9789b4f477c1007e2c55efa90d01f8c21a7..57506f2fa6d31abdc4c50abd0dbf1749 #include "chrome/browser/picture_in_picture/auto_picture_in_picture_tab_helper.h" #include "chrome/browser/picture_in_picture/auto_pip_setting_overlay_view.h" +#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) + #include "chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker.h" #include "chrome/browser/picture_in_picture/picture_in_picture_window.h" #include "media/base/media_switches.h" - #include "net/base/url_util.h" @@ -68,6 +71,7 @@ constexpr double kMaxWindowSizeRatio = 0.8; // `kMaxWindowSizeRatio`. constexpr double kMaxSiteRequestedWindowSizeRatio = 0.25; diff --git a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch index 221a9d79c3fd9..459b7abdeb715 100644 --- a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch +++ b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch @@ -9,10 +9,10 @@ focus node change via TextInputManager. chromium-bug: https://crbug.com/1369605 diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index 34fca79b7c87b2fd098271fb5a4f83c015eeb2bc..12363555481b504ea69f822319aadadee5b03a2f 100644 +index bbcf0a84cbb912279b6c698af0371cfee313c96c..bdc7541ccb7cd1ffe0b1a53360e32dc98c22e6fd 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -3245,6 +3245,12 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( +@@ -3246,6 +3246,12 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( } } @@ -26,10 +26,10 @@ index 34fca79b7c87b2fd098271fb5a4f83c015eeb2bc..12363555481b504ea69f822319aadade RenderWidgetHostViewAura* popup_child_host_view) { popup_child_host_view_ = popup_child_host_view; diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h -index 7328d8cc05de07a66685ce4ca41a57385b7acc6b..6c757ec57d2bffa638b49c9c1d9c0825ccc0d909 100644 +index 051faabada8b61788090d47482d4c1c20eaedef7..e9d496173fed9969a5e40d59bbbd4b20128ff1b3 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h -@@ -652,6 +652,8 @@ class CONTENT_EXPORT RenderWidgetHostViewAura +@@ -657,6 +657,8 @@ class CONTENT_EXPORT RenderWidgetHostViewAura RenderWidgetHostViewBase* updated_view) override; void OnTextSelectionChanged(TextInputManager* text_input_mangager, RenderWidgetHostViewBase* updated_view) override; @@ -87,10 +87,10 @@ index 75df43e3cd2721a92c90c18154d53d5c203e2465..ce42c75c8face36d21f53f44c0201ac4 // The view with active text input state, i.e., a focused <input> element. // It will be nullptr if no such view exists. Note that the active view diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 5bca1c0fbaa4dc3c6294fa206463ca3190a0367d..366399484c0ff72362fd246dc36182e611954283 100644 +index 47bbe40f74ded6be7d5ae4e1c96331bef3070291..a180b19360dd35f38a2927d01a3fd3ecd0c7dd4e 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10119,7 +10119,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( +@@ -10134,7 +10134,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( "WebContentsImpl::OnFocusedElementChangedInFrame", "render_frame_host", frame); RenderWidgetHostViewBase* root_view = diff --git a/patches/chromium/fix_restore_original_resize_performance_on_macos.patch b/patches/chromium/fix_restore_original_resize_performance_on_macos.patch index ea478524da7f5..b4775a62173cc 100644 --- a/patches/chromium/fix_restore_original_resize_performance_on_macos.patch +++ b/patches/chromium/fix_restore_original_resize_performance_on_macos.patch @@ -11,10 +11,10 @@ This patch should be upstreamed as a conditional revert of the logic in desktop vs mobile runtimes. i.e. restore the old logic only on desktop platforms diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index e07b2d171bbc33e271c5cef7e49e3451a8cdff84..0e2b978b3f35e5805d380da398bba58fcd256310 100644 +index d7de0324994cf69009eb5be92110351e98ba47fb..12df047f66b9e3184b7421aa5fbe4e91e340e395 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -2153,9 +2153,8 @@ RenderWidgetHostImpl::GetWidgetInputHandler() { +@@ -2154,9 +2154,8 @@ RenderWidgetHostImpl::GetWidgetInputHandler() { void RenderWidgetHostImpl::NotifyScreenInfoChanged() { // The resize message (which may not happen immediately) will carry with it // the screen info as well as the new size (if the screen has changed scale diff --git a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch index 31ead3ae50956..1b0e9de9c283c 100644 --- a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch +++ b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch @@ -59,7 +59,7 @@ index cba373664bec3a32abad6fe0396bd67b53b7e67f..a54f1b3351efd2d8f324436f7f35cd43 #endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_SCRIPT_EXECUTION_CALLBACK_H_ diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index e96fca375fc3eb2504dd6f82e5be2c025d23089e..62615df61435da20f7c93adf71a98c91ae151d5d 100644 +index ac4623d35dc9d0765fef5aedfc635df14f95ced3..2db446cddef9dc0505e9c9a7a75cba5d43018959 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc @@ -3185,6 +3185,7 @@ void LocalFrame::RequestExecuteScript( @@ -80,10 +80,10 @@ index e96fca375fc3eb2504dd6f82e5be2c025d23089e..62615df61435da20f7c93adf71a98c91 void LocalFrame::SetEvictCachedSessionStorageOnFreezeOrUnload() { diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h -index 71eb863235ef37ef3a9671a825ef25c1b444bae4..e8870377d3c822a341fb9bec98c7cd67c184f20d 100644 +index 6ea33fee79cf65d4badcd28c088d23ad985cdaec..b0784aea80b095d371e7477139ec79ae89b41ec3 100644 --- a/third_party/blink/renderer/core/frame/local_frame.h +++ b/third_party/blink/renderer/core/frame/local_frame.h -@@ -826,6 +826,7 @@ class CORE_EXPORT LocalFrame final +@@ -828,6 +828,7 @@ class CORE_EXPORT LocalFrame final mojom::blink::EvaluationTiming, mojom::blink::LoadEventBlockingOption, WebScriptExecutionCallback, @@ -215,10 +215,10 @@ index 389ba18d5c709156f0c8da2e578825ba59ce6190..1dcfee3a5f43a4be6a57511b194aa685 mojom::blink::WantResultOption::kWantResult, wait_for_promise); } diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -index 6f5745a56ad0a64649c726355808095e96567915..0cc0203f0bf1016c29ca508a7fc23f21f5c85234 100644 +index 57d2bc0f0247b116859bc16bab54ae5e18c4bb23..2dfb326accfbc2e3540a160c2c1f7f2a21807783 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -@@ -1123,14 +1123,15 @@ void WebLocalFrameImpl::RequestExecuteScript( +@@ -1125,14 +1125,15 @@ void WebLocalFrameImpl::RequestExecuteScript( mojom::blink::EvaluationTiming evaluation_timing, mojom::blink::LoadEventBlockingOption blocking_option, WebScriptExecutionCallback callback, diff --git a/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch b/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch index 0d7032c2f3ec2..ff76857574dc7 100644 --- a/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch +++ b/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch @@ -15,10 +15,10 @@ capturer was window or screen-specific, as the IDs remain valid for generic capturer as well. diff --git a/content/browser/media/capture/desktop_capture_device.cc b/content/browser/media/capture/desktop_capture_device.cc -index d69a82b80bf621b1546f376cd7bc6588327f70a9..d3fc15ddcd7bdaf46016a3d7ad46da19b0fd6644 100644 +index e880eb61f6cbbb6b3cb9e0262981457e77360e5b..e69e25b301deb94216397badadc333aaf10af3b5 100644 --- a/content/browser/media/capture/desktop_capture_device.cc +++ b/content/browser/media/capture/desktop_capture_device.cc -@@ -964,9 +964,16 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( +@@ -976,9 +976,16 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( switch (source.type) { case DesktopMediaID::TYPE_SCREEN: { @@ -38,7 +38,7 @@ index d69a82b80bf621b1546f376cd7bc6588327f70a9..d3fc15ddcd7bdaf46016a3d7ad46da19 if (screen_capturer && screen_capturer->SelectSource(source.id)) { capturer = std::make_unique<webrtc::DesktopAndCursorComposer>( std::move(screen_capturer), options); -@@ -979,8 +986,15 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( +@@ -995,8 +1002,15 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( } case DesktopMediaID::TYPE_WINDOW: { diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index 521127296c139..c746710e406df 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -6,10 +6,10 @@ Subject: frame_host_manager.patch Allows embedder to intercept site instances created by chromium. diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc -index 8b25708f074cbf0e0aa9c750bf54af58aadf4358..93ae522c5cb5dd3e03097d8631562d25dc0063ef 100644 +index b930c5e23c9d10b9be4126cf2eeb057ab04c519f..945f17e13f47462acc3895a3340cd1080d3043e9 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc -@@ -4792,6 +4792,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -4797,6 +4797,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( request->ResetStateForSiteInstanceChange(); } diff --git a/patches/chromium/gin_enable_disable_v8_platform.patch b/patches/chromium/gin_enable_disable_v8_platform.patch index d332f17e0e30d..bde63695ee376 100644 --- a/patches/chromium/gin_enable_disable_v8_platform.patch +++ b/patches/chromium/gin_enable_disable_v8_platform.patch @@ -7,7 +7,7 @@ We don't use gin to create the V8 platform, because we need to inject Node things. diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc -index 8a9be905bcbe9ccc8afaae2795605f87b81465d9..ab574fd81bc08e109123f07f095d26e19504baa0 100644 +index 456409c9e84c7a061d474470c8e42c5ddb5eb799..87187d05175a9da4fd7af03ba8a139a2d9554551 100644 --- a/gin/isolate_holder.cc +++ b/gin/isolate_holder.cc @@ -162,11 +162,13 @@ void IsolateHolder::Initialize(ScriptMode mode, diff --git a/patches/chromium/gritsettings_resource_ids.patch b/patches/chromium/gritsettings_resource_ids.patch index e864d9f53d299..6facda7473d19 100644 --- a/patches/chromium/gritsettings_resource_ids.patch +++ b/patches/chromium/gritsettings_resource_ids.patch @@ -6,10 +6,10 @@ Subject: gritsettings_resource_ids.patch Add electron resources file to the list of resource ids generation. diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec -index dd44a6f6850fe36d9a159e98cd1ffb23df10876d..9850329b7dfdabb00463a570932ff50911556011 100644 +index 0b26bb83f4ac8b9e394dee53dee6117adf2e3f28..734939a9e901583fb359a3e02e8a4531a322013a 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec -@@ -1585,6 +1585,11 @@ +@@ -1593,6 +1593,11 @@ "messages": [10120], }, diff --git a/patches/chromium/isolate_holder.patch b/patches/chromium/isolate_holder.patch index 9517feda1bd5b..f0e628ed08c32 100644 --- a/patches/chromium/isolate_holder.patch +++ b/patches/chromium/isolate_holder.patch @@ -15,7 +15,7 @@ for us to register the isolate in between Isolate::Allocate and Isolate::Initialize. diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc -index ab574fd81bc08e109123f07f095d26e19504baa0..656267caef2d515f8c3f77535b308108a0b30be1 100644 +index 87187d05175a9da4fd7af03ba8a139a2d9554551..05c899258143a958471f361b87324f7500d594c9 100644 --- a/gin/isolate_holder.cc +++ b/gin/isolate_holder.cc @@ -81,7 +81,8 @@ IsolateHolder::IsolateHolder( diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index f499b20df0526..488e05df295d1 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -35,10 +35,10 @@ system font by checking if it's kCTFontPriorityAttribute is set to system priority. diff --git a/base/BUILD.gn b/base/BUILD.gn -index f96e2575849490fa8b2060b00c092ce90d540324..3babc3bbf4b7af1833254e8b92d7cd669877e168 100644 +index eb710b05758b8a5db171e84ecb7a2c072076940a..b74719e075c550146cf6879a33c0e08a0177aeae 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn -@@ -1060,6 +1060,7 @@ component("base") { +@@ -1064,6 +1064,7 @@ component("base") { "//build:ios_buildflags", "//build/config/compiler:compiler_buildflags", "//third_party/modp_b64", @@ -195,10 +195,10 @@ index e12c1d078147d956a1d9b1bc498c1b1d6fe7b974..233362259dc4e728ed37435e65041764 } // namespace base diff --git a/components/os_crypt/sync/BUILD.gn b/components/os_crypt/sync/BUILD.gn -index 45d8e77cdfe6539563d16dd93fd48f8241f4bfca..e9fffc2e3f0520a56ff5753a4a1abfc11c795b83 100644 +index 4021f6fb72cd997f502fd0f8cadf4452fd473c41..43d25c4826c00af26fad9b4ed3c3bf0fee091fd4 100644 --- a/components/os_crypt/sync/BUILD.gn +++ b/components/os_crypt/sync/BUILD.gn -@@ -76,6 +76,8 @@ component("sync") { +@@ -65,6 +65,8 @@ component("sync") { "os_crypt_mac.mm", ] deps += [ "//crypto:mock_apple_keychain" ] @@ -548,7 +548,7 @@ index 010c713090e5038dc90db131c8f621422d30c03b..20c35e887a0496ee609c077e3b0494bd void ForwardKeyboardEvent(const input::NativeWebKeyboardEvent& key_event, diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -index e2b316223ee5cbd99cb5f9f69c5454600cb8f74f..3d5cf1f31281e8412e6cdb441e6aa7954ad2d601 100644 +index e51fd827f7afc01a5189737f86a2414627a6546e..bb50f03ba5622c2bfb96bc75d145f471a920c3bf 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -34,6 +34,7 @@ @@ -582,10 +582,10 @@ index e2b316223ee5cbd99cb5f9f69c5454600cb8f74f..3d5cf1f31281e8412e6cdb441e6aa795 return kAttributes; } diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index fbcca47f273a226fbed885f7dc56662778ecff8c..37b070c55bdda55136e1ed76771e10eb883a3a0e 100644 +index 9e8831ceb624e757e5174d0c7a6e2659c132245c..b468ad7f19389157c73e2f7305e57160db8f96fa 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn -@@ -347,6 +347,7 @@ source_set("browser") { +@@ -346,6 +346,7 @@ source_set("browser") { "//ui/webui/resources", "//v8", "//v8:v8_version", @@ -594,7 +594,7 @@ index fbcca47f273a226fbed885f7dc56662778ecff8c..37b070c55bdda55136e1ed76771e10eb public_deps = [ diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h -index 319e58e5c3cad4ec47fca2c7cb0d59d4c5fd460c..d17bdb51081cee80f6f43199057de557063ecf1a 100644 +index 29a5a99fa2c8e90812bd7ff40b153ead807bdbef..c8683c70f8cabfa89c95c28dc5fe59f42e9970c6 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.h +++ b/content/browser/renderer_host/render_widget_host_view_mac.h @@ -24,6 +24,7 @@ @@ -605,7 +605,7 @@ index 319e58e5c3cad4ec47fca2c7cb0d59d4c5fd460c..d17bdb51081cee80f6f43199057de557 #include "mojo/public/cpp/bindings/associated_receiver.h" #include "mojo/public/cpp/bindings/associated_remote.h" #include "third_party/blink/public/mojom/webshare/webshare.mojom.h" -@@ -54,7 +55,9 @@ class CursorManager; +@@ -58,7 +59,9 @@ struct CopyOutputBitmapWithMetadata; @protocol RenderWidgetHostViewMacDelegate; @@ -615,7 +615,7 @@ index 319e58e5c3cad4ec47fca2c7cb0d59d4c5fd460c..d17bdb51081cee80f6f43199057de557 @class RenderWidgetHostViewCocoa; namespace content { -@@ -675,9 +678,11 @@ class CONTENT_EXPORT RenderWidgetHostViewMac +@@ -680,9 +683,11 @@ class CONTENT_EXPORT RenderWidgetHostViewMac // EnsureSurfaceSynchronizedForWebTest(). uint32_t latest_capture_sequence_number_ = 0u; @@ -628,7 +628,7 @@ index 319e58e5c3cad4ec47fca2c7cb0d59d4c5fd460c..d17bdb51081cee80f6f43199057de557 // Used to force the NSApplication's focused accessibility element to be the // content::BrowserAccessibilityCocoa accessibility tree when the NSView for diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index 439cb7e93e802c689e16a24853f3ce75216ec74f..1fde0953bdc8bf3cd777206d7d340188ebf946fb 100644 +index 1c091d1bfaea0fe00e99584d153a1b36bf574b9e..9524be857c44a6523cf101d3cd24e69b30291c50 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -52,6 +52,7 @@ @@ -650,7 +650,7 @@ index 439cb7e93e802c689e16a24853f3ce75216ec74f..1fde0953bdc8bf3cd777206d7d340188 // Reset `ns_view_` before resetting `remote_ns_view_` to avoid dangling // pointers. `ns_view_` gets reinitialized later in this method. -@@ -1652,10 +1655,12 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1653,10 +1656,12 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, gfx::NativeViewAccessible RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() { @@ -663,7 +663,7 @@ index 439cb7e93e802c689e16a24853f3ce75216ec74f..1fde0953bdc8bf3cd777206d7d340188 return gfx::NativeViewAccessible([GetInProcessNSView() window]); } -@@ -1707,9 +1712,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1708,9 +1713,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, } void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) { @@ -675,7 +675,7 @@ index 439cb7e93e802c689e16a24853f3ce75216ec74f..1fde0953bdc8bf3cd777206d7d340188 } bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame( -@@ -2212,20 +2219,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -2213,20 +2220,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, void RenderWidgetHostViewMac::GetRenderWidgetAccessibilityToken( GetRenderWidgetAccessibilityTokenCallback callback) { base::ProcessId pid = getpid(); @@ -797,7 +797,7 @@ index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbe } // namespace content diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn -index c9e14f94e0f713b09db8ec3e29702f7b948f1e3b..f52984c0ad9611933a75b7e359bc2d35ff0cd575 100644 +index 5f1636775e238ef9e1722d6f54d358d0f7f21cbe..8ebf47f05e7395a8db8325e74f17bc89bef2f019 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn @@ -703,6 +703,7 @@ static_library("test_support") { @@ -938,7 +938,7 @@ index d288ffce5c1265adbdefc571f840851026e7479e..e9a6e8c31401750d270fcc55ef1116b2 namespace ui { diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn -index cbda18b7646aacd6f15284faaefeafd452bb5ce9..9e60819fd389aed880b314f7152190c7cacf4429 100644 +index 9388ffac4f70746b04e533b51faf4f2d55ab3358..98f45dc973159b5823d8a0433dfd4bc634874b1e 100644 --- a/media/audio/BUILD.gn +++ b/media/audio/BUILD.gn @@ -203,6 +203,7 @@ source_set("audio") { @@ -950,7 +950,7 @@ index cbda18b7646aacd6f15284faaefeafd452bb5ce9..9e60819fd389aed880b314f7152190c7 if (is_ios) { diff --git a/media/audio/apple/audio_low_latency_input.cc b/media/audio/apple/audio_low_latency_input.cc -index 5eda5e58b30b84795ec3827aad7ce97171400097..60bf6c34e8d824ea6d4e02b2951568604db68f43 100644 +index 6cde211f88439af0925296b0c8c9500aecadc034..08e7053117478ea898264040eea119dcc21ae8e2 100644 --- a/media/audio/apple/audio_low_latency_input.cc +++ b/media/audio/apple/audio_low_latency_input.cc @@ -29,6 +29,7 @@ @@ -1396,10 +1396,10 @@ index eb81a70e4d5d5cd3e6ae9b45f8cd1c795ea76c51..9921ccb10d3455600eddd85f77f10228 } // namespace sandbox diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn -index 267e8ddfe2905f169a7cf9a819a4baa82b47770e..3a9fe67e684df903c256b396ce024c0c6f7c92a7 100644 +index 299d9850d09c0ae6380c16c4fdd5c7d355f99032..61b3f8f2cefc6b8e108ab22f7a4b6b33ed6922d4 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn -@@ -427,6 +427,7 @@ component("core") { +@@ -428,6 +428,7 @@ component("core") { "//ui/gfx/geometry", "//ui/gfx/geometry:geometry_skia", "//ui/strings", @@ -1759,10 +1759,10 @@ index 93e90c4eba9bc9b93d68e834eb6baabeb2d0ecf0..1b90f41d05f847a94adf2f4da827b1d0 } // namespace diff --git a/ui/display/BUILD.gn b/ui/display/BUILD.gn -index ca9b2b6f9a4e070d2fd40a6fec672d612ff757e0..87eee402eb38270690b798b67a368e113008d8cc 100644 +index 41572ec01d71f56eb8815cf9845e2c4ccefb9964..90c72f19b557d985581c7250187616ee85821964 100644 --- a/ui/display/BUILD.gn +++ b/ui/display/BUILD.gn -@@ -131,6 +131,12 @@ component("display") { +@@ -132,6 +132,12 @@ component("display") { "//ui/gfx/geometry", ] @@ -1776,18 +1776,18 @@ index ca9b2b6f9a4e070d2fd40a6fec672d612ff757e0..87eee402eb38270690b798b67a368e11 deps += [ "//build:ios_buildflags" ] } diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm -index 4be0d3508981ca6e7f06134b9c44e8eff39799fc..688c60025bd5ce14f9b790760e537bf7b5651268 100644 +index 7f08f6e5870b021e578fe29f42fd6476ab53a8df..88e884c1510ad617b86678ed31a7bbaa71518742 100644 --- a/ui/display/mac/screen_mac.mm +++ b/ui/display/mac/screen_mac.mm -@@ -33,6 +33,7 @@ - #include "base/trace_event/trace_event.h" +@@ -34,6 +34,7 @@ #include "build/build_config.h" #include "components/device_event_log/device_event_log.h" + #include "components/viz/common/resources/shared_image_format.h" +#include "electron/mas.h" #include "ui/display/display.h" #include "ui/display/display_change_notifier.h" #include "ui/display/mac/screen_mac_headless.h" -@@ -182,7 +183,17 @@ DisplayMac BuildDisplayForScreen(NSScreen* screen) { +@@ -184,7 +185,17 @@ DisplayMac BuildDisplayForScreen(NSScreen* screen) { display.set_color_depth(Display::kDefaultBitsPerPixel); display.set_depth_per_component(Display::kDefaultBitsPerComponent); } @@ -1806,7 +1806,7 @@ index 4be0d3508981ca6e7f06134b9c44e8eff39799fc..688c60025bd5ce14f9b790760e537bf7 // Query the display's refresh rate. double refresh_rate = 1.0 / screen.minimumRefreshInterval; diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn -index a00134fb815bd413dca8ae9581f488a3d3f42910..26c83b597a3e6846c1c1c11eefe6f9d7a8ac2619 100644 +index 0bcdadec85f2a12a226b1bcac3db387e1593757c..ea89c8c2ee61f55d5a5db4ec0ad360d180bde024 100644 --- a/ui/gfx/BUILD.gn +++ b/ui/gfx/BUILD.gn @@ -335,6 +335,12 @@ component("gfx") { @@ -1918,7 +1918,7 @@ index e855d05f466059f20a31022a1a2810eeadeb4fff..e523151fb670af28cf2c54548c500982 // Used to force the NSApplication's focused accessibility element to be the // views::Views accessibility tree when the NSView for this is focused. diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -index 240bf8ce57ffce734263ecc62bda1ad70b1b60ce..7459d4c241e914248261c62b63652fd7139dd54e 100644 +index ac4257215c61f3cb388e14f4439e23ac29f1307d..e1a1cdb2ec192d2ee5a555ecccf041f757336f79 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm @@ -21,6 +21,7 @@ diff --git a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch index a8cb0a94a44cf..0267a0a9d46a3 100644 --- a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch +++ b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch @@ -7,7 +7,7 @@ This adds a callback from the network service that's used to implement session.setCertificateVerifyCallback. diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index a02161899767745c6ddfeafecdeec0181105e8a6..68ad4334b47b075ea6ed80f2f29e496089695f8d 100644 +index c99cb040889eb820e1f32df1af6ac92698945991..f1a7f4ab3d77415c22417bac0bb7dd9a5fa91342 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc @@ -166,6 +166,11 @@ diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index b73749345d963..f2abd290ba7fb 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -31,10 +31,10 @@ index e94fccc1b564c349eb2d2c9acd0574c3589a2eaf..a75a55b6c54f5aacc915a27d2aa99395 const GURL& origin, const GURL& document_url, diff --git a/content/browser/notifications/blink_notification_service_impl.cc b/content/browser/notifications/blink_notification_service_impl.cc -index e06d4785c3bdc6567447ec6cb6f9bb6cf940c9cc..ce786b2271c997cd66213db9fc444757d00a6d9b 100644 +index 2fd342198d04c5d7fa7e80c0893a905a22ff4601..b907b5588541337576e96bbee7c2c29c1b7355a5 100644 --- a/content/browser/notifications/blink_notification_service_impl.cc +++ b/content/browser/notifications/blink_notification_service_impl.cc -@@ -85,12 +85,14 @@ BlinkNotificationServiceImpl::BlinkNotificationServiceImpl( +@@ -87,12 +87,14 @@ BlinkNotificationServiceImpl::BlinkNotificationServiceImpl( BrowserContext* browser_context, scoped_refptr<ServiceWorkerContextWrapper> service_worker_context, RenderProcessHost* render_process_host, @@ -49,7 +49,7 @@ index e06d4785c3bdc6567447ec6cb6f9bb6cf940c9cc..ce786b2271c997cd66213db9fc444757 browser_context_(browser_context), service_worker_context_(std::move(service_worker_context)), render_process_host_id_(render_process_host->GetDeprecatedID()), -@@ -190,7 +192,7 @@ void BlinkNotificationServiceImpl::DisplayNonPersistentNotification( +@@ -198,7 +200,7 @@ void BlinkNotificationServiceImpl::DisplayNonPersistentNotification( creator_type_); browser_context_->GetPlatformNotificationService()->DisplayNotification( @@ -133,7 +133,7 @@ index 5be62a3fb27e37f3c1db6b811172f6dfebe18f61..34349f9832fe4b9a3d48db613a789afb const GURL& document_url, const WeakDocumentPtr& weak_document_ptr, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 1bc649d5382bbfd9565dcca8a25dfa06d6bc9735..b01a2051cee154cc002e4c0274e8955b4eccfe38 100644 +index a06f8fcefd34ea766ed4cfd842916d3d579948ba..42f8ca40427cc0f95e9e4e0df5708a80d022c522 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -2305,7 +2305,7 @@ void RenderProcessHostImpl::CreateNotificationService( diff --git a/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch b/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch index ed8ae4f833ac8..00d54013e9e0c 100644 --- a/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch +++ b/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch @@ -10,11 +10,11 @@ The keyed mutex introduce extra performance cost and spikes. However, at offscre For resolving complex conflict please pin @reitowo For more reason please see: https://crrev.com/c/5465148 -diff --git a/gpu/command_buffer/service/shared_image/gpu_memory_buffer_factory_dxgi.cc b/gpu/command_buffer/service/shared_image/gpu_memory_buffer_factory_dxgi.cc -index e0b94914e0cf7dc83503fa4a4b7fa75442e5b404..b8ffc6ce4973a3d2ef194e4289ad8bba122f315a 100644 ---- a/gpu/command_buffer/service/shared_image/gpu_memory_buffer_factory_dxgi.cc -+++ b/gpu/command_buffer/service/shared_image/gpu_memory_buffer_factory_dxgi.cc -@@ -170,7 +170,8 @@ gfx::GpuMemoryBufferHandle GpuMemoryBufferFactoryDXGI::CreateNativeGmbHandle( +diff --git a/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc b/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc +index a3b6969a20f08bc4b6f9baac645da3dcb6d1bbfb..683c36ba3e6190b03ee777ba8e5f0ed445c1047c 100644 +--- a/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc ++++ b/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc +@@ -383,7 +383,8 @@ gfx::GpuMemoryBufferHandle D3DImageBackingFactory::CreateGpuMemoryBufferHandle( // so make sure that the usage is one that we support. DCHECK(usage == gfx::BufferUsage::GPU_READ || usage == gfx::BufferUsage::SCANOUT || @@ -24,7 +24,7 @@ index e0b94914e0cf7dc83503fa4a4b7fa75442e5b404..b8ffc6ce4973a3d2ef194e4289ad8bba << "Incorrect usage, usage=" << gfx::BufferUsageToString(usage); D3D11_TEXTURE2D_DESC desc = { -@@ -184,7 +185,9 @@ gfx::GpuMemoryBufferHandle GpuMemoryBufferFactoryDXGI::CreateNativeGmbHandle( +@@ -397,7 +398,9 @@ gfx::GpuMemoryBufferHandle D3DImageBackingFactory::CreateGpuMemoryBufferHandle( D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET, 0, D3D11_RESOURCE_MISC_SHARED_NTHANDLE | diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index c9661272a61f2..0261c4a8d53ea 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -30,10 +30,10 @@ index 9a4195a3e53353342c75d6c4372ed4c27ef13fd3..bc1bfa1ac381ec94121a264d9dcbae9e // RenderWidgetHost on the primary main frame, and false otherwise. virtual bool IsWidgetForPrimaryMainFrame(RenderWidgetHostImpl*); diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 1156ea5df2a390604b822b82cf42940029fea1f7..e07b2d171bbc33e271c5cef7e49e3451a8cdff84 100644 +index 755fa9cf571873072d67d97226e7d847c618afcf..d7de0324994cf69009eb5be92110351e98ba47fb 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -2072,6 +2072,9 @@ void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) { +@@ -2073,6 +2073,9 @@ void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) { if (view_) { view_->UpdateCursor(cursor); } @@ -44,10 +44,10 @@ index 1156ea5df2a390604b822b82cf42940029fea1f7..e07b2d171bbc33e271c5cef7e49e3451 void RenderWidgetHostImpl::ShowContextMenuAtPoint( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 655b289b783a8c35fb85fed715501b25a23acc85..e7a985973e1fd6ff51649d4e3fe802cc306c8f39 100644 +index 32d16bae9a25d06f410f51d3cc25c27ea83c6821..b568a66369e246322698630e495826f0c1109221 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -6134,6 +6134,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { +@@ -6149,6 +6149,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { return text_input_manager_.get(); } @@ -60,10 +60,10 @@ index 655b289b783a8c35fb85fed715501b25a23acc85..e7a985973e1fd6ff51649d4e3fe802cc RenderWidgetHostImpl* render_widget_host) { return render_widget_host == GetPrimaryMainFrame()->GetRenderWidgetHost(); diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index 342a5f984838eba5aef7a535c3758bb96c0f89a3..034797826196560ab6b71f885d52c8e1c94c1a67 100644 +index 0a739681261937520e86457eaf04ea0d41092ca9..364e3ad00c81fd003d3404b4c4fa3393c3ab443c 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -1179,6 +1179,7 @@ class CONTENT_EXPORT WebContentsImpl +@@ -1177,6 +1177,7 @@ class CONTENT_EXPORT WebContentsImpl void SendScreenRects() override; void SendActiveState(bool active) override; TextInputManager* GetTextInputManager() override; @@ -72,7 +72,7 @@ index 342a5f984838eba5aef7a535c3758bb96c0f89a3..034797826196560ab6b71f885d52c8e1 RenderWidgetHostImpl* render_widget_host) override; bool IsShowingContextMenuOnPage() const override; diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h -index 62e5f908e2df02e5189bfb2e35e5311cd24f3948..167f0e2a69bd2d5bf3807edad7abe78873edaa1b 100644 +index 4faff4e44a441cd9e95ee926d6e62a9249424433..bf06dcb8b69001f914541423824a144ac331f190 100644 --- a/content/public/browser/web_contents_observer.h +++ b/content/public/browser/web_contents_observer.h @@ -34,6 +34,7 @@ diff --git a/patches/chromium/refactor_expose_file_system_access_blocklist.patch b/patches/chromium/refactor_expose_file_system_access_blocklist.patch index 3320173490463..80d62a0228435 100644 --- a/patches/chromium/refactor_expose_file_system_access_blocklist.patch +++ b/patches/chromium/refactor_expose_file_system_access_blocklist.patch @@ -8,7 +8,7 @@ it in Electron and prevent drift from Chrome's blocklist. We should look for a w to upstream this change to Chrome. diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc -index 0c6a0751119ac303f85327f0ccb0e32b957b837a..150147638f7c6f1e87e9a7379af9ecf65ed4c4dc 100644 +index 37aa6f6b51c8f83c6b3165ac230a691cecbfd303..f07dee4023f026eb57288f5e71bfa6014b558c00 100644 --- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc +++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc @@ -84,11 +84,13 @@ @@ -25,7 +25,7 @@ index 0c6a0751119ac303f85327f0ccb0e32b957b837a..150147638f7c6f1e87e9a7379af9ecf6 #include "components/tabs/public/tab_interface.h" #if BUILDFLAG(ENABLE_PLATFORM_APPS) #include "extensions/browser/extension_registry.h" // nogncheck -@@ -265,190 +267,10 @@ bool MaybeIsLocalUNCPath(const base::FilePath& path) { +@@ -288,190 +290,10 @@ bool MaybeIsLocalUNCPath(const base::FilePath& path) { } #endif @@ -220,7 +220,7 @@ index 0c6a0751119ac303f85327f0ccb0e32b957b837a..150147638f7c6f1e87e9a7379af9ecf6 // Checks if `path` should be blocked by the `rules`. // The BlockType of the nearest ancestor of a path to check is what -@@ -1363,16 +1185,6 @@ struct ChromeFileSystemAccessPermissionContext::OriginState { +@@ -1404,16 +1226,6 @@ struct ChromeFileSystemAccessPermissionContext::OriginState { std::unique_ptr<base::RetainingOneShotTimer> cleanup_timer; }; @@ -237,7 +237,7 @@ index 0c6a0751119ac303f85327f0ccb0e32b957b837a..150147638f7c6f1e87e9a7379af9ecf6 ChromeFileSystemAccessPermissionContext:: ChromeFileSystemAccessPermissionContext(content::BrowserContext* context, const base::Clock* clock) -@@ -1391,7 +1203,7 @@ ChromeFileSystemAccessPermissionContext:: +@@ -1432,7 +1244,7 @@ ChromeFileSystemAccessPermissionContext:: #if BUILDFLAG(IS_ANDROID) one_time_permissions_tracker_.Observe( OneTimePermissionsTrackerFactory::GetForBrowserContext(context)); @@ -246,7 +246,7 @@ index 0c6a0751119ac303f85327f0ccb0e32b957b837a..150147638f7c6f1e87e9a7379af9ecf6 auto* provider = web_app::WebAppProvider::GetForWebApps( Profile::FromBrowserContext(profile_)); if (provider) { -@@ -2776,7 +2588,7 @@ void ChromeFileSystemAccessPermissionContext::OnShutdown() { +@@ -2817,7 +2629,7 @@ void ChromeFileSystemAccessPermissionContext::OnShutdown() { one_time_permissions_tracker_.Reset(); } @@ -255,7 +255,7 @@ index 0c6a0751119ac303f85327f0ccb0e32b957b837a..150147638f7c6f1e87e9a7379af9ecf6 void ChromeFileSystemAccessPermissionContext::OnWebAppInstalled( const webapps::AppId& app_id) { if (!base::FeatureList::IsEnabled( -@@ -3111,11 +2923,7 @@ bool ChromeFileSystemAccessPermissionContext:: +@@ -3152,11 +2964,7 @@ bool ChromeFileSystemAccessPermissionContext:: HandleType handle_type, UserAction user_action, GrantType grant_type) { @@ -268,7 +268,7 @@ index 0c6a0751119ac303f85327f0ccb0e32b957b837a..150147638f7c6f1e87e9a7379af9ecf6 if (!base::FeatureList::IsEnabled( features::kFileSystemAccessPersistentPermissions)) { return false; -@@ -3166,6 +2974,7 @@ bool ChromeFileSystemAccessPermissionContext:: +@@ -3207,6 +3015,7 @@ bool ChromeFileSystemAccessPermissionContext:: return false; #endif // BUILDFLAG(IS_ANDROID) diff --git a/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch b/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch index 2e5ee4547643c..93386b5312dc1 100644 --- a/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch +++ b/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch @@ -7,7 +7,7 @@ Subject: refactor: expose HostImportModuleDynamically and This is so that Electron can blend Blink's and Node's implementations of these isolate handlers. diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -index 31500795700bc257b1a05515a8d557b32b0a370d..54ec914fbff24421437a89c2e05e052b1385c633 100644 +index 8499bf5bced44db827663b57a9af29d7dc731e76..a5e68f2554ee01d9a9e39900d350c64b1ceb7860 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc @@ -645,8 +645,9 @@ bool WasmCustomDescriptorsEnabledCallback(v8::Local<v8::Context> context) { diff --git a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch index a0f367b865799..7f142fe47412e 100644 --- a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch +++ b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch @@ -28,7 +28,7 @@ index 7078014e6db7c43d66b1448b2b36500f206ec4a0..9decf37eaf32eb837141bc9ee96b6881 break; } diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc -index 0a72093709ae8f56cc7b8d1649efe23050423054..0d7ad32add07e4c8f61d8df08de9e1c176bba6d6 100644 +index a43a28e60d87a446adc187121abbbeeecb50bac7..ba886970854682ccbc145a5ec524a8d0cf58f03a 100644 --- a/content/browser/permissions/permission_controller_impl.cc +++ b/content/browser/permissions/permission_controller_impl.cc @@ -94,7 +94,15 @@ PermissionToSchedulingFeature(PermissionType permission_name) { diff --git a/patches/chromium/refactor_unfilter_unresponsive_events.patch b/patches/chromium/refactor_unfilter_unresponsive_events.patch index d1230cd7df4d1..829fb38701e71 100644 --- a/patches/chromium/refactor_unfilter_unresponsive_events.patch +++ b/patches/chromium/refactor_unfilter_unresponsive_events.patch @@ -15,10 +15,10 @@ This CL removes these filters so the unresponsive event can still be accessed from our JS event. The filtering is moved into Electron's code. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index a257bc1480369f24b05db19bd2bfce064b96407d..fefe40186f436f3117543f8c6d0c7c67f358bd2a 100644 +index 3489db5f1acfbd4d6fa6d3650e3e73498c728791..356ed97619d2ef911270275dbd518d76997ce1f1 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10257,25 +10257,13 @@ void WebContentsImpl::RendererUnresponsive( +@@ -10272,25 +10272,13 @@ void WebContentsImpl::RendererUnresponsive( base::RepeatingClosure hang_monitor_restarter) { OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RendererUnresponsive", "render_widget_host", render_widget_host); diff --git a/patches/chromium/render_widget_host_view_mac.patch b/patches/chromium/render_widget_host_view_mac.patch index 02d22d12db05b..b7735ba9242cf 100644 --- a/patches/chromium/render_widget_host_view_mac.patch +++ b/patches/chromium/render_widget_host_view_mac.patch @@ -8,7 +8,7 @@ respond to the first mouse click in their window, which is desirable for some kinds of utility windows. Similarly for `disableAutoHideCursor`. diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -index c2aeece6d8804b532808c614340577640f904e2b..e2b316223ee5cbd99cb5f9f69c5454600cb8f74f 100644 +index 63ecc872cd8ef58ebc3decb2aa0f88885bc76ca5..e51fd827f7afc01a5189737f86a2414627a6546e 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -167,6 +167,15 @@ void ExtractUnderlines(NSAttributedString* string, diff --git a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch index 94f0513a4e534..b1ffe2566a79c 100644 --- a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch +++ b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch @@ -18,12 +18,12 @@ This partially (leaves the removal of the feature flag) reverts ef865130abd5539e7bce12308659b19980368f12. diff --git a/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.h b/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.h -index 428902f90950b2e9434c8a624a313268ebb80cd4..afcc3bc481be6a16119f7e2af647276cb0dafa1e 100644 +index 13e928e3790735fdad68fbca0a8a8e9d0836fdee..2719f8853e840d6f890d01220345644db163fd07 100644 --- a/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.h +++ b/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.h -@@ -12,6 +12,8 @@ +@@ -11,6 +11,8 @@ + #include "base/metrics/field_trial_params.h" #import "content/app_shim_remote_cocoa/web_contents_view_cocoa.h" - #include "content/common/web_contents_ns_view_bridge.mojom.h" +extern CONTENT_EXPORT const base::FeatureParam<bool> + kEnhancedWindowOcclusionDetection; @@ -233,10 +233,10 @@ index d8167e854a3264b19a07544039fd01aba45e27a1..2e5a4ae715529e3b7b5c8fbb7195c7ce } diff --git a/content/common/features.cc b/content/common/features.cc -index 788a0da0f67b5580192b9bf374839cade061aae4..2a14433d9d53d98c3cd51a4f7106fb8534efce51 100644 +index 079f57e17386914cb571d6d77e66bb71a453adca..ed328eafcf60390495296d7a2f4cef17de5fd225 100644 --- a/content/common/features.cc +++ b/content/common/features.cc -@@ -292,6 +292,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); +@@ -298,6 +298,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kIOSurfaceCapturer, base::FEATURE_ENABLED_BY_DEFAULT); #endif @@ -252,10 +252,10 @@ index 788a0da0f67b5580192b9bf374839cade061aae4..2a14433d9d53d98c3cd51a4f7106fb85 BASE_FEATURE(kKeepChildProcessAfterIPCReset, base::FEATURE_DISABLED_BY_DEFAULT); diff --git a/content/common/features.h b/content/common/features.h -index f6b18e1c45945126b530187342d2d00c68812338..38649d29fe945c11907e9ead88cd9ec2ca0b1f5a 100644 +index 24b248f94510619b5a570498578f33910245dcf9..8baefcc9ff7d80cb5ba1e3a7174cb3dac9e2b16f 100644 --- a/content/common/features.h +++ b/content/common/features.h -@@ -106,6 +106,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); +@@ -107,6 +107,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); #if BUILDFLAG(IS_MAC) CONTENT_EXPORT BASE_DECLARE_FEATURE(kIOSurfaceCapturer); #endif diff --git a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch index a0074c88399b1..c4dd06737832c 100644 --- a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch +++ b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch @@ -39,10 +39,10 @@ index bc1bfa1ac381ec94121a264d9dcbae9e02ab5a81..c6fc03ae158b3ce87fd684d765a3f1b0 // event before sending it to the renderer. See enum for details on return // value. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 0e2b978b3f35e5805d380da398bba58fcd256310..39dfc8593da452bc40caca94cbb38eca57364d92 100644 +index 12df047f66b9e3184b7421aa5fbe4e91e340e395..702cc747c768355b3827410dbb0d84a0f8b2e44c 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -1588,6 +1588,10 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( +@@ -1589,6 +1589,10 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( CHECK_GE(mouse_event.GetType(), WebInputEvent::Type::kMouseTypeFirst); CHECK_LE(mouse_event.GetType(), WebInputEvent::Type::kMouseTypeLast); @@ -54,10 +54,10 @@ index 0e2b978b3f35e5805d380da398bba58fcd256310..39dfc8593da452bc40caca94cbb38eca if (mouse_event_callback.Run(mouse_event)) { return; diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index fefe40186f436f3117543f8c6d0c7c67f358bd2a..2bff527424f3aa98f032743e8ea5a33b439555ad 100644 +index 356ed97619d2ef911270275dbd518d76997ce1f1..a99dbcc5e9890392010fac4afa285302b33acef7 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4451,6 +4451,12 @@ void WebContentsImpl::RenderWidgetWasResized( +@@ -4466,6 +4466,12 @@ void WebContentsImpl::RenderWidgetWasResized( width_changed); } @@ -71,10 +71,10 @@ index fefe40186f436f3117543f8c6d0c7c67f358bd2a..2bff527424f3aa98f032743e8ea5a33b const gfx::PointF& client_pt) { if (delegate_) { diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index 034797826196560ab6b71f885d52c8e1c94c1a67..55db63b3f99e465d2c77bb25dca5d50005df5ce7 100644 +index 364e3ad00c81fd003d3404b4c4fa3393c3ab443c..843cc094920e46943c35bda4e82b876d30c462c4 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -1110,6 +1110,7 @@ class CONTENT_EXPORT WebContentsImpl +@@ -1108,6 +1108,7 @@ class CONTENT_EXPORT WebContentsImpl double GetPendingZoomLevel(RenderWidgetHostImpl* rwh) override; diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index 66e1af29d1b0b..5c72a9af7e634 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index bce1e6ff07587e7f75d1925291872fe21ba5404c..c6e851033ca7da1ad3d9b108491ce5b38cfc71a4 100644 +index ae2e7540435daef0779f6d442c743f15fc9ae88a..d6a4fbe710b46c62bb6343d91bfaa702a21d78b3 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25163,6 +25163,21 @@ +@@ -25338,6 +25338,21 @@ ] } ], @@ -36,10 +36,10 @@ index bce1e6ff07587e7f75d1925291872fe21ba5404c..c6e851033ca7da1ad3d9b108491ce5b3 { "platforms": [ diff --git a/ui/views/views_features.cc b/ui/views/views_features.cc -index 88ca7f0b1fc025ee41653004dc10ed48cbd59d32..b8ec7177ced38773b96f7d44277bba383d0ff8ca 100644 +index eddb6b33f0df6f494ae9dfa63851c924e2d2350c..d74308e69e794637410597c7dd9a06b2d5fff425 100644 --- a/ui/views/views_features.cc +++ b/ui/views/views_features.cc -@@ -27,6 +27,14 @@ BASE_FEATURE(kEnablePlatformHighContrastInkDrop, +@@ -22,6 +22,14 @@ BASE_FEATURE(kAnnounceTextAdditionalAttributes, // crbug.com/370856871. BASE_FEATURE(kEnableTouchDragCursorSync, base::FEATURE_ENABLED_BY_DEFAULT); @@ -55,12 +55,12 @@ index 88ca7f0b1fc025ee41653004dc10ed48cbd59d32..b8ec7177ced38773b96f7d44277bba38 // to kKeyboardAccessibleTooltip in //ui/base/ui_base_features.cc. BASE_FEATURE(kKeyboardAccessibleTooltipInViews, diff --git a/ui/views/views_features.h b/ui/views/views_features.h -index 58063f2452dc484a97c79b382067d9b34875e344..d586436498263c595a17454f54644d2deb05f308 100644 +index c1d8107ec3e32d31811572aa1d7a7c7a242da7d9..463abf871c7e169dc1ca9f523d74fc14d58541cc 100644 --- a/ui/views/views_features.h +++ b/ui/views/views_features.h -@@ -15,6 +15,7 @@ namespace views::features { +@@ -14,6 +14,7 @@ namespace views::features { + // Please keep alphabetized. VIEWS_EXPORT BASE_DECLARE_FEATURE(kAnnounceTextAdditionalAttributes); - VIEWS_EXPORT BASE_DECLARE_FEATURE(kEnablePlatformHighContrastInkDrop); VIEWS_EXPORT BASE_DECLARE_FEATURE(kEnableTouchDragCursorSync); +VIEWS_EXPORT BASE_DECLARE_FEATURE(kEnableTransparentHwndEnlargement); VIEWS_EXPORT BASE_DECLARE_FEATURE(kKeyboardAccessibleTooltipInViews); diff --git a/patches/chromium/scroll_bounce_flag.patch b/patches/chromium/scroll_bounce_flag.patch index ec7f6a5b827f8..be39eb6717f5f 100644 --- a/patches/chromium/scroll_bounce_flag.patch +++ b/patches/chromium/scroll_bounce_flag.patch @@ -6,10 +6,10 @@ Subject: scroll_bounce_flag.patch Patch to make scrollBounce option work. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc -index ccfd37cc73dff797166eb0e675d430d7abade835..2c2ceb5535ff5bfceab6e7a5af61e96b5f92e011 100644 +index 5898582f6aaea2ffc87349f5e0049995ae524108..ee5c04977fdd92371ee1d96e26cdae0914482582 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc -@@ -1217,7 +1217,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { +@@ -1208,7 +1208,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { } bool RenderThreadImpl::IsElasticOverscrollEnabled() { diff --git a/patches/chromium/support_mixed_sandbox_with_zygote.patch b/patches/chromium/support_mixed_sandbox_with_zygote.patch index 9f997b8094f30..4d349df9b51b7 100644 --- a/patches/chromium/support_mixed_sandbox_with_zygote.patch +++ b/patches/chromium/support_mixed_sandbox_with_zygote.patch @@ -22,7 +22,7 @@ However, the patch would need to be reviewed by the security team, as it does touch a security-sensitive class. diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index b01a2051cee154cc002e4c0274e8955b4eccfe38..21bd24c3bf02f047a42daaddd155e83e2dc86963 100644 +index 42f8ca40427cc0f95e9e4e0df5708a80d022c522..b7b348a6db7fb4e78fd10adc97031fbb34c52dac 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -1896,6 +1896,10 @@ bool RenderProcessHostImpl::Init() { diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index 5b9a28b6804b0..26a6a22a4d1be 100644 --- a/patches/chromium/web_contents.patch +++ b/patches/chromium/web_contents.patch @@ -9,10 +9,10 @@ is needed for OSR. Originally landed in https://github.com/electron/libchromiumcontent/pull/226. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index dfcb0be8195aab4df36c319c0996ec8a1a4f555e..2eed5dbdda53e0d7ad8aa8cab08258cb2d3a1433 100644 +index 2adea6e88f5e09f3416e665039e83c367dca58af..509009403163872684eb55684f22c0435c892960 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4182,6 +4182,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -4197,6 +4197,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, params.main_frame_name, GetOpener(), primary_main_frame_policy, base::UnguessableToken::Create()); @@ -26,7 +26,7 @@ index dfcb0be8195aab4df36c319c0996ec8a1a4f555e..2eed5dbdda53e0d7ad8aa8cab08258cb std::unique_ptr<WebContentsViewDelegate> delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -4192,6 +4199,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -4207,6 +4214,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, view_ = CreateWebContentsView(this, std::move(delegate), &render_view_host_delegate_view_); } diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index 6de4df7d60068..c1374d337a536 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,10 +15,10 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 15e2f327060adeb32e977a8a371604819fe01108..f8649ef3b599b64dcbee26984f1136c137255f28 100644 +index ebe44040a554674058ee5307b7df32f224f09c17..2488db00782f22dd9e0c835258d6022e6ea6e644 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -8971,6 +8971,17 @@ void RenderFrameHostImpl::EnterFullscreen( +@@ -8960,6 +8960,17 @@ void RenderFrameHostImpl::EnterFullscreen( } } @@ -37,10 +37,10 @@ index 15e2f327060adeb32e977a8a371604819fe01108..f8649ef3b599b64dcbee26984f1136c1 if (had_fullscreen_token && !GetView()->HasFocus()) GetView()->Focus(); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 2eed5dbdda53e0d7ad8aa8cab08258cb2d3a1433..5bca1c0fbaa4dc3c6294fa206463ca3190a0367d 100644 +index 509009403163872684eb55684f22c0435c892960..47bbe40f74ded6be7d5ae4e1c96331bef3070291 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4468,21 +4468,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( +@@ -4483,21 +4483,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( const input::NativeWebKeyboardEvent& event) { OPTIONAL_TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("content.verbose"), "WebContentsImpl::PreHandleKeyboardEvent"); @@ -80,7 +80,7 @@ index 2eed5dbdda53e0d7ad8aa8cab08258cb2d3a1433..5bca1c0fbaa4dc3c6294fa206463ca31 } bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) { -@@ -4641,7 +4645,7 @@ void WebContentsImpl::EnterFullscreenMode( +@@ -4656,7 +4660,7 @@ void WebContentsImpl::EnterFullscreenMode( OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::EnterFullscreenMode"); DCHECK(CanEnterFullscreenMode(requesting_frame)); DCHECK(requesting_frame->IsActive()); diff --git a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch index ea898e1cb4b60..09b6873587d8c 100644 --- a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch +++ b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch @@ -10,10 +10,10 @@ to handle this without patching, but this is fairly clean for now and no longer patching legacy devtools code. diff --git a/front_end/entrypoints/main/MainImpl.ts b/front_end/entrypoints/main/MainImpl.ts -index 59588e13341d954327c57af7dcf554d3a739ddc3..878cec17c3f79a00a2cffe12364f943c11f88676 100644 +index fcf39a1fbc6219ac7d84211753dd9d0d12b236ab..c52bb1c444108e8f9c374ce4e22f56ebead8195e 100644 --- a/front_end/entrypoints/main/MainImpl.ts +++ b/front_end/entrypoints/main/MainImpl.ts -@@ -752,6 +752,8 @@ export class MainImpl { +@@ -744,6 +744,8 @@ export class MainImpl { globalThis.Main = globalThis.Main || {}; // @ts-expect-error Exported for Tests.js globalThis.Main.Main = MainImpl; diff --git a/patches/nan/.patches b/patches/nan/.patches index a8b0cedecdd75..af858c2ddfa52 100644 --- a/patches/nan/.patches +++ b/patches/nan/.patches @@ -7,3 +7,4 @@ fix_support_new_variant_of_namedpropertyhandlerconfiguration_and.patch fix_correct_usages_of_v8_returnvalue_void_set_nonempty_for_new.patch chore_remove_deprecated_functioncallbackinfo_holder.patch fix_replace_deprecated_get_setprototype.patch +fix_replace_usage_of_removed_writeutf8_with_writeutf8v2.patch diff --git a/patches/nan/fix_replace_usage_of_removed_writeutf8_with_writeutf8v2.patch b/patches/nan/fix_replace_usage_of_removed_writeutf8_with_writeutf8v2.patch new file mode 100644 index 0000000000000..369ccb946f410 --- /dev/null +++ b/patches/nan/fix_replace_usage_of_removed_writeutf8_with_writeutf8v2.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: David Sanders <dsanders11@ucsbalum.com> +Date: Tue, 14 Oct 2025 19:55:10 -0700 +Subject: fix: replace usage of removed WriteUtf8 with WriteUtf8V2 + +Refs https://chromium-review.googlesource.com/c/v8/v8/+/6495189 + +diff --git a/nan.h b/nan.h +index f4865a77e60d5105ed2426037984ddcbfa58bbca..d0b3e919f275bd4451eef9ad6aa1a78629ce862c 100644 +--- a/nan.h ++++ b/nan.h +@@ -418,12 +418,18 @@ template<typename P> class WeakCallbackInfo; + + namespace imp { + static const size_t kMaxLength = 0x3fffffff; +- // v8::String::REPLACE_INVALID_UTF8 was introduced +- // in node.js v0.10.29 and v0.8.27. +-#if NODE_MAJOR_VERSION > 0 || \ ++#if V8_MAJOR_VERSION > 13 || \ ++ V8_MAJOR_VERSION == 13 && V8_MINOR_VERSION > 3 || \ ++ V8_MAJOR_VERSION == 13 && V8_MINOR_VERSION == 3 && V8_BUILD_NUMBER >= 16 ++ // v8::String::WriteFlags::kReplaceInvalidUtf8 was introduced in ++ // v8 13.3.16 ++ static const unsigned kReplaceInvalidUtf8 = v8::String::WriteFlags::kReplaceInvalidUtf8; ++#elif NODE_MAJOR_VERSION > 0 || \ + NODE_MINOR_VERSION > 10 || \ + NODE_MINOR_VERSION == 10 && NODE_PATCH_VERSION >= 29 || \ + NODE_MINOR_VERSION == 8 && NODE_PATCH_VERSION >= 27 ++ // v8::String::REPLACE_INVALID_UTF8 was introduced ++ // in node.js v0.10.29 and v0.8.27. + static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8; + #else + static const unsigned kReplaceInvalidUtf8 = 0; +@@ -1157,11 +1163,11 @@ class Utf8String { + str_ = static_cast<char*>(malloc(len)); + assert(str_ != 0); + } +- const int flags = +- v8::String::NO_NULL_TERMINATION | imp::kReplaceInvalidUtf8; + #if NODE_MAJOR_VERSION >= 11 +- length_ = string->WriteUtf8(v8::Isolate::GetCurrent(), str_, +- static_cast<int>(len), 0, flags); ++ length_ = string->WriteUtf8V2(v8::Isolate::GetCurrent(), ++ str_, ++ len, ++ imp::kReplaceInvalidUtf8); + #else + // See https://github.com/nodejs/nan/issues/832. + // Disable the warning as there is no way around it. +@@ -1173,6 +1179,8 @@ class Utf8String { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #endif ++ const int flags = ++ v8::String::NO_NULL_TERMINATION | imp::kReplaceInvalidUtf8; + length_ = string->WriteUtf8(str_, static_cast<int>(len), 0, flags); + #ifdef __GNUC__ + #pragma GCC diagnostic pop +@@ -1499,9 +1507,10 @@ class Utf8String { + str_ = static_cast<char*>(malloc(len)); + assert(str_ != 0); + } +- const int flags = +- v8::String::NO_NULL_TERMINATION | imp::kReplaceInvalidUtf8; +- length_ = string->WriteUtf8(str_, static_cast<int>(len), 0, flags); ++ length_ = string->WriteUtf8V2(v8::Isolate::GetCurrent(), ++ str_, ++ len, ++ imp::kReplaceInvalidUtf8); + str_[length_] = '\0'; + } + } diff --git a/patches/node/.patches b/patches/node/.patches index 301adc7c48439..523c726bd83d4 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -53,3 +53,12 @@ api_remove_deprecated_getisolate.patch src_switch_from_get_setprototype_to_get_setprototypev2.patch fix_replace_deprecated_setprototype.patch fix_redefined_macos_sdk_header_symbols.patch +src_simplify_string_bytes_with_views.patch +src_improve_utf8_string_generation_performance.patch +src_use_non-deprecated_utf8lengthv2_method.patch +src_use_non-deprecated_writeutf8v2_method.patch +src_refactor_writeucs2_and_remove_flags_argument.patch +src_use_string_writev2_in_twobytevalue.patch +node-api_use_writev2_in_napi_get_value_string_utf16.patch +node-api_use_writeonebytev2_in_napi_get_value_string_latin1.patch +src_migrate_writeonebyte_to_writeonebytev2.patch diff --git a/patches/node/node-api_use_writeonebytev2_in_napi_get_value_string_latin1.patch b/patches/node/node-api_use_writeonebytev2_in_napi_get_value_string_latin1.patch new file mode 100644 index 0000000000000..262e000823261 --- /dev/null +++ b/patches/node/node-api_use_writeonebytev2_in_napi_get_value_string_latin1.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Chengzhong Wu <cwu631@bloomberg.net> +Date: Fri, 16 May 2025 17:10:54 +0100 +Subject: node-api: use WriteOneByteV2 in napi_get_value_string_latin1 + +PR-URL: https://github.com/nodejs/node/pull/58325 +Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> +Reviewed-By: Michael Dawson <midawson@redhat.com> + +diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc +index cc2312bd2fd1ed194f927bbf33951ca0548d1a31..e4fd88f406be4d9117aa490ca2aa328c5ff0aab9 100644 +--- a/src/js_native_api_v8.cc ++++ b/src/js_native_api_v8.cc +@@ -2441,21 +2441,21 @@ napi_status NAPI_CDECL napi_get_value_string_latin1( + + v8::Local<v8::Value> val = v8impl::V8LocalValueFromJsValue(value); + RETURN_STATUS_IF_FALSE(env, val->IsString(), napi_string_expected); ++ v8::Local<v8::String> str = val.As<v8::String>(); + + if (!buf) { + CHECK_ARG(env, result); +- *result = val.As<v8::String>()->Length(); ++ *result = str->Length(); + } else if (bufsize != 0) { +- int copied = +- val.As<v8::String>()->WriteOneByte(env->isolate, +- reinterpret_cast<uint8_t*>(buf), +- 0, +- bufsize - 1, +- v8::String::NO_NULL_TERMINATION); +- +- buf[copied] = '\0'; ++ uint32_t length = static_cast<uint32_t>( ++ std::min(bufsize - 1, static_cast<size_t>(str->Length()))); ++ str->WriteOneByteV2(env->isolate, ++ 0, ++ length, ++ reinterpret_cast<uint8_t*>(buf), ++ v8::String::WriteFlags::kNullTerminate); + if (result != nullptr) { +- *result = copied; ++ *result = length; + } + } else if (result != nullptr) { + *result = 0; +@@ -2479,12 +2479,12 @@ napi_status NAPI_CDECL napi_get_value_string_utf8( + + v8::Local<v8::Value> val = v8impl::V8LocalValueFromJsValue(value); + RETURN_STATUS_IF_FALSE(env, val->IsString(), napi_string_expected); ++ v8::Local<v8::String> str = val.As<v8::String>(); + + if (!buf) { + CHECK_ARG(env, result); +- *result = val.As<v8::String>()->Utf8LengthV2(env->isolate); ++ *result = str->Utf8LengthV2(env->isolate); + } else if (bufsize != 0) { +- auto str = val.As<v8::String>(); + size_t copied = + str->WriteUtf8V2(env->isolate, + buf, diff --git a/patches/node/node-api_use_writev2_in_napi_get_value_string_utf16.patch b/patches/node/node-api_use_writev2_in_napi_get_value_string_utf16.patch new file mode 100644 index 0000000000000..ecb6d83cf0624 --- /dev/null +++ b/patches/node/node-api_use_writev2_in_napi_get_value_string_utf16.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= <tniessen@tnie.de> +Date: Fri, 16 May 2025 17:10:45 +0100 +Subject: node-api: use WriteV2 in napi_get_value_string_utf16 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Since `String::Write()` is deprecated, use `String::Write2()` instead. +That requires us to compute the correct number of characters ahead of +time but removes the need for dealing with the return value. + +PR-URL: https://github.com/nodejs/node/pull/58165 +Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> +Reviewed-By: James M Snell <jasnell@gmail.com> +Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com> +Reviewed-By: Chengzhong Wu <legendecas@gmail.com> +Reviewed-By: Michael Dawson <midawson@redhat.com> + +diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc +index 8f97ca4d9cbb840efd36c77fed12d746a2793670..cc2312bd2fd1ed194f927bbf33951ca0548d1a31 100644 +--- a/src/js_native_api_v8.cc ++++ b/src/js_native_api_v8.cc +@@ -2520,21 +2520,23 @@ napi_status NAPI_CDECL napi_get_value_string_utf16(napi_env env, + + v8::Local<v8::Value> val = v8impl::V8LocalValueFromJsValue(value); + RETURN_STATUS_IF_FALSE(env, val->IsString(), napi_string_expected); ++ v8::Local<v8::String> str = val.As<v8::String>(); + + if (!buf) { + CHECK_ARG(env, result); + // V8 assumes UTF-16 length is the same as the number of characters. +- *result = val.As<v8::String>()->Length(); ++ *result = str->Length(); + } else if (bufsize != 0) { +- int copied = val.As<v8::String>()->Write(env->isolate, +- reinterpret_cast<uint16_t*>(buf), +- 0, +- bufsize - 1, +- v8::String::NO_NULL_TERMINATION); ++ uint32_t length = static_cast<uint32_t>( ++ std::min(bufsize - 1, static_cast<size_t>(str->Length()))); ++ str->WriteV2(env->isolate, ++ 0, ++ length, ++ reinterpret_cast<uint16_t*>(buf), ++ v8::String::WriteFlags::kNullTerminate); + +- buf[copied] = '\0'; + if (result != nullptr) { +- *result = copied; ++ *result = length; + } + } else if (result != nullptr) { + *result = 0; diff --git a/patches/node/src_improve_utf8_string_generation_performance.patch b/patches/node/src_improve_utf8_string_generation_performance.patch new file mode 100644 index 0000000000000..9fba676aef4fb --- /dev/null +++ b/patches/node/src_improve_utf8_string_generation_performance.patch @@ -0,0 +1,166 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Yagiz Nizipli <yagiz@nizipli.com> +Date: Mon, 16 Sep 2024 20:19:46 -0400 +Subject: src: improve utf8 string generation performance + +PR-URL: https://github.com/nodejs/node/pull/54873 +Reviewed-By: Daniel Lemire <daniel@lemire.me> +Reviewed-By: Matteo Collina <matteo.collina@gmail.com> +Reviewed-By: James M Snell <jasnell@gmail.com> +Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> + +diff --git a/src/string_bytes.cc b/src/string_bytes.cc +index f0fbf496dcfdec2c522508c61ae24fb20b1eb081..4324ed52d7cd6af5202512858a62346c3ab6c302 100644 +--- a/src/string_bytes.cc ++++ b/src/string_bytes.cc +@@ -386,21 +386,21 @@ Maybe<size_t> StringBytes::StorageSize(Isolate* isolate, + Local<Value> val, + enum encoding encoding) { + HandleScope scope(isolate); +- size_t data_size = 0; +- bool is_buffer = Buffer::HasInstance(val); + +- if (is_buffer && (encoding == BUFFER || encoding == LATIN1)) { ++ if (Buffer::HasInstance(val) && (encoding == BUFFER || encoding == LATIN1)) { + return Just(Buffer::Length(val)); + } + + Local<String> str; + if (!val->ToString(isolate->GetCurrentContext()).ToLocal(&str)) + return Nothing<size_t>(); ++ String::ValueView view(isolate, str); ++ size_t data_size = 0; + + switch (encoding) { + case ASCII: + case LATIN1: +- data_size = str->Length(); ++ data_size = view.length(); + break; + + case BUFFER: +@@ -408,25 +408,25 @@ Maybe<size_t> StringBytes::StorageSize(Isolate* isolate, + // A single UCS2 codepoint never takes up more than 3 utf8 bytes. + // It is an exercise for the caller to decide when a string is + // long enough to justify calling Size() instead of StorageSize() +- data_size = 3 * str->Length(); ++ data_size = 3 * view.length(); + break; + + case UCS2: +- data_size = str->Length() * sizeof(uint16_t); ++ data_size = view.length() * sizeof(uint16_t); + break; + + case BASE64URL: +- data_size = simdutf::base64_length_from_binary(str->Length(), ++ data_size = simdutf::base64_length_from_binary(view.length(), + simdutf::base64_url); + break; + + case BASE64: +- data_size = simdutf::base64_length_from_binary(str->Length()); ++ data_size = simdutf::base64_length_from_binary(view.length()); + break; + + case HEX: +- CHECK(str->Length() % 2 == 0 && "invalid hex string length"); +- data_size = str->Length() / 2; ++ CHECK(view.length() % 2 == 0 && "invalid hex string length"); ++ data_size = view.length() / 2; + break; + + default: +@@ -447,32 +447,36 @@ Maybe<size_t> StringBytes::Size(Isolate* isolate, + Local<String> str; + if (!val->ToString(isolate->GetCurrentContext()).ToLocal(&str)) + return Nothing<size_t>(); ++ String::ValueView view(isolate, str); + + switch (encoding) { + case ASCII: + case LATIN1: +- return Just<size_t>(str->Length()); ++ return Just<size_t>(view.length()); + + case BUFFER: + case UTF8: +- return Just<size_t>(str->Utf8Length(isolate)); ++ if (view.is_one_byte()) { ++ return Just<size_t>(simdutf::utf8_length_from_latin1( ++ reinterpret_cast<const char*>(view.data8()), view.length())); ++ } ++ return Just<size_t>(simdutf::utf8_length_from_utf16( ++ reinterpret_cast<const char16_t*>(view.data16()), view.length())); + + case UCS2: +- return Just(str->Length() * sizeof(uint16_t)); ++ return Just(view.length() * sizeof(uint16_t)); + + case BASE64URL: { +- String::Value value(isolate, str); +- return Just(simdutf::base64_length_from_binary(value.length(), ++ return Just(simdutf::base64_length_from_binary(view.length(), + simdutf::base64_url)); + } + + case BASE64: { +- String::Value value(isolate, str); +- return Just(simdutf::base64_length_from_binary(value.length())); ++ return Just(simdutf::base64_length_from_binary(view.length())); + } + + case HEX: +- return Just<size_t>(str->Length() / 2); ++ return Just<size_t>(view.length() / 2); + } + + UNREACHABLE(); +diff --git a/src/util.cc b/src/util.cc +index 1b38f22b930b77d80aa53f9b12299d3cc469a46d..03c4794314c1c228f95536d2d20a440061cf3a80 100644 +--- a/src/util.cc ++++ b/src/util.cc +@@ -48,6 +48,8 @@ + #include <sys/types.h> + #endif + ++#include <simdutf.h> ++ + #include <atomic> + #include <cstdio> + #include <cstring> +@@ -100,11 +102,31 @@ static void MakeUtf8String(Isolate* isolate, + MaybeStackBuffer<T>* target) { + Local<String> string; + if (!value->ToString(isolate->GetCurrentContext()).ToLocal(&string)) return; ++ String::ValueView value_view(isolate, string); ++ ++ auto value_length = value_view.length(); ++ ++ if (value_view.is_one_byte()) { ++ auto const_char = reinterpret_cast<const char*>(value_view.data8()); ++ auto expected_length = ++ target->capacity() < (static_cast<size_t>(value_length) * 2 + 1) ++ ? simdutf::utf8_length_from_latin1(const_char, value_length) ++ : value_length * 2; ++ ++ // Add +1 for null termination. ++ target->AllocateSufficientStorage(expected_length + 1); ++ const auto actual_length = simdutf::convert_latin1_to_utf8( ++ const_char, value_length, target->out()); ++ target->SetLengthAndZeroTerminate(actual_length); ++ return; ++ } + +- size_t storage; +- if (!StringBytes::StorageSize(isolate, string, UTF8).To(&storage)) return; +- storage += 1; ++ // Add +1 for null termination. ++ size_t storage = (3 * value_length) + 1; + target->AllocateSufficientStorage(storage); ++ ++ // TODO(@anonrig): Use simdutf to speed up non-one-byte strings once it's ++ // implemented + const int flags = + String::NO_NULL_TERMINATION | String::REPLACE_INVALID_UTF8; + const int length = diff --git a/patches/node/src_migrate_writeonebyte_to_writeonebytev2.patch b/patches/node/src_migrate_writeonebyte_to_writeonebytev2.patch new file mode 100644 index 0000000000000..b0267d9a85302 --- /dev/null +++ b/patches/node/src_migrate_writeonebyte_to_writeonebytev2.patch @@ -0,0 +1,276 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Chengzhong Wu <cwu631@bloomberg.net> +Date: Fri, 29 Aug 2025 23:41:00 +0100 +Subject: src: migrate WriteOneByte to WriteOneByteV2 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +PR-URL: https://github.com/nodejs/node/pull/59634 +Fixes: https://github.com/nodejs/node/issues/59555 +Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> +Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> +Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> +Reviewed-By: Darshan Sen <raisinten@gmail.com> +Reviewed-By: Matteo Collina <matteo.collina@gmail.com> + +diff --git a/src/node_buffer.cc b/src/node_buffer.cc +index ae73e6743879f32f08b4f6f8c546c587de71d2f3..be93e60f851c6c144fdd19f810e0a44cf3845bce 100644 +--- a/src/node_buffer.cc ++++ b/src/node_buffer.cc +@@ -1033,8 +1033,11 @@ void IndexOfString(const FunctionCallbackInfo<Value>& args) { + if (needle_data == nullptr) { + return args.GetReturnValue().Set(-1); + } +- needle->WriteOneByte( +- isolate, needle_data, 0, needle_length, String::NO_NULL_TERMINATION); ++ StringBytes::Write(isolate, ++ reinterpret_cast<char*>(needle_data), ++ needle_length, ++ needle, ++ enc); + + result = nbytes::SearchString(reinterpret_cast<const uint8_t*>(haystack), + haystack_length, +@@ -1288,11 +1291,7 @@ static void Btoa(const FunctionCallbackInfo<Value>& args) { + simdutf::binary_to_base64(ext->data(), ext->length(), buffer.out()); + } else if (input->IsOneByte()) { + MaybeStackBuffer<uint8_t> stack_buf(input->Length()); +- input->WriteOneByte(env->isolate(), +- stack_buf.out(), +- 0, +- input->Length(), +- String::NO_NULL_TERMINATION); ++ input->WriteOneByteV2(env->isolate(), 0, input->Length(), stack_buf.out()); + + size_t expected_length = + simdutf::base64_length_from_binary(input->Length()); +@@ -1348,11 +1347,8 @@ static void Atob(const FunctionCallbackInfo<Value>& args) { + ext->data(), ext->length(), buffer.out(), simdutf::base64_default); + } else if (input->IsOneByte()) { + MaybeStackBuffer<uint8_t> stack_buf(input->Length()); +- input->WriteOneByte(args.GetIsolate(), +- stack_buf.out(), +- 0, +- input->Length(), +- String::NO_NULL_TERMINATION); ++ input->WriteOneByteV2( ++ args.GetIsolate(), 0, input->Length(), stack_buf.out()); + const char* data = reinterpret_cast<const char*>(*stack_buf); + size_t expected_length = + simdutf::maximal_binary_length_from_base64(data, input->Length()); +diff --git a/src/node_http2.cc b/src/node_http2.cc +index 8237c9b7d325dd925ae8798d7795fcd94eeb13d0..27a0db87e1f7f75336ecaa044e7cd66a9a5e87a4 100644 +--- a/src/node_http2.cc ++++ b/src/node_http2.cc +@@ -485,13 +485,10 @@ Origins::Origins( + + CHECK_LE(origin_contents + origin_string_len, + static_cast<char*>(bs_->Data()) + bs_->ByteLength()); +- CHECK_EQ(origin_string->WriteOneByte( +- env->isolate(), +- reinterpret_cast<uint8_t*>(origin_contents), +- 0, +- origin_string_len, +- String::NO_NULL_TERMINATION), +- origin_string_len); ++ origin_string->WriteOneByteV2(env->isolate(), ++ 0, ++ origin_string_len, ++ reinterpret_cast<uint8_t*>(origin_contents)); + + size_t n = 0; + char* p; +@@ -3183,8 +3180,8 @@ void Http2Session::AltSvc(const FunctionCallbackInfo<Value>& args) { + if (origin_str.IsEmpty() || value_str.IsEmpty()) + return; + +- size_t origin_len = origin_str->Length(); +- size_t value_len = value_str->Length(); ++ int origin_len = origin_str->Length(); ++ int value_len = value_str->Length(); + + CHECK_LE(origin_len + value_len, 16382); // Max permitted for ALTSVC + // Verify that origin len != 0 if stream id == 0, or +@@ -3193,8 +3190,13 @@ void Http2Session::AltSvc(const FunctionCallbackInfo<Value>& args) { + + MaybeStackBuffer<uint8_t> origin(origin_len); + MaybeStackBuffer<uint8_t> value(value_len); +- origin_str->WriteOneByte(env->isolate(), *origin); +- value_str->WriteOneByte(env->isolate(), *value); ++ origin_str->WriteOneByteV2(env->isolate(), ++ 0, ++ origin_len, ++ *origin, ++ String::WriteFlags::kNullTerminate); ++ value_str->WriteOneByteV2( ++ env->isolate(), 0, value_len, *value, String::WriteFlags::kNullTerminate); + + session->AltSvc(id, *origin, origin_len, *value, value_len); + } +diff --git a/src/node_http_common-inl.h b/src/node_http_common-inl.h +index dba1a5e051b3e03c435ba3885b3fe2d04ea8ca9e..46984dba907fffb836d62b9c6e6b325a0ba504dd 100644 +--- a/src/node_http_common-inl.h ++++ b/src/node_http_common-inl.h +@@ -2,9 +2,11 @@ + #define SRC_NODE_HTTP_COMMON_INL_H_ + + #include "node_http_common.h" ++ ++#include "env-inl.h" + #include "node.h" + #include "node_mem-inl.h" +-#include "env-inl.h" ++#include "string_bytes.h" + #include "v8.h" + + #include <algorithm> +@@ -37,13 +39,12 @@ NgHeaders<T>::NgHeaders(Environment* env, v8::Local<v8::Array> headers) { + nv_t* const nva = reinterpret_cast<nv_t*>(start); + + CHECK_LE(header_contents + header_string_len, *buf_ + buf_.length()); +- CHECK_EQ(header_string.As<v8::String>()->WriteOneByte( +- env->isolate(), +- reinterpret_cast<uint8_t*>(header_contents), +- 0, +- header_string_len, +- v8::String::NO_NULL_TERMINATION), +- header_string_len); ++ CHECK_EQ(StringBytes::Write(env->isolate(), ++ header_contents, ++ header_string_len, ++ header_string.As<v8::String>(), ++ LATIN1), ++ static_cast<size_t>(header_string_len)); + + size_t n = 0; + char* p; +diff --git a/src/string_bytes.cc b/src/string_bytes.cc +index b02e9c5d14c2438d30b16f977c4e8a76bb23479d..71381f8fdc341cf2bac34028eb10df30fd9306b9 100644 +--- a/src/string_bytes.cc ++++ b/src/string_bytes.cc +@@ -249,11 +249,13 @@ size_t StringBytes::Write(Isolate* isolate, + nbytes = std::min(buflen, static_cast<size_t>(input_view.length())); + memcpy(buf, input_view.data8(), nbytes); + } else { +- uint8_t* const dst = reinterpret_cast<uint8_t*>(buf); +- const int flags = String::HINT_MANY_WRITES_EXPECTED | +- String::NO_NULL_TERMINATION | +- String::REPLACE_INVALID_UTF8; +- nbytes = str->WriteOneByte(isolate, dst, 0, buflen, flags); ++ nbytes = std::min(buflen, static_cast<size_t>(input_view.length())); ++ // Do not use v8::String::WriteOneByteV2 as it asserts the string to be ++ // a one byte string. For compatibility, convert the uint16_t to uint8_t ++ // even though this may loose accuracy. ++ for (size_t i = 0; i < nbytes; i++) { ++ buf[i] = static_cast<uint8_t>(input_view.data16()[i]); ++ } + } + break; + +diff --git a/test/cctest/test_string_bytes.cc b/test/cctest/test_string_bytes.cc +new file mode 100644 +index 0000000000000000000000000000000000000000..bc308918680bb153dbbda8b18dcb24d129f14833 +--- /dev/null ++++ b/test/cctest/test_string_bytes.cc +@@ -0,0 +1,100 @@ ++#include "gtest/gtest.h" ++#include "node.h" ++#include "node_test_fixture.h" ++#include "string_bytes.h" ++#include "util-inl.h" ++ ++using node::MaybeStackBuffer; ++using node::StringBytes; ++using v8::HandleScope; ++using v8::Local; ++using v8::Maybe; ++using v8::String; ++ ++class StringBytesTest : public EnvironmentTestFixture {}; ++ ++// Data "Hello, ÆÊÎÖÿ" ++static const char latin1_data[] = "Hello, \xC6\xCA\xCE\xD6\xFF"; ++static const char utf8_data[] = "Hello, ÆÊÎÖÿ"; ++ ++TEST_F(StringBytesTest, WriteLatin1WithOneByteString) { ++ const HandleScope handle_scope(isolate_); ++ const Argv argv; ++ Env env_{handle_scope, argv}; ++ ++ Local<String> one_byte_str = ++ String::NewFromOneByte(isolate_, ++ reinterpret_cast<const uint8_t*>(latin1_data)) ++ .ToLocalChecked(); ++ ++ Maybe<size_t> size_maybe = ++ StringBytes::StorageSize(isolate_, one_byte_str, node::LATIN1); ++ ++ ASSERT_TRUE(size_maybe.IsJust()); ++ size_t size = size_maybe.FromJust(); ++ ASSERT_EQ(size, 12u); ++ ++ MaybeStackBuffer<char> buf; ++ size_t written = StringBytes::Write( ++ isolate_, buf.out(), buf.capacity(), one_byte_str, node::LATIN1); ++ ASSERT_EQ(written, 12u); ++ ++ // Null-terminate the buffer and compare the contents. ++ buf.SetLength(13); ++ buf[12] = '\0'; ++ ASSERT_STREQ(latin1_data, buf.out()); ++} ++ ++TEST_F(StringBytesTest, WriteLatin1WithUtf8String) { ++ const HandleScope handle_scope(isolate_); ++ const Argv argv; ++ Env env_{handle_scope, argv}; ++ ++ Local<String> utf8_str = ++ String::NewFromUtf8(isolate_, utf8_data).ToLocalChecked(); ++ ++ Maybe<size_t> size_maybe = ++ StringBytes::StorageSize(isolate_, utf8_str, node::LATIN1); ++ ++ ASSERT_TRUE(size_maybe.IsJust()); ++ size_t size = size_maybe.FromJust(); ++ ASSERT_EQ(size, 12u); ++ ++ MaybeStackBuffer<char> buf; ++ size_t written = StringBytes::Write( ++ isolate_, buf.out(), buf.capacity(), utf8_str, node::LATIN1); ++ ASSERT_EQ(written, 12u); ++ ++ // Null-terminate the buffer and compare the contents. ++ buf.SetLength(13); ++ buf[12] = '\0'; ++ ASSERT_STREQ(latin1_data, buf.out()); ++} ++ ++// Verify that StringBytes::Write converts two-byte characters to one-byte ++// characters, even if there is no valid one-byte representation. ++TEST_F(StringBytesTest, WriteLatin1WithInvalidChar) { ++ const HandleScope handle_scope(isolate_); ++ const Argv argv; ++ Env env_{handle_scope, argv}; ++ ++ Local<String> utf8_str = ++ String::NewFromUtf8(isolate_, "Hello, 世界").ToLocalChecked(); ++ ++ Maybe<size_t> size_maybe = ++ StringBytes::StorageSize(isolate_, utf8_str, node::LATIN1); ++ ++ ASSERT_TRUE(size_maybe.IsJust()); ++ size_t size = size_maybe.FromJust(); ++ ASSERT_EQ(size, 9u); ++ ++ MaybeStackBuffer<char> buf; ++ size_t written = StringBytes::Write( ++ isolate_, buf.out(), buf.capacity(), utf8_str, node::LATIN1); ++ ASSERT_EQ(written, 9u); ++ ++ // Null-terminate the buffer and compare the contents. ++ buf.SetLength(10); ++ buf[9] = '\0'; ++ ASSERT_STREQ("Hello, \x16\x4C", buf.out()); ++} diff --git a/patches/node/src_refactor_writeucs2_and_remove_flags_argument.patch b/patches/node/src_refactor_writeucs2_and_remove_flags_argument.patch new file mode 100644 index 0000000000000..28eee21c9094f --- /dev/null +++ b/patches/node/src_refactor_writeucs2_and_remove_flags_argument.patch @@ -0,0 +1,140 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= <tniessen@tnie.de> +Date: Thu, 8 May 2025 13:55:26 +0100 +Subject: src: refactor WriteUCS2 and remove flags argument +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This change refactors `StringBytes::WriteUCS2()` in multiple ways. + +The `flags` argument being passed to `WriteUCS2()` is not useful: the +only really relevant flag is `NO_NULL_TERMINATION` since V8 ignores +`REPLACE_INVALID_UTF8`, `HINT_MANY_WRITES_EXPECTED`, and +`PRESERVE_ONE_BYTE_NULL` for UTF-16 strings. However, `WriteUCS2()` +might not null-terminate the result correctly regardless of whether +`NO_NULL_TERMINATION` is set because it makes multiple calls to +`String::Write()` internally. For these reasons, this patch removes the +`flags` argument entirely and always assumes `NO_NULL_TERMINATION`. + +Next, this patch replaces the calls to the deprecated function +`String::Write()` with calls to the new function `String::WriteV2()`, +which always succeeds and always writes a predictable number of +characters, removing the need to deal with a return value here. + +Lastly, this patch simplifies the implementation of `WriteUCS2()` and +computes the exact number of characters `nchars` from the beginning, +removing the need to later check again if the number of characters is +zero. + +PR-URL: https://github.com/nodejs/node/pull/58163 +Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> +Reviewed-By: James M Snell <jasnell@gmail.com> + +diff --git a/src/string_bytes.cc b/src/string_bytes.cc +index 0eb9b1967f1f185a140239924809468394297d58..b02e9c5d14c2438d30b16f977c4e8a76bb23479d 100644 +--- a/src/string_bytes.cc ++++ b/src/string_bytes.cc +@@ -198,40 +198,34 @@ MaybeLocal<Value> ExternTwoByteString::NewSimpleFromCopy(Isolate* isolate, + + } // anonymous namespace + +-size_t StringBytes::WriteUCS2( +- Isolate* isolate, char* buf, size_t buflen, Local<String> str, int flags) { ++size_t StringBytes::WriteUCS2(Isolate* isolate, ++ char* buf, ++ size_t buflen, ++ Local<String> str) { + uint16_t* const dst = reinterpret_cast<uint16_t*>(buf); + +- size_t max_chars = buflen / sizeof(*dst); +- if (max_chars == 0) { ++ const size_t max_chars = buflen / sizeof(*dst); ++ const size_t nchars = std::min(max_chars, static_cast<size_t>(str->Length())); ++ if (nchars == 0) { + return 0; + } + + uint16_t* const aligned_dst = nbytes::AlignUp(dst, sizeof(*dst)); +- size_t nchars; ++ CHECK_EQ(reinterpret_cast<uintptr_t>(aligned_dst) % sizeof(*dst), 0); + if (aligned_dst == dst) { +- nchars = str->Write(isolate, dst, 0, max_chars, flags); +- return nchars * sizeof(*dst); +- } ++ str->WriteV2(isolate, 0, nchars, dst); ++ } else { ++ // Write all but the last char. ++ str->WriteV2(isolate, 0, nchars - 1, aligned_dst); + +- CHECK_EQ(reinterpret_cast<uintptr_t>(aligned_dst) % sizeof(*dst), 0); ++ // Shift everything to unaligned-left. ++ memmove(dst, aligned_dst, (nchars - 1) * sizeof(*dst)); + +- // Write all but the last char +- max_chars = std::min(max_chars, static_cast<size_t>(str->Length())); +- if (max_chars == 0) { +- return 0; ++ // One more char to be written. ++ uint16_t last; ++ str->WriteV2(isolate, nchars - 1, 1, &last); ++ memcpy(dst + nchars - 1, &last, sizeof(last)); + } +- nchars = str->Write(isolate, aligned_dst, 0, max_chars - 1, flags); +- CHECK_EQ(nchars, max_chars - 1); +- +- // Shift everything to unaligned-left +- memmove(dst, aligned_dst, nchars * sizeof(*dst)); +- +- // One more char to be written +- uint16_t last; +- CHECK_EQ(str->Write(isolate, &last, nchars, 1, flags), 1); +- memcpy(buf + nchars * sizeof(*dst), &last, sizeof(last)); +- nchars++; + + return nchars * sizeof(*dst); + } +@@ -248,10 +242,6 @@ size_t StringBytes::Write(Isolate* isolate, + Local<String> str = val.As<String>(); + String::ValueView input_view(isolate, str); + +- int flags = String::HINT_MANY_WRITES_EXPECTED | +- String::NO_NULL_TERMINATION | +- String::REPLACE_INVALID_UTF8; +- + switch (encoding) { + case ASCII: + case LATIN1: +@@ -260,6 +250,9 @@ size_t StringBytes::Write(Isolate* isolate, + memcpy(buf, input_view.data8(), nbytes); + } else { + uint8_t* const dst = reinterpret_cast<uint8_t*>(buf); ++ const int flags = String::HINT_MANY_WRITES_EXPECTED | ++ String::NO_NULL_TERMINATION | ++ String::REPLACE_INVALID_UTF8; + nbytes = str->WriteOneByte(isolate, dst, 0, buflen, flags); + } + break; +@@ -271,7 +264,7 @@ size_t StringBytes::Write(Isolate* isolate, + break; + + case UCS2: { +- nbytes = WriteUCS2(isolate, buf, buflen, str, flags); ++ nbytes = WriteUCS2(isolate, buf, buflen, str); + + // Node's "ucs2" encoding wants LE character data stored in + // the Buffer, so we need to reorder on BE platforms. See +diff --git a/src/string_bytes.h b/src/string_bytes.h +index 53bc003fbda43663d6b8619672b23803fc88deb6..2a916b1c6a03b53c15e96e050dfa5711caaa07e2 100644 +--- a/src/string_bytes.h ++++ b/src/string_bytes.h +@@ -102,8 +102,7 @@ class StringBytes { + static size_t WriteUCS2(v8::Isolate* isolate, + char* buf, + size_t buflen, +- v8::Local<v8::String> str, +- int flags); ++ v8::Local<v8::String> str); + }; + + } // namespace node diff --git a/patches/node/src_simplify_string_bytes_with_views.patch b/patches/node/src_simplify_string_bytes_with_views.patch new file mode 100644 index 0000000000000..0e326633751e1 --- /dev/null +++ b/patches/node/src_simplify_string_bytes_with_views.patch @@ -0,0 +1,150 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Daniel Lemire <daniel@lemire.me> +Date: Thu, 12 Sep 2024 12:07:08 -0400 +Subject: src: simplify string_bytes with views + +PR-URL: https://github.com/nodejs/node/pull/54876 +Reviewed-By: James M Snell <jasnell@gmail.com> +Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> +Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> + +diff --git a/src/string_bytes.cc b/src/string_bytes.cc +index addb7e21ba6a3bbabf3ff5f32240a5e428d176ee..f0fbf496dcfdec2c522508c61ae24fb20b1eb081 100644 +--- a/src/string_bytes.cc ++++ b/src/string_bytes.cc +@@ -246,6 +246,7 @@ size_t StringBytes::Write(Isolate* isolate, + + CHECK(val->IsString() == true); + Local<String> str = val.As<String>(); ++ String::ValueView input_view(isolate, str); + + int flags = String::HINT_MANY_WRITES_EXPECTED | + String::NO_NULL_TERMINATION | +@@ -254,10 +255,9 @@ size_t StringBytes::Write(Isolate* isolate, + switch (encoding) { + case ASCII: + case LATIN1: +- if (str->IsExternalOneByte()) { +- auto ext = str->GetExternalOneByteStringResource(); +- nbytes = std::min(buflen, ext->length()); +- memcpy(buf, ext->data(), nbytes); ++ if (input_view.is_one_byte()) { ++ nbytes = std::min(buflen, static_cast<size_t>(input_view.length())); ++ memcpy(buf, input_view.data8(), nbytes); + } else { + uint8_t* const dst = reinterpret_cast<uint8_t*>(buf); + nbytes = str->WriteOneByte(isolate, dst, 0, buflen, flags); +@@ -282,31 +282,11 @@ size_t StringBytes::Write(Isolate* isolate, + } + + case BASE64URL: +- if (str->IsExternalOneByte()) { // 8-bit case +- auto ext = str->GetExternalOneByteStringResource(); ++ if (input_view.is_one_byte()) { // 8-bit case + size_t written_len = buflen; + auto result = simdutf::base64_to_binary_safe( +- ext->data(), ext->length(), buf, written_len, simdutf::base64_url); +- if (result.error == simdutf::error_code::SUCCESS) { +- nbytes = written_len; +- } else { +- // The input does not follow the WHATWG forgiving-base64 specification +- // adapted for base64url +- // https://infra.spec.whatwg.org/#forgiving-base64-decode +- nbytes = +- nbytes::Base64Decode(buf, buflen, ext->data(), ext->length()); +- } +- } else if (str->IsOneByte()) { +- MaybeStackBuffer<uint8_t> stack_buf(str->Length()); +- str->WriteOneByte(isolate, +- stack_buf.out(), +- 0, +- str->Length(), +- String::NO_NULL_TERMINATION); +- size_t written_len = buflen; +- auto result = simdutf::base64_to_binary_safe( +- reinterpret_cast<const char*>(*stack_buf), +- stack_buf.length(), ++ reinterpret_cast<const char*>(input_view.data8()), ++ input_view.length(), + buf, + written_len, + simdutf::base64_url); +@@ -316,8 +296,11 @@ size_t StringBytes::Write(Isolate* isolate, + // The input does not follow the WHATWG forgiving-base64 specification + // (adapted for base64url with + and / replaced by - and _). + // https://infra.spec.whatwg.org/#forgiving-base64-decode +- nbytes = +- nbytes::Base64Decode(buf, buflen, *stack_buf, stack_buf.length()); ++ nbytes = nbytes::Base64Decode( ++ buf, ++ buflen, ++ reinterpret_cast<const char*>(input_view.data8()), ++ input_view.length()); + } + } else { + String::Value value(isolate, str); +@@ -340,40 +323,23 @@ size_t StringBytes::Write(Isolate* isolate, + break; + + case BASE64: { +- if (str->IsExternalOneByte()) { // 8-bit case +- auto ext = str->GetExternalOneByteStringResource(); ++ if (input_view.is_one_byte()) { // 8-bit case + size_t written_len = buflen; + auto result = simdutf::base64_to_binary_safe( +- ext->data(), ext->length(), buf, written_len); +- if (result.error == simdutf::error_code::SUCCESS) { +- nbytes = written_len; +- } else { +- // The input does not follow the WHATWG forgiving-base64 specification +- // https://infra.spec.whatwg.org/#forgiving-base64-decode +- nbytes = +- nbytes::Base64Decode(buf, buflen, ext->data(), ext->length()); +- } +- } else if (str->IsOneByte()) { +- MaybeStackBuffer<uint8_t> stack_buf(str->Length()); +- str->WriteOneByte(isolate, +- stack_buf.out(), +- 0, +- str->Length(), +- String::NO_NULL_TERMINATION); +- size_t written_len = buflen; +- auto result = simdutf::base64_to_binary_safe( +- reinterpret_cast<const char*>(*stack_buf), +- stack_buf.length(), ++ reinterpret_cast<const char*>(input_view.data8()), ++ input_view.length(), + buf, + written_len); + if (result.error == simdutf::error_code::SUCCESS) { + nbytes = written_len; + } else { + // The input does not follow the WHATWG forgiving-base64 specification +- // (adapted for base64url with + and / replaced by - and _). + // https://infra.spec.whatwg.org/#forgiving-base64-decode +- nbytes = +- nbytes::Base64Decode(buf, buflen, *stack_buf, stack_buf.length()); ++ nbytes = nbytes::Base64Decode( ++ buf, ++ buflen, ++ reinterpret_cast<const char*>(input_view.data8()), ++ input_view.length()); + } + } else { + String::Value value(isolate, str); +@@ -394,9 +360,12 @@ size_t StringBytes::Write(Isolate* isolate, + break; + } + case HEX: +- if (str->IsExternalOneByte()) { +- auto ext = str->GetExternalOneByteStringResource(); +- nbytes = nbytes::HexDecode(buf, buflen, ext->data(), ext->length()); ++ if (input_view.is_one_byte()) { ++ nbytes = ++ nbytes::HexDecode(buf, ++ buflen, ++ reinterpret_cast<const char*>(input_view.data8()), ++ input_view.length()); + } else { + String::Value value(isolate, str); + nbytes = nbytes::HexDecode(buf, buflen, *value, value.length()); diff --git a/patches/node/src_use_non-deprecated_utf8lengthv2_method.patch b/patches/node/src_use_non-deprecated_utf8lengthv2_method.patch new file mode 100644 index 0000000000000..1a6455865e2a1 --- /dev/null +++ b/patches/node/src_use_non-deprecated_utf8lengthv2_method.patch @@ -0,0 +1,87 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Yagiz Nizipli <yagiz@nizipli.com> +Date: Thu, 17 Apr 2025 10:57:40 -0400 +Subject: src: use non-deprecated Utf8LengthV2() method + +PR-URL: https://github.com/nodejs/node/pull/58070 +Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> +Reviewed-By: Darshan Sen <raisinten@gmail.com> +Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> +Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> + +diff --git a/benchmark/napi/function_args/binding.cc b/benchmark/napi/function_args/binding.cc +index 078fe0ee3ea767616e7b938fe4a2fb8d6a2b8d6e..e7c3cb40586ce9f99a57f3d26944e03738bdbabd 100644 +--- a/benchmark/napi/function_args/binding.cc ++++ b/benchmark/napi/function_args/binding.cc +@@ -21,7 +21,7 @@ void CallWithString(const FunctionCallbackInfo<Value>& args) { + assert(args.Length() == 1 && args[0]->IsString()); + if (args.Length() == 1 && args[0]->IsString()) { + Local<String> str = args[0].As<String>(); +- const int32_t length = str->Utf8Length(args.GetIsolate()) + 1; ++ const size_t length = str->Utf8LengthV2(args.GetIsolate()) + 1; + char* buf = new char[length]; + str->WriteUtf8(args.GetIsolate(), buf, length); + delete[] buf; +diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc +index 7eea2eaefcad5780663a6b87985925ae5d70a5f9..b9a7710ef3cc516ff89aee0da0a8f142507605e3 100644 +--- a/src/crypto/crypto_util.cc ++++ b/src/crypto/crypto_util.cc +@@ -445,7 +445,7 @@ ByteSource ByteSource::FromStringOrBuffer(Environment* env, + ByteSource ByteSource::FromString(Environment* env, Local<String> str, + bool ntc) { + CHECK(str->IsString()); +- size_t size = str->Utf8Length(env->isolate()); ++ size_t size = str->Utf8LengthV2(env->isolate()); + size_t alloc_size = ntc ? size + 1 : size; + ByteSource::Builder out(alloc_size); + int opts = String::NO_OPTIONS; +diff --git a/src/encoding_binding.cc b/src/encoding_binding.cc +index 5ace688bb7ffc86eedf5aff11ab0ab487ad9440e..2d45bbe60f413121b3fd0f01802aeb4368f0c301 100644 +--- a/src/encoding_binding.cc ++++ b/src/encoding_binding.cc +@@ -119,7 +119,7 @@ void BindingData::EncodeUtf8String(const FunctionCallbackInfo<Value>& args) { + CHECK(args[0]->IsString()); + + Local<String> str = args[0].As<String>(); +- size_t length = str->Utf8Length(isolate); ++ size_t length = str->Utf8LengthV2(isolate); + + Local<ArrayBuffer> ab; + { +diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc +index 6e1680a74e21240ab99be86dcf23e60a05174888..a84fdae795dc1cb367a2e446264575c550ce07ee 100644 +--- a/src/js_native_api_v8.cc ++++ b/src/js_native_api_v8.cc +@@ -2482,7 +2482,7 @@ napi_status NAPI_CDECL napi_get_value_string_utf8( + + if (!buf) { + CHECK_ARG(env, result); +- *result = val.As<v8::String>()->Utf8Length(env->isolate); ++ *result = val.As<v8::String>()->Utf8LengthV2(env->isolate); + } else if (bufsize != 0) { + int copied = val.As<v8::String>()->WriteUtf8( + env->isolate, +diff --git a/src/node_buffer.cc b/src/node_buffer.cc +index 15129e4455fdc8792f21511a04d534ba3a4ebb5f..ae73e6743879f32f08b4f6f8c546c587de71d2f3 100644 +--- a/src/node_buffer.cc ++++ b/src/node_buffer.cc +@@ -662,7 +662,7 @@ void Fill(const FunctionCallbackInfo<Value>& args) { + // Can't use StringBytes::Write() in all cases. For example if attempting + // to write a two byte character into a one byte Buffer. + if (enc == UTF8) { +- str_length = str_obj->Utf8Length(env->isolate()); ++ str_length = str_obj->Utf8LengthV2(env->isolate()); + node::Utf8Value str(env->isolate(), args[1]); + memcpy(ts_obj_data + start, *str, std::min(str_length, fill_length)); + +@@ -750,8 +750,8 @@ void SlowByteLengthUtf8(const FunctionCallbackInfo<Value>& args) { + CHECK(args[0]->IsString()); + + // Fast case: avoid StringBytes on UTF8 string. Jump to v8. +- args.GetReturnValue().Set( +- args[0].As<String>()->Utf8Length(args.GetIsolate())); ++ size_t result = args[0].As<String>()->Utf8LengthV2(args.GetIsolate()); ++ args.GetReturnValue().Set(static_cast<uint64_t>(result)); + } + + uint32_t FastByteLengthUtf8(Local<Value> receiver, diff --git a/patches/node/src_use_non-deprecated_writeutf8v2_method.patch b/patches/node/src_use_non-deprecated_writeutf8v2_method.patch new file mode 100644 index 0000000000000..0dd5b3e13d1d4 --- /dev/null +++ b/patches/node/src_use_non-deprecated_writeutf8v2_method.patch @@ -0,0 +1,138 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Yagiz Nizipli <yagiz@nizipli.com> +Date: Thu, 17 Apr 2025 11:36:25 -0400 +Subject: src: use non-deprecated WriteUtf8V2() method + +PR-URL: https://github.com/nodejs/node/pull/58070 +Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> +Reviewed-By: Darshan Sen <raisinten@gmail.com> +Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> +Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> + +diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc +index b9a7710ef3cc516ff89aee0da0a8f142507605e3..73bfa6ac5e6e2b837b1bbc4a6d5f337fc0b79913 100644 +--- a/src/crypto/crypto_util.cc ++++ b/src/crypto/crypto_util.cc +@@ -29,6 +29,7 @@ namespace node { + using ncrypto::BignumPointer; + using ncrypto::BIOPointer; + using ncrypto::CryptoErrorList; ++using ncrypto::DataPointer; + #ifndef OPENSSL_NO_ENGINE + using ncrypto::EnginePointer; + #endif // !OPENSSL_NO_ENGINE +@@ -447,11 +448,12 @@ ByteSource ByteSource::FromString(Environment* env, Local<String> str, + CHECK(str->IsString()); + size_t size = str->Utf8LengthV2(env->isolate()); + size_t alloc_size = ntc ? size + 1 : size; +- ByteSource::Builder out(alloc_size); +- int opts = String::NO_OPTIONS; +- if (!ntc) opts |= String::NO_NULL_TERMINATION; +- str->WriteUtf8(env->isolate(), out.data<char>(), alloc_size, nullptr, opts); +- return std::move(out).release(); ++ auto out = DataPointer::Alloc(alloc_size); ++ int flags = String::WriteFlags::kNone; ++ if (ntc) flags |= String::WriteFlags::kNullTerminate; ++ str->WriteUtf8V2( ++ env->isolate(), static_cast<char*>(out.get()), alloc_size, flags); ++ return ByteSource::Allocated(out.release()); + } + + ByteSource ByteSource::FromBuffer(Local<Value> buffer, bool ntc) { +diff --git a/src/encoding_binding.cc b/src/encoding_binding.cc +index 2d45bbe60f413121b3fd0f01802aeb4368f0c301..2af83e27f77f9afe2f725338b04061efbf0960a1 100644 +--- a/src/encoding_binding.cc ++++ b/src/encoding_binding.cc +@@ -98,13 +98,12 @@ void BindingData::EncodeInto(const FunctionCallbackInfo<Value>& args) { + char* write_result = static_cast<char*>(buf->Data()) + dest->ByteOffset(); + size_t dest_length = dest->ByteLength(); + +- int nchars; +- int written = source->WriteUtf8( +- isolate, +- write_result, +- dest_length, +- &nchars, +- String::NO_NULL_TERMINATION | String::REPLACE_INVALID_UTF8); ++ size_t nchars; ++ size_t written = source->WriteUtf8V2(isolate, ++ write_result, ++ dest_length, ++ String::WriteFlags::kReplaceInvalidUtf8, ++ &nchars); + + binding_data->encode_into_results_buffer_[0] = nchars; + binding_data->encode_into_results_buffer_[1] = written; +@@ -129,11 +128,11 @@ void BindingData::EncodeUtf8String(const FunctionCallbackInfo<Value>& args) { + + CHECK(bs); + +- str->WriteUtf8(isolate, +- static_cast<char*>(bs->Data()), +- -1, // We are certain that `data` is sufficiently large +- nullptr, +- String::NO_NULL_TERMINATION | String::REPLACE_INVALID_UTF8); ++ // We are certain that `data` is sufficiently large ++ str->WriteUtf8V2(isolate, ++ static_cast<char*>(bs->Data()), ++ bs->MaxByteLength(), ++ String::WriteFlags::kReplaceInvalidUtf8); + + ab = ArrayBuffer::New(isolate, std::move(bs)); + } +diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc +index a84fdae795dc1cb367a2e446264575c550ce07ee..8f97ca4d9cbb840efd36c77fed12d746a2793670 100644 +--- a/src/js_native_api_v8.cc ++++ b/src/js_native_api_v8.cc +@@ -2484,12 +2484,12 @@ napi_status NAPI_CDECL napi_get_value_string_utf8( + CHECK_ARG(env, result); + *result = val.As<v8::String>()->Utf8LengthV2(env->isolate); + } else if (bufsize != 0) { +- int copied = val.As<v8::String>()->WriteUtf8( +- env->isolate, +- buf, +- bufsize - 1, +- nullptr, +- v8::String::REPLACE_INVALID_UTF8 | v8::String::NO_NULL_TERMINATION); ++ auto str = val.As<v8::String>(); ++ size_t copied = ++ str->WriteUtf8V2(env->isolate, ++ buf, ++ bufsize - 1, ++ v8::String::WriteFlags::kReplaceInvalidUtf8); + + buf[copied] = '\0'; + if (result != nullptr) { +diff --git a/src/string_bytes.cc b/src/string_bytes.cc +index 4324ed52d7cd6af5202512858a62346c3ab6c302..0eb9b1967f1f185a140239924809468394297d58 100644 +--- a/src/string_bytes.cc ++++ b/src/string_bytes.cc +@@ -266,7 +266,8 @@ size_t StringBytes::Write(Isolate* isolate, + + case BUFFER: + case UTF8: +- nbytes = str->WriteUtf8(isolate, buf, buflen, nullptr, flags); ++ nbytes = str->WriteUtf8V2( ++ isolate, buf, buflen, String::WriteFlags::kReplaceInvalidUtf8); + break; + + case UCS2: { +diff --git a/src/util.cc b/src/util.cc +index 03c4794314c1c228f95536d2d20a440061cf3a80..e616e11107555f0613cb631e3b4320fc281441fa 100644 +--- a/src/util.cc ++++ b/src/util.cc +@@ -125,12 +125,8 @@ static void MakeUtf8String(Isolate* isolate, + size_t storage = (3 * value_length) + 1; + target->AllocateSufficientStorage(storage); + +- // TODO(@anonrig): Use simdutf to speed up non-one-byte strings once it's +- // implemented +- const int flags = +- String::NO_NULL_TERMINATION | String::REPLACE_INVALID_UTF8; +- const int length = +- string->WriteUtf8(isolate, target->out(), storage, nullptr, flags); ++ size_t length = string->WriteUtf8V2( ++ isolate, target->out(), storage, String::WriteFlags::kReplaceInvalidUtf8); + target->SetLengthAndZeroTerminate(length); + } + diff --git a/patches/node/src_use_string_writev2_in_twobytevalue.patch b/patches/node/src_use_string_writev2_in_twobytevalue.patch new file mode 100644 index 0000000000000..1f466dffbc585 --- /dev/null +++ b/patches/node/src_use_string_writev2_in_twobytevalue.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= <tniessen@tnie.de> +Date: Fri, 9 May 2025 04:15:47 +0100 +Subject: src: use String::WriteV2() in TwoByteValue +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Since `String::Write()` is deprecated, use `String::WriteV2()` instead. + +PR-URL: https://github.com/nodejs/node/pull/58164 +Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> +Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> +Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> +Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> +Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> +Reviewed-By: James M Snell <jasnell@gmail.com> + +diff --git a/src/util.cc b/src/util.cc +index e616e11107555f0613cb631e3b4320fc281441fa..c5c2b89dc3fc008114b2492d1e16928428f097b4 100644 +--- a/src/util.cc ++++ b/src/util.cc +@@ -146,12 +146,10 @@ TwoByteValue::TwoByteValue(Isolate* isolate, Local<Value> value) { + Local<String> string; + if (!value->ToString(isolate->GetCurrentContext()).ToLocal(&string)) return; + +- // Allocate enough space to include the null terminator +- const size_t storage = string->Length() + 1; +- AllocateSufficientStorage(storage); +- +- const int flags = String::NO_NULL_TERMINATION; +- const int length = string->Write(isolate, out(), 0, storage, flags); ++ // Allocate enough space to include the null terminator. ++ const size_t length = string->Length(); ++ AllocateSufficientStorage(length + 1); ++ string->WriteV2(isolate, 0, length, out()); + SetLengthAndZeroTerminate(length); + } + diff --git a/patches/webrtc/fix_handle_pipewire_capturer_initialization_and_management.patch b/patches/webrtc/fix_handle_pipewire_capturer_initialization_and_management.patch index 231491f4167bb..4ea2687bb14a8 100644 --- a/patches/webrtc/fix_handle_pipewire_capturer_initialization_and_management.patch +++ b/patches/webrtc/fix_handle_pipewire_capturer_initialization_and_management.patch @@ -36,10 +36,10 @@ for desktop capturer. This change re-enables that fallback, which was previously default behavior. diff --git a/modules/desktop_capture/desktop_capturer.cc b/modules/desktop_capture/desktop_capturer.cc -index ae9aba26ee56e8a0d48f81994f964b278c9019d3..758f1b44e01adb6807bc7c5f673d06fffbac5865 100644 +index bf63f73178688e49286bb6686d5a42ce040c663e..f5f62a2b7865d8415ec08242312df006bcb2edf5 100644 --- a/modules/desktop_capture/desktop_capturer.cc +++ b/modules/desktop_capture/desktop_capturer.cc -@@ -123,7 +123,7 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateGenericCapturer( +@@ -138,7 +138,7 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateGenericCapturer( std::unique_ptr<DesktopCapturer> capturer; #if defined(WEBRTC_USE_PIPEWIRE) @@ -61,10 +61,10 @@ index 361b465dad2a53f4dac774fa2d6d6d9e3fc5fc31..ef05a35bc4f2c2352b12c0af0b09193b capturer_failed_ = true; } diff --git a/modules/desktop_capture/screen_capturer_linux.cc b/modules/desktop_capture/screen_capturer_linux.cc -index 94726750c5762e22b517445b23254513eb207aae..85946a6c7eef56a66c0ee2ec06bdc5f2ba49c53c 100644 +index f25e08fb594c563b1f8ca0fd1c4383ed39df5149..8ce6a9d82d808c1618b857ac83af85ac38a43a2a 100644 --- a/modules/desktop_capture/screen_capturer_linux.cc +++ b/modules/desktop_capture/screen_capturer_linux.cc -@@ -35,11 +35,10 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer( +@@ -39,11 +39,10 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer( #endif // defined(WEBRTC_USE_PIPEWIRE) #if defined(WEBRTC_USE_X11) @@ -80,10 +80,10 @@ index 94726750c5762e22b517445b23254513eb207aae..85946a6c7eef56a66c0ee2ec06bdc5f2 } // namespace webrtc diff --git a/modules/desktop_capture/window_capturer_linux.cc b/modules/desktop_capture/window_capturer_linux.cc -index f621a63e72131fd8426361a078a55d1e07c0e436..91394503da5e7f6d090e2eaede02316cf51ad7b2 100644 +index 87ea3d57212c5f62194f206787756b7f3fb63e90..3f565ab13a033dc29d55f819da7de464b6e19885 100644 --- a/modules/desktop_capture/window_capturer_linux.cc +++ b/modules/desktop_capture/window_capturer_linux.cc -@@ -35,11 +35,10 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer( +@@ -39,11 +39,10 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer( #endif // defined(WEBRTC_USE_PIPEWIRE) #if defined(WEBRTC_USE_X11) diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 14b2ee52e0da1..66736f3002a20 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -551,17 +551,17 @@ base::IDMap<WebContents*>& GetAllWebContents() { void OnCapturePageDone(gin_helper::Promise<gfx::Image> promise, base::ScopedClosureRunner capture_handle, - const SkBitmap& bitmap) { + const viz::CopyOutputBitmapWithMetadata& result) { auto ui_task_runner = content::GetUIThreadTaskRunner({}); if (!ui_task_runner->RunsTasksInCurrentSequence()) { ui_task_runner->PostTask( FROM_HERE, base::BindOnce(&OnCapturePageDone, std::move(promise), - std::move(capture_handle), bitmap)); + std::move(capture_handle), result)); return; } // Hack to enable transparency in captured image - promise.Resolve(gfx::Image::CreateFrom1xBitmap(bitmap)); + promise.Resolve(gfx::Image::CreateFrom1xBitmap(result.bitmap)); capture_handle.RunAndReset(); } diff --git a/shell/browser/browser_linux.cc b/shell/browser/browser_linux.cc index 03e1a9521c11d..56503dfe755ed 100644 --- a/shell/browser/browser_linux.cc +++ b/shell/browser/browser_linux.cc @@ -134,7 +134,7 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol, std::u16string Browser::GetApplicationNameForProtocol(const GURL& url) { const std::vector<std::string> argv = { "xdg-mime", "query", "default", - base::StrCat({"x-scheme-handler/", url.scheme_piece()})}; + base::StrCat({"x-scheme-handler/", url.scheme()})}; return base::ASCIIToUTF16(GetXdgAppOutput(argv).value_or(std::string())); } diff --git a/shell/browser/browser_win.cc b/shell/browser/browser_win.cc index bd9f5ea24e064..d640283b4b2ad 100644 --- a/shell/browser/browser_win.cc +++ b/shell/browser/browser_win.cc @@ -106,7 +106,7 @@ bool IsValidCustomProtocol(const std::wstring& scheme) { // (https://docs.microsoft.com/en-us/windows/win32/api/shlwapi/ne-shlwapi-assocstr) // and returns the application name, icon and path that handles the protocol. std::wstring GetAppInfoHelperForProtocol(ASSOCSTR assoc_str, const GURL& url) { - const std::wstring url_scheme = base::ASCIIToWide(url.scheme_piece()); + const std::wstring url_scheme = base::ASCIIToWide(url.scheme()); if (!IsValidCustomProtocol(url_scheme)) return {}; diff --git a/shell/browser/electron_web_ui_controller_factory.cc b/shell/browser/electron_web_ui_controller_factory.cc index d4b7d022e2aa3..6b5c4ff4e21e9 100644 --- a/shell/browser/electron_web_ui_controller_factory.cc +++ b/shell/browser/electron_web_ui_controller_factory.cc @@ -25,7 +25,7 @@ ElectronWebUIControllerFactory::~ElectronWebUIControllerFactory() = default; content::WebUI::TypeID ElectronWebUIControllerFactory::GetWebUIType( content::BrowserContext* browser_context, const GURL& url) { - if (const std::string_view host = url.host_piece(); + if (const std::string_view host = url.host(); host == chrome::kChromeUIDevToolsHost || host == chrome::kChromeUIAccessibilityHost) { return this; @@ -44,7 +44,7 @@ std::unique_ptr<content::WebUIController> ElectronWebUIControllerFactory::CreateWebUIControllerForURL( content::WebUI* web_ui, const GURL& url) { - const std::string_view host = url.host_piece(); + const std::string_view host = url.host(); if (host == chrome::kChromeUIDevToolsHost) { auto* browser_context = web_ui->GetWebContents()->GetBrowserContext(); diff --git a/shell/browser/extensions/api/tabs/tabs_api.cc b/shell/browser/extensions/api/tabs/tabs_api.cc index 010f7ae15521e..fb6b6c37b2383 100644 --- a/shell/browser/extensions/api/tabs/tabs_api.cc +++ b/shell/browser/extensions/api/tabs/tabs_api.cc @@ -510,7 +510,7 @@ bool IsKillURL(const GURL& url) { content::kChromeUIMemoryExhaustHost, }); - return kKillHosts.contains(url.host_piece()); + return kKillHosts.contains(url.host()); } GURL ResolvePossiblyRelativeURL(const std::string& url_string, diff --git a/shell/browser/net/proxying_url_loader_factory.cc b/shell/browser/net/proxying_url_loader_factory.cc index 1bbb15b669cfc..bb361278dfecf 100644 --- a/shell/browser/net/proxying_url_loader_factory.cc +++ b/shell/browser/net/proxying_url_loader_factory.cc @@ -797,7 +797,7 @@ void ProxyingURLLoaderFactory::CreateLoaderAndStart( bool bypass_custom_protocol_handlers = options & kBypassCustomProtocolHandlers; if (!bypass_custom_protocol_handlers) { - auto it = intercepted_handlers_->find(request.url.scheme_piece()); + auto it = intercepted_handlers_->find(request.url.scheme()); if (it != intercepted_handlers_->end()) { mojo::PendingRemote<network::mojom::URLLoaderFactory> loader_remote; this->Clone(loader_remote.InitWithNewPipeAndPassReceiver()); diff --git a/shell/browser/osr/osr_host_display_client.cc b/shell/browser/osr/osr_host_display_client.cc index 8f316f044919d..e2c41c8442be8 100644 --- a/shell/browser/osr/osr_host_display_client.cc +++ b/shell/browser/osr/osr_host_display_client.cc @@ -6,7 +6,7 @@ #include <utility> -#include "components/viz/common/resources/resource_sizes.h" +#include "components/viz/common/resources/shared_image_format_utils.h" #include "mojo/public/cpp/system/platform_handle.h" #include "skia/ext/platform_canvas.h" #include "third_party/skia/include/core/SkColor.h" @@ -39,11 +39,10 @@ void LayeredWindowUpdater::OnAllocatedSharedMemory( return; // Make sure |pixel_size| is sane. - size_t expected_bytes; - bool size_result = viz::ResourceSizes::MaybeSizeInBytes( - pixel_size, viz::SinglePlaneFormat::kRGBA_8888, &expected_bytes); - if (!size_result) + if (!SharedMemorySizeForSharedImageFormat(viz::SinglePlaneFormat::kRGBA_8888, + pixel_size)) { return; + } #if defined(WIN32) canvas_ = skia::CreatePlatformCanvasWithSharedSection( diff --git a/shell/browser/osr/osr_render_widget_host_view.cc b/shell/browser/osr/osr_render_widget_host_view.cc index 79b868c12a64e..ff2cd93c0c81b 100644 --- a/shell/browser/osr/osr_render_widget_host_view.cc +++ b/shell/browser/osr/osr_render_widget_host_view.cc @@ -489,7 +489,8 @@ uint32_t OffScreenRenderWidgetHostView::GetCaptureSequenceNumber() const { void OffScreenRenderWidgetHostView::CopyFromSurface( const gfx::Rect& src_rect, const gfx::Size& output_size, - base::OnceCallback<void(const SkBitmap&)> callback) { + base::OnceCallback<void(const viz::CopyOutputBitmapWithMetadata&)> + callback) { delegated_frame_host()->CopyFromCompositingSurface(src_rect, output_size, std::move(callback)); } diff --git a/shell/browser/osr/osr_render_widget_host_view.h b/shell/browser/osr/osr_render_widget_host_view.h index 92433ffa209cb..2ec006889a355 100644 --- a/shell/browser/osr/osr_render_widget_host_view.h +++ b/shell/browser/osr/osr_render_widget_host_view.h @@ -147,7 +147,8 @@ class OffScreenRenderWidgetHostView void CopyFromSurface( const gfx::Rect& src_rect, const gfx::Size& output_size, - base::OnceCallback<void(const SkBitmap&)> callback) override; + base::OnceCallback<void(const viz::CopyOutputBitmapWithMetadata&)> + callback) override; display::ScreenInfo GetScreenInfo() const override; void TransformPointToRootSurface(gfx::PointF* point) override {} gfx::Rect GetBoundsInRootWindow() override; diff --git a/shell/browser/ui/inspectable_web_contents.cc b/shell/browser/ui/inspectable_web_contents.cc index cad4af25589f6..18ae7c3f630cd 100644 --- a/shell/browser/ui/inspectable_web_contents.cc +++ b/shell/browser/ui/inspectable_web_contents.cc @@ -681,7 +681,7 @@ void InspectableWebContents::LoadNetworkResource(DispatchCallback callback, std::make_unique<network::WrapperPendingSharedURLLoaderFactory>( std::move(pending_remote))); } else if (const auto* const protocol_handler = - protocol_registry->FindRegistered(gurl.scheme_piece())) { + protocol_registry->FindRegistered(gurl.scheme())) { url_loader_factory = network::SharedURLLoaderFactory::Create( std::make_unique<network::WrapperPendingSharedURLLoaderFactory>( ElectronURLLoaderFactory::Create(protocol_handler->first, diff --git a/shell/common/api/electron_api_url_loader.cc b/shell/common/api/electron_api_url_loader.cc index 81084d9f1b7e8..7e7a7d04ef8e0 100644 --- a/shell/common/api/electron_api_url_loader.cc +++ b/shell/common/api/electron_api_url_loader.cc @@ -492,7 +492,7 @@ SimpleURLLoaderWrapper::GetURLLoaderFactoryForURL(const GURL& url) { // correctly intercept file:// scheme URLs. if (const bool bypass = request_options_ & kBypassCustomProtocolHandlers; !bypass) { - const std::string_view scheme = url.scheme_piece(); + const std::string_view scheme = url.scheme(); const auto* const protocol_registry = ProtocolRegistry::FromBrowserContext(browser_context_); diff --git a/shell/renderer/api/electron_api_web_frame.cc b/shell/renderer/api/electron_api_web_frame.cc index 5c700084c37d1..6ec272a600646 100644 --- a/shell/renderer/api/electron_api_web_frame.cc +++ b/shell/renderer/api/electron_api_web_frame.cc @@ -811,7 +811,7 @@ class WebFrameRenderer final void ClearCache(v8::Isolate* isolate) { blink::WebCache::Clear(); base::MemoryPressureListener::NotifyMemoryPressure( - base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL); + base::MEMORY_PRESSURE_LEVEL_CRITICAL); } v8::Local<v8::Value> FindFrameByToken(v8::Isolate* isolate, From 47ec145e22a850bb61e58217c9adc7e216cff343 Mon Sep 17 00:00:00 2001 From: Robo <nilay2014@gmail.com> Date: Thu, 16 Oct 2025 10:16:17 +0900 Subject: [PATCH 140/268] chore: update fix_harden_blink_scriptstate_maybefrom.patch (#48566) --- ...x_harden_blink_scriptstate_maybefrom.patch | 74 +++++++++++-------- 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch b/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch index c10564d736499..b58b7d49f5591 100644 --- a/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch +++ b/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch @@ -3,6 +3,9 @@ From: deepak1556 <hop2deep@gmail.com> Date: Wed, 28 Jun 2023 21:11:40 +0900 Subject: fix: harden blink::ScriptState::MaybeFrom +NOTE: since https://chromium-review.googlesource.com/c/chromium/src/+/6973697 +the patch is only needed for 32-bit builds. + This is needed as side effect of https://chromium-review.googlesource.com/c/chromium/src/+/4609446 which now gets blink::ExecutionContext from blink::ScriptState and there are isolate callbacks which get entered from Node.js @@ -53,73 +56,84 @@ index cecf528475cb832ed1876381878eade582bc83d6..71308b2d963c2d083328aad6be356dc5 enum EmbedderDataTag : uint16_t { diff --git a/third_party/blink/renderer/platform/bindings/script_state.cc b/third_party/blink/renderer/platform/bindings/script_state.cc -index 7c602990a3f9a3083308d282fe79bf858b642cdf..29222ecc17bf2e621c44f4b0f15a638326f3be38 100644 +index 7c602990a3f9a3083308d282fe79bf858b642cdf..f8ee61b8b2a45371d259717215a1fb4511514567 100644 --- a/third_party/blink/renderer/platform/bindings/script_state.cc +++ b/third_party/blink/renderer/platform/bindings/script_state.cc -@@ -14,6 +14,10 @@ namespace blink { +@@ -14,6 +14,12 @@ namespace blink { ScriptState::CreateCallback ScriptState::s_create_callback_ = nullptr; ++#if defined(ARCH_CPU_32_BITS) +int const ScriptState::kScriptStateTag = 0x6e6f64; +void* const ScriptState::kScriptStateTagPtr = const_cast<void*>( + static_cast<const void*>(&ScriptState::kScriptStateTag)); ++#endif // defined(ARCH_CPU_32_BITS) + // static void ScriptState::SetCreateCallback(CreateCallback create_callback) { DCHECK(create_callback); -@@ -39,6 +43,8 @@ ScriptState::ScriptState(v8::Local<v8::Context> context, +@@ -39,6 +45,10 @@ ScriptState::ScriptState(v8::Local<v8::Context> context, context_.SetWeak(this, &OnV8ContextCollectedCallback); context->SetAlignedPointerInEmbedderData(kV8ContextPerContextDataIndex, this, gin::kBlinkScriptState); ++#if defined(ARCH_CPU_32_BITS) + context->SetAlignedPointerInEmbedderData( + kV8ContextPerContextDataTagIndex, ScriptState::kScriptStateTagPtr); ++#endif // defined(ARCH_CPU_32_BITS) RendererResourceCoordinator::Get()->OnScriptStateCreated(this, execution_context); } -@@ -82,6 +88,8 @@ void ScriptState::DissociateContext() { +@@ -82,6 +92,10 @@ void ScriptState::DissociateContext() { // Cut the reference from V8 context to ScriptState. GetContext()->SetAlignedPointerInEmbedderData( kV8ContextPerContextDataIndex, nullptr, gin::kBlinkScriptState); ++#if defined(ARCH_CPU_32_BITS) + GetContext()->SetAlignedPointerInEmbedderData( + kV8ContextPerContextDataTagIndex, nullptr); ++#endif // defined(ARCH_CPU_32_BITS) reference_from_v8_context_.Clear(); // Cut the reference from ScriptState to V8 context. diff --git a/third_party/blink/renderer/platform/bindings/script_state.h b/third_party/blink/renderer/platform/bindings/script_state.h -index f06885f429a395b5c2eb55c89803837b550d765c..3340e4ec8d1ea20ea8310f288428b5869e85392a 100644 +index f06885f429a395b5c2eb55c89803837b550d765c..1d64099b32c2a9a0d68e8b5317d17e13789dc299 100644 --- a/third_party/blink/renderer/platform/bindings/script_state.h +++ b/third_party/blink/renderer/platform/bindings/script_state.h -@@ -185,7 +185,12 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> { - v8::Local<v8::Context> context) { - DCHECK(!context.IsEmpty()); - if (context->GetNumberOfEmbedderDataFields() <= -- kV8ContextPerContextDataIndex) { -+ kV8ContextPerContextDataTagIndex) { -+ return nullptr; -+ } -+ if (context->GetAlignedPointerFromEmbedderData( -+ kV8ContextPerContextDataTagIndex) != -+ ScriptState::kScriptStateTagPtr) { +@@ -6,6 +6,7 @@ + #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_SCRIPT_STATE_H_ + + #include "base/memory/raw_ptr.h" ++#include "build/build_config.h" + #include "gin/public/context_holder.h" + #include "gin/public/gin_embedders.h" + #include "third_party/blink/public/common/tokens/tokens.h" +@@ -188,6 +189,15 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> { + kV8ContextPerContextDataIndex) { return nullptr; } ++#if defined(ARCH_CPU_32_BITS) ++ if (context->GetNumberOfEmbedderDataFields() <= ++ kV8ContextPerContextDataTagIndex || ++ context->GetAlignedPointerFromEmbedderData( ++ kV8ContextPerContextDataTagIndex) != ++ ScriptState::kScriptStateTagPtr) { ++ return nullptr; ++ } ++#endif // defined(ARCH_CPU_32_BITS) ScriptState* script_state = -@@ -263,6 +268,8 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> { - static void SetCreateCallback(CreateCallback); - friend class ScriptStateImpl; + static_cast<ScriptState*>(context->GetAlignedPointerFromEmbedderData( + isolate, kV8ContextPerContextDataIndex, gin::kBlinkScriptState)); +@@ -267,6 +277,14 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> { + static_cast<int>(gin::kPerContextDataStartIndex) + + static_cast<int>(gin::kEmbedderBlink); ++#if defined(ARCH_CPU_32_BITS) + static void* const kScriptStateTagPtr; + static int const kScriptStateTag; - static constexpr int kV8ContextPerContextDataIndex = - static_cast<int>(gin::kPerContextDataStartIndex) + - static_cast<int>(gin::kEmbedderBlink); -@@ -271,6 +278,10 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> { - // internals.idl. - String last_compiled_script_file_name_; - bool last_compiled_script_used_code_cache_ = false; -+ + static constexpr int kV8ContextPerContextDataTagIndex = + static_cast<int>(gin::kPerContextDataStartIndex) + + static_cast<int>(gin::kEmbedderBlinkTag); - }; - - // ScriptStateProtectingContext keeps the context associated with the ++#endif // defined(ARCH_CPU_32_BITS) ++ + // For accessing information about the last script compilation via + // internals.idl. + String last_compiled_script_file_name_; From 3886763421ecb11c42b57199ce743f43f3eb9802 Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Fri, 17 Oct 2025 01:53:13 +0200 Subject: [PATCH 141/268] ci: fix publish for macOS < 26.0 (#48575) --- build/args/all.gn | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/args/all.gn b/build/args/all.gn index 340e10b8962b5..e0e2e5af7a73d 100644 --- a/build/args/all.gn +++ b/build/args/all.gn @@ -19,6 +19,10 @@ proprietary_codecs = true enable_printing = true +# Refs https://chromium-review.googlesource.com/c/chromium/src/+/6986517 +# CI is using MacOS 15.5 which doesn't have the required modulemaps. +use_clang_modules = false + # Removes DLLs from the build, which are only meant to be used for Chromium development. # See https://github.com/electron/electron/pull/17985 angle_enable_vulkan_validation_layers = false From 8269b94849ceff58508b855cd64a519bd864aebc Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Fri, 17 Oct 2025 13:04:24 -0400 Subject: [PATCH 142/268] chore: bump chromium to 143.0.7474.0 (main) (#48572) * chore: bump chromium in DEPS to 143.0.7474.0 * 7006208: [Mac] Fix rendering bug for manual occlusion detection on macOS 26 Refs https://chromium-review.googlesource.com/c/chromium/src/+/7006208 * chore: update patches * 7038563: Forward declare more in page_navigator.h Refs https://chromium-review.googlesource.com/c/chromium/src/+/7038563 * 7023417: Remove ipc/ipc_message_macros.h Refs https://chromium-review.googlesource.com/c/chromium/src/+/7023417 * 7006340: Move icon_util files to win/ subdrectory Refs https://chromium-review.googlesource.com/c/chromium/src/+/7006340 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> --- DEPS | 2 +- .../add_didinstallconditionalfeatures.patch | 8 ++-- ..._scheduler_throttling_per_renderview.patch | 2 +- patches/chromium/blink_local_frame.patch | 6 +-- ..._depend_on_packed_resource_integrity.patch | 12 +++--- patches/chromium/can_create_window.patch | 18 ++++---- ...ameter_in_script_lifecycle_observers.patch | 8 ++-- ...fy_chromium_handling_of_mouse_events.patch | 2 +- ...screationoverridden_with_full_params.patch | 12 +++--- patches/chromium/disable_hidden.patch | 2 +- .../chromium/enable_reset_aspect_ratio.patch | 2 +- ...moothing_css_rule_and_blink_painting.patch | 20 ++++----- ...screen_rendering_with_viz_compositor.patch | 10 ++--- ...allback_for_sync_and_async_clipboard.patch | 6 +-- ...dless_mode_handling_in_native_widget.patch | 2 +- .../fix_aspect_ratio_with_max_size.patch | 2 +- ...ding_non-standard_schemes_in_iframes.patch | 4 +- ...board_hides_on_input_blur_in_webview.patch | 2 +- ...x_remove_caption-removing_style_call.patch | 2 +- ..._material_update_issue_on_windows_11.patch | 2 +- ...from_localframe_requestexecutescript.patch | 16 +++---- ...t_menu_item_when_opened_via_keyboard.patch | 4 +- patches/chromium/frame_host_manager.patch | 2 +- ..._avoid_private_macos_api_usage.patch.patch | 6 +-- .../chromium/notification_provenance.patch | 6 +-- patches/chromium/printing.patch | 8 ++-- ..._expose_file_system_access_blocklist.patch | 8 ++-- ..._electron_permissiontypes_into_blink.patch | 6 +-- ...ean_up_stale_macwebcontentsocclusion.patch | 43 ++++++++++++++----- ...windowtreehostwin_window_enlargement.patch | 4 +- .../support_mixed_sandbox_with_zygote.patch | 4 +- patches/chromium/webview_fullscreen.patch | 2 +- ...i_to_allow_electron_to_set_dock_side.patch | 4 +- shell/browser/child_web_contents_tracker.cc | 5 +++ shell/browser/child_web_contents_tracker.h | 7 +++ shell/browser/ui/message_box_win.cc | 2 +- shell/browser/ui/win/taskbar_host.cc | 2 +- shell/common/api/electron_api_native_image.cc | 2 +- .../api/electron_api_native_image_win.cc | 2 +- shell/common/skia_util.cc | 2 +- .../electron_render_frame_observer.cc | 1 - 41 files changed, 146 insertions(+), 114 deletions(-) diff --git a/DEPS b/DEPS index 12b6ee3be3b40..62bb28e7bab3c 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '143.0.7469.0', + '143.0.7474.0', 'node_version': 'v22.20.0', 'nan_version': diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index 12c6072b92079..aeec585da2e89 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -23,10 +23,10 @@ index 5196f155cdc641b66c4faa77d8b00097145a1290..bbfac47a74f989482343c222b78f187b int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 2fca6bc42e218050ba325e07f771a3b7e2c6f322..ba670e2841e29f4fc0fd7732bcc89532e45ecb1c 100644 +index f3bd4cf4da4aee11d327e05526d3c247142dc3d1..0dfbc387901dfb7937ff57ce98d85291b527ebc7 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4732,6 +4732,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, +@@ -4733,6 +4733,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, observer.DidCreateScriptContext(context, world_id); } @@ -40,7 +40,7 @@ index 2fca6bc42e218050ba325e07f771a3b7e2c6f322..ba670e2841e29f4fc0fd7732bcc89532 int world_id) { for (auto& observer : observers_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index 1b91ce91b859144680e23b2d3f9bdf514b8bb628..fd13b40fd61067a4b0374a12121a96294ea3cb7f 100644 +index 01d77f902b69071d42dc53d6429239f2c191be5f..cf54df57c72cfaf97d7d3ff1afe134c6f39860f1 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h @@ -603,6 +603,8 @@ class CONTENT_EXPORT RenderFrameImpl @@ -53,7 +53,7 @@ index 1b91ce91b859144680e23b2d3f9bdf514b8bb628..fd13b40fd61067a4b0374a12121a9629 int world_id) override; void DidChangeScrollOffset() override; diff --git a/third_party/blink/public/web/web_local_frame_client.h b/third_party/blink/public/web/web_local_frame_client.h -index 5e40b324ee3a5147bb5911373147aa9add878899..d5a86fa3b41c9f4bf294cfdf7e210da05f7ae2e9 100644 +index 5c1d0c1581b7ef6214f3dde6a4053a23c8673b74..4520c9edccf63bdb9e35bf3a99a8ddb39170da24 100644 --- a/third_party/blink/public/web/web_local_frame_client.h +++ b/third_party/blink/public/web/web_local_frame_client.h @@ -667,6 +667,9 @@ class BLINK_EXPORT WebLocalFrameClient { diff --git a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch index c64ee3ad15f73..026f3f4f78c27 100644 --- a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -51,7 +51,7 @@ index 7944fe64e0da112fc670358b75506bb199bb5e4a..0e3c16c6af2a078943e9f39808134ab2 void SendRendererPreferencesToRenderer( const blink::RendererPreferences& preferences); diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index 9e7796a55f58b0bb04eb576f9d7ea3099ce08bdc..bbcf0a84cbb912279b6c698af0371cfee313c96c 100644 +index d1d64d93753179f28b4c4ac9653ac1cfc00afd84..8ebaf11825c7b37d28bb2037cd7d7d9fa8101201 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -578,8 +578,8 @@ void RenderWidgetHostViewAura::ShowImpl(PageVisibilityState page_visibility) { diff --git a/patches/chromium/blink_local_frame.patch b/patches/chromium/blink_local_frame.patch index 012a2fef0aec0..31cfeaf20972f 100644 --- a/patches/chromium/blink_local_frame.patch +++ b/patches/chromium/blink_local_frame.patch @@ -49,10 +49,10 @@ index cdb5b9246087b5678cf6a0f2713f6238dafc13de..7efbe7524c5ddd3785fff0e2d8901f93 // its owning reference back to our owning LocalFrame. client_->Detached(type); diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index 06053c55838982a72450375bbb62e6978f5acded..ac4623d35dc9d0765fef5aedfc635df14f95ced3 100644 +index 9338d883b1441e1ddd4b39a87f56cd62d6c0eff7..e7f9b2ebfd5a04290b8d2d8a75141534e35bc4c6 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc -@@ -746,10 +746,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { +@@ -747,10 +747,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { } DCHECK(!view_ || !view_->IsAttached()); @@ -63,7 +63,7 @@ index 06053c55838982a72450375bbb62e6978f5acded..ac4623d35dc9d0765fef5aedfc635df1 if (!Client()) return false; -@@ -803,6 +799,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { +@@ -804,6 +800,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { DCHECK(!view_->IsAttached()); Client()->WillBeDetached(); diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index a331ec48eac9e..e5a9cde81158e 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -33,10 +33,10 @@ index 9bffa9c8272a81059eb05fa79107bb326029402c..d286e9ab4edf86570418d4b3699c8f2d "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index e86a07e7f1722bb060e016f5644cd5f448ef5c4f..07abe8ca788af04d03ac729ac4b6ffe8216f07b2 100644 +index dfb4e59e972ebd9fd7f919f646c8c197ca24b02f..351956f63e0a4265756e5a49400828f901b7c5c7 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4805,7 +4805,7 @@ static_library("browser") { +@@ -4817,7 +4817,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index e86a07e7f1722bb060e016f5644cd5f448ef5c4f..07abe8ca788af04d03ac729ac4b6ffe8 # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 016f3d150a99ac222bb7e6b9b887ab655d461070..f23bcf4dee15bacf99077bcd6ab9286dbfe6c3c4 100644 +index 8e6eac2e03d473b7741e41a17ec091ef7efa8cdf..3000724346e73a0641bf34e67009e7a34e7f74b3 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7574,9 +7574,12 @@ test("unit_tests") { +@@ -7570,9 +7570,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index 016f3d150a99ac222bb7e6b9b887ab655d461070..f23bcf4dee15bacf99077bcd6ab9286d "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8508,6 +8511,10 @@ test("unit_tests") { +@@ -8505,6 +8508,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index 016f3d150a99ac222bb7e6b9b887ab655d461070..f23bcf4dee15bacf99077bcd6ab9286d sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8564,7 +8571,6 @@ test("unit_tests") { +@@ -8561,7 +8568,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index ee7af812020e9..47d7fa7f868f0 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,7 +9,7 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 25aab53f348352ac5712c9419a7b24d39d49ca63..ebe44040a554674058ee5307b7df32f224f09c17 100644 +index 42c40d8c9c10cbf7ef15c5e764dfbd0ad91f8919..6174c48ad073bfda2c783dca76dfdf05ee8c5a75 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc @@ -9854,6 +9854,7 @@ void RenderFrameHostImpl::CreateNewWindow( @@ -77,10 +77,10 @@ index 15a83f61ed4e31ba34cbc19995cd9d68b1599f1d..9cf9fefad46a6c2ead4085adc76e0c07 // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 68bafbcd65301fd26f18e433057d69ae9d63a078..8a199da3b79672d900efa3ae2a721ef74481d7fc 100644 +index 7b813d46382672421e569f68204f6f127bab7dce..64ad3e62245ad9b1fd0b8e0487b6d14d34a6d5f3 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -875,6 +875,8 @@ bool ContentBrowserClient::CanCreateWindow( +@@ -881,6 +881,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -90,7 +90,7 @@ index 68bafbcd65301fd26f18e433057d69ae9d63a078..8a199da3b79672d900efa3ae2a721ef7 bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 7658c8045ad4687ffc2923061ee8310bf76c1190..22b1bcac984a5f0e7140693a9c8ff586f12afe24 100644 +index 3f0599ae229b9785146fcd29528d183f2d04a8e7..ef9073ffcf8a5fa51fa028667cf3328cfae6f994 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -196,6 +196,7 @@ class NetworkService; @@ -101,7 +101,7 @@ index 7658c8045ad4687ffc2923061ee8310bf76c1190..22b1bcac984a5f0e7140693a9c8ff586 } // namespace network namespace sandbox { -@@ -1448,6 +1449,8 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -1454,6 +1455,8 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -170,10 +170,10 @@ index caf97e0c94edfa1106b465e793190c82f646ebdb..38b61d04446736bcc44a412f633c01ed // typically happens when popups are created. virtual void WebContentsCreated(WebContents* source_contents, diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 4971952ae4ebe3518a4838752fa37ee3de54223e..2fca6bc42e218050ba325e07f771a3b7e2c6f322 100644 +index edca410830a8a70ecb6ac275c3f87bc2b7fb4f8c..f3bd4cf4da4aee11d327e05526d3c247142dc3d1 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -6831,6 +6831,10 @@ WebView* RenderFrameImpl::CreateNewWindow( +@@ -6832,6 +6832,10 @@ WebView* RenderFrameImpl::CreateNewWindow( request.HasUserGesture(), GetWebFrame()->IsAdFrame(), GetWebFrame()->IsAdScriptInStack()); @@ -232,10 +232,10 @@ index 82e9d3dfb5f7da76d89fe15ae61d379fa46e177d..fd035512099a54dff6cc951a2226c23a } // namespace blink diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc -index a8f768190d649f528ba34a0203b80f8b9c0f4cee..997a22ed7a1f7870058b1da9c6eda2c319ff1e9d 100644 +index daf39704b251e33828ca4bf7678b4b620f677843..576f7d6f351dd3c009ad48f3b3e9f5272f6fb4cf 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc -@@ -2353,6 +2353,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, +@@ -2347,6 +2347,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, WebWindowFeatures window_features = GetWindowFeaturesFromString(features, entered_window); diff --git a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch index 627ee10f12d03..6ece03f2a69ec 100644 --- a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch +++ b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch @@ -34,10 +34,10 @@ index bbfac47a74f989482343c222b78f187b70297e4e..3677ca3345fbc775d139684a12fe3624 virtual void DidClearWindowObject() {} virtual void DidChangeScrollOffset() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index ba670e2841e29f4fc0fd7732bcc89532e45ecb1c..128ffa612eda421f9d8c49c9324b3b52b782ba2c 100644 +index 0dfbc387901dfb7937ff57ce98d85291b527ebc7..a03e501a6c21d20fb571f0b1272c4425cd243681 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4738,10 +4738,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( +@@ -4739,10 +4739,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( observer.DidInstallConditionalFeatures(context, world_id); } @@ -52,7 +52,7 @@ index ba670e2841e29f4fc0fd7732bcc89532e45ecb1c..128ffa612eda421f9d8c49c9324b3b52 void RenderFrameImpl::DidChangeScrollOffset() { diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index fd13b40fd61067a4b0374a12121a96294ea3cb7f..e79c07abf2744c5461ce682a406954a2a23f03d0 100644 +index cf54df57c72cfaf97d7d3ff1afe134c6f39860f1..54f83b86322dcf9ad544a4ba71fb83e77e8e572c 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h @@ -605,7 +605,8 @@ class CONTENT_EXPORT RenderFrameImpl @@ -167,7 +167,7 @@ index f96781a047056876b030581b539be0507acc3a1c..cd9be80be2500a001b1895c81ee597dd // Called when initial script evaluation finished for the main script. // |success| is true if the evaluation completed with no uncaught exception. diff --git a/third_party/blink/public/web/web_local_frame_client.h b/third_party/blink/public/web/web_local_frame_client.h -index d5a86fa3b41c9f4bf294cfdf7e210da05f7ae2e9..faeacf7fc8aac20b950acebd3ff8d29c17f7b4b9 100644 +index 4520c9edccf63bdb9e35bf3a99a8ddb39170da24..dd2c5bd50075c345262b05952ecf3f2aa300b6ff 100644 --- a/third_party/blink/public/web/web_local_frame_client.h +++ b/third_party/blink/public/web/web_local_frame_client.h @@ -671,7 +671,8 @@ class BLINK_EXPORT WebLocalFrameClient { diff --git a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch index 124a50731be21..036aefba49b87 100644 --- a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch +++ b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch @@ -61,7 +61,7 @@ index b65ced55f997d5064b9d9338190567f8c264fce8..e8acd2828ed05deefa335ce2bb461f0c Widget* GetWidget(); const Widget* GetWidget() const; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 5376a8278a4cc784ad69cda6594c5055847c1f22..1005d553d39909bdf7c2c7b1b714c58861ba747d 100644 +index dd65b0925e21a1c70c4b7dde17853f7177f4fd3e..b8a7170d9048beb886925428356bb2ba24f7a8e6 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -3240,15 +3240,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index d41a14bbcf08e..23b51d46b230f 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -80,10 +80,10 @@ index 39fa45f0a0f9076bd7ac0be6f455dd540a276512..3d0381d463eed73470b28085830f2a23 content::WebContents* source, const content::OpenURLParams& params, diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index dec03a1df14aa997dd1c6044fe0167e444a8c5f3..08889021e8ae25d48d542362a86faacc28005933 100644 +index 5392350919f54b5270e817de94599e8dc6a96d4c..311d89b44bdbe71b8a647b6e1a2fd3376d0306e9 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc -@@ -2413,7 +2413,8 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2377,7 +2377,8 @@ bool Browser::IsWebContentsCreationOverridden( content::mojom::WindowContainerType window_container_type, const GURL& opener_url, const std::string& frame_name, @@ -93,7 +93,7 @@ index dec03a1df14aa997dd1c6044fe0167e444a8c5f3..08889021e8ae25d48d542362a86faacc if (HasActorTask(profile(), opener)) { // If an ExecutionEngine is acting on the opener, prevent it from creating a // new WebContents. We'll instead force the navigation to happen in the same -@@ -2426,7 +2427,7 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2390,7 +2391,7 @@ bool Browser::IsWebContentsCreationOverridden( return (window_container_type == content::mojom::WindowContainerType::BACKGROUND && ShouldCreateBackgroundContents(source_site_instance, opener_url, @@ -103,10 +103,10 @@ index dec03a1df14aa997dd1c6044fe0167e444a8c5f3..08889021e8ae25d48d542362a86faacc WebContents* Browser::CreateCustomWebContents( diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h -index 81a247cded1dd321f1003221f02a5c3a0c5a3312..037f5ecdf3a4437c935b90c45ef29536e0bfa2e3 100644 +index bdb26bf23fde058fcee289a8a6a01cf973cc4a91..c8de3b2b777c9192635269943a6255adbadc9294 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h -@@ -954,8 +954,7 @@ class Browser : public TabStripModelObserver, +@@ -944,8 +944,7 @@ class Browser : public TabStripModelObserver, content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -356,7 +356,7 @@ index 7eeffdfbda9611806c6f260f0c68f6d84689cb7e..5d8f6d132068d7fabaa52bc61354c71a content::RenderFrameHost* opener, content::SiteInstance* source_site_instance, diff --git a/fuchsia_web/webengine/browser/frame_impl.cc b/fuchsia_web/webengine/browser/frame_impl.cc -index e3761e1de9031dafab2e26063d048ddfe784a682..d3ff31613f5ecfe3407d3088b25c0422e7e7a93c 100644 +index 44fdb7377fc4d09137d0718de0f960b0d190c99f..46bde9f83510116f8723d400d5947f9cc6ba3ab5 100644 --- a/fuchsia_web/webengine/browser/frame_impl.cc +++ b/fuchsia_web/webengine/browser/frame_impl.cc @@ -585,8 +585,7 @@ bool FrameImpl::IsWebContentsCreationOverridden( diff --git a/patches/chromium/disable_hidden.patch b/patches/chromium/disable_hidden.patch index ad3aeda57ea98..7f6a3ef2463bd 100644 --- a/patches/chromium/disable_hidden.patch +++ b/patches/chromium/disable_hidden.patch @@ -34,7 +34,7 @@ index d1c15f323f2c36dc12dbb8ac2a8f19c0f3365429..507231f8134f7b1bba031baafe6db584 // |routing_id| must not be IPC::mojom::kRoutingIdNone. // If this object outlives |delegate|, DetachDelegate() must be called when diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index 39bbcb9f74d9d4fb4c2e81569b100f81837355b9..9e7796a55f58b0bb04eb576f9d7ea3099ce08bdc 100644 +index 5ff22d23ed92f208f12f1edc864ce8348e220c12..d1d64d93753179f28b4c4ac9653ac1cfc00afd84 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -642,7 +642,7 @@ void RenderWidgetHostViewAura::HideImpl() { diff --git a/patches/chromium/enable_reset_aspect_ratio.patch b/patches/chromium/enable_reset_aspect_ratio.patch index 7acc972e7488f..9ce85d572d99d 100644 --- a/patches/chromium/enable_reset_aspect_ratio.patch +++ b/patches/chromium/enable_reset_aspect_ratio.patch @@ -19,7 +19,7 @@ index 35469ecb01a680315b2f92e2599a3b56b5fc7549..d2651f4fcbb7991e9ec8f164e5bee51d excluded_margin); } diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 5246e5bb427f09bccdf53ee4de79bcf7c1c6a702..41b5219bdba3eba8bde935992fe60fc14898f68d 100644 +index 3d5818d3865d28c038630b2a5419e8f4d97f1556..b1d33fb3589d1aa3ec400a958d7c3c8a64d64e5c 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -1050,8 +1050,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen, diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index f787c488ac37d..d533def1ae6b6 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -20,7 +20,7 @@ making three primary changes to Blink: * Controls whether the CSS rule is available. diff --git a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom -index 880e5f9800b7b32ced2e1ae8e60f1115ccd1b038..aea957c186de970c71c97da1efd5228967566741 100644 +index dde6a1d1928921ee8c88128aadc22938a55c54f0..40ed673f5a00d7db98b672420fa8ad2429ccfb03 100644 --- a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom +++ b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom @@ -48,6 +48,7 @@ enum CSSSampleId { @@ -45,10 +45,10 @@ index e189d584f05f2ce6354c03a9b19f56985df8a15e..41b430e8f2416be098494f5c49fb97ca 'internal-forced-visited-'): internal_visited_order = 0 diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 -index b8d8077e22d63fc08b8d7caf44ff0c181ce09c3b..a9098abaa3f92a86e723e6d20465ee5029ae0277 100644 +index ba708dfe213587c303707d0eb4fcea82363bc681..63a778afca3350a1555d109407b04704f38c7cb1 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5 -@@ -9029,6 +9029,26 @@ +@@ -9035,6 +9035,26 @@ property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], }, @@ -76,7 +76,7 @@ index b8d8077e22d63fc08b8d7caf44ff0c181ce09c3b..a9098abaa3f92a86e723e6d20465ee50 { name: "-internal-visited-color", diff --git a/third_party/blink/renderer/core/css/css_property_equality.cc b/third_party/blink/renderer/core/css/css_property_equality.cc -index 53fae0d3349df9a6baf19feeefd932e9ffaee3eb..a76f16fb33bd831cb946354a5d4d9da54d088f5c 100644 +index 80b6ddafd5649ff5972e6533b68f300c223482d0..65fab5a716f6118515ab0a11e776e85c57f4ce57 100644 --- a/third_party/blink/renderer/core/css/css_property_equality.cc +++ b/third_party/blink/renderer/core/css/css_property_equality.cc @@ -354,6 +354,8 @@ bool CSSPropertyEquality::PropertiesEqual(const PropertyHandle& property, @@ -89,10 +89,10 @@ index 53fae0d3349df9a6baf19feeefd932e9ffaee3eb..a76f16fb33bd831cb946354a5d4d9da5 return a.EmptyCells() == b.EmptyCells(); case CSSPropertyID::kFill: diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -index fc786d43c4c5d1e2ab0f6c0990e607b31ca254d7..88e0db3246cf96d6a682874de272a68a41aec32e 100644 +index 68dc56e6eb5674b031117243bd97db6c5359cace..afee29f28468513a62e3cd70e7b49d90b5c606ed 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -@@ -12467,5 +12467,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( +@@ -12468,5 +12468,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( CSSValueID::kNone>(stream); } @@ -130,7 +130,7 @@ index fc786d43c4c5d1e2ab0f6c0990e607b31ca254d7..88e0db3246cf96d6a682874de272a68a } // namespace css_longhand } // namespace blink diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc -index 18195a2597f4bfc598d2d545b91688611f48ce11..8f107b529818fc654465fbe41804e2656c0f568a 100644 +index 884e3378db56c0fcb24060ed24bae44247158347..87e5578d0cd704fcf2d7db000c4e5585d3f45d7e 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc @@ -4116,6 +4116,15 @@ PositionTryFallback StyleBuilderConverter::ConvertSinglePositionTryFallback( @@ -201,10 +201,10 @@ index 0802c73aa4aaf4e1fb5efd367758f19c36691f71..5f06c0af277a7c937e694470beac707a return result; } diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn -index b055f218f600948204764f5fe9f5978c9f9fa4f4..2398af8635402706b11afda36b4510667661b74c 100644 +index 53fdc793db73f873310860f5767ed7dcb928e24c..f4d2ac7351353ec9907230051f4db6ff0d00c4bf 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn -@@ -1672,6 +1672,8 @@ component("platform") { +@@ -1669,6 +1669,8 @@ component("platform") { "widget/widget_base.h", "widget/widget_base_client.h", "windows_keyboard_codes.h", @@ -312,7 +312,7 @@ index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index 21ff121087a23deeeaf69593b69462c3a297b458..c1b444add778b390a267445bac2c2b6926dbd026 100644 +index 9bd900305a5fd76bc68c0106a2e2ff4350f4408b..97525abc3d02f748e921ffc673a574d370cf96a0 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch index 9775effa86895..20a2f8b60ce36 100644 --- a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch +++ b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch @@ -238,7 +238,7 @@ index 67d5ff67d74c107a867b39b306c6528425b87e05..5fd12a25c9e319e8e675955926271c9d diff --git a/components/viz/service/display_embedder/software_output_device_proxy.cc b/components/viz/service/display_embedder/software_output_device_proxy.cc new file mode 100644 -index 0000000000000000000000000000000000000000..02872ac8658a58ea7a508a7063ee1e7e5d69ab0a +index 0000000000000000000000000000000000000000..601e646c293ac18e692663642f540577168924d6 --- /dev/null +++ b/components/viz/service/display_embedder/software_output_device_proxy.cc @@ -0,0 +1,161 @@ @@ -262,7 +262,7 @@ index 0000000000000000000000000000000000000000..02872ac8658a58ea7a508a7063ee1e7e +#if BUILDFLAG(IS_WIN) +#include "components/viz/service/display_embedder/output_device_backing.h" +#include "skia/ext/skia_utils_win.h" -+#include "ui/gfx/gdi_util.h" ++#include "ui/gfx/win/gdi_util.h" +#include "ui/gfx/win/hwnd_util.h" +#else +#include "mojo/public/cpp/base/shared_memory_utils.h" @@ -508,7 +508,7 @@ index 0000000000000000000000000000000000000000..e1a22ee881c0fd679ac2d2d4d11a3c93 + +#endif // COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_SOFTWARE_OUTPUT_DEVICE_PROXY_H_ diff --git a/components/viz/service/display_embedder/software_output_device_win.cc b/components/viz/service/display_embedder/software_output_device_win.cc -index 838031388c4c20bbcf068210559cb2018a661cd6..ec12dcfdc34891ecd107facc93c8f650c46f11d7 100644 +index b5154321105f08335b67ad2d552afa61337a4976..cb28230d9a8da6bd2259ef0c898013293421ac56 100644 --- a/components/viz/service/display_embedder/software_output_device_win.cc +++ b/components/viz/service/display_embedder/software_output_device_win.cc @@ -156,7 +156,7 @@ void SoftwareOutputDeviceWinProxy::EndPaintDelegated( @@ -521,10 +521,10 @@ index 838031388c4c20bbcf068210559cb2018a661cd6..ec12dcfdc34891ecd107facc93c8f650 waiting_on_draw_ack_ = true; diff --git a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc -index 03f18d799eb8887f8435624eb7da4547e85aef08..744700c84b7ef79091a7ad590e086564f2109720 100644 +index d8f845998240032f668324665d61b2efd60c0e1c..9eb5ab874ceecb4902b9272ce574d81302cf2802 100644 --- a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc +++ b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc -@@ -130,7 +130,8 @@ RootCompositorFrameSinkImpl::Create( +@@ -131,7 +131,8 @@ RootCompositorFrameSinkImpl::Create( params->gpu_compositing, params->widget); auto output_surface = output_surface_provider->CreateOutputSurface( params->widget, params->gpu_compositing, display_client.get(), diff --git a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch index f1ba3a29c7a1b..2b82da812c184 100644 --- a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch +++ b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch @@ -20,7 +20,7 @@ This patch will be removed when the deprecated sync api support is removed. diff --git a/components/permissions/permission_util.cc b/components/permissions/permission_util.cc -index e243b7202505075658e04adc1eeacc01c7d7d72d..7078014e6db7c43d66b1448b2b36500f206ec4a0 100644 +index fc516272be02a3dac1086e4aaf2015dc946cc3c2..86b8df2b23dc975a6db87f04005cb105054305b0 100644 --- a/components/permissions/permission_util.cc +++ b/components/permissions/permission_util.cc @@ -536,6 +536,7 @@ ContentSettingsType PermissionUtil::PermissionTypeToContentSettingsTypeSafe( @@ -141,10 +141,10 @@ index a5ac9d4a417ac8e75e761c40841f41ab9057c761..292bd1f9de78828e739dae24a45a1dd3 bool ClipboardCommands::ExecuteCopy(LocalFrame& frame, diff --git a/third_party/blink/renderer/modules/permissions/permission_utils.cc b/third_party/blink/renderer/modules/permissions/permission_utils.cc -index b533436f91ba67c6060d4a1976f7c197b6db3afc..63df740efad1e407f0990d2ba48a9cbcb8bdb6f8 100644 +index 691726eb23434005adc559534fc0aeede937cc92..a980ed6afb84eceef9c9b594b325e8e3783821ec 100644 --- a/third_party/blink/renderer/modules/permissions/permission_utils.cc +++ b/third_party/blink/renderer/modules/permissions/permission_utils.cc -@@ -146,6 +146,8 @@ String PermissionNameToString(PermissionName name) { +@@ -145,6 +145,8 @@ String PermissionNameToString(PermissionName name) { return "web-printing"; case PermissionName::SMART_CARD: return "smart-card"; diff --git a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch index c6ff5dcf44dc9..3d2e18ed2414c 100644 --- a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch +++ b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch @@ -90,7 +90,7 @@ index e1a1cdb2ec192d2ee5a555ecccf041f757336f79..68a210eaf34d6d410a14478ad5bf0c78 // Register the CGWindowID (used to identify this window for video capture) diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc -index 55a5d241058f192091e34164880c0888504b30bd..c047e938a39fa2466fc95312ba7bc581a68b48e2 100644 +index 566acaeff6b746c97db606cbda71b29e82570453..28f14b53aa9f2daf25431231539a5dbfc3c42b95 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -222,6 +222,18 @@ ui::ZOrderLevel Widget::InitParams::EffectiveZOrderLevel() const { diff --git a/patches/chromium/fix_aspect_ratio_with_max_size.patch b/patches/chromium/fix_aspect_ratio_with_max_size.patch index 2589b601380a1..57b1a5e8d7762 100644 --- a/patches/chromium/fix_aspect_ratio_with_max_size.patch +++ b/patches/chromium/fix_aspect_ratio_with_max_size.patch @@ -11,7 +11,7 @@ enlarge window above dimensions set during creation of the BrowserWindow. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 41b5219bdba3eba8bde935992fe60fc14898f68d..5376a8278a4cc784ad69cda6594c5055847c1f22 100644 +index b1d33fb3589d1aa3ec400a958d7c3c8a64d64e5c..dd65b0925e21a1c70c4b7dde17853f7177f4fd3e 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -3844,17 +3844,30 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param, diff --git a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch index 60be0a88278ce..e76186e3c163d 100644 --- a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch +++ b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch @@ -28,10 +28,10 @@ The patch should be removed in favor of either: Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397. diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index c39536aa73916af5063f1ed0259d0e8006dd791b..50ab987697d406a010c91f55b0298a049ecacb73 100644 +index f1a98c5b954f8eb25376e0db1024a71bfe36375a..190ecb1887b45555d4a572881404ff6692bd18a4 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc -@@ -11402,6 +11402,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { +@@ -11412,6 +11412,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { target_rph_id); } diff --git a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch index 459b7abdeb715..ad6e5a6a4d423 100644 --- a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch +++ b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch @@ -9,7 +9,7 @@ focus node change via TextInputManager. chromium-bug: https://crbug.com/1369605 diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index bbcf0a84cbb912279b6c698af0371cfee313c96c..bdc7541ccb7cd1ffe0b1a53360e32dc98c22e6fd 100644 +index 8ebaf11825c7b37d28bb2037cd7d7d9fa8101201..49b345b47d0d7bc7cf981ae821b14c368151b92e 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -3246,6 +3246,12 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( diff --git a/patches/chromium/fix_remove_caption-removing_style_call.patch b/patches/chromium/fix_remove_caption-removing_style_call.patch index 4cf483cb96e6d..60d85f2a6c399 100644 --- a/patches/chromium/fix_remove_caption-removing_style_call.patch +++ b/patches/chromium/fix_remove_caption-removing_style_call.patch @@ -18,7 +18,7 @@ or resizing, but Electron does not seem to run into that issue for opaque frameless windows even with that block commented out. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 1005d553d39909bdf7c2c7b1b714c58861ba747d..74ae0fa48721fbf19631294d92ae9326ad902c99 100644 +index b8a7170d9048beb886925428356bb2ba24f7a8e6..2a47325ff020977a8c574b1edceb722c15513624 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -1857,7 +1857,23 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) { diff --git a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch index 189147d9e5332..143f159e4a13c 100644 --- a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch +++ b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch @@ -36,7 +36,7 @@ index 0cd07fd5fb55dcc0d972de4c027fcb895d156592..0f4d335e1d54b5e92fc217080d86513d // Overridden from DesktopWindowTreeHost: void Init(const Widget::InitParams& params) override; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 74ae0fa48721fbf19631294d92ae9326ad902c99..1a26051de18f336db1ef7b1a4a60db9052e97b5e 100644 +index 2a47325ff020977a8c574b1edceb722c15513624..edecbfca5b2c0b6c4dfc6d9049a2e4556559b9f1 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -994,13 +994,13 @@ void HWNDMessageHandler::FrameTypeChanged() { diff --git a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch index 1b0e9de9c283c..2615b6db8151c 100644 --- a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch +++ b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch @@ -59,10 +59,10 @@ index cba373664bec3a32abad6fe0396bd67b53b7e67f..a54f1b3351efd2d8f324436f7f35cd43 #endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_SCRIPT_EXECUTION_CALLBACK_H_ diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index ac4623d35dc9d0765fef5aedfc635df14f95ced3..2db446cddef9dc0505e9c9a7a75cba5d43018959 100644 +index e7f9b2ebfd5a04290b8d2d8a75141534e35bc4c6..d4b4eee7a179904913ac1003781600ceaf5033ba 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc -@@ -3185,6 +3185,7 @@ void LocalFrame::RequestExecuteScript( +@@ -3186,6 +3186,7 @@ void LocalFrame::RequestExecuteScript( mojom::blink::EvaluationTiming evaluation_timing, mojom::blink::LoadEventBlockingOption blocking_option, WebScriptExecutionCallback callback, @@ -70,7 +70,7 @@ index ac4623d35dc9d0765fef5aedfc635df14f95ced3..2db446cddef9dc0505e9c9a7a75cba5d BackForwardCacheAware back_forward_cache_aware, mojom::blink::WantResultOption want_result_option, mojom::blink::PromiseResultOption promise_behavior) { -@@ -3242,7 +3243,7 @@ void LocalFrame::RequestExecuteScript( +@@ -3243,7 +3244,7 @@ void LocalFrame::RequestExecuteScript( PausableScriptExecutor::CreateAndRun( script_state, std::move(script_sources), execute_script_policy, user_gesture, evaluation_timing, blocking_option, want_result_option, @@ -80,10 +80,10 @@ index ac4623d35dc9d0765fef5aedfc635df14f95ced3..2db446cddef9dc0505e9c9a7a75cba5d void LocalFrame::SetEvictCachedSessionStorageOnFreezeOrUnload() { diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h -index 6ea33fee79cf65d4badcd28c088d23ad985cdaec..b0784aea80b095d371e7477139ec79ae89b41ec3 100644 +index 1f0313622e2f1672a9d5464c2b9250cd17654dfb..43eb1f9294a00b4f4f836c9f60f0712edb8d3da2 100644 --- a/third_party/blink/renderer/core/frame/local_frame.h +++ b/third_party/blink/renderer/core/frame/local_frame.h -@@ -828,6 +828,7 @@ class CORE_EXPORT LocalFrame final +@@ -826,6 +826,7 @@ class CORE_EXPORT LocalFrame final mojom::blink::EvaluationTiming, mojom::blink::LoadEventBlockingOption, WebScriptExecutionCallback, @@ -92,10 +92,10 @@ index 6ea33fee79cf65d4badcd28c088d23ad985cdaec..b0784aea80b095d371e7477139ec79ae mojom::blink::WantResultOption, mojom::blink::PromiseResultOption); diff --git a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc -index 3a1da2ef67d9b551cb162ba7eee62383107f651a..71a45aa41b6fe475f9e265857b990fdaa875b72a 100644 +index 1a96ae610e8469a311730915c35dab9943aa9d77..6d6893015058de20fc8cda69c09b6438f27ae3d6 100644 --- a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc +++ b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc -@@ -998,6 +998,7 @@ void LocalFrameMojoHandler::JavaScriptExecuteRequestInIsolatedWorld( +@@ -981,6 +981,7 @@ void LocalFrameMojoHandler::JavaScriptExecuteRequestInIsolatedWorld( std::move(callback).Run(value ? std::move(*value) : base::Value()); }, std::move(callback)), @@ -203,7 +203,7 @@ index fa65331f40b90d812b71a489fd560e9359152d2b..390714d631dc88ef92d59ef9618a5706 const mojom::blink::UserActivationOption user_activation_option_; const mojom::blink::LoadEventBlockingOption blocking_option_; diff --git a/third_party/blink/renderer/core/frame/web_frame_test.cc b/third_party/blink/renderer/core/frame/web_frame_test.cc -index 389ba18d5c709156f0c8da2e578825ba59ce6190..1dcfee3a5f43a4be6a57511b194aa68518c1b090 100644 +index b78f7ac17be5915a57e217bbaa981fb04d60dd40..996eb063b8b7e48ce1744de7a6fcb78fa594cf74 100644 --- a/third_party/blink/renderer/core/frame/web_frame_test.cc +++ b/third_party/blink/renderer/core/frame/web_frame_test.cc @@ -295,6 +295,7 @@ void ExecuteScriptsInMainWorld( diff --git a/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch b/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch index af9b9d1036a5f..67dfa426bce2b 100644 --- a/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch +++ b/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch @@ -6,7 +6,7 @@ Subject: fix: select the first menu item when opened via keyboard This fixes an accessibility issue where the root view is 'focused' to the screen reader instead of the first menu item as with all other native menus. This patch will be upstreamed. diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc -index 9bb09e12baa7fc8f6ae71f2e64af05dc8236d803..d76282aed81e51f4301222db55c97dd0a705fe8b 100644 +index cfc9d7bac42a8d6b8fd81d9b0d8f98d55fdc43f4..1091903f786f5455ed6831796afcc2a5dfae36bd 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc @@ -740,6 +740,16 @@ void MenuController::Run(Widget* parent, @@ -26,7 +26,7 @@ index 9bb09e12baa7fc8f6ae71f2e64af05dc8236d803..d76282aed81e51f4301222db55c97dd0 if (button_controller) { pressed_lock_ = button_controller->TakeLock( false, ui::LocatedEvent::FromIfValid(event)); -@@ -2496,18 +2506,15 @@ void MenuController::OpenMenuImpl(MenuItemView* item, bool show) { +@@ -2502,18 +2512,15 @@ void MenuController::OpenMenuImpl(MenuItemView* item, bool show) { } item->GetSubmenu()->ShowAt(params); diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index c746710e406df..22ede7f62eb89 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -20,7 +20,7 @@ index b930c5e23c9d10b9be4126cf2eeb057ab04c519f..945f17e13f47462acc3895a3340cd108 } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 22b1bcac984a5f0e7140693a9c8ff586f12afe24..86cea3713135261fdc3e68ce3396f89682e22e6f 100644 +index ef9073ffcf8a5fa51fa028667cf3328cfae6f994..c7f660c6602a2cead04540245da10c0b99a27910 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -334,6 +334,11 @@ class CONTENT_EXPORT ContentBrowserClient { diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index 488e05df295d1..b5b632e177d28 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -35,7 +35,7 @@ system font by checking if it's kCTFontPriorityAttribute is set to system priority. diff --git a/base/BUILD.gn b/base/BUILD.gn -index eb710b05758b8a5db171e84ecb7a2c072076940a..b74719e075c550146cf6879a33c0e08a0177aeae 100644 +index db75ce4ffaf20ac8c20b8ae1bbfca0564c3401cf..2a5b942f32c1a9ce9406b4f5bfc22560274da017 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -1064,6 +1064,7 @@ component("base") { @@ -582,7 +582,7 @@ index e51fd827f7afc01a5189737f86a2414627a6546e..bb50f03ba5622c2bfb96bc75d145f471 return kAttributes; } diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index 9e8831ceb624e757e5174d0c7a6e2659c132245c..b468ad7f19389157c73e2f7305e57160db8f96fa 100644 +index ede10f778a87d33711e363991dc46c68a36cf2ca..5edd90b7ec1d108fc63c16ee0cf2d16fda83da30 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn @@ -346,6 +346,7 @@ source_set("browser") { @@ -1806,7 +1806,7 @@ index 7f08f6e5870b021e578fe29f42fd6476ab53a8df..88e884c1510ad617b86678ed31a7bbaa // Query the display's refresh rate. double refresh_rate = 1.0 / screen.minimumRefreshInterval; diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn -index 0bcdadec85f2a12a226b1bcac3db387e1593757c..ea89c8c2ee61f55d5a5db4ec0ad360d180bde024 100644 +index 61d686b36b09744d0c54cf07e6f01c5edccf91b3..803f28548670dc66e371be462677a3a9880b55e6 100644 --- a/ui/gfx/BUILD.gn +++ b/ui/gfx/BUILD.gn @@ -335,6 +335,12 @@ component("gfx") { diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index f2abd290ba7fb..a3bbeb9701156 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -133,10 +133,10 @@ index 5be62a3fb27e37f3c1db6b811172f6dfebe18f61..34349f9832fe4b9a3d48db613a789afb const GURL& document_url, const WeakDocumentPtr& weak_document_ptr, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index a06f8fcefd34ea766ed4cfd842916d3d579948ba..42f8ca40427cc0f95e9e4e0df5708a80d022c522 100644 +index d689ab09609595e9738a771d723f2923f629d6cb..ae46fafbb67668d3c0a147cb0d8cf8fda958409a 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -2305,7 +2305,7 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2314,7 +2314,7 @@ void RenderProcessHostImpl::CreateNotificationService( case RenderProcessHost::NotificationServiceCreatorType::kSharedWorker: case RenderProcessHost::NotificationServiceCreatorType::kDedicatedWorker: { storage_partition_impl_->GetPlatformNotificationContext()->CreateService( @@ -145,7 +145,7 @@ index a06f8fcefd34ea766ed4cfd842916d3d579948ba..42f8ca40427cc0f95e9e4e0df5708a80 creator_type, std::move(receiver)); break; } -@@ -2313,7 +2313,7 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2322,7 +2322,7 @@ void RenderProcessHostImpl::CreateNotificationService( CHECK(rfh); storage_partition_impl_->GetPlatformNotificationContext()->CreateService( diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch index ec969a5a4a3b9..b80f61ff14769 100644 --- a/patches/chromium/printing.patch +++ b/patches/chromium/printing.patch @@ -11,7 +11,7 @@ majority of changes originally come from these PRs: This patch also fixes callback for manual user cancellation and success. diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc -index 6f35d5ab358627ff8b1cbf09f5643f0f484e027a..5e736b846880a7d4a1e1611a0f70feca102bfbbc 100644 +index f91857eb0b6ad385721b8224100de26dfdd7dd8d..45e8766fcb8d46d8edc3bf8d21d3f826a8ae24be 100644 --- a/chrome/browser/printing/print_job.cc +++ b/chrome/browser/printing/print_job.cc @@ -97,6 +97,7 @@ bool PrintWithReducedRasterization(PrefService* prefs) { @@ -30,7 +30,7 @@ index 6f35d5ab358627ff8b1cbf09f5643f0f484e027a..5e736b846880a7d4a1e1611a0f70feca #endif // BUILDFLAG(IS_WIN) -@@ -151,10 +153,8 @@ void PrintJob::Initialize(std::unique_ptr<PrinterQuery> query, +@@ -204,10 +206,8 @@ void PrintJob::Initialize(std::unique_ptr<PrinterQuery> query, #if BUILDFLAG(IS_WIN) pdf_page_mapping_ = PageNumber::GetPages(settings->ranges(), page_count); @@ -43,7 +43,7 @@ index 6f35d5ab358627ff8b1cbf09f5643f0f484e027a..5e736b846880a7d4a1e1611a0f70feca #endif auto new_doc = base::MakeRefCounted<PrintedDocument>(std::move(settings), -@@ -404,8 +404,10 @@ void PrintJob::StartPdfToEmfConversion( +@@ -407,8 +407,10 @@ void PrintJob::StartPdfToEmfConversion( const PrintSettings& settings = document()->settings(); @@ -55,7 +55,7 @@ index 6f35d5ab358627ff8b1cbf09f5643f0f484e027a..5e736b846880a7d4a1e1611a0f70feca using RenderMode = PdfRenderSettings::Mode; RenderMode mode = print_with_reduced_rasterization -@@ -497,8 +499,10 @@ void PrintJob::StartPdfToPostScriptConversion( +@@ -500,8 +502,10 @@ void PrintJob::StartPdfToPostScriptConversion( if (ps_level2) { mode = PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2; } else { diff --git a/patches/chromium/refactor_expose_file_system_access_blocklist.patch b/patches/chromium/refactor_expose_file_system_access_blocklist.patch index 80d62a0228435..423a731c735de 100644 --- a/patches/chromium/refactor_expose_file_system_access_blocklist.patch +++ b/patches/chromium/refactor_expose_file_system_access_blocklist.patch @@ -8,11 +8,11 @@ it in Electron and prevent drift from Chrome's blocklist. We should look for a w to upstream this change to Chrome. diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc -index 37aa6f6b51c8f83c6b3165ac230a691cecbfd303..f07dee4023f026eb57288f5e71bfa6014b558c00 100644 +index ef6e8792bf1ff3299a16e36f508108abd791c0f1..a69088723f763738598c4efbefe96668ee05e0ad 100644 --- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc +++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc @@ -84,11 +84,13 @@ - #include "chrome/browser/ui/browser_window.h" + #include "chrome/browser/ui/browser_window/public/browser_window_interface_iterator.h" #include "chrome/browser/ui/tabs/public/tab_features.h" #include "chrome/browser/ui/views/file_system_access/file_system_access_page_action_controller.h" +#if 0 @@ -255,7 +255,7 @@ index 37aa6f6b51c8f83c6b3165ac230a691cecbfd303..f07dee4023f026eb57288f5e71bfa601 void ChromeFileSystemAccessPermissionContext::OnWebAppInstalled( const webapps::AppId& app_id) { if (!base::FeatureList::IsEnabled( -@@ -3152,11 +2964,7 @@ bool ChromeFileSystemAccessPermissionContext:: +@@ -3175,11 +2987,7 @@ bool ChromeFileSystemAccessPermissionContext:: HandleType handle_type, UserAction user_action, GrantType grant_type) { @@ -268,7 +268,7 @@ index 37aa6f6b51c8f83c6b3165ac230a691cecbfd303..f07dee4023f026eb57288f5e71bfa601 if (!base::FeatureList::IsEnabled( features::kFileSystemAccessPersistentPermissions)) { return false; -@@ -3207,6 +3015,7 @@ bool ChromeFileSystemAccessPermissionContext:: +@@ -3230,6 +3038,7 @@ bool ChromeFileSystemAccessPermissionContext:: return false; #endif // BUILDFLAG(IS_ANDROID) diff --git a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch index 7f142fe47412e..f1c5e01c220fa 100644 --- a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch +++ b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch @@ -6,7 +6,7 @@ Subject: refactor: patch electron PermissionTypes into blink 6387077: [PermissionOptions] Generalize PermissionRequestDescription | https://chromium-review.googlesource.com/c/chromium/src/+/6387077 diff --git a/components/permissions/permission_util.cc b/components/permissions/permission_util.cc -index 7078014e6db7c43d66b1448b2b36500f206ec4a0..9decf37eaf32eb837141bc9ee96b688188dcc078 100644 +index 86b8df2b23dc975a6db87f04005cb105054305b0..770fd74ac5a21fe6daf68efe68efcf5a69483d84 100644 --- a/components/permissions/permission_util.cc +++ b/components/permissions/permission_util.cc @@ -536,7 +536,17 @@ ContentSettingsType PermissionUtil::PermissionTypeToContentSettingsTypeSafe( @@ -185,10 +185,10 @@ index 549f9079c004ce8427ab2be0dba2e5b24471a8c9..e7276b12b22035730fda18103dad604e struct MidiPermissionDescriptor { diff --git a/third_party/blink/renderer/modules/permissions/permission_utils.cc b/third_party/blink/renderer/modules/permissions/permission_utils.cc -index 63df740efad1e407f0990d2ba48a9cbcb8bdb6f8..3973be677468b36124b88293c46cab615a4a63c5 100644 +index a980ed6afb84eceef9c9b594b325e8e3783821ec..ff2898ca035ae5f2bc218615a87ec148e3764385 100644 --- a/third_party/blink/renderer/modules/permissions/permission_utils.cc +++ b/third_party/blink/renderer/modules/permissions/permission_utils.cc -@@ -146,8 +146,22 @@ String PermissionNameToString(PermissionName name) { +@@ -145,8 +145,22 @@ String PermissionNameToString(PermissionName name) { return "web-printing"; case PermissionName::SMART_CARD: return "smart-card"; diff --git a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch index b1ffe2566a79c..9bb55b9b908ca 100644 --- a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch +++ b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch @@ -31,10 +31,14 @@ index 13e928e3790735fdad68fbca0a8a8e9d0836fdee..2719f8853e840d6f890d01220345644d kDisplaySleepAndAppHideDetection; diff --git a/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.mm b/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.mm -index 32523e6a6f800de3917d18825f94c66ef4ea4388..634d68b9a2840d7c9e7c3b5e23d8b1b8ac02456b 100644 +index a5570988c3721d9f6bd05c402a7658d3af6f2c2c..0a2dba6aa2d48bc39d2a55c8b4d6606744c10ca7 100644 --- a/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.mm +++ b/content/app_shim_remote_cocoa/web_contents_occlusion_checker_mac.mm -@@ -19,6 +19,12 @@ +@@ -14,9 +14,16 @@ + #include "base/mac/mac_util.h" + #include "base/metrics/field_trial_params.h" + #include "base/no_destructor.h" ++#include "content/common/features.h" #include "content/public/browser/content_browser_client.h" #include "content/public/common/content_client.h" @@ -47,7 +51,7 @@ index 32523e6a6f800de3917d18825f94c66ef4ea4388..634d68b9a2840d7c9e7c3b5e23d8b1b8 namespace { NSString* const kWindowDidChangePositionInWindowList = -@@ -127,7 +133,8 @@ - (void)dealloc { +@@ -125,7 +132,8 @@ - (void)dealloc { - (BOOL)isManualOcclusionDetectionEnabled { return [WebContentsOcclusionCheckerMac @@ -58,10 +62,18 @@ index 32523e6a6f800de3917d18825f94c66ef4ea4388..634d68b9a2840d7c9e7c3b5e23d8b1b8 // Alternative implementation of orderWindow:relativeTo:. Replaces diff --git a/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm b/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm -index d8167e854a3264b19a07544039fd01aba45e27a1..2e5a4ae715529e3b7b5c8fbb7195c7cef78ca4ee 100644 +index 17d6d7d935f93afefa9123f56ef9c138c3070f93..8dfa7501a6a2998e107bf9b51f5e5c3d52e880bf 100644 --- a/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/web_contents_view_cocoa.mm -@@ -29,6 +29,7 @@ +@@ -16,6 +16,7 @@ + #import "content/app_shim_remote_cocoa/web_drag_source_mac.h" + #import "content/browser/web_contents/web_contents_view_mac.h" + #import "content/browser/web_contents/web_drag_dest_mac.h" ++#include "content/common/features.h" + #include "content/public/browser/content_browser_client.h" + #include "content/public/common/content_client.h" + #include "ui/base/clipboard/clipboard_constants.h" +@@ -28,6 +29,7 @@ #include "ui/resources/grit/ui_resources.h" using content::DropData; @@ -69,7 +81,7 @@ index d8167e854a3264b19a07544039fd01aba45e27a1..2e5a4ae715529e3b7b5c8fbb7195c7ce using remote_cocoa::mojom::DraggingInfo; using remote_cocoa::mojom::SelectionDirection; -@@ -124,12 +125,15 @@ @implementation WebContentsViewCocoa { +@@ -123,17 +125,20 @@ @implementation WebContentsViewCocoa { WebDragSource* __strong _dragSource; NSDragOperation _dragOperation; @@ -78,16 +90,25 @@ index d8167e854a3264b19a07544039fd01aba45e27a1..2e5a4ae715529e3b7b5c8fbb7195c7ce } + (void)initialize { +- if (![WebContentsOcclusionCheckerMac +- manualOcclusionDetectionSupportedForCurrentMacOSVersion]) { +- return; +- } ++ if (base::FeatureList::IsEnabled(kMacWebContentsOcclusion)) { ++ if (![WebContentsOcclusionCheckerMac ++ manualOcclusionDetectionSupportedForCurrentMacOSVersion]) { ++ return; ++ } + - // Create the WebContentsOcclusionCheckerMac shared instance. - [WebContentsOcclusionCheckerMac sharedInstance]; -+ if (base::FeatureList::IsEnabled(kMacWebContentsOcclusion)) { + // Create the WebContentsOcclusionCheckerMac shared instance. + [WebContentsOcclusionCheckerMac sharedInstance]; + } } - (instancetype)initWithViewsHostableView:(ui::ViewsHostableView*)v { -@@ -440,6 +444,7 @@ - (void)updateWebContentsVisibility: +@@ -444,6 +449,7 @@ - (void)updateWebContentsVisibility: (remote_cocoa::mojom::Visibility)visibility { using remote_cocoa::mojom::Visibility; @@ -95,7 +116,7 @@ index d8167e854a3264b19a07544039fd01aba45e27a1..2e5a4ae715529e3b7b5c8fbb7195c7ce if (!_host) return; -@@ -485,6 +490,20 @@ - (void)updateWebContentsVisibility { +@@ -489,6 +495,20 @@ - (void)updateWebContentsVisibility { [self updateWebContentsVisibility:visibility]; } @@ -116,7 +137,7 @@ index d8167e854a3264b19a07544039fd01aba45e27a1..2e5a4ae715529e3b7b5c8fbb7195c7ce - (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize { // Subviews do not participate in auto layout unless the the size this view // changes. This allows RenderWidgetHostViewMac::SetBounds(..) to select a -@@ -507,11 +526,39 @@ - (void)viewWillMoveToWindow:(NSWindow*)newWindow { +@@ -511,11 +531,39 @@ - (void)viewWillMoveToWindow:(NSWindow*)newWindow { NSWindow* oldWindow = [self window]; @@ -160,7 +181,7 @@ index d8167e854a3264b19a07544039fd01aba45e27a1..2e5a4ae715529e3b7b5c8fbb7195c7ce } if (newWindow) { -@@ -519,26 +566,66 @@ - (void)viewWillMoveToWindow:(NSWindow*)newWindow { +@@ -523,26 +571,66 @@ - (void)viewWillMoveToWindow:(NSWindow*)newWindow { selector:@selector(windowChangedOcclusionState:) name:NSWindowDidChangeOcclusionStateNotification object:newWindow]; diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index 5c72a9af7e634..92f67b41913b8 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index ae2e7540435daef0779f6d442c743f15fc9ae88a..d6a4fbe710b46c62bb6343d91bfaa702a21d78b3 100644 +index deca578dd5f2640cf8eda3f7e672605ab9f3cf8d..2599db9659dad689fb86cc6405f767f8c321b12e 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25338,6 +25338,21 @@ +@@ -25249,6 +25249,21 @@ ] } ], diff --git a/patches/chromium/support_mixed_sandbox_with_zygote.patch b/patches/chromium/support_mixed_sandbox_with_zygote.patch index 4d349df9b51b7..bc0d2fa1e179d 100644 --- a/patches/chromium/support_mixed_sandbox_with_zygote.patch +++ b/patches/chromium/support_mixed_sandbox_with_zygote.patch @@ -22,10 +22,10 @@ However, the patch would need to be reviewed by the security team, as it does touch a security-sensitive class. diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 42f8ca40427cc0f95e9e4e0df5708a80d022c522..b7b348a6db7fb4e78fd10adc97031fbb34c52dac 100644 +index ae46fafbb67668d3c0a147cb0d8cf8fda958409a..3cda71f0b6c606b9df9b457e3f94ee7d3af051b6 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -1896,6 +1896,10 @@ bool RenderProcessHostImpl::Init() { +@@ -1905,6 +1905,10 @@ bool RenderProcessHostImpl::Init() { std::unique_ptr<SandboxedProcessLauncherDelegate> sandbox_delegate = std::make_unique<RendererSandboxedProcessLauncherDelegateWin>( *cmd_line, IsPdf(), IsJitDisabled()); diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index c1374d337a536..8a77316f02dd0 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,7 +15,7 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index ebe44040a554674058ee5307b7df32f224f09c17..2488db00782f22dd9e0c835258d6022e6ea6e644 100644 +index 6174c48ad073bfda2c783dca76dfdf05ee8c5a75..77458232a5ccdaa8a2387f6b154d890cd373117f 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc @@ -8960,6 +8960,17 @@ void RenderFrameHostImpl::EnterFullscreen( diff --git a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch index 09b6873587d8c..540f033e0bb68 100644 --- a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch +++ b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch @@ -10,10 +10,10 @@ to handle this without patching, but this is fairly clean for now and no longer patching legacy devtools code. diff --git a/front_end/entrypoints/main/MainImpl.ts b/front_end/entrypoints/main/MainImpl.ts -index fcf39a1fbc6219ac7d84211753dd9d0d12b236ab..c52bb1c444108e8f9c374ce4e22f56ebead8195e 100644 +index 38e8831e13bcebcc13963081844f94d5cc2e82f8..7550fdaf993af0d8c53ad38de1a0e4d11f9ccc6a 100644 --- a/front_end/entrypoints/main/MainImpl.ts +++ b/front_end/entrypoints/main/MainImpl.ts -@@ -744,6 +744,8 @@ export class MainImpl { +@@ -765,6 +765,8 @@ export class MainImpl { globalThis.Main = globalThis.Main || {}; // @ts-expect-error Exported for Tests.js globalThis.Main.Main = MainImpl; diff --git a/shell/browser/child_web_contents_tracker.cc b/shell/browser/child_web_contents_tracker.cc index b72eabda6c0f9..6a03b51b56ffd 100644 --- a/shell/browser/child_web_contents_tracker.cc +++ b/shell/browser/child_web_contents_tracker.cc @@ -3,7 +3,12 @@ // found in the LICENSE file. #include "shell/browser/child_web_contents_tracker.h" + +#include "base/memory/scoped_refptr.h" #include "content/public/browser/web_contents_user_data.h" +#include "content/public/common/referrer.h" +#include "services/network/public/cpp/resource_request_body.h" +#include "url/gurl.h" namespace electron { diff --git a/shell/browser/child_web_contents_tracker.h b/shell/browser/child_web_contents_tracker.h index c16113af7274f..e944e10c130d2 100644 --- a/shell/browser/child_web_contents_tracker.h +++ b/shell/browser/child_web_contents_tracker.h @@ -7,7 +7,14 @@ #include <string> +#include "base/memory/scoped_refptr.h" #include "content/public/browser/web_contents_user_data.h" +#include "content/public/common/referrer.h" +#include "url/gurl.h" + +namespace network { +class ResourceRequestBody; +} // namespace network namespace electron { diff --git a/shell/browser/ui/message_box_win.cc b/shell/browser/ui/message_box_win.cc index 88775b0446fa8..d683d6c43d077 100644 --- a/shell/browser/ui/message_box_win.cc +++ b/shell/browser/ui/message_box_win.cc @@ -19,8 +19,8 @@ #include "shell/browser/browser.h" #include "shell/browser/native_window_views.h" #include "shell/browser/ui/win/dialog_thread.h" -#include "ui/gfx/icon_util.h" #include "ui/gfx/image/image_skia.h" +#include "ui/gfx/win/icon_util.h" namespace electron { diff --git a/shell/browser/ui/win/taskbar_host.cc b/shell/browser/ui/win/taskbar_host.cc index b0094736e670f..36b8fa8789852 100644 --- a/shell/browser/ui/win/taskbar_host.cc +++ b/shell/browser/ui/win/taskbar_host.cc @@ -18,7 +18,7 @@ #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkRRect.h" #include "ui/display/win/screen_win.h" -#include "ui/gfx/icon_util.h" +#include "ui/gfx/win/icon_util.h" namespace electron { diff --git a/shell/common/api/electron_api_native_image.cc b/shell/common/api/electron_api_native_image.cc index ced163c16abfc..14ab473c7c077 100644 --- a/shell/common/api/electron_api_native_image.cc +++ b/shell/common/api/electron_api_native_image.cc @@ -51,7 +51,7 @@ #if BUILDFLAG(IS_WIN) #include "base/win/scoped_gdi_object.h" #include "shell/common/asar/archive.h" -#include "ui/gfx/icon_util.h" +#include "ui/gfx/win/icon_util.h" #endif namespace electron::api { diff --git a/shell/common/api/electron_api_native_image_win.cc b/shell/common/api/electron_api_native_image_win.cc index 53f1fe7137433..d66f4209c64a0 100644 --- a/shell/common/api/electron_api_native_image_win.cc +++ b/shell/common/api/electron_api_native_image_win.cc @@ -14,8 +14,8 @@ #include "shell/common/gin_helper/promise.h" #include "shell/common/skia_util.h" #include "third_party/skia/include/core/SkBitmap.h" -#include "ui/gfx/icon_util.h" #include "ui/gfx/image/image_skia.h" +#include "ui/gfx/win/icon_util.h" namespace electron::api { diff --git a/shell/common/skia_util.cc b/shell/common/skia_util.cc index c8b7236794489..3e1031a3742c4 100644 --- a/shell/common/skia_util.cc +++ b/shell/common/skia_util.cc @@ -24,7 +24,7 @@ #include "ui/gfx/image/image_util.h" #if BUILDFLAG(IS_WIN) -#include "ui/gfx/icon_util.h" +#include "ui/gfx/win/icon_util.h" #endif namespace electron::util { diff --git a/shell/renderer/electron_render_frame_observer.cc b/shell/renderer/electron_render_frame_observer.cc index da4128349ff96..cc25ed14d0d64 100644 --- a/shell/renderer/electron_render_frame_observer.cc +++ b/shell/renderer/electron_render_frame_observer.cc @@ -7,7 +7,6 @@ #include "base/memory/ref_counted_memory.h" #include "base/trace_event/trace_event.h" #include "content/public/renderer/render_frame.h" -#include "ipc/ipc_message_macros.h" #include "net/base/net_module.h" #include "net/grit/net_resources.h" #include "services/service_manager/public/cpp/interface_provider.h" From cb1f6ed32f3d577520a52500c976f2de12993bf1 Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Sun, 19 Oct 2025 21:46:34 +0200 Subject: [PATCH 143/268] chore: bump chromium to 143.0.7477.0 (main) (#48584) * chore: bump chromium in DEPS to 143.0.7477.0 * 7049117: [CodeCache] Adjust PersistentCache for CodeCache feature Refs https://chromium-review.googlesource.com/c/chromium/src/+/7049117 * chore: update patches * chore: add missing includes of ui/gfx/image/image_skia.h * 7028738: Rename several ipc_* files used by param_traits* Refs https://chromium-review.googlesource.com/c/chromium/src/+/7028738 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com> --- DEPS | 2 +- .../add_didinstallconditionalfeatures.patch | 8 ++--- ..._scheduler_throttling_per_renderview.patch | 6 ++-- ..._windows_to_have_different_web_prefs.patch | 8 ++--- .../build_add_electron_tracing_category.patch | 2 +- ..._mojom_interfaces_to_depend_on_blink.patch | 4 +-- ..._depend_on_packed_resource_integrity.patch | 16 +++++----- patches/chromium/can_create_window.patch | 20 ++++++------ ...ameter_in_script_lifecycle_observers.patch | 8 ++--- .../chromium/chore_partial_revert_of.patch | 2 +- ...screationoverridden_with_full_params.patch | 12 +++---- .../extend_apply_webpreferences.patch | 4 +-- ...t_allow_code_cache_in_custom_schemes.patch | 14 ++++---- ...e_launch_options_for_service_process.patch | 6 ++-- ...moothing_css_rule_and_blink_painting.patch | 20 ++++++------ ...allback_for_sync_and_async_clipboard.patch | 2 +- ...ding_non-standard_schemes_in_iframes.patch | 4 +-- ...ingshelper_behind_branding_buildflag.patch | 4 +-- ...board_hides_on_input_blur_in_webview.patch | 2 +- ...from_localframe_requestexecutescript.patch | 2 +- patches/chromium/frame_host_manager.patch | 4 +-- .../chromium/gritsettings_resource_ids.patch | 4 +-- ..._avoid_private_macos_api_usage.patch.patch | 32 +++++++++---------- .../chromium/notification_provenance.patch | 4 +-- patches/chromium/picture-in-picture.patch | 10 +++--- ...r_changes_to_the_webcontentsobserver.patch | 6 ++-- ..._electron_permissiontypes_into_blink.patch | 2 +- ...efactor_unfilter_unresponsive_events.patch | 2 +- patches/chromium/resource_file_conflict.patch | 6 ++-- ...ean_up_stale_macwebcontentsocclusion.patch | 4 +-- ...al_remove_unused_prehandlemouseevent.patch | 6 ++-- ...windowtreehostwin_window_enlargement.patch | 4 +-- patches/chromium/scroll_bounce_flag.patch | 2 +- ...ecks_in_mediastreamdevicescontroller.patch | 2 +- patches/chromium/web_contents.patch | 2 +- patches/chromium/webview_fullscreen.patch | 4 +-- shell/browser/api/electron_api_base_window.cc | 1 + shell/browser/ui/drag_util_views.cc | 1 + shell/browser/ui/tray_icon_linux.cc | 1 + .../renderer/electron_render_frame_observer.h | 2 +- 40 files changed, 124 insertions(+), 121 deletions(-) diff --git a/DEPS b/DEPS index 62bb28e7bab3c..81b371133a9dc 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '143.0.7474.0', + '143.0.7477.0', 'node_version': 'v22.20.0', 'nan_version': diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index aeec585da2e89..44e0cbc1ad429 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -23,10 +23,10 @@ index 5196f155cdc641b66c4faa77d8b00097145a1290..bbfac47a74f989482343c222b78f187b int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index f3bd4cf4da4aee11d327e05526d3c247142dc3d1..0dfbc387901dfb7937ff57ce98d85291b527ebc7 100644 +index 792ecdf43c810d19641251d3f5eeddccc4c621e9..99d368046177dd92c8b36743f461d348bbf19a2e 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4733,6 +4733,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, +@@ -4723,6 +4723,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, observer.DidCreateScriptContext(context, world_id); } @@ -40,10 +40,10 @@ index f3bd4cf4da4aee11d327e05526d3c247142dc3d1..0dfbc387901dfb7937ff57ce98d85291 int world_id) { for (auto& observer : observers_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index 01d77f902b69071d42dc53d6429239f2c191be5f..cf54df57c72cfaf97d7d3ff1afe134c6f39860f1 100644 +index b0528c4f02bdbf54dc490f9163fbf4f24e3471db..542eddb03c98eac5c03c9bc208af2c863d552b2d 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -603,6 +603,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -604,6 +604,8 @@ class CONTENT_EXPORT RenderFrameImpl void DidObserveLayoutShift(double score, bool after_input_or_scroll) override; void DidCreateScriptContext(v8::Local<v8::Context> context, int world_id) override; diff --git a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch index 026f3f4f78c27..77f735be8c08a 100644 --- a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -116,10 +116,10 @@ index 9c0fe6ad62872f05cfb1179b4b979139008976d2..6aca43e61ef7f1caea74c30e5c3ce449 // Visibility ----------------------------------------------------------- diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index f6d49b17d03a6e82965f5fe33ef1ae16051d7454..c610d4d9af1d8e5d2a12e2fc49fba145b17e086f 100644 +index 071ede882b2503e22ff97967a7f9cbfd96d048bd..baf06a06756ac7cdcd7f7aef15f812d5d64c04d3 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -2514,6 +2514,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( +@@ -2512,6 +2512,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( TRACE_EVENT2("navigation", "WebViewImpl::SetPageLifecycleStateInternal", "old_state", old_state, "new_state", new_state); @@ -130,7 +130,7 @@ index f6d49b17d03a6e82965f5fe33ef1ae16051d7454..c610d4d9af1d8e5d2a12e2fc49fba145 bool storing_in_bfcache = new_state->is_in_back_forward_cache && !old_state->is_in_back_forward_cache; bool restoring_from_bfcache = !new_state->is_in_back_forward_cache && -@@ -4031,10 +4035,23 @@ PageScheduler* WebViewImpl::Scheduler() const { +@@ -4029,10 +4033,23 @@ PageScheduler* WebViewImpl::Scheduler() const { return GetPage()->GetPageScheduler(); } diff --git a/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch b/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch index 201eb52e84772..38ab1192d214e 100644 --- a/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch +++ b/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch @@ -8,7 +8,7 @@ WebPreferences of in-process child windows, rather than relying on process-level command line switches, as before. diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc -index c0362530043cdaffc008d0c90d55cb9522db1557..3eb37d797feccdbb2a9d4b4f26e222b6f837b802 100644 +index dd803e6537c9c7eb1d6e5b36c4268ce2c2314622..c84364663dbb0bcbc51048f1d41bfb6f962dfea4 100644 --- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc +++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc @@ -148,6 +148,19 @@ bool StructTraits<blink::mojom::WebPreferencesDataView, @@ -32,7 +32,7 @@ index c0362530043cdaffc008d0c90d55cb9522db1557..3eb37d797feccdbb2a9d4b4f26e222b6 out->accelerated_video_decode_enabled = data.accelerated_video_decode_enabled(); diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h -index 30572628d5d221e58159391f6bfd8e01525291bd..6020cce84810b9515298b65880091ebb97559688 100644 +index 2a2ccea94b2a1af9ed54b884e1c0cdf67c4a6c32..24c3c81c5170291974cef00f201d69a9ce93ef0f 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences.h +++ b/third_party/blink/public/common/web_preferences/web_preferences.h @@ -9,6 +9,7 @@ @@ -43,7 +43,7 @@ index 30572628d5d221e58159391f6bfd8e01525291bd..6020cce84810b9515298b65880091ebb #include "build/build_config.h" #include "net/nqe/effective_connection_type.h" #include "third_party/blink/public/common/common_export.h" -@@ -464,6 +465,19 @@ struct BLINK_COMMON_EXPORT WebPreferences { +@@ -463,6 +464,19 @@ struct BLINK_COMMON_EXPORT WebPreferences { bool increment_local_surface_id_for_mainframe_same_doc_navigation = true; #endif // BUILDFLAG(IS_ANDROID) @@ -129,7 +129,7 @@ index ccba9b7353c87d2e2bced7770920c976865c0d65..4d93ef8c1976cf533c32bc9c17dbf6b8 return r.cookie_enabled; } diff --git a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom -index 9827715ad3cd306a0ec18fb6b2936ecf8677af21..66cbaf3a5b19a38295cad04d0e978de417984370 100644 +index a8bae4875ba2a8dd3d2574f55d6c229fc8025aa0..b5162c90cc3036ce97ceae590ef905033e10b399 100644 --- a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom +++ b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom @@ -8,9 +8,11 @@ import "third_party/blink/public/mojom/css/preferred_color_scheme.mojom"; diff --git a/patches/chromium/build_add_electron_tracing_category.patch b/patches/chromium/build_add_electron_tracing_category.patch index a2392cdb8426d..509ec4dc263a7 100644 --- a/patches/chromium/build_add_electron_tracing_category.patch +++ b/patches/chromium/build_add_electron_tracing_category.patch @@ -8,7 +8,7 @@ categories in use are known / declared. This patch is required for us to introduce a new Electron category for Electron-specific tracing. diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h -index b89448c88ca896247a6c3e12c858d6d13856c5b7..ed60fbfc350d546834a26e74ee5bd6e6c0579ed4 100644 +index 0781468366f8684b0e245bd6df85c1f48b5a915a..5d4ea347e2cba761870462ff1e623792416dbf4c 100644 --- a/base/trace_event/builtin_categories.h +++ b/base/trace_event/builtin_categories.h @@ -128,6 +128,7 @@ PERFETTO_DEFINE_CATEGORIES_IN_NAMESPACE_WITH_ATTRS( diff --git a/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch b/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch index b3ab1bac45d53..611b5b5febd0d 100644 --- a/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch +++ b/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch @@ -10,10 +10,10 @@ Needed for: 2) //electron/shell/common:web_contents_utility diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn -index 8e91c465c68bec818253820ecaeeb7c3feb180a2..fea8bb9f87c007775a2bb6e1abe1ec498a8b19b4 100644 +index b6511498e08e6d0a280b89175fcfdb61c7e40df4..e214d7ea5e7108baf9f9910d6b44deff587914c2 100644 --- a/content/public/common/BUILD.gn +++ b/content/public/common/BUILD.gn -@@ -371,6 +371,8 @@ mojom("interfaces") { +@@ -370,6 +370,8 @@ mojom("interfaces") { "//content/common/*", "//extensions/common:mojom", "//extensions/common:mojom_blink", diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index e5a9cde81158e..66b6142f0eea2 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -11,10 +11,10 @@ if we ever align our .pak file generation with Chrome we can remove this patch. diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index 9bffa9c8272a81059eb05fa79107bb326029402c..d286e9ab4edf86570418d4b3699c8f2d720597e5 100644 +index e7ee2d88b136be97e0668874a309085554041a5a..1ed28fa85bf906bea9628da146627067b105d94f 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn -@@ -197,11 +197,16 @@ if (!is_android && !is_mac) { +@@ -196,11 +196,16 @@ if (!is_android && !is_mac) { "common/crash_keys.h", ] @@ -33,10 +33,10 @@ index 9bffa9c8272a81059eb05fa79107bb326029402c..d286e9ab4edf86570418d4b3699c8f2d "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index dfb4e59e972ebd9fd7f919f646c8c197ca24b02f..351956f63e0a4265756e5a49400828f901b7c5c7 100644 +index 5e2fef20796c5060a3d31eed46f92f5e0c3eb105..ca9eb62e3991b5af4c4604ebfd0f8feedb25cae0 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4817,7 +4817,7 @@ static_library("browser") { +@@ -4814,7 +4814,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index dfb4e59e972ebd9fd7f919f646c8c197ca24b02f..351956f63e0a4265756e5a49400828f9 # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 8e6eac2e03d473b7741e41a17ec091ef7efa8cdf..3000724346e73a0641bf34e67009e7a34e7f74b3 100644 +index 65f7fb312a896cce006780d8ba5a1d72a812bc1b..94455256a730c724daf9af5b139ef35d224aab7d 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7570,9 +7570,12 @@ test("unit_tests") { +@@ -7557,9 +7557,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index 8e6eac2e03d473b7741e41a17ec091ef7efa8cdf..3000724346e73a0641bf34e67009e7a3 "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8505,6 +8508,10 @@ test("unit_tests") { +@@ -8493,6 +8496,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index 8e6eac2e03d473b7741e41a17ec091ef7efa8cdf..3000724346e73a0641bf34e67009e7a3 sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8561,7 +8568,6 @@ test("unit_tests") { +@@ -8549,7 +8556,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 47d7fa7f868f0..0fb14eba58631 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,7 +9,7 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 42c40d8c9c10cbf7ef15c5e764dfbd0ad91f8919..6174c48ad073bfda2c783dca76dfdf05ee8c5a75 100644 +index e9df50dedd831f7545361aa3b33ec42ad44ab944..7b3d2f97a8a6aec42303b658b6820c393354f01c 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc @@ -9854,6 +9854,7 @@ void RenderFrameHostImpl::CreateNewWindow( @@ -21,7 +21,7 @@ index 42c40d8c9c10cbf7ef15c5e764dfbd0ad91f8919..6174c48ad073bfda2c783dca76dfdf05 &no_javascript_access); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index b484a953a22cf32e873ee27b2c1c342e99bbeea2..32d16bae9a25d06f410f51d3cc25c27ea83c6821 100644 +index 533e0ba9934532b67441a9116546bd00c16c19a9..df1b2c1a866ccb275a87dab55e3b0f654a370f49 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -5338,6 +5338,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( @@ -77,10 +77,10 @@ index 15a83f61ed4e31ba34cbc19995cd9d68b1599f1d..9cf9fefad46a6c2ead4085adc76e0c07 // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 7b813d46382672421e569f68204f6f127bab7dce..64ad3e62245ad9b1fd0b8e0487b6d14d34a6d5f3 100644 +index e42ca23fc0deadbf6f17a40238b06fbf86e71572..34dedcda9d191f7c927f13ede7056ff21082b6f1 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -881,6 +881,8 @@ bool ContentBrowserClient::CanCreateWindow( +@@ -882,6 +882,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -90,10 +90,10 @@ index 7b813d46382672421e569f68204f6f127bab7dce..64ad3e62245ad9b1fd0b8e0487b6d14d bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 3f0599ae229b9785146fcd29528d183f2d04a8e7..ef9073ffcf8a5fa51fa028667cf3328cfae6f994 100644 +index 25ac9504205330f94a2d09b0f29648973f1165e7..ffe9b06a5c1ad941f803b33b9654f48b7589f754 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -196,6 +196,7 @@ class NetworkService; +@@ -201,6 +201,7 @@ class NetworkService; class TrustedURLLoaderHeaderClient; } // namespace mojom struct ResourceRequest; @@ -101,7 +101,7 @@ index 3f0599ae229b9785146fcd29528d183f2d04a8e7..ef9073ffcf8a5fa51fa028667cf3328c } // namespace network namespace sandbox { -@@ -1454,6 +1455,8 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -1459,6 +1460,8 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -170,10 +170,10 @@ index caf97e0c94edfa1106b465e793190c82f646ebdb..38b61d04446736bcc44a412f633c01ed // typically happens when popups are created. virtual void WebContentsCreated(WebContents* source_contents, diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index edca410830a8a70ecb6ac275c3f87bc2b7fb4f8c..f3bd4cf4da4aee11d327e05526d3c247142dc3d1 100644 +index 66714ce46183169853952879cca77069ad248017..792ecdf43c810d19641251d3f5eeddccc4c621e9 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -6832,6 +6832,10 @@ WebView* RenderFrameImpl::CreateNewWindow( +@@ -6815,6 +6815,10 @@ WebView* RenderFrameImpl::CreateNewWindow( request.HasUserGesture(), GetWebFrame()->IsAdFrame(), GetWebFrame()->IsAdScriptInStack()); @@ -232,7 +232,7 @@ index 82e9d3dfb5f7da76d89fe15ae61d379fa46e177d..fd035512099a54dff6cc951a2226c23a } // namespace blink diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc -index daf39704b251e33828ca4bf7678b4b620f677843..576f7d6f351dd3c009ad48f3b3e9f5272f6fb4cf 100644 +index 29a3e6f8640c8c574803dde123639d52e089e421..15f9762af0726b52657982e2005d8a40a011a848 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc @@ -2347,6 +2347,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, diff --git a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch index 6ece03f2a69ec..8105b83fac5e4 100644 --- a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch +++ b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch @@ -34,10 +34,10 @@ index bbfac47a74f989482343c222b78f187b70297e4e..3677ca3345fbc775d139684a12fe3624 virtual void DidClearWindowObject() {} virtual void DidChangeScrollOffset() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 0dfbc387901dfb7937ff57ce98d85291b527ebc7..a03e501a6c21d20fb571f0b1272c4425cd243681 100644 +index 99d368046177dd92c8b36743f461d348bbf19a2e..b0a1859d22063cf6d5a73b5ccd5ea6fb86f9a6b9 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4739,10 +4739,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( +@@ -4729,10 +4729,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( observer.DidInstallConditionalFeatures(context, world_id); } @@ -52,10 +52,10 @@ index 0dfbc387901dfb7937ff57ce98d85291b527ebc7..a03e501a6c21d20fb571f0b1272c4425 void RenderFrameImpl::DidChangeScrollOffset() { diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index cf54df57c72cfaf97d7d3ff1afe134c6f39860f1..54f83b86322dcf9ad544a4ba71fb83e77e8e572c 100644 +index 542eddb03c98eac5c03c9bc208af2c863d552b2d..e91c0f20d4e401a43936a9de9b6a6b6c1199612c 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -605,7 +605,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -606,7 +606,8 @@ class CONTENT_EXPORT RenderFrameImpl int world_id) override; void DidInstallConditionalFeatures(v8::Local<v8::Context> context, int world_id) override; diff --git a/patches/chromium/chore_partial_revert_of.patch b/patches/chromium/chore_partial_revert_of.patch index 95ba0f58154f9..edf77e03394c6 100644 --- a/patches/chromium/chore_partial_revert_of.patch +++ b/patches/chromium/chore_partial_revert_of.patch @@ -14,7 +14,7 @@ track down the source of this problem & figure out if we can fix it by changing something in Electron. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index a180b19360dd35f38a2927d01a3fd3ecd0c7dd4e..3489db5f1acfbd4d6fa6d3650e3e73498c728791 100644 +index 279edf4e1a04f9c9884c088001561ea3d539063d..4fe94ab63b0bea981406f8c4d181a85d1e5721a4 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -5309,7 +5309,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index 23b51d46b230f..3eae35299cd38 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -80,10 +80,10 @@ index 39fa45f0a0f9076bd7ac0be6f455dd540a276512..3d0381d463eed73470b28085830f2a23 content::WebContents* source, const content::OpenURLParams& params, diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index 5392350919f54b5270e817de94599e8dc6a96d4c..311d89b44bdbe71b8a647b6e1a2fd3376d0306e9 100644 +index a66f503e1ffcf5c7435d3bfa5b8af6eda707f125..9af4329932a838c05a3ef7aa5f5da884a501c342 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc -@@ -2377,7 +2377,8 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2373,7 +2373,8 @@ bool Browser::IsWebContentsCreationOverridden( content::mojom::WindowContainerType window_container_type, const GURL& opener_url, const std::string& frame_name, @@ -93,7 +93,7 @@ index 5392350919f54b5270e817de94599e8dc6a96d4c..311d89b44bdbe71b8a647b6e1a2fd337 if (HasActorTask(profile(), opener)) { // If an ExecutionEngine is acting on the opener, prevent it from creating a // new WebContents. We'll instead force the navigation to happen in the same -@@ -2390,7 +2391,7 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2386,7 +2387,7 @@ bool Browser::IsWebContentsCreationOverridden( return (window_container_type == content::mojom::WindowContainerType::BACKGROUND && ShouldCreateBackgroundContents(source_site_instance, opener_url, @@ -103,10 +103,10 @@ index 5392350919f54b5270e817de94599e8dc6a96d4c..311d89b44bdbe71b8a647b6e1a2fd337 WebContents* Browser::CreateCustomWebContents( diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h -index bdb26bf23fde058fcee289a8a6a01cf973cc4a91..c8de3b2b777c9192635269943a6255adbadc9294 100644 +index 370f70ca0cce817fa396b284f95cda3e814eeed0..bcc9b602d361df1307a7d4a67315900a167a716d 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h -@@ -944,8 +944,7 @@ class Browser : public TabStripModelObserver, +@@ -943,8 +943,7 @@ class Browser : public TabStripModelObserver, content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -222,7 +222,7 @@ index b969f1d97b7e3396119b579cfbe61e19ff7d2dd4..b8d6169652da28266a514938b45b39c5 content::WebContents* AddNewContents( content::WebContents* source, diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index b568a66369e246322698630e495826f0c1109221..2adea6e88f5e09f3416e665039e83c367dca58af 100644 +index b2b12ef9dd78713eaee6792523fcddef97c3e0ca..710fec97c2443921c00a9a65b06a9b7862517cdd 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -5272,8 +5272,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( diff --git a/patches/chromium/extend_apply_webpreferences.patch b/patches/chromium/extend_apply_webpreferences.patch index 4aeb01cfc10c8..5bad3454fd7fa 100644 --- a/patches/chromium/extend_apply_webpreferences.patch +++ b/patches/chromium/extend_apply_webpreferences.patch @@ -15,10 +15,10 @@ Ideally we could add an embedder observer pattern here but that can be done in future work. diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index c610d4d9af1d8e5d2a12e2fc49fba145b17e086f..2e3ac83d16cd08372a4bdf48a5801a5bed1da220 100644 +index baf06a06756ac7cdcd7f7aef15f812d5d64c04d3..ca2e14d97532f17143ae80ce5ef7efc18463f2ce 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -1908,6 +1908,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, +@@ -1906,6 +1906,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, #if BUILDFLAG(IS_MAC) web_view_impl->SetMaximumLegibleScale( prefs.default_maximum_page_scale_factor); diff --git a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch index fba11c008ee61..f9dab8e9a350a 100644 --- a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch +++ b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch @@ -253,7 +253,7 @@ index fb3fdfca483ff5041ee98095af3f6ac2640adbaf..ada19d78ec1337b0c49a1597c877886f + } // namespace content diff --git a/content/browser/renderer_host/code_cache_host_impl.cc b/content/browser/renderer_host/code_cache_host_impl.cc -index 4a28c9618120b0b85b01687b3a231539fe1d9c34..91123e98ecb9aadf91d355947da8aa4dba7150fa 100644 +index 95134893c5eb6fa22b8e535a3495b2d4b3325447..71003cc065b579992dab4a781b696685cf506cce 100644 --- a/content/browser/renderer_host/code_cache_host_impl.cc +++ b/content/browser/renderer_host/code_cache_host_impl.cc @@ -8,6 +8,7 @@ @@ -261,10 +261,10 @@ index 4a28c9618120b0b85b01687b3a231539fe1d9c34..91123e98ecb9aadf91d355947da8aa4d #include <utility> +#include "base/containers/contains.h" - #include "base/feature_list.h" #include "base/functional/bind.h" #include "base/functional/callback_helpers.h" -@@ -38,6 +39,7 @@ + #include "base/metrics/histogram_functions.h" +@@ -36,6 +37,7 @@ #include "third_party/blink/public/mojom/loader/code_cache.mojom-data-view.h" #include "url/gurl.h" #include "url/origin.h" @@ -272,7 +272,7 @@ index 4a28c9618120b0b85b01687b3a231539fe1d9c34..91123e98ecb9aadf91d355947da8aa4d using blink::mojom::CacheStorageError; -@@ -112,6 +114,11 @@ std::optional<std::string> GetContextKeyForPersistentCacheCollection( +@@ -110,6 +112,11 @@ std::optional<std::string> GetContextKeyForPersistentCacheCollection( return context_key; } @@ -284,7 +284,7 @@ index 4a28c9618120b0b85b01687b3a231539fe1d9c34..91123e98ecb9aadf91d355947da8aa4d bool CheckSecurityForAccessingCodeCacheData( const GURL& resource_url, int render_process_id, -@@ -122,40 +129,56 @@ bool CheckSecurityForAccessingCodeCacheData( +@@ -120,40 +127,56 @@ bool CheckSecurityForAccessingCodeCacheData( // Code caching is only allowed for http(s) and chrome/chrome-untrusted // scripts. Furthermore, there is no way for http(s) pages to load chrome or @@ -363,7 +363,7 @@ index 4a28c9618120b0b85b01687b3a231539fe1d9c34..91123e98ecb9aadf91d355947da8aa4d } if (operation == CodeCacheHostImpl::Operation::kWrite) { -@@ -612,6 +635,7 @@ std::optional<GURL> CodeCacheHostImpl::GetSecondaryKeyForCodeCache( +@@ -607,6 +630,7 @@ std::optional<GURL> CodeCacheHostImpl::GetSecondaryKeyForCodeCache( process_lock.MatchesScheme(url::kHttpsScheme) || process_lock.MatchesScheme(content::kChromeUIScheme) || process_lock.MatchesScheme(content::kChromeUIUntrustedScheme) || @@ -405,7 +405,7 @@ index 52f16979b05b692ef72762d0cbc16bcb361b047e..b658ebeb9c572158b27d94af56331be8 std::vector<std::string> extension_schemes; // Registers a URL scheme with a predefined default custom handler. diff --git a/url/url_util.cc b/url/url_util.cc -index e47605cd20719aef6f076419bbbc7a656e6dc590..0bf502c6ad8564ed66bb014e260a93230e62d992 100644 +index d50a7842442e60e8d43bfb5f1226501a065ddf83..8cb0380cfb69e3abac3018b5bab10a73e2019215 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -136,6 +136,9 @@ struct SchemeRegistry { diff --git a/patches/chromium/feat_configure_launch_options_for_service_process.patch b/patches/chromium/feat_configure_launch_options_for_service_process.patch index d9f7c6c98437a..ca44ff7ec237f 100644 --- a/patches/chromium/feat_configure_launch_options_for_service_process.patch +++ b/patches/chromium/feat_configure_launch_options_for_service_process.patch @@ -348,10 +348,10 @@ index 580fa663e729a43bef44a10de8983c4aecc312fb..f39af3df87786a472f987309ac0dea69 // Whether or not to bind viz::mojom::Gpu to the utility process. bool allowed_gpu_; diff --git a/content/browser/service_host/utility_sandbox_delegate.cc b/content/browser/service_host/utility_sandbox_delegate.cc -index 8f89c28144e1ecf3d7dbf9a3b43031cbad12a8ea..faa49bb63bd2e9080da441286bdbf427f22cd26f 100644 +index 67a4e6b3a522a1fffd850ee9e6be08c1cfd3cab6..4ec82c5b35392966262bcb77bc16757705d7ce4b 100644 --- a/content/browser/service_host/utility_sandbox_delegate.cc +++ b/content/browser/service_host/utility_sandbox_delegate.cc -@@ -43,17 +43,19 @@ UtilitySandboxedProcessLauncherDelegate:: +@@ -39,17 +39,19 @@ UtilitySandboxedProcessLauncherDelegate:: UtilitySandboxedProcessLauncherDelegate( sandbox::mojom::Sandbox sandbox_type, const base::EnvironmentMap& env, @@ -375,7 +375,7 @@ index 8f89c28144e1ecf3d7dbf9a3b43031cbad12a8ea..faa49bb63bd2e9080da441286bdbf427 #if DCHECK_IS_ON() bool supported_sandbox_type = sandbox_type_ == sandbox::mojom::Sandbox::kNoSandbox || -@@ -121,11 +123,28 @@ UtilitySandboxedProcessLauncherDelegate::GetSandboxType() { +@@ -114,11 +116,28 @@ UtilitySandboxedProcessLauncherDelegate::GetSandboxType() { return sandbox_type_; } diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index d533def1ae6b6..12491aa33061c 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -20,7 +20,7 @@ making three primary changes to Blink: * Controls whether the CSS rule is available. diff --git a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom -index dde6a1d1928921ee8c88128aadc22938a55c54f0..40ed673f5a00d7db98b672420fa8ad2429ccfb03 100644 +index 3735887b8084d2044a27b7a93147ed1653d14384..6afb92d96f23b4baa46d41968a49d76bc6d80aa1 100644 --- a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom +++ b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom @@ -48,6 +48,7 @@ enum CSSSampleId { @@ -45,10 +45,10 @@ index e189d584f05f2ce6354c03a9b19f56985df8a15e..41b430e8f2416be098494f5c49fb97ca 'internal-forced-visited-'): internal_visited_order = 0 diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 -index ba708dfe213587c303707d0eb4fcea82363bc681..63a778afca3350a1555d109407b04704f38c7cb1 100644 +index 5e4e2becfabf4a85d9253b590ecc86297aa37ce4..a916e3dd149f33ad2a98d031303a38f9c673c9b8 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5 -@@ -9035,6 +9035,26 @@ +@@ -9040,6 +9040,26 @@ property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], }, @@ -76,7 +76,7 @@ index ba708dfe213587c303707d0eb4fcea82363bc681..63a778afca3350a1555d109407b04704 { name: "-internal-visited-color", diff --git a/third_party/blink/renderer/core/css/css_property_equality.cc b/third_party/blink/renderer/core/css/css_property_equality.cc -index 80b6ddafd5649ff5972e6533b68f300c223482d0..65fab5a716f6118515ab0a11e776e85c57f4ce57 100644 +index 0de4f52f5f047f5ec8f94ad9337f4c75a5fd364d..930a0c39390043faf8c326785a4214ab41b82603 100644 --- a/third_party/blink/renderer/core/css/css_property_equality.cc +++ b/third_party/blink/renderer/core/css/css_property_equality.cc @@ -354,6 +354,8 @@ bool CSSPropertyEquality::PropertiesEqual(const PropertyHandle& property, @@ -89,10 +89,10 @@ index 80b6ddafd5649ff5972e6533b68f300c223482d0..65fab5a716f6118515ab0a11e776e85c return a.EmptyCells() == b.EmptyCells(); case CSSPropertyID::kFill: diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -index 68dc56e6eb5674b031117243bd97db6c5359cace..afee29f28468513a62e3cd70e7b49d90b5c606ed 100644 +index 634af2759e469274b0b9584c29c87dad910c0c6c..166ab54556534327189fa66de0e273882fdb4c4f 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -@@ -12468,5 +12468,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( +@@ -12486,5 +12486,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( CSSValueID::kNone>(stream); } @@ -201,10 +201,10 @@ index 0802c73aa4aaf4e1fb5efd367758f19c36691f71..5f06c0af277a7c937e694470beac707a return result; } diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn -index 53fdc793db73f873310860f5767ed7dcb928e24c..f4d2ac7351353ec9907230051f4db6ff0d00c4bf 100644 +index d7a67479b6140a407a9097b189cdf874c68f7dea..ab707c142986b6f9ee8c0e28064116746f1db248 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn -@@ -1669,6 +1669,8 @@ component("platform") { +@@ -1668,6 +1668,8 @@ component("platform") { "widget/widget_base.h", "widget/widget_base_client.h", "windows_keyboard_codes.h", @@ -214,7 +214,7 @@ index 53fdc793db73f873310860f5767ed7dcb928e24c..f4d2ac7351353ec9907230051f4db6ff sources -= blink_platform_avx_files diff --git a/third_party/blink/renderer/platform/geometry/contoured_rect.h b/third_party/blink/renderer/platform/geometry/contoured_rect.h -index 59031b23d3c50aa87db48a5c5a66c5ab04a8103a..1f83cf0dff83d748bf1caafd3685202c14a3aaed 100644 +index 65bd093f56eafc7dac2cd51f9d32f5c2879cb2ea..9a56422bcef24d8fcbfa24a7ff4626c670f1491b 100644 --- a/third_party/blink/renderer/platform/geometry/contoured_rect.h +++ b/third_party/blink/renderer/platform/geometry/contoured_rect.h @@ -52,19 +52,29 @@ class PLATFORM_EXPORT ContouredRect { @@ -312,7 +312,7 @@ index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index 9bd900305a5fd76bc68c0106a2e2ff4350f4408b..97525abc3d02f748e921ffc673a574d370cf96a0 100644 +index ad26b8e7aee2692730c37bc78545d1aa8eb20437..4fb2eaee6626d3c459313ef1a86b130a9ad91278 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch index 2b82da812c184..ea4b4f4badd35 100644 --- a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch +++ b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch @@ -32,7 +32,7 @@ index fc516272be02a3dac1086e4aaf2015dc946cc3c2..86b8df2b23dc975a6db87f04005cb105 break; } diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc -index e4a4d129e8b7ea11d3825ab55a6a71706d94d34f..a43a28e60d87a446adc187121abbbeeecb50bac7 100644 +index 2011a912add2bbd74129e7ecad9ca6f5bade24ee..87dc1b64e3cedf6d59d8ab2dc811bf8300193bdc 100644 --- a/content/browser/permissions/permission_controller_impl.cc +++ b/content/browser/permissions/permission_controller_impl.cc @@ -94,6 +94,7 @@ PermissionToSchedulingFeature(PermissionType permission_name) { diff --git a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch index e76186e3c163d..e6fb571781093 100644 --- a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch +++ b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch @@ -28,10 +28,10 @@ The patch should be removed in favor of either: Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397. diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index f1a98c5b954f8eb25376e0db1024a71bfe36375a..190ecb1887b45555d4a572881404ff6692bd18a4 100644 +index c85afe527615663d4db159abe89e6c8edfe0227c..f35735988b64d93474bda64a529ea0671d122647 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc -@@ -11412,6 +11412,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { +@@ -11429,6 +11429,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { target_rph_id); } diff --git a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch index 5b95c8ca1edb1..b34e4e6eb1759 100644 --- a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch +++ b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch @@ -83,10 +83,10 @@ index de8cfaabed0e4ed3db9b55729f7ea22014f63dd2..45df203c236ed0f36f079ad0dcbe98e9 PictureInPictureOcclusionTracker* diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -index 117b6b94f54f7629b5233cfdf988608476e7321c..8ac7f669984b47d4ec831ae9e2617eb2ea4ae36a 100644 +index f737adbdc968e659cf5ba59e6cd5fd5fa093edff..0c9d713a51a15abdec331f8991bfa6222984afec 100644 --- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -@@ -471,11 +471,13 @@ std::unique_ptr<VideoOverlayWindowViews> VideoOverlayWindowViews::Create( +@@ -474,11 +474,13 @@ std::unique_ptr<VideoOverlayWindowViews> VideoOverlayWindowViews::Create( #endif // BUILDFLAG(IS_WIN) diff --git a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch index ad6e5a6a4d423..8ba3aeabd005a 100644 --- a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch +++ b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch @@ -87,7 +87,7 @@ index 75df43e3cd2721a92c90c18154d53d5c203e2465..ce42c75c8face36d21f53f44c0201ac4 // The view with active text input state, i.e., a focused <input> element. // It will be nullptr if no such view exists. Note that the active view diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 47bbe40f74ded6be7d5ae4e1c96331bef3070291..a180b19360dd35f38a2927d01a3fd3ecd0c7dd4e 100644 +index 9b878662e81e8a0c74542040ebab6bb2f6f078f9..279edf4e1a04f9c9884c088001561ea3d539063d 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -10134,7 +10134,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( diff --git a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch index 2615b6db8151c..817f76ac79836 100644 --- a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch +++ b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch @@ -203,7 +203,7 @@ index fa65331f40b90d812b71a489fd560e9359152d2b..390714d631dc88ef92d59ef9618a5706 const mojom::blink::UserActivationOption user_activation_option_; const mojom::blink::LoadEventBlockingOption blocking_option_; diff --git a/third_party/blink/renderer/core/frame/web_frame_test.cc b/third_party/blink/renderer/core/frame/web_frame_test.cc -index b78f7ac17be5915a57e217bbaa981fb04d60dd40..996eb063b8b7e48ce1744de7a6fcb78fa594cf74 100644 +index eb2dae117ece11bce06bac2197fd2198f54e3b08..80687e766019eafed602efa1bfd37483c703eadf 100644 --- a/third_party/blink/renderer/core/frame/web_frame_test.cc +++ b/third_party/blink/renderer/core/frame/web_frame_test.cc @@ -295,6 +295,7 @@ void ExecuteScriptsInMainWorld( diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index 22ede7f62eb89..9fe311833361a 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -20,10 +20,10 @@ index b930c5e23c9d10b9be4126cf2eeb057ab04c519f..945f17e13f47462acc3895a3340cd108 } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index ef9073ffcf8a5fa51fa028667cf3328cfae6f994..c7f660c6602a2cead04540245da10c0b99a27910 100644 +index ffe9b06a5c1ad941f803b33b9654f48b7589f754..bc5a75f8c2686a543226858f54ab54388df706cb 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -334,6 +334,11 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -339,6 +339,11 @@ class CONTENT_EXPORT ContentBrowserClient { virtual ~ContentBrowserClient() = default; diff --git a/patches/chromium/gritsettings_resource_ids.patch b/patches/chromium/gritsettings_resource_ids.patch index 6facda7473d19..7282a1a539420 100644 --- a/patches/chromium/gritsettings_resource_ids.patch +++ b/patches/chromium/gritsettings_resource_ids.patch @@ -6,10 +6,10 @@ Subject: gritsettings_resource_ids.patch Add electron resources file to the list of resource ids generation. diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec -index 0b26bb83f4ac8b9e394dee53dee6117adf2e3f28..734939a9e901583fb359a3e02e8a4531a322013a 100644 +index 608d46c32bd650bbdfee69adc27116c0470c21d9..993cc1fc056aceb6bb30343bae4f6837cb51b69c 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec -@@ -1593,6 +1593,11 @@ +@@ -1595,6 +1595,11 @@ "messages": [10120], }, diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index b5b632e177d28..009e582ae8618 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -35,10 +35,10 @@ system font by checking if it's kCTFontPriorityAttribute is set to system priority. diff --git a/base/BUILD.gn b/base/BUILD.gn -index db75ce4ffaf20ac8c20b8ae1bbfca0564c3401cf..2a5b942f32c1a9ce9406b4f5bfc22560274da017 100644 +index ceee35240ccce11f01557582f5f89494c43b190a..09ef47870e18621013cc6f9154dfc247df9ef304 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn -@@ -1064,6 +1064,7 @@ component("base") { +@@ -1066,6 +1066,7 @@ component("base") { "//build:ios_buildflags", "//build/config/compiler:compiler_buildflags", "//third_party/modp_b64", @@ -582,10 +582,10 @@ index e51fd827f7afc01a5189737f86a2414627a6546e..bb50f03ba5622c2bfb96bc75d145f471 return kAttributes; } diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index ede10f778a87d33711e363991dc46c68a36cf2ca..5edd90b7ec1d108fc63c16ee0cf2d16fda83da30 100644 +index 7a62de74fd44d46ad08a2e16d2d0349237b9c6f8..255ced54478f633a76fcbe3012c6b03f280bc8e5 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn -@@ -346,6 +346,7 @@ source_set("browser") { +@@ -344,6 +344,7 @@ source_set("browser") { "//ui/webui/resources", "//v8", "//v8:v8_version", @@ -703,10 +703,10 @@ index 1c091d1bfaea0fe00e99584d153a1b36bf574b9e..9524be857c44a6523cf101d3cd24e69b /////////////////////////////////////////////////////////////////////////////// diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn -index 8c293f5bb0e859f438a7ab50b70b4d5449dc1358..d58c73427935127fdec173224bcb970964a9f14d 100644 +index 19c948e949386a1678767cbc606304e65400c507..9394e841d84593ea846b785cffe2ab06efffd7d1 100644 --- a/content/common/BUILD.gn +++ b/content/common/BUILD.gn -@@ -275,6 +275,7 @@ source_set("common") { +@@ -274,6 +274,7 @@ source_set("common") { "//ui/shell_dialogs", "//url", "//url/ipc:url_ipc", @@ -715,10 +715,10 @@ index 8c293f5bb0e859f438a7ab50b70b4d5449dc1358..d58c73427935127fdec173224bcb9709 defines = [] diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn -index b6a99875ce151b5a517e2c850ba50d8ba9749e0f..b88b411d7d5430200c88203e727c49ab90233140 100644 +index 8404e4d6b8b2fc2d5f1597d5cbfcbcea2e692091..678121670b4977853e6fa1515f37d1ad21a3bd33 100644 --- a/content/renderer/BUILD.gn +++ b/content/renderer/BUILD.gn -@@ -323,6 +323,7 @@ target(link_target_type, "renderer") { +@@ -322,6 +322,7 @@ target(link_target_type, "renderer") { "//ui/surface", "//url", "//v8", @@ -797,7 +797,7 @@ index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbe } // namespace content diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn -index 5f1636775e238ef9e1722d6f54d358d0f7f21cbe..8ebf47f05e7395a8db8325e74f17bc89bef2f019 100644 +index 9f546ba120be2ca3074ec6fc482c5f841fcb95a5..87991225d7cc5cac1af6b75bb9f5d101c53b9796 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn @@ -703,6 +703,7 @@ static_library("test_support") { @@ -808,7 +808,7 @@ index 5f1636775e238ef9e1722d6f54d358d0f7f21cbe..8ebf47f05e7395a8db8325e74f17bc89 ] data_deps = [ -@@ -1175,6 +1176,8 @@ static_library("browsertest_support") { +@@ -1178,6 +1179,8 @@ static_library("browsertest_support") { # TODO(crbug.com/40031409): Fix code that adds exit-time destructors and # enable the diagnostic by removing this line. configs += [ "//build/config/compiler:no_exit_time_destructors" ] @@ -817,7 +817,7 @@ index 5f1636775e238ef9e1722d6f54d358d0f7f21cbe..8ebf47f05e7395a8db8325e74f17bc89 } mojom("content_test_mojo_bindings") { -@@ -2065,6 +2068,7 @@ test("content_browsertests") { +@@ -2068,6 +2071,7 @@ test("content_browsertests") { "//ui/shell_dialogs", "//ui/snapshot", "//ui/webui:test_support", @@ -825,7 +825,7 @@ index 5f1636775e238ef9e1722d6f54d358d0f7f21cbe..8ebf47f05e7395a8db8325e74f17bc89 ] if (!(is_chromeos && target_cpu == "arm64" && current_cpu == "arm")) { -@@ -3395,6 +3399,7 @@ test("content_unittests") { +@@ -3397,6 +3401,7 @@ test("content_unittests") { "//ui/shell_dialogs", "//ui/webui:test_support", "//url", @@ -1806,7 +1806,7 @@ index 7f08f6e5870b021e578fe29f42fd6476ab53a8df..88e884c1510ad617b86678ed31a7bbaa // Query the display's refresh rate. double refresh_rate = 1.0 / screen.minimumRefreshInterval; diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn -index 61d686b36b09744d0c54cf07e6f01c5edccf91b3..803f28548670dc66e371be462677a3a9880b55e6 100644 +index 7bfbb8f3b19bd459d9e7e4926cf5ef2f352e3d15..0a7c5f16abb26c1be7ccba8e6be206d7b7871ef7 100644 --- a/ui/gfx/BUILD.gn +++ b/ui/gfx/BUILD.gn @@ -335,6 +335,12 @@ component("gfx") { @@ -1861,10 +1861,10 @@ index bbe355cf69f160866188216cc274d75bd35603db..06ee100d7ea2e892dbf3c0b1adc96c50 // enough. return PlatformFontMac::SystemFontType::kGeneral; diff --git a/ui/views/BUILD.gn b/ui/views/BUILD.gn -index 95a2d5d04ac69b48f59fa4c8c940b1075436bca7..1af7790524bd0c25f6384f7fb55f3df0fe03cfc1 100644 +index dd2fcedc84417c324021e4aba4e78a84ff098803..ed3b4b5b8e9d931e7b7f9b5d91f93f5fcda4ef2c 100644 --- a/ui/views/BUILD.gn +++ b/ui/views/BUILD.gn -@@ -722,6 +722,8 @@ component("views") { +@@ -721,6 +721,8 @@ component("views") { "IOSurface.framework", "QuartzCore.framework", ] @@ -1873,7 +1873,7 @@ index 95a2d5d04ac69b48f59fa4c8c940b1075436bca7..1af7790524bd0c25f6384f7fb55f3df0 } if (is_win) { -@@ -1152,6 +1154,8 @@ source_set("test_support") { +@@ -1151,6 +1153,8 @@ source_set("test_support") { "//ui/base/mojom:ui_base_types", ] diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index a3bbeb9701156..fdac049a5033d 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -7,10 +7,10 @@ Pass RenderFrameHost through to PlatformNotificationService so Electron can identify which renderer a notification came from. diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc -index 3c6b6c0bfb41dc8daf39780469134baf5372aa8e..903ff32264f514ed547d8719c88a9070e50f3857 100644 +index b6d896b49de98981cbd4a046b7b640266f5b18c3..9d1df23ef92924c04e4226d672134f9ffc4410ae 100644 --- a/chrome/browser/notifications/platform_notification_service_impl.cc +++ b/chrome/browser/notifications/platform_notification_service_impl.cc -@@ -252,6 +252,7 @@ bool PlatformNotificationServiceImpl::WasClosedProgrammatically( +@@ -264,6 +264,7 @@ bool PlatformNotificationServiceImpl::WasClosedProgrammatically( // TODO(awdf): Rename to DisplayNonPersistentNotification (Similar for Close) void PlatformNotificationServiceImpl::DisplayNotification( diff --git a/patches/chromium/picture-in-picture.patch b/patches/chromium/picture-in-picture.patch index 486aa601d40e2..fba78174c95f8 100644 --- a/patches/chromium/picture-in-picture.patch +++ b/patches/chromium/picture-in-picture.patch @@ -38,7 +38,7 @@ index 85df555841ac0d32d2f097547c9991cecf0f4b1a..7a108339448fad3105e87c9d9af678c2 ui::ImageModel::FromVectorIcon(*icon, kColorPipWindowForeground, kCloseButtonIconSize)); diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -index d54cc1a443e3b2d869dc148f532b3138a6d02d29..117b6b94f54f7629b5233cfdf988608476e7321c 100644 +index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..f737adbdc968e659cf5ba59e6cd5fd5fa093edff 100644 --- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc @@ -18,12 +18,16 @@ @@ -76,7 +76,7 @@ index d54cc1a443e3b2d869dc148f532b3138a6d02d29..117b6b94f54f7629b5233cfdf9886084 std::wstring app_user_model_id; Browser* browser = chrome::FindBrowserWithTab(controller->GetWebContents()); if (browser) { -@@ -1271,11 +1275,13 @@ void VideoOverlayWindowViews::SetUpViews() { +@@ -1274,11 +1278,13 @@ void VideoOverlayWindowViews::SetUpViews() { &VideoOverlayWindowViews::OnLiveCaptionButtonPressed, base::Unretained(this))); live_caption_button->SetSize(kActionButtonSize); @@ -90,7 +90,7 @@ index d54cc1a443e3b2d869dc148f532b3138a6d02d29..117b6b94f54f7629b5233cfdf9886084 toggle_microphone_button = std::make_unique<ToggleMicrophoneButton>(base::BindRepeating( [](VideoOverlayWindowViews* overlay) { -@@ -2412,9 +2418,10 @@ void VideoOverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) { +@@ -2415,9 +2421,10 @@ void VideoOverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) { event->SetHandled(); return; } @@ -102,7 +102,7 @@ index d54cc1a443e3b2d869dc148f532b3138a6d02d29..117b6b94f54f7629b5233cfdf9886084 return; } -@@ -2573,6 +2580,7 @@ gfx::Rect VideoOverlayWindowViews::GetLiveCaptionDialogBounds() { +@@ -2576,6 +2583,7 @@ gfx::Rect VideoOverlayWindowViews::GetLiveCaptionDialogBounds() { bool VideoOverlayWindowViews::HasHighMediaEngagement( const url::Origin& origin) const { @@ -110,7 +110,7 @@ index d54cc1a443e3b2d869dc148f532b3138a6d02d29..117b6b94f54f7629b5233cfdf9886084 MediaEngagementService* service = MediaEngagementService::Get(Profile::FromBrowserContext( GetController()->GetWebContents()->GetBrowserContext())); -@@ -2581,6 +2589,8 @@ bool VideoOverlayWindowViews::HasHighMediaEngagement( +@@ -2584,6 +2592,8 @@ bool VideoOverlayWindowViews::HasHighMediaEngagement( } return service->HasHighEngagement(origin); diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index 0261c4a8d53ea..7e59fdba35127 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -44,7 +44,7 @@ index 755fa9cf571873072d67d97226e7d847c618afcf..d7de0324994cf69009eb5be92110351e void RenderWidgetHostImpl::ShowContextMenuAtPoint( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 32d16bae9a25d06f410f51d3cc25c27ea83c6821..b568a66369e246322698630e495826f0c1109221 100644 +index df1b2c1a866ccb275a87dab55e3b0f654a370f49..b2b12ef9dd78713eaee6792523fcddef97c3e0ca 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -6149,6 +6149,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { @@ -60,10 +60,10 @@ index 32d16bae9a25d06f410f51d3cc25c27ea83c6821..b568a66369e246322698630e495826f0 RenderWidgetHostImpl* render_widget_host) { return render_widget_host == GetPrimaryMainFrame()->GetRenderWidgetHost(); diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index 0a739681261937520e86457eaf04ea0d41092ca9..364e3ad00c81fd003d3404b4c4fa3393c3ab443c 100644 +index 8e26b26988f910aefd3775f56b024f3fae331fce..247e71fa9a43116b40cfffd8da0169223272d9c9 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -1177,6 +1177,7 @@ class CONTENT_EXPORT WebContentsImpl +@@ -1176,6 +1176,7 @@ class CONTENT_EXPORT WebContentsImpl void SendScreenRects() override; void SendActiveState(bool active) override; TextInputManager* GetTextInputManager() override; diff --git a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch index f1c5e01c220fa..3de47bd38b025 100644 --- a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch +++ b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch @@ -28,7 +28,7 @@ index 86b8df2b23dc975a6db87f04005cb105054305b0..770fd74ac5a21fe6daf68efe68efcf5a break; } diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc -index a43a28e60d87a446adc187121abbbeeecb50bac7..ba886970854682ccbc145a5ec524a8d0cf58f03a 100644 +index 87dc1b64e3cedf6d59d8ab2dc811bf8300193bdc..9041414efe3e20edeb170117b1ad396e32508aae 100644 --- a/content/browser/permissions/permission_controller_impl.cc +++ b/content/browser/permissions/permission_controller_impl.cc @@ -94,7 +94,15 @@ PermissionToSchedulingFeature(PermissionType permission_name) { diff --git a/patches/chromium/refactor_unfilter_unresponsive_events.patch b/patches/chromium/refactor_unfilter_unresponsive_events.patch index 829fb38701e71..e198f1eb7d6db 100644 --- a/patches/chromium/refactor_unfilter_unresponsive_events.patch +++ b/patches/chromium/refactor_unfilter_unresponsive_events.patch @@ -15,7 +15,7 @@ This CL removes these filters so the unresponsive event can still be accessed from our JS event. The filtering is moved into Electron's code. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 3489db5f1acfbd4d6fa6d3650e3e73498c728791..356ed97619d2ef911270275dbd518d76997ce1f1 100644 +index 4fe94ab63b0bea981406f8c4d181a85d1e5721a4..b76ad9f490ffa4942c92f3cf458683255e00f8e7 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -10272,25 +10272,13 @@ void WebContentsImpl::RendererUnresponsive( diff --git a/patches/chromium/resource_file_conflict.patch b/patches/chromium/resource_file_conflict.patch index 1525b4328a7ac..9e3d8afcbf322 100644 --- a/patches/chromium/resource_file_conflict.patch +++ b/patches/chromium/resource_file_conflict.patch @@ -52,10 +52,10 @@ Some alternatives to this patch: None of these options seems like a substantial maintainability win over this patch to me (@nornagon). diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index 0753724487493487c32955962105a8560892718b..9bffa9c8272a81059eb05fa79107bb326029402c 100644 +index 6ca05f8839773f1908c1559c4031af7f21a2d412..e7ee2d88b136be97e0668874a309085554041a5a 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn -@@ -1542,7 +1542,7 @@ if (is_chrome_branded && !is_android) { +@@ -1541,7 +1541,7 @@ if (is_chrome_branded && !is_android) { } } @@ -64,7 +64,7 @@ index 0753724487493487c32955962105a8560892718b..9bffa9c8272a81059eb05fa79107bb32 chrome_paks("packed_resources") { if (is_mac) { output_dir = "$root_gen_dir/repack" -@@ -1588,6 +1588,12 @@ repack("browser_tests_pak") { +@@ -1587,6 +1587,12 @@ repack("browser_tests_pak") { deps = [ "//chrome/test/data/webui:resources" ] } diff --git a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch index 9bb55b9b908ca..5bd2eb79b0073 100644 --- a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch +++ b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch @@ -254,7 +254,7 @@ index 17d6d7d935f93afefa9123f56ef9c138c3070f93..8dfa7501a6a2998e107bf9b51f5e5c3d } diff --git a/content/common/features.cc b/content/common/features.cc -index 079f57e17386914cb571d6d77e66bb71a453adca..ed328eafcf60390495296d7a2f4cef17de5fd225 100644 +index eeea9763d5c6b99b665906a7dafb054e2a21c297..8c6145d64f3255ac7d8584ebab0830bc849b9e8d 100644 --- a/content/common/features.cc +++ b/content/common/features.cc @@ -298,6 +298,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); @@ -273,7 +273,7 @@ index 079f57e17386914cb571d6d77e66bb71a453adca..ed328eafcf60390495296d7a2f4cef17 BASE_FEATURE(kKeepChildProcessAfterIPCReset, base::FEATURE_DISABLED_BY_DEFAULT); diff --git a/content/common/features.h b/content/common/features.h -index 24b248f94510619b5a570498578f33910245dcf9..8baefcc9ff7d80cb5ba1e3a7174cb3dac9e2b16f 100644 +index 243c4b57083c58c889e9e9d8034dc109420e2fc2..13b7a0c529e7214369c4affebe8fb95e2ddc256e 100644 --- a/content/common/features.h +++ b/content/common/features.h @@ -107,6 +107,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); diff --git a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch index c4dd06737832c..9aea704cea780 100644 --- a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch +++ b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch @@ -54,7 +54,7 @@ index 12df047f66b9e3184b7421aa5fbe4e91e340e395..702cc747c768355b3827410dbb0d84a0 if (mouse_event_callback.Run(mouse_event)) { return; diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 356ed97619d2ef911270275dbd518d76997ce1f1..a99dbcc5e9890392010fac4afa285302b33acef7 100644 +index b76ad9f490ffa4942c92f3cf458683255e00f8e7..7051e4b2f0ded032647d43bdbf29306cec040c85 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -4466,6 +4466,12 @@ void WebContentsImpl::RenderWidgetWasResized( @@ -71,10 +71,10 @@ index 356ed97619d2ef911270275dbd518d76997ce1f1..a99dbcc5e9890392010fac4afa285302 const gfx::PointF& client_pt) { if (delegate_) { diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index 364e3ad00c81fd003d3404b4c4fa3393c3ab443c..843cc094920e46943c35bda4e82b876d30c462c4 100644 +index 247e71fa9a43116b40cfffd8da0169223272d9c9..48ac6629a904a135f3e3ca7e1f924807e575675a 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -1108,6 +1108,7 @@ class CONTENT_EXPORT WebContentsImpl +@@ -1107,6 +1107,7 @@ class CONTENT_EXPORT WebContentsImpl double GetPendingZoomLevel(RenderWidgetHostImpl* rwh) override; diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index 92f67b41913b8..73b0599f3232c 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index deca578dd5f2640cf8eda3f7e672605ab9f3cf8d..2599db9659dad689fb86cc6405f767f8c321b12e 100644 +index f762eb8abf2b075d61cadb3acf236d9dd4dd2fa3..b31c8d7e7699634e437d7bfb884c48ae979559d8 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25249,6 +25249,21 @@ +@@ -25277,6 +25277,21 @@ ] } ], diff --git a/patches/chromium/scroll_bounce_flag.patch b/patches/chromium/scroll_bounce_flag.patch index be39eb6717f5f..2fc9a233a265a 100644 --- a/patches/chromium/scroll_bounce_flag.patch +++ b/patches/chromium/scroll_bounce_flag.patch @@ -6,7 +6,7 @@ Subject: scroll_bounce_flag.patch Patch to make scrollBounce option work. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc -index 5898582f6aaea2ffc87349f5e0049995ae524108..ee5c04977fdd92371ee1d96e26cdae0914482582 100644 +index 348191bb49b4e94ba0073beda02dee1cc29b4e36..56ffe822150ab05ca1df726a77a2a34cd96a291c 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -1208,7 +1208,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { diff --git a/patches/chromium/short-circuit_permissions_checks_in_mediastreamdevicescontroller.patch b/patches/chromium/short-circuit_permissions_checks_in_mediastreamdevicescontroller.patch index 0763fcead569d..5a3c799fb425b 100644 --- a/patches/chromium/short-circuit_permissions_checks_in_mediastreamdevicescontroller.patch +++ b/patches/chromium/short-circuit_permissions_checks_in_mediastreamdevicescontroller.patch @@ -15,7 +15,7 @@ short-circuit all the permissions checks in MSDC for now to allow us to unduplicate this code. diff --git a/components/webrtc/media_stream_devices_controller.cc b/components/webrtc/media_stream_devices_controller.cc -index d98c6fb6870df8ab29234d4f7d1f3ca4ac903089..9933b5b5965ee74666cfe11554f0ccd56fae37c5 100644 +index 0e528c5356f333f1397e569d0403c6c121f1b175..3c1ca4e67547118ebf2ec1ddf3847c741f2d00f3 100644 --- a/components/webrtc/media_stream_devices_controller.cc +++ b/components/webrtc/media_stream_devices_controller.cc @@ -57,7 +57,8 @@ bool PermissionIsRequested(blink::PermissionType permission, diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index 26a6a22a4d1be..5f3c0ea443a0f 100644 --- a/patches/chromium/web_contents.patch +++ b/patches/chromium/web_contents.patch @@ -9,7 +9,7 @@ is needed for OSR. Originally landed in https://github.com/electron/libchromiumcontent/pull/226. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 2adea6e88f5e09f3416e665039e83c367dca58af..509009403163872684eb55684f22c0435c892960 100644 +index 710fec97c2443921c00a9a65b06a9b7862517cdd..0a6b0be67233bd86ba7f955c393270873c8a4334 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -4197,6 +4197,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index 8a77316f02dd0..e89738e8e4096 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,7 +15,7 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 6174c48ad073bfda2c783dca76dfdf05ee8c5a75..77458232a5ccdaa8a2387f6b154d890cd373117f 100644 +index 7b3d2f97a8a6aec42303b658b6820c393354f01c..47b07b3de0953f54fd33943d0cd8b688d8db8e4e 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc @@ -8960,6 +8960,17 @@ void RenderFrameHostImpl::EnterFullscreen( @@ -37,7 +37,7 @@ index 6174c48ad073bfda2c783dca76dfdf05ee8c5a75..77458232a5ccdaa8a2387f6b154d890c if (had_fullscreen_token && !GetView()->HasFocus()) GetView()->Focus(); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 509009403163872684eb55684f22c0435c892960..47bbe40f74ded6be7d5ae4e1c96331bef3070291 100644 +index 0a6b0be67233bd86ba7f955c393270873c8a4334..9b878662e81e8a0c74542040ebab6bb2f6f078f9 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -4483,21 +4483,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index 382a271cd00e2..5570733ca4f0b 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -44,6 +44,7 @@ #include "ui/base/win/shell.h" #elif BUILDFLAG(IS_LINUX) #include "shell/browser/ui/views/opaque_frame_view.h" +#include "ui/gfx/image/image_skia.h" #endif #if BUILDFLAG(IS_WIN) diff --git a/shell/browser/ui/drag_util_views.cc b/shell/browser/ui/drag_util_views.cc index ccd0ea6bffe5f..4e4aa8870eeb0 100644 --- a/shell/browser/ui/drag_util_views.cc +++ b/shell/browser/ui/drag_util_views.cc @@ -12,6 +12,7 @@ #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/display/screen.h" #include "ui/gfx/geometry/point.h" +#include "ui/gfx/image/image_skia.h" #include "ui/views/button_drag_utils.h" #include "ui/views/widget/widget.h" #include "url/gurl.h" diff --git a/shell/browser/ui/tray_icon_linux.cc b/shell/browser/ui/tray_icon_linux.cc index 50b03937babdd..b7d0f1e137c13 100644 --- a/shell/browser/ui/tray_icon_linux.cc +++ b/shell/browser/ui/tray_icon_linux.cc @@ -7,6 +7,7 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h" #include "shell/browser/ui/status_icon_gtk.h" +#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia_rep.h" namespace electron { diff --git a/shell/renderer/electron_render_frame_observer.h b/shell/renderer/electron_render_frame_observer.h index f72faff431c4d..bf3ff8232345c 100644 --- a/shell/renderer/electron_render_frame_observer.h +++ b/shell/renderer/electron_render_frame_observer.h @@ -8,7 +8,7 @@ #include <string> #include "content/public/renderer/render_frame_observer.h" -#include "ipc/ipc_platform_file.h" +#include "ipc/platform_file_for_transit.h" #include "third_party/blink/public/web/web_local_frame.h" namespace electron { From 82e2edc2e73bb7ade3d6bef5023b379982872be0 Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Mon, 20 Oct 2025 09:54:14 +0200 Subject: [PATCH 144/268] fix: background hover contrast for WCO buttons (#48568) --- shell/browser/ui/views/win_caption_button.cc | 10 +++++++++- shell/browser/ui/views/win_caption_button.h | 8 ++++---- shell/browser/ui/views/win_frame_view.cc | 16 ++++------------ shell/browser/ui/views/win_frame_view.h | 3 +++ 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/shell/browser/ui/views/win_caption_button.cc b/shell/browser/ui/views/win_caption_button.cc index 63b69f42e7b77..9db1e70b0c8db 100644 --- a/shell/browser/ui/views/win_caption_button.cc +++ b/shell/browser/ui/views/win_caption_button.cc @@ -11,6 +11,7 @@ #include "base/i18n/rtl.h" #include "base/numerics/safe_conversions.h" #include "base/win/windows_version.h" +#include "chrome/browser/ui/color/chrome_color_id.h" #include "chrome/grit/theme_resources.h" #include "shell/browser/native_window_views.h" #include "shell/browser/ui/views/win_frame_view.h" @@ -47,6 +48,13 @@ std::unique_ptr<WinIconPainter> WinCaptionButton::CreateIconPainter() { return std::make_unique<WinIconPainter>(); } +SkColor WinCaptionButton::GetBaseForegroundColor() const { + return GetColorProvider()->GetColor( + frame_view_->GetShouldPaintAsActive() + ? kColorCaptionButtonForegroundActive + : kColorCaptionButtonForegroundInactive); +} + gfx::Size WinCaptionButton::CalculatePreferredSize( const views::SizeBounds& available_size) const { // TODO(bsep): The sizes in this function are for 1x device scale and don't @@ -76,7 +84,7 @@ void WinCaptionButton::OnPaintBackground(gfx::Canvas* canvas) { pressed_alpha = 0x98; } else { // Match the native buttons. - base_color = frame_view_->GetReadableFeatureColor(bg_color); + base_color = GetBaseForegroundColor(); hovered_alpha = 0x1A; pressed_alpha = 0x33; diff --git a/shell/browser/ui/views/win_caption_button.h b/shell/browser/ui/views/win_caption_button.h index ff96851c842a1..4534f8710736d 100644 --- a/shell/browser/ui/views/win_caption_button.h +++ b/shell/browser/ui/views/win_caption_button.h @@ -49,6 +49,10 @@ class WinCaptionButton : public views::Button { private: std::unique_ptr<WinIconPainter> CreateIconPainter(); + + // The base color to use for the button symbols and background blending. Uses + // the more readable of black and white. + SkColor GetBaseForegroundColor() const; // Returns the amount we should visually reserve on the left (right in RTL) // for spacing between buttons. We do this instead of repositioning the // buttons to avoid the sliver of deadspace that would result. @@ -59,10 +63,6 @@ class WinCaptionButton : public views::Button { // smaller indices). int GetButtonDisplayOrderIndex() const; - // The base color to use for the button symbols and background blending. Uses - // the more readable of black and white. - SkColor GetBaseColor() const; - // Paints the minimize/maximize/restore/close icon for the button. void PaintSymbol(gfx::Canvas* canvas); diff --git a/shell/browser/ui/views/win_frame_view.cc b/shell/browser/ui/views/win_frame_view.cc index 1c158529db0c0..697243c4adde4 100644 --- a/shell/browser/ui/views/win_frame_view.cc +++ b/shell/browser/ui/views/win_frame_view.cc @@ -39,18 +39,6 @@ void WinFrameView::Init(NativeWindowViews* window, views::Widget* frame) { } } -SkColor WinFrameView::GetReadableFeatureColor(SkColor background_color) { - // color_utils::GetColorWithMaxContrast()/IsDark() aren't used here because - // they switch based on the Chrome light/dark endpoints, while we want to use - // the system native behavior below. - const auto windows_luma = [](SkColor c) { - return 0.25f * SkColorGetR(c) + 0.625f * SkColorGetG(c) + - 0.125f * SkColorGetB(c); - }; - return windows_luma(background_color) <= 128.0f ? SK_ColorWHITE - : SK_ColorBLACK; -} - void WinFrameView::InvalidateCaptionButtons() { if (!caption_button_container_) return; @@ -282,6 +270,10 @@ void WinFrameView::LayoutWindowControlsOverlay() { window()->NotifyLayoutWindowControlsOverlay(); } +bool WinFrameView::GetShouldPaintAsActive() { + return ShouldPaintAsActive(); +} + BEGIN_METADATA(WinFrameView) END_METADATA diff --git a/shell/browser/ui/views/win_frame_view.h b/shell/browser/ui/views/win_frame_view.h index 679e24ba272b8..c47550aef09e0 100644 --- a/shell/browser/ui/views/win_frame_view.h +++ b/shell/browser/ui/views/win_frame_view.h @@ -46,6 +46,9 @@ class WinFrameView : public FramelessView { // the area above the top of the screen). int TitlebarMaximizedVisualHeight() const; + // Returns true if the frame should be painted as active. + bool GetShouldPaintAsActive(); + protected: // views::View: void Layout(PassKey) override; From cf47342327f4f1d6a9cea6b229799cf319bcd624 Mon Sep 17 00:00:00 2001 From: Michaela Laurencin <nilay2014@gmail.com> Date: Mon, 20 Oct 2025 11:47:58 -0400 Subject: [PATCH 145/268] chore: exempt tracking-upstream issues from stale (#48574) --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 2e645130c63f9..28e1ba9538cb9 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -27,7 +27,7 @@ jobs: This issue has been automatically marked as stale. **If this issue is still affecting you, please leave any comment** (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the [latest version of Electron](https://www.electronjs.org/releases/stable) or in the [beta](https://www.electronjs.org/releases/beta)—please include it with your comment! close-issue-message: > This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a [supported version of Electron](https://www.electronjs.org/docs/latest/tutorial/electron-timelines#timeline) please open a new issue and include instructions for reproducing the issue. - exempt-issue-labels: "discussion,security \U0001F512,enhancement :sparkles:,status/confirmed,stale-exempt,upgrade-follow-up" + exempt-issue-labels: "discussion,security \U0001F512,enhancement :sparkles:,status/confirmed,stale-exempt,upgrade-follow-up,tracking-upstream" only-pr-labels: not-a-real-label pending-repro: runs-on: ubuntu-latest From ef22c17d1b6c13334d1ff7bf22bdc854a5faf1de Mon Sep 17 00:00:00 2001 From: Mitchell Cohen <nilay2014@gmail.com> Date: Mon, 20 Oct 2025 15:42:23 -0400 Subject: [PATCH 146/268] fix: position window titlebar buttons correctly in Ubuntu on Wayland (#48490) --- docs/api/environment-variables.md | 11 ----------- docs/breaking-changes.md | 10 ++++++++-- lib/browser/init.ts | 21 --------------------- shell/common/platform_util_linux.cc | 9 --------- 4 files changed, 8 insertions(+), 43 deletions(-) diff --git a/docs/api/environment-variables.md b/docs/api/environment-variables.md index f6b05c4cf85c7..c033676a5915e 100644 --- a/docs/api/environment-variables.md +++ b/docs/api/environment-variables.md @@ -186,14 +186,3 @@ the one downloaded by `npm install`. Usage: ```sh export ELECTRON_OVERRIDE_DIST_PATH=/Users/username/projects/electron/out/Testing ``` - -## Set By Electron - -Electron sets some variables in your environment at runtime. - -### `ORIGINAL_XDG_CURRENT_DESKTOP` - -This variable is set to the value of `XDG_CURRENT_DESKTOP` that your application -originally launched with. Electron sometimes modifies the value of `XDG_CURRENT_DESKTOP` -to affect other logic within Chromium so if you want access to the _original_ value -you should look up this environment variable instead. diff --git a/docs/breaking-changes.md b/docs/breaking-changes.md index 5a7148198effe..745bd13c59aeb 100644 --- a/docs/breaking-changes.md +++ b/docs/breaking-changes.md @@ -47,9 +47,15 @@ See [here](https://www.electronjs.org/docs/latest/api/structures/offscreen-share ### Removed: `ELECTRON_OZONE_PLATFORM_HINT` environment variable -The default value of the `--ozone-plaftform` flag [changed to `auto`](https://chromium-review.googlesource.com/c/chromium/src/+/6775426). +The default value of the `--ozone-platform` flag [changed to `auto`](https://chromium-review.googlesource.com/c/chromium/src/+/6775426). -You should use the `XDG_SESSION_TYPE=wayland` environment variable instead to use Wayland. +Electron now defaults to running as a native Wayland app when launched in a Wayland session (when `XDG_SESSION_TYPE=wayland`). +Users can force XWayland by passing `--ozone-platform=x11`. + +### Removed: `ORIGINAL_XDG_CURRENT_DESKTOP` environment variable + +Previously, Electron changed the value of `XDG_CURRENT_DESKTOP` internally to `Unity`, and stored the original name of the desktop session +in a separate variable. `XDG_CURRENT_DESKTOP` is no longer overriden and now reflects the actual desktop environment. ### Removed: macOS 11 support diff --git a/lib/browser/init.ts b/lib/browser/init.ts index 0b9b225884f01..35cf6f8325611 100644 --- a/lib/browser/init.ts +++ b/lib/browser/init.ts @@ -162,27 +162,6 @@ require('@electron/internal/browser/api/web-contents-view'); // Set main startup script of the app. const mainStartupScript = packageJson.main || 'index.js'; -const KNOWN_XDG_DESKTOP_VALUES = new Set(['Pantheon', 'Unity:Unity7', 'pop:GNOME']); - -function currentPlatformSupportsAppIndicator () { - if (process.platform !== 'linux') return false; - const currentDesktop = process.env.XDG_CURRENT_DESKTOP; - - if (!currentDesktop) return false; - if (KNOWN_XDG_DESKTOP_VALUES.has(currentDesktop)) return true; - // ubuntu based or derived session (default ubuntu one, communitheme…) supports - // indicator too. - if (/ubuntu/ig.test(currentDesktop)) return true; - - return false; -} - -// Workaround for electron/electron#5050 and electron/electron#9046 -process.env.ORIGINAL_XDG_CURRENT_DESKTOP = process.env.XDG_CURRENT_DESKTOP; -if (currentPlatformSupportsAppIndicator()) { - process.env.XDG_CURRENT_DESKTOP = 'Unity'; -} - // Quit when all windows are closed and no other one is listening to this. app.on('window-all-closed', () => { if (app.listenerCount('window-all-closed') === 1) { diff --git a/shell/common/platform_util_linux.cc b/shell/common/platform_util_linux.cc index d0f6ca904b12f..b5cedcff0ad3f 100644 --- a/shell/common/platform_util_linux.cc +++ b/shell/common/platform_util_linux.cc @@ -15,7 +15,6 @@ #include "base/cancelable_callback.h" #include "base/containers/contains.h" -#include "base/containers/map_util.h" #include "base/environment.h" #include "base/files/file_util.h" #include "base/files/scoped_file.h" @@ -59,8 +58,6 @@ const char kFreedesktopPortalName[] = "org.freedesktop.portal.Desktop"; const char kFreedesktopPortalPath[] = "/org/freedesktop/portal/desktop"; const char kFreedesktopPortalOpenURI[] = "org.freedesktop.portal.OpenURI"; -const char kOriginalXdgCurrentDesktopEnvVar[] = "ORIGINAL_XDG_CURRENT_DESKTOP"; - const char kMethodOpenDirectory[] = "OpenDirectory"; class ShowItemHelper { @@ -279,12 +276,6 @@ bool XDGUtil(const std::vector<std::string>& argv, base::nix::CreateLaunchOptionsWithXdgActivation(base::BindOnce( [](base::RepeatingClosure quit_loop, base::LaunchOptions* options_out, base::LaunchOptions options) { - // Correct the XDG_CURRENT_DESKTOP environment variable before calling - // XDG, in case it was changed for compatibility. - if (const auto* orig = base::FindOrNull( - options.environment, kOriginalXdgCurrentDesktopEnvVar)) - options.environment.emplace(base::nix::kXdgCurrentDesktopEnvVar, - *orig); *options_out = std::move(options); std::move(quit_loop).Run(); }, From 2a585610ad90533cced81ec8d2b836052a06c670 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt <nilay2014@gmail.com> Date: Mon, 20 Oct 2025 15:57:50 -0400 Subject: [PATCH 147/268] build: use one build target (#48527) This reverts commit Optimizes our builds for use with siso/avoids file contention on Windows --- .github/actions/build-electron/action.yml | 39 ++++++----------------- BUILD.gn | 23 +++++++++++++ script/gn-check.js | 4 ++- 3 files changed, 35 insertions(+), 31 deletions(-) diff --git a/.github/actions/build-electron/action.yml b/.github/actions/build-electron/action.yml index dddfe3a94fd64..07ceccab1e912 100644 --- a/.github/actions/build-electron/action.yml +++ b/.github/actions/build-electron/action.yml @@ -60,7 +60,11 @@ runs: sudo launchctl limit maxfiles 65536 200000 fi - NINJA_SUMMARIZE_BUILD=1 e build + if [ "${{ inputs.is-release }}" = "true" ]; then + NINJA_SUMMARIZE_BUILD=1 e build --target electron:release_build + else + NINJA_SUMMARIZE_BUILD=1 e build --target electron:testing_build + fi cp out/Default/.ninja_log out/electron_ninja_log node electron/script/check-symlinks.js @@ -74,11 +78,10 @@ runs: else echo "Skipping build-stats.mjs upload because DD_API_KEY is not set" fi - - name: Build Electron dist.zip ${{ inputs.step-suffix }} + - name: Verify dist.zip ${{ inputs.step-suffix }} shell: bash run: | - cd src - e build --target electron:electron_dist_zip + cd src if [ "${{ inputs.is-asan }}" != "true" ]; then target_os=${{ inputs.target-platform == 'macos' && 'mac' || inputs.target-platform }} if [ "${{ inputs.artifact-platform }}" = "mas" ]; then @@ -86,11 +89,10 @@ runs: fi electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.$target_os.${{ inputs.target-arch }}.manifest fi - - name: Build Mksnapshot ${{ inputs.step-suffix }} + - name: Fixup Mksnapshot ${{ inputs.step-suffix }} shell: bash run: | cd src - e build --target electron:electron_mksnapshot_zip ELECTRON_DEPOT_TOOLS_DISABLE_LOG=1 e d gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args # Remove unused args from mksnapshot_args SEDOPTION="-i" @@ -142,11 +144,6 @@ runs: fi electron/script/zip_manifests/check-zip-manifest.py out/Default/chromedriver.zip electron/script/zip_manifests/chromedriver_zip.$target_os.${{ inputs.target-arch }}.manifest fi - - name: Build Node.js headers ${{ inputs.step-suffix }} - shell: bash - run: | - cd src - e build --target electron:node_headers - name: Create installed_software.json ${{ inputs.step-suffix }} shell: powershell if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'win' }} @@ -166,17 +163,11 @@ runs: # Needed for msdia140.dll on 64-bit windows cd src export PATH="$PATH:$(pwd)/third_party/llvm-build/Release+Asserts/bin" - - name: Generate & Zip Symbols ${{ inputs.step-suffix }} + - name: Zip Symbols ${{ inputs.step-suffix }} shell: bash run: | - # Generate breakpad symbols on release builds - if [ "${{ inputs.generate-symbols }}" = "true" ]; then - e build --target electron:electron_symbols - fi cd src export BUILD_PATH="$(pwd)/out/Default" - e build --target electron:licenses - e build --target electron:electron_version_file if [ "${{ inputs.is-release }}" = "true" ]; then DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH else @@ -189,18 +180,6 @@ runs: cd src gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true use_siso=true $GN_EXTRA_ARGS" e build --target electron:electron_ffmpeg_zip -C ../../out/ffmpeg - - name: Generate Hunspell Dictionaries ${{ inputs.step-suffix }} - shell: bash - if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }} - run: | - e build --target electron:hunspell_dictionaries_zip - - name: Generate Libcxx ${{ inputs.step-suffix }} - shell: bash - if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }} - run: | - e build --target electron:libcxx_headers_zip - e build --target electron:libcxxabi_headers_zip - e build --target electron:libcxx_objects_zip - name: Remove Clang problem matcher shell: bash run: echo "::remove-matcher owner=clang::" diff --git a/BUILD.gn b/BUILD.gn index 2347766ae994c..c27602f16406a 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1624,6 +1624,29 @@ group("node_headers") { public_deps = [ ":tar_node_headers" ] } +group("testing_build") { + public_deps = [ + ":electron_dist_zip", + ":electron_mksnapshot_zip", + ":node_headers", + ] +} + +group("release_build") { + public_deps = [ ":testing_build" ] + if (is_official_build) { + public_deps += [ ":electron_symbols" ] + } + if (is_linux) { + public_deps += [ + ":hunspell_dictionaries_zip", + ":libcxx_headers_zip", + ":libcxx_objects_zip", + ":libcxxabi_headers_zip", + ] + } +} + if (is_linux && is_official_build) { strip_binary("strip_electron_binary") { binary_input = "$root_out_dir/$electron_project_name" diff --git a/script/gn-check.js b/script/gn-check.js index 542b1fbdeb734..13776019a6ed1 100644 --- a/script/gn-check.js +++ b/script/gn-check.js @@ -33,7 +33,9 @@ const gnCheckDirs = [ '//electron:electron_lib', '//electron:electron_app', '//electron/shell/common:mojo', - '//electron/shell/common:plugin' + '//electron/shell/common:plugin', + '//electron:testing_build', + '//electron:release_build' ]; for (const dir of gnCheckDirs) { From 9478d595adf2c4f7a8161f9d9334dcf22413b6db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Tue, 21 Oct 2025 07:30:39 +0200 Subject: [PATCH 148/268] build(deps): bump actions/setup-node from 5.0.0 to 6.0.0 (#48607) Bumps [actions/setup-node](https://github.com/actions/setup-node) from 5.0.0 to 6.0.0. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/a0853c24544627f65ddf259abe73b1d18a591444...2028fbc5c25fe9cf00d9f06a71cc4710d4507903) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/archaeologist-dig.yml | 2 +- .github/workflows/audit-branch-ci.yml | 2 +- .github/workflows/pipeline-segment-electron-build.yml | 2 +- .github/workflows/pipeline-segment-electron-test.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/archaeologist-dig.yml b/.github/workflows/archaeologist-dig.yml index 9684a742b7a95..07c32d17a3742 100644 --- a/.github/workflows/archaeologist-dig.yml +++ b/.github/workflows/archaeologist-dig.yml @@ -13,7 +13,7 @@ jobs: with: fetch-depth: 0 - name: Setup Node.js/npm - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 with: node-version: 20.19.x - name: Setting Up Dig Site diff --git a/.github/workflows/audit-branch-ci.yml b/.github/workflows/audit-branch-ci.yml index 67e6a9f18823f..47af2dafcc991 100644 --- a/.github/workflows/audit-branch-ci.yml +++ b/.github/workflows/audit-branch-ci.yml @@ -16,7 +16,7 @@ jobs: contents: read steps: - name: Setup Node.js - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version: 22.17.x - run: npm install @actions/cache@4.0.3 @electron/fiddle-core@2.0.1 diff --git a/.github/workflows/pipeline-segment-electron-build.yml b/.github/workflows/pipeline-segment-electron-build.yml index 154b3b73c6e31..620c6563456fc 100644 --- a/.github/workflows/pipeline-segment-electron-build.yml +++ b/.github/workflows/pipeline-segment-electron-build.yml @@ -115,7 +115,7 @@ jobs: run: df -h - name: Setup Node.js/npm if: ${{ inputs.target-platform == 'macos' }} - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 with: node-version: 20.19.x cache: yarn diff --git a/.github/workflows/pipeline-segment-electron-test.yml b/.github/workflows/pipeline-segment-electron-test.yml index 418409411e9b9..b376f9dd2bee0 100644 --- a/.github/workflows/pipeline-segment-electron-test.yml +++ b/.github/workflows/pipeline-segment-electron-test.yml @@ -70,7 +70,7 @@ jobs: cp $(which node) /mnt/runner-externals/node20/bin/ - name: Setup Node.js/npm if: ${{ inputs.target-platform == 'win' }} - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 with: node-version: 20.19.x - name: Add TCC permissions on macOS From 6f5e5dae38393e26bfc72f3b8e26bf530e2fce14 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Tue, 21 Oct 2025 10:47:44 +0200 Subject: [PATCH 149/268] build(deps): bump github/codeql-action from 4.30.8 to 4.30.9 (#48606) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.30.8 to 4.30.9. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/f443b600d91635bebf5b0d9ebc620189c0d6fba5...16140ae1a102900babc80a33c44059580f687047) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.30.9 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/scorecards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 1e006fb0846d6..85aa61ca70bad 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -50,6 +50,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v3.29.5 + uses: github/codeql-action/upload-sarif@16140ae1a102900babc80a33c44059580f687047 # v3.29.5 with: sarif_file: results.sarif From a42d32668bfc371831a4921a5059219aa61e01c8 Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Tue, 21 Oct 2025 08:11:09 -0500 Subject: [PATCH 150/268] chore: bump chromium to 143.0.7483.0 (main) (#48590) * chore: bump chromium in DEPS to 143.0.7482.0 * chore: bump chromium in DEPS to 143.0.7483.0 * [CodeHealth] Remove RenderWidgetHostImpl::is_hidden() | https://chromium-review.googlesource.com/c/chromium/src/+/7050059 * chore: update mas_avoid_private_macos_api_usage.patch.patch [graphite] Refactor backpressure fences on Mac to avoid GLContext | https://chromium-review.googlesource.com/c/chromium/src/+/7047167 * chore: update disable_compositor_recycling.patch no manual changes; patch applied with fuzz [CodeHealth] Remove RenderWidgetHostImpl::is_hidden() | https://chromium-review.googlesource.com/c/chromium/src/+/7050059 * chore: update allow_disabling_blink_scheduler_throttling_per_renderview.patch [CodeHealth] Remove RenderWidgetHostImpl::is_hidden() | https://chromium-review.googlesource.com/c/chromium/src/+/7050059 * chore: update feat_allow_code_cache_in_custom_schemes.patch [url] Change Add*Scheme*(...) functions to accept std::string_view | https://chromium-review.googlesource.com/c/chromium/src/+/7046471 * chore: e patches all * [memory] Replace bool success with MemoryDumpRequestOutcome enum. | https://chromium-review.googlesource.com/c/chromium/src/+/7029767 * [CodeHealth] Remove RenderWidgetHostImpl::is_hidden() | https://chromium-review.googlesource.com/c/chromium/src/+/7050059 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> --- DEPS | 2 +- .../add_didinstallconditionalfeatures.patch | 4 +- ..._scheduler_throttling_per_renderview.patch | 6 +- ..._depend_on_packed_resource_integrity.patch | 6 +- patches/chromium/can_create_window.patch | 14 ++-- ...ameter_in_script_lifecycle_observers.patch | 4 +- ...fy_chromium_handling_of_mouse_events.patch | 2 +- .../chromium/chore_partial_revert_of.patch | 2 +- ...screationoverridden_with_full_params.patch | 2 +- .../disable_compositor_recycling.patch | 6 +- patches/chromium/disable_hidden.patch | 12 ++-- .../chromium/enable_reset_aspect_ratio.patch | 2 +- ...xpose_setuseragent_on_networkcontext.patch | 6 +- ...t_allow_code_cache_in_custom_schemes.patch | 16 ++--- ...e_launch_options_for_service_process.patch | 4 +- ...moothing_css_rule_and_blink_painting.patch | 2 +- .../fix_aspect_ratio_with_max_size.patch | 4 +- ...ding_non-standard_schemes_in_iframes.patch | 4 +- ...board_hides_on_input_blur_in_webview.patch | 10 +-- ...x_remove_caption-removing_style_call.patch | 2 +- ..._material_update_issue_on_windows_11.patch | 2 +- ...original_resize_performance_on_macos.patch | 2 +- patches/chromium/frame_host_manager.patch | 6 +- ..._avoid_private_macos_api_usage.patch.patch | 65 +++++++++---------- ...emote_certificate_verification_logic.patch | 8 +-- .../chromium/notification_provenance.patch | 10 +-- ...r_changes_to_the_webcontentsobserver.patch | 4 +- ...efactor_unfilter_unresponsive_events.patch | 4 +- ...ean_up_stale_macwebcontentsocclusion.patch | 4 +- ...al_remove_unused_prehandlemouseevent.patch | 4 +- ...windowtreehostwin_window_enlargement.patch | 4 +- .../support_mixed_sandbox_with_zygote.patch | 2 +- patches/chromium/web_contents.patch | 2 +- patches/chromium/webview_fullscreen.patch | 4 +- .../browser/api/electron_api_web_contents.cc | 2 +- shell/common/api/electron_bindings.cc | 8 ++- shell/common/api/electron_bindings.h | 3 +- 37 files changed, 123 insertions(+), 121 deletions(-) diff --git a/DEPS b/DEPS index 81b371133a9dc..db368a1d01312 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '143.0.7477.0', + '143.0.7483.0', 'node_version': 'v22.20.0', 'nan_version': diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index 44e0cbc1ad429..56f1c1cae1411 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -123,10 +123,10 @@ index fcc0928abbc454281b022e0451d993651ecba42f..16066fe34ee0335a0dabe00b6890e584 int32_t world_id) override; diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h -index 769b08ca081fe83c50babb2743fde6e8961b65ff..d8f3b11c98fd58baa9995762a29847b9fd760c84 100644 +index 9ec4431ed035543beb78a3311049886c6d8e03f8..d46f3b764f653c990e57fb2c67121c8fd6b1b115 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.h +++ b/third_party/blink/renderer/core/loader/empty_clients.h -@@ -420,6 +420,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { +@@ -424,6 +424,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { void DidCreateScriptContext(v8::Local<v8::Context>, int32_t world_id) override {} diff --git a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch index 77f735be8c08a..2b0e89e649cee 100644 --- a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -51,16 +51,16 @@ index 7944fe64e0da112fc670358b75506bb199bb5e4a..0e3c16c6af2a078943e9f39808134ab2 void SendRendererPreferencesToRenderer( const blink::RendererPreferences& preferences); diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index d1d64d93753179f28b4c4ac9653ac1cfc00afd84..8ebaf11825c7b37d28bb2037cd7d7d9fa8101201 100644 +index 08fc2be8e60d16de952ca7f76701ca4eea722c4b..8ad61a86598ac2249496e44113f31ebb21dc616b 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -578,8 +578,8 @@ void RenderWidgetHostViewAura::ShowImpl(PageVisibilityState page_visibility) { // OnShowWithPageVisibility will not call NotifyHostAndDelegateOnWasShown, // which updates `visibility_`, unless the host is hidden. Make sure no update // is needed. -- CHECK(host_->is_hidden() || visibility_ == Visibility::VISIBLE); +- CHECK(host_->IsHidden() || visibility_ == Visibility::VISIBLE); - OnShowWithPageVisibility(page_visibility); -+ if (host_->is_hidden() || visibility_ == Visibility::VISIBLE) ++ if (host_->IsHidden() || visibility_ == Visibility::VISIBLE) + OnShowWithPageVisibility(page_visibility); } diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index 66b6142f0eea2..8fa24a6310177 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -33,10 +33,10 @@ index e7ee2d88b136be97e0668874a309085554041a5a..1ed28fa85bf906bea9628da146627067 "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 5e2fef20796c5060a3d31eed46f92f5e0c3eb105..ca9eb62e3991b5af4c4604ebfd0f8feedb25cae0 100644 +index 7ad4a62c8bfb97d36fbd86a08d5deccdc77da129..0e281fc366c4ee35efdec3625425f2fc8ced135a 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4814,7 +4814,7 @@ static_library("browser") { +@@ -4813,7 +4813,7 @@ static_library("browser") { ] } @@ -46,7 +46,7 @@ index 5e2fef20796c5060a3d31eed46f92f5e0c3eb105..ca9eb62e3991b5af4c4604ebfd0f8fee # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 65f7fb312a896cce006780d8ba5a1d72a812bc1b..94455256a730c724daf9af5b139ef35d224aab7d 100644 +index 5befc9056f87e389a296ebf2bbbc6faad96d0b67..76f632121c7a6f3582cdcbbb076df979be749cb8 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn @@ -7557,9 +7557,12 @@ test("unit_tests") { diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 0fb14eba58631..9f86c6afffc94 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,7 +9,7 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index e9df50dedd831f7545361aa3b33ec42ad44ab944..7b3d2f97a8a6aec42303b658b6820c393354f01c 100644 +index e2a33a8275974c726148b73aae61ed23fa524a31..6635ed3b341ffc63d80d895dc5746c79092f53ab 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc @@ -9854,6 +9854,7 @@ void RenderFrameHostImpl::CreateNewWindow( @@ -21,7 +21,7 @@ index e9df50dedd831f7545361aa3b33ec42ad44ab944..7b3d2f97a8a6aec42303b658b6820c39 &no_javascript_access); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 533e0ba9934532b67441a9116546bd00c16c19a9..df1b2c1a866ccb275a87dab55e3b0f654a370f49 100644 +index cd6abd23d61ea7f12ac4caf9f9c5d5c1822c6c05..4472f8020547631c921860a07637c110c1d8f080 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -5338,6 +5338,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( @@ -77,10 +77,10 @@ index 15a83f61ed4e31ba34cbc19995cd9d68b1599f1d..9cf9fefad46a6c2ead4085adc76e0c07 // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index e42ca23fc0deadbf6f17a40238b06fbf86e71572..34dedcda9d191f7c927f13ede7056ff21082b6f1 100644 +index 7b813d46382672421e569f68204f6f127bab7dce..64ad3e62245ad9b1fd0b8e0487b6d14d34a6d5f3 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -882,6 +882,8 @@ bool ContentBrowserClient::CanCreateWindow( +@@ -881,6 +881,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -90,10 +90,10 @@ index e42ca23fc0deadbf6f17a40238b06fbf86e71572..34dedcda9d191f7c927f13ede7056ff2 bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 25ac9504205330f94a2d09b0f29648973f1165e7..ffe9b06a5c1ad941f803b33b9654f48b7589f754 100644 +index 3f0599ae229b9785146fcd29528d183f2d04a8e7..ef9073ffcf8a5fa51fa028667cf3328cfae6f994 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -201,6 +201,7 @@ class NetworkService; +@@ -196,6 +196,7 @@ class NetworkService; class TrustedURLLoaderHeaderClient; } // namespace mojom struct ResourceRequest; @@ -101,7 +101,7 @@ index 25ac9504205330f94a2d09b0f29648973f1165e7..ffe9b06a5c1ad941f803b33b9654f48b } // namespace network namespace sandbox { -@@ -1459,6 +1460,8 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -1454,6 +1455,8 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, diff --git a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch index 8105b83fac5e4..c9b22b691bd0d 100644 --- a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch +++ b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch @@ -245,10 +245,10 @@ index 16066fe34ee0335a0dabe00b6890e5844349c0b5..cc84479f65bdbe56cb4b38bfcef0d752 // Returns true if we should allow register V8 extensions to be added. diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h -index d8f3b11c98fd58baa9995762a29847b9fd760c84..5a9c9356a2098dfa9d28a5d30b19b492463216c8 100644 +index d46f3b764f653c990e57fb2c67121c8fd6b1b115..fe30a119d9befbde7c461637cf670a4b861efe05 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.h +++ b/third_party/blink/renderer/core/loader/empty_clients.h -@@ -422,7 +422,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { +@@ -426,7 +426,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { int32_t world_id) override {} void DidInstallConditionalFeatures(v8::Local<v8::Context>, int32_t world_id) override {} diff --git a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch index 036aefba49b87..715165f195843 100644 --- a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch +++ b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch @@ -61,7 +61,7 @@ index b65ced55f997d5064b9d9338190567f8c264fce8..e8acd2828ed05deefa335ce2bb461f0c Widget* GetWidget(); const Widget* GetWidget() const; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index dd65b0925e21a1c70c4b7dde17853f7177f4fd3e..b8a7170d9048beb886925428356bb2ba24f7a8e6 100644 +index 10480326f56bcfebd6f9851d5cef401ee56f010c..0265177961817083e32e8357117e7ae158ba6ef3 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -3240,15 +3240,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, diff --git a/patches/chromium/chore_partial_revert_of.patch b/patches/chromium/chore_partial_revert_of.patch index edf77e03394c6..b5304565622df 100644 --- a/patches/chromium/chore_partial_revert_of.patch +++ b/patches/chromium/chore_partial_revert_of.patch @@ -14,7 +14,7 @@ track down the source of this problem & figure out if we can fix it by changing something in Electron. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 279edf4e1a04f9c9884c088001561ea3d539063d..4fe94ab63b0bea981406f8c4d181a85d1e5721a4 100644 +index 0d2e6fb394799980c61c0855d4cb4c1933719a6e..8f7467af5365f7ea0a76027256748d62b6cb7531 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -5309,7 +5309,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index 3eae35299cd38..f9f547e2ba1dd 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -222,7 +222,7 @@ index b969f1d97b7e3396119b579cfbe61e19ff7d2dd4..b8d6169652da28266a514938b45b39c5 content::WebContents* AddNewContents( content::WebContents* source, diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index b2b12ef9dd78713eaee6792523fcddef97c3e0ca..710fec97c2443921c00a9a65b06a9b7862517cdd 100644 +index 3897ca794fd23f337b73c7305b37da7a97f9c550..2451f06b6b6dc96da44494da1db5e1f47654dad4 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -5272,8 +5272,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( diff --git a/patches/chromium/disable_compositor_recycling.patch b/patches/chromium/disable_compositor_recycling.patch index ff5f119a39d5f..1ffdb9bf22b9e 100644 --- a/patches/chromium/disable_compositor_recycling.patch +++ b/patches/chromium/disable_compositor_recycling.patch @@ -6,11 +6,11 @@ Subject: fix: disabling compositor recycling Compositor recycling is useful for Chrome because there can be many tabs and spinning up a compositor for each one would be costly. In practice, Chrome uses the parent compositor code path of browser_compositor_view_mac.mm; the NSView of each tab is detached when it's hidden and attached when it's shown. For Electron, there is no parent compositor, so we're forced into the "own compositor" code path, which seems to be non-optimal and pretty ruthless in terms of the release of resources. Electron has no real concept of multiple tabs per window, so it should be okay to disable this ruthless recycling altogether in Electron. diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index 9524be857c44a6523cf101d3cd24e69b30291c50..629216122514a1db80b452a6552b96ddb743eb32 100644 +index 9a507a70493e5a648a25968f917a7829105fa6d1..596bef745e62f96a25e95d713a1a4d6d30361fac 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm -@@ -558,7 +558,11 @@ - return; +@@ -559,7 +559,11 @@ + } host()->WasHidden(); - browser_compositor_->SetRenderWidgetHostIsHidden(true); diff --git a/patches/chromium/disable_hidden.patch b/patches/chromium/disable_hidden.patch index 7f6a3ef2463bd..8c1a5072c0186 100644 --- a/patches/chromium/disable_hidden.patch +++ b/patches/chromium/disable_hidden.patch @@ -6,7 +6,7 @@ Subject: disable_hidden.patch Electron uses this to disable background throttling for hidden windows. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 39121bd94e74440954d337fa8cb4ce3d6e14756b..755fa9cf571873072d67d97226e7d847c618afcf 100644 +index 029e77eb851f46d8997890a9acc742aa371537ef..3a820b1b9c9aab336c724ef8c0d823eddb330e1e 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -841,6 +841,10 @@ void RenderWidgetHostImpl::WasHidden() { @@ -21,10 +21,10 @@ index 39121bd94e74440954d337fa8cb4ce3d6e14756b..755fa9cf571873072d67d97226e7d847 // Prompts should remain open and functional across tab switches. if (!delegate_ || !delegate_->IsWaitingForPointerLockPrompt(this)) { diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h -index d1c15f323f2c36dc12dbb8ac2a8f19c0f3365429..507231f8134f7b1bba031baafe6db584f9a47d5d 100644 +index 2d32d91eb98fe749ae262ba06a1a399813aa7bab..8ebf542046ffba6823804b797e373c80bab12873 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h -@@ -1035,6 +1035,8 @@ class CONTENT_EXPORT RenderWidgetHostImpl +@@ -1031,6 +1031,8 @@ class CONTENT_EXPORT RenderWidgetHostImpl return synthetic_gesture_controller_.get(); } @@ -34,15 +34,15 @@ index d1c15f323f2c36dc12dbb8ac2a8f19c0f3365429..507231f8134f7b1bba031baafe6db584 // |routing_id| must not be IPC::mojom::kRoutingIdNone. // If this object outlives |delegate|, DetachDelegate() must be called when diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index 5ff22d23ed92f208f12f1edc864ce8348e220c12..d1d64d93753179f28b4c4ac9653ac1cfc00afd84 100644 +index e5eb88eaed395182081a387fee2a13c3b60adf23..08fc2be8e60d16de952ca7f76701ca4eea722c4b 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -642,7 +642,7 @@ void RenderWidgetHostViewAura::HideImpl() { CHECK(visibility_ == Visibility::HIDDEN || visibility_ == Visibility::OCCLUDED); -- if (!host()->is_hidden()) { -+ if (!host()->is_hidden() && !host()->disable_hidden_) { +- if (!host()->IsHidden()) { ++ if (!host()->IsHidden() && !host()->disable_hidden_) { host()->WasHidden(); aura::WindowTreeHost* host = window_->GetHost(); aura::Window* parent = window_->parent(); diff --git a/patches/chromium/enable_reset_aspect_ratio.patch b/patches/chromium/enable_reset_aspect_ratio.patch index 9ce85d572d99d..16762cdaa4ef6 100644 --- a/patches/chromium/enable_reset_aspect_ratio.patch +++ b/patches/chromium/enable_reset_aspect_ratio.patch @@ -19,7 +19,7 @@ index 35469ecb01a680315b2f92e2599a3b56b5fc7549..d2651f4fcbb7991e9ec8f164e5bee51d excluded_margin); } diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 3d5818d3865d28c038630b2a5419e8f4d97f1556..b1d33fb3589d1aa3ec400a958d7c3c8a64d64e5c 100644 +index 4331e6268871f06f842ddd6323932b5feac6e418..9c048b941eed92f599dc0b1d1273b215816376dd 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -1050,8 +1050,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen, diff --git a/patches/chromium/expose_setuseragent_on_networkcontext.patch b/patches/chromium/expose_setuseragent_on_networkcontext.patch index 221d744b29d7b..3e79ededccf11 100644 --- a/patches/chromium/expose_setuseragent_on_networkcontext.patch +++ b/patches/chromium/expose_setuseragent_on_networkcontext.patch @@ -33,7 +33,7 @@ index 0ab8187b0db8ae6db46d81738f653a2bc4c566f6..de3d55e85c22317f7f9375eb94d0d5d4 } // namespace net diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index f1a7f4ab3d77415c22417bac0bb7dd9a5fa91342..71185e4b6ed4125c3343810bc9c41d887fcd4643 100644 +index 3dab10eb45b641b8a720e73cb8578fe9508f723c..4f9f7ac2c89bad694621fd3b1bbe5460a09c054e 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc @@ -1910,6 +1910,13 @@ void NetworkContext::EnableDurableMessageCollector( @@ -63,10 +63,10 @@ index d73d6500b354805fa7436705801fa740dd01e8ea..5426624e27a58292ef760d07898c145f void SetEnableReferrers(bool enable_referrers) override; #if BUILDFLAG(IS_CT_SUPPORTED) diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index cd4f5d711b31dac365b98f94a72c121a5a29f46d..5de330915c4f73c77f0582bcfdc2d2d15fcc304d 100644 +index e6bf2df4c3de555c4be3bb7ec7b90b87d3c2c240..9455b44b740af80a799aa5a01b67ed68d3b7a6ac 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -1354,6 +1354,9 @@ interface NetworkContext { +@@ -1352,6 +1352,9 @@ interface NetworkContext { mojo_base.mojom.UnguessableToken throttling_profile_id, pending_receiver<DurableMessageCollector> receiver); diff --git a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch index f9dab8e9a350a..6b491599922d1 100644 --- a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch +++ b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch @@ -405,7 +405,7 @@ index 52f16979b05b692ef72762d0cbc16bcb361b047e..b658ebeb9c572158b27d94af56331be8 std::vector<std::string> extension_schemes; // Registers a URL scheme with a predefined default custom handler. diff --git a/url/url_util.cc b/url/url_util.cc -index d50a7842442e60e8d43bfb5f1226501a065ddf83..8cb0380cfb69e3abac3018b5bab10a73e2019215 100644 +index c374142a54d7c6bf4902c94267991ec09fb26f87..07de14ed198d85d7811323d04a69f13022f0e709 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -136,6 +136,9 @@ struct SchemeRegistry { @@ -418,11 +418,11 @@ index d50a7842442e60e8d43bfb5f1226501a065ddf83..8cb0380cfb69e3abac3018b5bab10a73 // Schemes with a predefined default custom handler. std::vector<SchemeWithHandler> predefined_handler_schemes; -@@ -688,6 +691,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() { +@@ -689,6 +692,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() { return GetSchemeRegistry().empty_document_schemes; } -+void AddCodeCacheScheme(const char* new_scheme) { ++void AddCodeCacheScheme(const std::string_view new_scheme) { + DoAddScheme(new_scheme, + &GetSchemeRegistryWithoutLocking()->code_cache_schemes); +} @@ -431,15 +431,15 @@ index d50a7842442e60e8d43bfb5f1226501a065ddf83..8cb0380cfb69e3abac3018b5bab10a73 + return GetSchemeRegistry().code_cache_schemes; +} + - void AddPredefinedHandlerScheme(const char* new_scheme, const char* handler) { + void AddPredefinedHandlerScheme(std::string_view new_scheme, + std::string_view handler) { DoAddSchemeWithHandler( - new_scheme, handler, diff --git a/url/url_util.h b/url/url_util.h -index 035d8390c345c3d9b77fb8d2a30a98934c3a40e7..9681ed030bd53b435d27ae3c330abca2207040a7 100644 +index 501baa71f6ec135827b505c2eca78c7e9ac0b8d3..10bf2c6e27dca530906ef7acb7ac43fa5c731d22 100644 --- a/url/url_util.h +++ b/url/url_util.h @@ -115,6 +115,15 @@ COMPONENT_EXPORT(URL) const std::vector<std::string>& GetCSPBypassingSchemes(); - COMPONENT_EXPORT(URL) void AddEmptyDocumentScheme(const char* new_scheme); + COMPONENT_EXPORT(URL) void AddEmptyDocumentScheme(std::string_view new_scheme); COMPONENT_EXPORT(URL) const std::vector<std::string>& GetEmptyDocumentSchemes(); +// Adds an application-defined scheme to the list of schemes that have V8 code @@ -448,7 +448,7 @@ index 035d8390c345c3d9b77fb8d2a30a98934c3a40e7..9681ed030bd53b435d27ae3c330abca2 +// they are treated as a separate cache type for security purpose. +// The http(s) schemes do not belong to this list neither, they always have V8 +// code cache enabled. -+COMPONENT_EXPORT(URL) void AddCodeCacheScheme(const char* new_scheme); ++COMPONENT_EXPORT(URL) void AddCodeCacheScheme(std::string_view new_scheme); +COMPONENT_EXPORT(URL) const std::vector<std::string>& GetCodeCacheSchemes(); + // Adds a scheme with a predefined default handler. diff --git a/patches/chromium/feat_configure_launch_options_for_service_process.patch b/patches/chromium/feat_configure_launch_options_for_service_process.patch index ca44ff7ec237f..d1bfdb107c664 100644 --- a/patches/chromium/feat_configure_launch_options_for_service_process.patch +++ b/patches/chromium/feat_configure_launch_options_for_service_process.patch @@ -348,7 +348,7 @@ index 580fa663e729a43bef44a10de8983c4aecc312fb..f39af3df87786a472f987309ac0dea69 // Whether or not to bind viz::mojom::Gpu to the utility process. bool allowed_gpu_; diff --git a/content/browser/service_host/utility_sandbox_delegate.cc b/content/browser/service_host/utility_sandbox_delegate.cc -index 67a4e6b3a522a1fffd850ee9e6be08c1cfd3cab6..4ec82c5b35392966262bcb77bc16757705d7ce4b 100644 +index ffa237864328e19868ed0d29590981e972cae9fb..877318c5158a3cd48ff23aa05d3570ff7bb01a6b 100644 --- a/content/browser/service_host/utility_sandbox_delegate.cc +++ b/content/browser/service_host/utility_sandbox_delegate.cc @@ -39,17 +39,19 @@ UtilitySandboxedProcessLauncherDelegate:: @@ -375,7 +375,7 @@ index 67a4e6b3a522a1fffd850ee9e6be08c1cfd3cab6..4ec82c5b35392966262bcb77bc167577 #if DCHECK_IS_ON() bool supported_sandbox_type = sandbox_type_ == sandbox::mojom::Sandbox::kNoSandbox || -@@ -114,11 +116,28 @@ UtilitySandboxedProcessLauncherDelegate::GetSandboxType() { +@@ -111,11 +113,28 @@ UtilitySandboxedProcessLauncherDelegate::GetSandboxType() { return sandbox_type_; } diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index 12491aa33061c..c9ed9dc10b8b7 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -312,7 +312,7 @@ index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index ad26b8e7aee2692730c37bc78545d1aa8eb20437..4fb2eaee6626d3c459313ef1a86b130a9ad91278 100644 +index c5c94ad6f34aa3bd060224ae01ccc705354e5158..0331b41978697787c0ea2cf6360ac9d2b5ed85a1 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/fix_aspect_ratio_with_max_size.patch b/patches/chromium/fix_aspect_ratio_with_max_size.patch index 57b1a5e8d7762..c562d8ac9f96c 100644 --- a/patches/chromium/fix_aspect_ratio_with_max_size.patch +++ b/patches/chromium/fix_aspect_ratio_with_max_size.patch @@ -11,10 +11,10 @@ enlarge window above dimensions set during creation of the BrowserWindow. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index b1d33fb3589d1aa3ec400a958d7c3c8a64d64e5c..dd65b0925e21a1c70c4b7dde17853f7177f4fd3e 100644 +index 9c048b941eed92f599dc0b1d1273b215816376dd..10480326f56bcfebd6f9851d5cef401ee56f010c 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -3844,17 +3844,30 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param, +@@ -3828,17 +3828,30 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param, delegate_->GetMinMaxSize(&min_window_size, &max_window_size); min_window_size = delegate_->DIPToScreenSize(min_window_size); max_window_size = delegate_->DIPToScreenSize(max_window_size); diff --git a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch index e6fb571781093..8b3c29165ad6e 100644 --- a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch +++ b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch @@ -28,10 +28,10 @@ The patch should be removed in favor of either: Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397. diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index c85afe527615663d4db159abe89e6c8edfe0227c..f35735988b64d93474bda64a529ea0671d122647 100644 +index 50ae4f25dd7c7e992fd59a0045fbda90e950a377..fde88d492f765d605eab7e2c3ff752acef3d8853 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc -@@ -11429,6 +11429,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { +@@ -11428,6 +11428,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { target_rph_id); } diff --git a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch index 8ba3aeabd005a..9677db4f76d1b 100644 --- a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch +++ b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch @@ -9,10 +9,10 @@ focus node change via TextInputManager. chromium-bug: https://crbug.com/1369605 diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index 8ebaf11825c7b37d28bb2037cd7d7d9fa8101201..49b345b47d0d7bc7cf981ae821b14c368151b92e 100644 +index 8ad61a86598ac2249496e44113f31ebb21dc616b..36eb119c30531faffb85c4456572f22a9735316d 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -3246,6 +3246,12 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( +@@ -3248,6 +3248,12 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( } } @@ -26,7 +26,7 @@ index 8ebaf11825c7b37d28bb2037cd7d7d9fa8101201..49b345b47d0d7bc7cf981ae821b14c36 RenderWidgetHostViewAura* popup_child_host_view) { popup_child_host_view_ = popup_child_host_view; diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h -index 051faabada8b61788090d47482d4c1c20eaedef7..e9d496173fed9969a5e40d59bbbd4b20128ff1b3 100644 +index 943006033c5f9c6d5cfdbc50ede2723fa8494834..49eb7cb18d1fa114d78048a6e41b8883afdcf674 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h @@ -657,6 +657,8 @@ class CONTENT_EXPORT RenderWidgetHostViewAura @@ -87,10 +87,10 @@ index 75df43e3cd2721a92c90c18154d53d5c203e2465..ce42c75c8face36d21f53f44c0201ac4 // The view with active text input state, i.e., a focused <input> element. // It will be nullptr if no such view exists. Note that the active view diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 9b878662e81e8a0c74542040ebab6bb2f6f078f9..279edf4e1a04f9c9884c088001561ea3d539063d 100644 +index 208fe58f95557ee103555858c2cda39e732ca991..0d2e6fb394799980c61c0855d4cb4c1933719a6e 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10134,7 +10134,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( +@@ -10143,7 +10143,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( "WebContentsImpl::OnFocusedElementChangedInFrame", "render_frame_host", frame); RenderWidgetHostViewBase* root_view = diff --git a/patches/chromium/fix_remove_caption-removing_style_call.patch b/patches/chromium/fix_remove_caption-removing_style_call.patch index 60d85f2a6c399..a6c391433ab06 100644 --- a/patches/chromium/fix_remove_caption-removing_style_call.patch +++ b/patches/chromium/fix_remove_caption-removing_style_call.patch @@ -18,7 +18,7 @@ or resizing, but Electron does not seem to run into that issue for opaque frameless windows even with that block commented out. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index b8a7170d9048beb886925428356bb2ba24f7a8e6..2a47325ff020977a8c574b1edceb722c15513624 100644 +index 0265177961817083e32e8357117e7ae158ba6ef3..0db716837b525cf8f7e2f498fc6db7953754b079 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -1857,7 +1857,23 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) { diff --git a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch index 143f159e4a13c..c2dc3c73b72d5 100644 --- a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch +++ b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch @@ -36,7 +36,7 @@ index 0cd07fd5fb55dcc0d972de4c027fcb895d156592..0f4d335e1d54b5e92fc217080d86513d // Overridden from DesktopWindowTreeHost: void Init(const Widget::InitParams& params) override; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 2a47325ff020977a8c574b1edceb722c15513624..edecbfca5b2c0b6c4dfc6d9049a2e4556559b9f1 100644 +index 0db716837b525cf8f7e2f498fc6db7953754b079..a5a640219294f9bf6a1a86e89624919247a70cb9 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -994,13 +994,13 @@ void HWNDMessageHandler::FrameTypeChanged() { diff --git a/patches/chromium/fix_restore_original_resize_performance_on_macos.patch b/patches/chromium/fix_restore_original_resize_performance_on_macos.patch index b4775a62173cc..3b47008402712 100644 --- a/patches/chromium/fix_restore_original_resize_performance_on_macos.patch +++ b/patches/chromium/fix_restore_original_resize_performance_on_macos.patch @@ -11,7 +11,7 @@ This patch should be upstreamed as a conditional revert of the logic in desktop vs mobile runtimes. i.e. restore the old logic only on desktop platforms diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index d7de0324994cf69009eb5be92110351e98ba47fb..12df047f66b9e3184b7421aa5fbe4e91e340e395 100644 +index 9a24c153e47b3f3878fa6ea92fb99d14c2cddd32..5b0f0b28c3f36315d5bb12ad7e35f21c91a1e8b6 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -2154,9 +2154,8 @@ RenderWidgetHostImpl::GetWidgetInputHandler() { diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index 9fe311833361a..9092dd5b24ac9 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -6,7 +6,7 @@ Subject: frame_host_manager.patch Allows embedder to intercept site instances created by chromium. diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc -index b930c5e23c9d10b9be4126cf2eeb057ab04c519f..945f17e13f47462acc3895a3340cd1080d3043e9 100644 +index c0895a2316b447dfea2359e47d9de19dbc262537..d9d49f35463f13967a9f5bead419d33505795a99 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc @@ -4797,6 +4797,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( @@ -20,10 +20,10 @@ index b930c5e23c9d10b9be4126cf2eeb057ab04c519f..945f17e13f47462acc3895a3340cd108 } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index ffe9b06a5c1ad941f803b33b9654f48b7589f754..bc5a75f8c2686a543226858f54ab54388df706cb 100644 +index ef9073ffcf8a5fa51fa028667cf3328cfae6f994..c7f660c6602a2cead04540245da10c0b99a27910 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -339,6 +339,11 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -334,6 +334,11 @@ class CONTENT_EXPORT ContentBrowserClient { virtual ~ContentBrowserClient() = default; diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index 009e582ae8618..14423a2a2b95e 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -35,10 +35,10 @@ system font by checking if it's kCTFontPriorityAttribute is set to system priority. diff --git a/base/BUILD.gn b/base/BUILD.gn -index ceee35240ccce11f01557582f5f89494c43b190a..09ef47870e18621013cc6f9154dfc247df9ef304 100644 +index d73ee1145fa64c309eddd02c62af6ee735c62e00..99810c2a0bd3550385ca2be80e4286eb78f201c9 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn -@@ -1066,6 +1066,7 @@ component("base") { +@@ -1069,6 +1069,7 @@ component("base") { "//build:ios_buildflags", "//build/config/compiler:compiler_buildflags", "//third_party/modp_b64", @@ -582,10 +582,10 @@ index e51fd827f7afc01a5189737f86a2414627a6546e..bb50f03ba5622c2bfb96bc75d145f471 return kAttributes; } diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index 7a62de74fd44d46ad08a2e16d2d0349237b9c6f8..255ced54478f633a76fcbe3012c6b03f280bc8e5 100644 +index 6fcfee8ce0bc2685f7a06d2ee47022cd00025d56..00db1039db13a2fa11be738f80d806a6aa0883ec 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn -@@ -344,6 +344,7 @@ source_set("browser") { +@@ -343,6 +343,7 @@ source_set("browser") { "//ui/webui/resources", "//v8", "//v8:v8_version", @@ -628,7 +628,7 @@ index 29a5a99fa2c8e90812bd7ff40b153ead807bdbef..c8683c70f8cabfa89c95c28dc5fe59f4 // Used to force the NSApplication's focused accessibility element to be the // content::BrowserAccessibilityCocoa accessibility tree when the NSView for diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index 1c091d1bfaea0fe00e99584d153a1b36bf574b9e..9524be857c44a6523cf101d3cd24e69b30291c50 100644 +index ea86cb14edf163b02a2b0fda0ab3fb6245edd717..9a507a70493e5a648a25968f917a7829105fa6d1 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -52,6 +52,7 @@ @@ -650,7 +650,7 @@ index 1c091d1bfaea0fe00e99584d153a1b36bf574b9e..9524be857c44a6523cf101d3cd24e69b // Reset `ns_view_` before resetting `remote_ns_view_` to avoid dangling // pointers. `ns_view_` gets reinitialized later in this method. -@@ -1653,10 +1656,12 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1654,10 +1657,12 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, gfx::NativeViewAccessible RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() { @@ -663,7 +663,7 @@ index 1c091d1bfaea0fe00e99584d153a1b36bf574b9e..9524be857c44a6523cf101d3cd24e69b return gfx::NativeViewAccessible([GetInProcessNSView() window]); } -@@ -1708,9 +1713,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1709,9 +1714,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, } void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) { @@ -675,7 +675,7 @@ index 1c091d1bfaea0fe00e99584d153a1b36bf574b9e..9524be857c44a6523cf101d3cd24e69b } bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame( -@@ -2213,20 +2220,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -2214,20 +2221,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, void RenderWidgetHostViewMac::GetRenderWidgetAccessibilityToken( GetRenderWidgetAccessibilityTokenCallback callback) { base::ProcessId pid = getpid(); @@ -797,7 +797,7 @@ index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbe } // namespace content diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn -index 9f546ba120be2ca3074ec6fc482c5f841fcb95a5..87991225d7cc5cac1af6b75bb9f5d101c53b9796 100644 +index 9143e3b761afec9420aa39d9f6760297dfb1acad..ab90bd4aff1f8842013708b92982f285ef1ce7a6 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn @@ -703,6 +703,7 @@ static_library("test_support") { @@ -808,7 +808,7 @@ index 9f546ba120be2ca3074ec6fc482c5f841fcb95a5..87991225d7cc5cac1af6b75bb9f5d101 ] data_deps = [ -@@ -1178,6 +1179,8 @@ static_library("browsertest_support") { +@@ -1175,6 +1176,8 @@ static_library("browsertest_support") { # TODO(crbug.com/40031409): Fix code that adds exit-time destructors and # enable the diagnostic by removing this line. configs += [ "//build/config/compiler:no_exit_time_destructors" ] @@ -817,7 +817,7 @@ index 9f546ba120be2ca3074ec6fc482c5f841fcb95a5..87991225d7cc5cac1af6b75bb9f5d101 } mojom("content_test_mojo_bindings") { -@@ -2068,6 +2071,7 @@ test("content_browsertests") { +@@ -2065,6 +2068,7 @@ test("content_browsertests") { "//ui/shell_dialogs", "//ui/snapshot", "//ui/webui:test_support", @@ -825,14 +825,14 @@ index 9f546ba120be2ca3074ec6fc482c5f841fcb95a5..87991225d7cc5cac1af6b75bb9f5d101 ] if (!(is_chromeos && target_cpu == "arm64" && current_cpu == "arm")) { -@@ -3397,6 +3401,7 @@ test("content_unittests") { +@@ -3402,6 +3406,7 @@ test("content_unittests") { "//ui/shell_dialogs", "//ui/webui:test_support", "//url", + "//electron/build/config:generate_mas_config", ] - if (enable_nocompile_tests) { + if (is_chromeos) { diff --git a/content/web_test/BUILD.gn b/content/web_test/BUILD.gn index ab961bccc3e4f0f5a40ac74df97447118b256c68..43f00bf0879809e986308a2cb26145c4a2a51dd3 100644 --- a/content/web_test/BUILD.gn @@ -904,10 +904,10 @@ index f300e8d331057e894b43b74944e5052c39206844..4ff5277d550485cd79c5b5316d89c730 base::WeakPtr<BluetoothLowEnergyAdapterApple> diff --git a/gpu/ipc/service/BUILD.gn b/gpu/ipc/service/BUILD.gn -index 74134d9b3d6d50146b97086385b8b4ee71d6cca4..014ce3738f354e360519d52b5ec2f99feebf3afe 100644 +index 327c2a54f2977ec99885c8c50709129cd5dcd87f..67c1b8a68dec740d0230d6b2396234b9a8b39a8a 100644 --- a/gpu/ipc/service/BUILD.gn +++ b/gpu/ipc/service/BUILD.gn -@@ -122,6 +122,7 @@ component("service") { +@@ -119,6 +119,7 @@ component("service") { "QuartzCore.framework", ] defines += [ "GL_SILENCE_DEPRECATION" ] @@ -916,7 +916,7 @@ index 74134d9b3d6d50146b97086385b8b4ee71d6cca4..014ce3738f354e360519d52b5ec2f99f if (is_ios) { sources += [ "image_transport_surface_ios.mm" ] diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.h b/gpu/ipc/service/image_transport_surface_overlay_mac.h -index d288ffce5c1265adbdefc571f840851026e7479e..e9a6e8c31401750d270fcc55ef1116b2608b65b5 100644 +index 8b7a675d95ad36cbb9528bc5bc7ef05e5124e5a3..ed6a9a326b82b177059317dc4bc54b102f9bcc78 100644 --- a/gpu/ipc/service/image_transport_surface_overlay_mac.h +++ b/gpu/ipc/service/image_transport_surface_overlay_mac.h @@ -8,6 +8,7 @@ @@ -1396,7 +1396,7 @@ index eb81a70e4d5d5cd3e6ae9b45f8cd1c795ea76c51..9921ccb10d3455600eddd85f77f10228 } // namespace sandbox diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn -index 299d9850d09c0ae6380c16c4fdd5c7d355f99032..61b3f8f2cefc6b8e108ab22f7a4b6b33ed6922d4 100644 +index bf9258eeacb85f6b2e424ecd7bb6b9a653673f4b..5a3da145062137ba010cffd47bae475efb5743d0 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn @@ -428,6 +428,7 @@ component("core") { @@ -1440,19 +1440,18 @@ index 0f8a6f75b7f01029adc2f5fd23559bacce19cf72..cf66c2f4f02a8e21cc83c3b7389fc515 } diff --git a/ui/accelerated_widget_mac/ca_layer_tree_coordinator.h b/ui/accelerated_widget_mac/ca_layer_tree_coordinator.h -index ce6a061b57cce101c103527dbbbe5ed47b2ecaf8..616922c34e1f3bc50584c0417129b78e3ff651d1 100644 +index d5f35d2ccfb21b231e235dbfae3eee96a488eb20..14592180823131ca87bc95300c8d9a82451e6628 100644 --- a/ui/accelerated_widget_mac/ca_layer_tree_coordinator.h +++ b/ui/accelerated_widget_mac/ca_layer_tree_coordinator.h -@@ -7,6 +7,7 @@ - +@@ -8,13 +8,16 @@ #include <queue> + #include "base/containers/queue.h" +#include "electron/mas.h" #include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h" - #include "ui/accelerated_widget_mac/ca_renderer_layer_tree.h" #include "ui/gfx/ca_layer_result.h" -@@ -14,7 +15,9 @@ - #include "ui/gl/gl_surface.h" + #include "ui/gfx/presentation_feedback.h" + #include "ui/gl/gl_context.h" #include "ui/gl/presenter.h" +#if !IS_MAS_BUILD() @@ -1461,7 +1460,7 @@ index ce6a061b57cce101c103527dbbbe5ed47b2ecaf8..616922c34e1f3bc50584c0417129b78e @class CALayer; @protocol MTLDevice; -@@ -113,7 +116,9 @@ class ACCELERATED_WIDGET_MAC_EXPORT CALayerTreeCoordinator { +@@ -119,7 +122,9 @@ class ACCELERATED_WIDGET_MAC_EXPORT CALayerTreeCoordinator { // both the current tree and the pending trees. size_t presented_ca_layer_trees_max_length_ = 2; @@ -1472,7 +1471,7 @@ index ce6a061b57cce101c103527dbbbe5ed47b2ecaf8..616922c34e1f3bc50584c0417129b78e // The root CALayer to display the current frame. This does not change // over the lifetime of the object. diff --git a/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm b/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm -index e1b1b0965669cae54565719f9ad6ba808416c2f7..ef7e6fd0d23626db303199ae5c79c8fd55ebba71 100644 +index 5e50feb42b4a49b03a75b510bb3ddc269282aa2f..1519401a362530b7107eab17c28b63486e7455ff 100644 --- a/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm +++ b/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm @@ -10,6 +10,7 @@ @@ -1480,18 +1479,18 @@ index e1b1b0965669cae54565719f9ad6ba808416c2f7..ef7e6fd0d23626db303199ae5c79c8fd #include "base/task/single_thread_task_runner.h" #include "base/trace_event/trace_event.h" +#include "electron/mas.h" + #include "ui/accelerated_widget_mac/ca_renderer_layer_tree.h" #include "ui/base/cocoa/animation_utils.h" #include "ui/base/cocoa/remote_layer_api.h" - #include "ui/gfx/ca_layer_params.h" -@@ -31,6 +32,7 @@ - allow_av_sample_buffer_display_layer), +@@ -37,6 +38,7 @@ buffer_presented_callback_(buffer_presented_callback), + gl_make_current_callback_(gl_make_current_callback), metal_device_(metal_device) { +#if !IS_MAS_BUILD() if (allow_remote_layers_) { root_ca_layer_ = [[CALayer alloc] init]; #if BUILDFLAG(IS_MAC) -@@ -59,6 +61,7 @@ +@@ -65,6 +67,7 @@ #endif ca_context_.layer = root_ca_layer_; } @@ -1499,7 +1498,7 @@ index e1b1b0965669cae54565719f9ad6ba808416c2f7..ef7e6fd0d23626db303199ae5c79c8fd } CALayerTreeCoordinator::~CALayerTreeCoordinator() = default; -@@ -162,9 +165,13 @@ +@@ -207,9 +210,13 @@ TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffers", TRACE_EVENT_SCOPE_THREAD, "GLImpl", static_cast<int>(gl::GetGLImplementation()), "width", pixel_size_.width()); @@ -1510,7 +1509,7 @@ index e1b1b0965669cae54565719f9ad6ba808416c2f7..ef7e6fd0d23626db303199ae5c79c8fd +#else + if (true) { +#endif - IOSurfaceRef io_surface = frame->layer_tree->GetContentIOSurface(); + IOSurfaceRef io_surface = frame.layer_tree->GetContentIOSurface(); if (io_surface) { DCHECK(!allow_remote_layers_); diff --git a/ui/accelerated_widget_mac/display_ca_layer_tree.mm b/ui/accelerated_widget_mac/display_ca_layer_tree.mm @@ -1806,10 +1805,10 @@ index 7f08f6e5870b021e578fe29f42fd6476ab53a8df..88e884c1510ad617b86678ed31a7bbaa // Query the display's refresh rate. double refresh_rate = 1.0 / screen.minimumRefreshInterval; diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn -index 7bfbb8f3b19bd459d9e7e4926cf5ef2f352e3d15..0a7c5f16abb26c1be7ccba8e6be206d7b7871ef7 100644 +index a48fbe958c15817eabb031afa6cff55404c75353..3967406db04ebedb077430479e5cb5c8cb9d2344 100644 --- a/ui/gfx/BUILD.gn +++ b/ui/gfx/BUILD.gn -@@ -335,6 +335,12 @@ component("gfx") { +@@ -333,6 +333,12 @@ component("gfx") { "//ui/base:ui_data_pack", ] diff --git a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch index 0267a0a9d46a3..1c73f4db7ce1f 100644 --- a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch +++ b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch @@ -7,7 +7,7 @@ This adds a callback from the network service that's used to implement session.setCertificateVerifyCallback. diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index c99cb040889eb820e1f32df1af6ac92698945991..f1a7f4ab3d77415c22417bac0bb7dd9a5fa91342 100644 +index a05f512367518549294eb82bb778671d542483a0..3dab10eb45b641b8a720e73cb8578fe9508f723c 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc @@ -166,6 +166,11 @@ @@ -190,10 +190,10 @@ index 02378d3f3e501d006fba8f9c7026b6699b69912c..d73d6500b354805fa7436705801fa740 std::unique_ptr<HostResolver> internal_host_resolver_; std::set<std::unique_ptr<HostResolver>, base::UniquePtrComparator> diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index 1c11b3538ee2082200b7d17e1c724a52ec2e7937..cd4f5d711b31dac365b98f94a72c121a5a29f46d 100644 +index c85aee5a260900a788d7d406e9be485fd2f9846d..e6bf2df4c3de555c4be3bb7ec7b90b87d3c2c240 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -317,6 +317,17 @@ struct SocketBrokerRemotes { +@@ -315,6 +315,17 @@ struct SocketBrokerRemotes { pending_remote<SocketBroker> server; }; @@ -211,7 +211,7 @@ index 1c11b3538ee2082200b7d17e1c724a52ec2e7937..cd4f5d711b31dac365b98f94a72c121a // Parameters for constructing a network context. struct NetworkContextParams { // The user agent string. -@@ -1010,6 +1021,9 @@ interface NetworkContext { +@@ -1008,6 +1019,9 @@ interface NetworkContext { // Sets a client for this network context. SetClient(pending_remote<NetworkContextClient> client); diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index fdac049a5033d..2a74eef0fc7fc 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -7,10 +7,10 @@ Pass RenderFrameHost through to PlatformNotificationService so Electron can identify which renderer a notification came from. diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc -index b6d896b49de98981cbd4a046b7b640266f5b18c3..9d1df23ef92924c04e4226d672134f9ffc4410ae 100644 +index 5b2b9b50fd76526e790055b3ed2ebbe966db850e..a3fdfaa605e5b6df1828b38d0ed05776397e3122 100644 --- a/chrome/browser/notifications/platform_notification_service_impl.cc +++ b/chrome/browser/notifications/platform_notification_service_impl.cc -@@ -264,6 +264,7 @@ bool PlatformNotificationServiceImpl::WasClosedProgrammatically( +@@ -265,6 +265,7 @@ bool PlatformNotificationServiceImpl::WasClosedProgrammatically( // TODO(awdf): Rename to DisplayNonPersistentNotification (Similar for Close) void PlatformNotificationServiceImpl::DisplayNotification( @@ -19,10 +19,10 @@ index b6d896b49de98981cbd4a046b7b640266f5b18c3..9d1df23ef92924c04e4226d672134f9f const GURL& origin, const GURL& document_url, diff --git a/chrome/browser/notifications/platform_notification_service_impl.h b/chrome/browser/notifications/platform_notification_service_impl.h -index e94fccc1b564c349eb2d2c9acd0574c3589a2eaf..a75a55b6c54f5aacc915a27d2aa99395a44da34e 100644 +index 76c0d0763cdb85888c5b02e62006ad30ca6a80ff..eec3dce46eb283b0721dc66ce5f1b254c490476a 100644 --- a/chrome/browser/notifications/platform_notification_service_impl.h +++ b/chrome/browser/notifications/platform_notification_service_impl.h -@@ -57,6 +57,7 @@ class PlatformNotificationServiceImpl +@@ -56,6 +56,7 @@ class PlatformNotificationServiceImpl // content::PlatformNotificationService implementation. void DisplayNotification( @@ -133,7 +133,7 @@ index 5be62a3fb27e37f3c1db6b811172f6dfebe18f61..34349f9832fe4b9a3d48db613a789afb const GURL& document_url, const WeakDocumentPtr& weak_document_ptr, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index d689ab09609595e9738a771d723f2923f629d6cb..ae46fafbb67668d3c0a147cb0d8cf8fda958409a 100644 +index 659d42adfea710b9ff9e315cffa6268a61d68243..e4df51e2fac09cd2c97bb125b9187aede4138f23 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -2314,7 +2314,7 @@ void RenderProcessHostImpl::CreateNotificationService( diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index 7e59fdba35127..5d9be1df69f62 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -30,7 +30,7 @@ index 9a4195a3e53353342c75d6c4372ed4c27ef13fd3..bc1bfa1ac381ec94121a264d9dcbae9e // RenderWidgetHost on the primary main frame, and false otherwise. virtual bool IsWidgetForPrimaryMainFrame(RenderWidgetHostImpl*); diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 755fa9cf571873072d67d97226e7d847c618afcf..d7de0324994cf69009eb5be92110351e98ba47fb 100644 +index 3a820b1b9c9aab336c724ef8c0d823eddb330e1e..9a24c153e47b3f3878fa6ea92fb99d14c2cddd32 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -2073,6 +2073,9 @@ void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) { @@ -44,7 +44,7 @@ index 755fa9cf571873072d67d97226e7d847c618afcf..d7de0324994cf69009eb5be92110351e void RenderWidgetHostImpl::ShowContextMenuAtPoint( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index df1b2c1a866ccb275a87dab55e3b0f654a370f49..b2b12ef9dd78713eaee6792523fcddef97c3e0ca 100644 +index 4472f8020547631c921860a07637c110c1d8f080..3897ca794fd23f337b73c7305b37da7a97f9c550 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -6149,6 +6149,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { diff --git a/patches/chromium/refactor_unfilter_unresponsive_events.patch b/patches/chromium/refactor_unfilter_unresponsive_events.patch index e198f1eb7d6db..f80c72602a662 100644 --- a/patches/chromium/refactor_unfilter_unresponsive_events.patch +++ b/patches/chromium/refactor_unfilter_unresponsive_events.patch @@ -15,10 +15,10 @@ This CL removes these filters so the unresponsive event can still be accessed from our JS event. The filtering is moved into Electron's code. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 4fe94ab63b0bea981406f8c4d181a85d1e5721a4..b76ad9f490ffa4942c92f3cf458683255e00f8e7 100644 +index 8f7467af5365f7ea0a76027256748d62b6cb7531..a9813ead175b478227bb91daf0d23cffc1bedca6 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10272,25 +10272,13 @@ void WebContentsImpl::RendererUnresponsive( +@@ -10281,25 +10281,13 @@ void WebContentsImpl::RendererUnresponsive( base::RepeatingClosure hang_monitor_restarter) { OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RendererUnresponsive", "render_widget_host", render_widget_host); diff --git a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch index 5bd2eb79b0073..e382469f1636b 100644 --- a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch +++ b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch @@ -254,10 +254,10 @@ index 17d6d7d935f93afefa9123f56ef9c138c3070f93..8dfa7501a6a2998e107bf9b51f5e5c3d } diff --git a/content/common/features.cc b/content/common/features.cc -index eeea9763d5c6b99b665906a7dafb054e2a21c297..8c6145d64f3255ac7d8584ebab0830bc849b9e8d 100644 +index 942f204b4c09787870c14e068dba543e7b64d442..6ccd0081e3c3ef88794ab82fc1282a1d91e047ea 100644 --- a/content/common/features.cc +++ b/content/common/features.cc -@@ -298,6 +298,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); +@@ -305,6 +305,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kIOSurfaceCapturer, base::FEATURE_ENABLED_BY_DEFAULT); #endif diff --git a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch index 9aea704cea780..31d175faff32c 100644 --- a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch +++ b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch @@ -39,7 +39,7 @@ index bc1bfa1ac381ec94121a264d9dcbae9e02ab5a81..c6fc03ae158b3ce87fd684d765a3f1b0 // event before sending it to the renderer. See enum for details on return // value. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 12df047f66b9e3184b7421aa5fbe4e91e340e395..702cc747c768355b3827410dbb0d84a0f8b2e44c 100644 +index 5b0f0b28c3f36315d5bb12ad7e35f21c91a1e8b6..08ca1a3fc2add9cf93b078b9136d9aa6d667b9f0 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -1589,6 +1589,10 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( @@ -54,7 +54,7 @@ index 12df047f66b9e3184b7421aa5fbe4e91e340e395..702cc747c768355b3827410dbb0d84a0 if (mouse_event_callback.Run(mouse_event)) { return; diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index b76ad9f490ffa4942c92f3cf458683255e00f8e7..7051e4b2f0ded032647d43bdbf29306cec040c85 100644 +index a9813ead175b478227bb91daf0d23cffc1bedca6..4777db11f1fbde96c7b117dfe0241bb5c34db126 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -4466,6 +4466,12 @@ void WebContentsImpl::RenderWidgetWasResized( diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index 73b0599f3232c..845cf01a24d83 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index f762eb8abf2b075d61cadb3acf236d9dd4dd2fa3..b31c8d7e7699634e437d7bfb884c48ae979559d8 100644 +index 7884bdff1cce1a7a52221f1d7bf5933cd4518b83..be66b04538b2969ba3f8ada0f63660eea586c42b 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25277,6 +25277,21 @@ +@@ -25301,6 +25301,21 @@ ] } ], diff --git a/patches/chromium/support_mixed_sandbox_with_zygote.patch b/patches/chromium/support_mixed_sandbox_with_zygote.patch index bc0d2fa1e179d..635a98ef33db7 100644 --- a/patches/chromium/support_mixed_sandbox_with_zygote.patch +++ b/patches/chromium/support_mixed_sandbox_with_zygote.patch @@ -22,7 +22,7 @@ However, the patch would need to be reviewed by the security team, as it does touch a security-sensitive class. diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index ae46fafbb67668d3c0a147cb0d8cf8fda958409a..3cda71f0b6c606b9df9b457e3f94ee7d3af051b6 100644 +index e4df51e2fac09cd2c97bb125b9187aede4138f23..20a9e4536e722e5f0c8f5bdb55504b7c19d2a29e 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -1905,6 +1905,10 @@ bool RenderProcessHostImpl::Init() { diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index 5f3c0ea443a0f..104e72890124f 100644 --- a/patches/chromium/web_contents.patch +++ b/patches/chromium/web_contents.patch @@ -9,7 +9,7 @@ is needed for OSR. Originally landed in https://github.com/electron/libchromiumcontent/pull/226. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 710fec97c2443921c00a9a65b06a9b7862517cdd..0a6b0be67233bd86ba7f955c393270873c8a4334 100644 +index 2451f06b6b6dc96da44494da1db5e1f47654dad4..ee597638585d787617b5a1d7b9ccac6782fb93ef 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -4197,6 +4197,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index e89738e8e4096..13d20b000e2f2 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,7 +15,7 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 7b3d2f97a8a6aec42303b658b6820c393354f01c..47b07b3de0953f54fd33943d0cd8b688d8db8e4e 100644 +index 6635ed3b341ffc63d80d895dc5746c79092f53ab..5a3acb372b87ed34a62478967c72aeeec83e9db9 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc @@ -8960,6 +8960,17 @@ void RenderFrameHostImpl::EnterFullscreen( @@ -37,7 +37,7 @@ index 7b3d2f97a8a6aec42303b658b6820c393354f01c..47b07b3de0953f54fd33943d0cd8b688 if (had_fullscreen_token && !GetView()->HasFocus()) GetView()->Focus(); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 0a6b0be67233bd86ba7f955c393270873c8a4334..9b878662e81e8a0c74542040ebab6bb2f6f078f9 100644 +index ee597638585d787617b5a1d7b9ccac6782fb93ef..208fe58f95557ee103555858c2cda39e732ca991 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -4483,21 +4483,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 66736f3002a20..1fa2247ef0834 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -2303,7 +2303,7 @@ void WebContents::SetBackgroundThrottling(bool allowed) { rwh_impl->disable_hidden_ = !background_throttling_; web_contents()->GetRenderViewHost()->SetSchedulerThrottling(allowed); - if (rwh_impl->is_hidden()) { + if (rwh_impl->IsHidden()) { rwh_impl->WasShown({}); } } diff --git a/shell/common/api/electron_bindings.cc b/shell/common/api/electron_bindings.cc index 3bae82a89726f..4ffe9f5fe7389 100644 --- a/shell/common/api/electron_bindings.cc +++ b/shell/common/api/electron_bindings.cc @@ -17,6 +17,8 @@ #include "electron/mas.h" #include "services/resource_coordinator/public/cpp/memory_instrumentation/global_memory_dump.h" #include "services/resource_coordinator/public/cpp/memory_instrumentation/memory_instrumentation.h" +// #include +// "services/resource_coordinator/public/mojom/memory_instrumentation/memory_instrumentation.mojom.h" #include "shell/browser/browser.h" #include "shell/common/application_info.h" #include "shell/common/gin_converters/file_path_converter.h" @@ -212,7 +214,7 @@ v8::Local<v8::Promise> ElectronBindings::GetProcessMemoryInfo( v8::Global<v8::Context> context(isolate, isolate->GetCurrentContext()); memory_instrumentation::MemoryInstrumentation::GetInstance() ->RequestGlobalDumpForPid( - base::GetCurrentProcId(), std::vector<std::string>(), + base::GetCurrentProcId(), {} /* allocator_dump_names */, base::BindOnce(&ElectronBindings::DidReceiveMemoryDump, std::move(context), std::move(promise), base::GetCurrentProcId())); @@ -236,7 +238,7 @@ void ElectronBindings::DidReceiveMemoryDump( v8::Global<v8::Context> context, gin_helper::Promise<gin_helper::Dictionary> promise, base::ProcessId target_pid, - bool success, + const memory_instrumentation::mojom::RequestOutcome outcome, std::unique_ptr<memory_instrumentation::GlobalMemoryDump> global_dump) { DCHECK(electron::IsBrowserProcess()); v8::Isolate* isolate = promise.isolate(); @@ -245,7 +247,7 @@ void ElectronBindings::DidReceiveMemoryDump( v8::Local<v8::Context>::New(isolate, context); v8::Context::Scope context_scope(local_context); - if (!success) { + if (outcome != memory_instrumentation::mojom::RequestOutcome::kSuccess) { promise.RejectWithErrorMessage("Failed to create memory dump"); return; } diff --git a/shell/common/api/electron_bindings.h b/shell/common/api/electron_bindings.h index 76259e0480245..a618a34e5e50e 100644 --- a/shell/common/api/electron_bindings.h +++ b/shell/common/api/electron_bindings.h @@ -10,6 +10,7 @@ #include "base/memory/scoped_refptr.h" #include "base/process/process_metrics.h" +#include "services/resource_coordinator/public/mojom/memory_instrumentation/memory_instrumentation.mojom-forward.h" #include "shell/common/node_bindings.h" #include "uv.h" // NOLINT(build/include_directory) @@ -59,7 +60,7 @@ class ElectronBindings { v8::Global<v8::Context> context, gin_helper::Promise<gin_helper::Dictionary> promise, base::ProcessId target_pid, - bool success, + memory_instrumentation::mojom::RequestOutcome outcome, std::unique_ptr<memory_instrumentation::GlobalMemoryDump> dump); private: From 505927d134f79f61ef117ab382c6a2b8f078abca Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Tue, 21 Oct 2025 16:43:04 +0200 Subject: [PATCH 151/268] fix: `trafficLightPosition` incorrect with `customButtonsOnHover` (#48538) fix: trafficLightPosition incorrect with customButtonsOnHover --- shell/browser/ui/cocoa/window_buttons_proxy.mm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/shell/browser/ui/cocoa/window_buttons_proxy.mm b/shell/browser/ui/cocoa/window_buttons_proxy.mm index de1d6b4630310..c0dfd0ac58e72 100644 --- a/shell/browser/ui/cocoa/window_buttons_proxy.mm +++ b/shell/browser/ui/cocoa/window_buttons_proxy.mm @@ -176,6 +176,13 @@ - (void)updateButtonsVisibility { [button setHidden:hidden]; [button setNeedsDisplay:YES]; } + + // On macOS 26, toggling the hidden state of the standard window buttons can + // cause AppKit to re-layout the title bar container and reset its frame, + // which loses the custom margin adjustments. Re-apply the calculated geometry + // after visibility changes to keep the buttons at the specified margin + // instead of snapping back to the default until the next manual resize. + [self redraw]; } // Return the bounds of all 3 buttons. From 8d0f3084cad6062deb1282e46cd448cf355ee652 Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Tue, 21 Oct 2025 16:45:02 +0200 Subject: [PATCH 152/268] fix: devtools crashing on Linux in detach mode (#48600) --- shell/browser/ui/views/electron_views_delegate.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/browser/ui/views/electron_views_delegate.cc b/shell/browser/ui/views/electron_views_delegate.cc index 447951f42dbb2..9417844e8aff5 100644 --- a/shell/browser/ui/views/electron_views_delegate.cc +++ b/shell/browser/ui/views/electron_views_delegate.cc @@ -8,6 +8,7 @@ #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" #include "ui/views/widget/native_widget_aura.h" +#include "ui/views/window/default_frame_view.h" #if BUILDFLAG(IS_LINUX) #include "base/environment.h" @@ -62,7 +63,7 @@ gfx::ImageSkia* ViewsDelegate::GetDefaultWindowIcon() const { std::unique_ptr<views::FrameView> ViewsDelegate::CreateDefaultFrameView( views::Widget* widget) { - return nullptr; + return std::make_unique<views::DefaultFrameView>(widget); } void ViewsDelegate::OnBeforeWidgetInit( From bfbe4701c3e7c2023223bea1ee86de4ded9fd616 Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Tue, 21 Oct 2025 16:46:46 +0200 Subject: [PATCH 153/268] fix: `systemPreferences.getAccentColor` inverted color (#48511) fix: systemPreferences.getAccentColor inverted color --- .../browser/api/electron_api_system_preferences_win.cc | 3 ++- spec/api-browser-window-spec.ts | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/shell/browser/api/electron_api_system_preferences_win.cc b/shell/browser/api/electron_api_system_preferences_win.cc index 5eeda4c87e844..46cac9af30517 100644 --- a/shell/browser/api/electron_api_system_preferences_win.cc +++ b/shell/browser/api/electron_api_system_preferences_win.cc @@ -16,6 +16,7 @@ #include "base/win/wrapped_window_proc.h" #include "shell/common/color_util.h" #include "shell/common/process_util.h" +#include "skia/ext/skia_utils_win.h" #include "ui/gfx/win/hwnd_util.h" #include "ui/gfx/win/singleton_hwnd.h" @@ -88,7 +89,7 @@ std::string SystemPreferences::GetAccentColor() { if (!color.has_value()) return ""; - return hexColorDWORDToRGBA(color.value()); + return ToRGBAHex(skia::COLORREFToSkColor(color.value()), false); } std::string SystemPreferences::GetColor(gin_helper::ErrorThrower thrower, diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 84784a7c322d8..e790934c89db7 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, net, protocol, screen, webContents, webFrameMain, session, WebContents, WebFrameMain } from 'electron/main'; +import { app, BrowserWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, net, protocol, screen, webContents, webFrameMain, session, systemPreferences, WebContents, WebFrameMain } from 'electron/main'; import { expect } from 'chai'; @@ -2590,6 +2590,14 @@ describe('BrowserWindow module', () => { expect(accentColor).to.match(/^#[0-9A-F]{6}$/i); }); + it('matches the systemPreferences system color when true', () => { + const w = new BrowserWindow({ show: false }); + w.setAccentColor(true); + const accentColor = w.getAccentColor() as string; + const systemColor = systemPreferences.getAccentColor().slice(0, 6); + expect(accentColor).to.equal(`#${systemColor}`); + }); + it('returns the correct accent color after multiple changes', () => { const w = new BrowserWindow({ show: false }); From 13f7741f215d70d4307489827615bf2f7d571494 Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Tue, 21 Oct 2025 16:49:08 +0200 Subject: [PATCH 154/268] feat: enable resetting accent color (#48274) --- docs/api/base-window.md | 14 +++++++++----- docs/api/browser-window.md | 14 +++++++++----- shell/browser/api/electron_api_base_window.cc | 9 ++++++++- spec/api-browser-window-spec.ts | 18 +++++++++++++++++- 4 files changed, 43 insertions(+), 12 deletions(-) diff --git a/docs/api/base-window.md b/docs/api/base-window.md index a4520c1c57482..43aa8a156b6ef 100644 --- a/docs/api/base-window.md +++ b/docs/api/base-window.md @@ -1262,15 +1262,16 @@ Sets the properties for the window's taskbar button. #### `win.setAccentColor(accentColor)` _Windows_ -* `accentColor` boolean | string - The accent color for the window. By default, follows user preference in System Settings. +* `accentColor` boolean | string | null - The accent color for the window. By default, follows user preference in System Settings. To reset to system default, pass `null`. Sets the system accent color and highlighting of active window border. The `accentColor` parameter accepts the following values: -* **Color string** - Sets a custom accent color using standard CSS color formats (Hex, RGB, RGBA, HSL, HSLA, or named colors). Alpha values in RGBA/HSLA formats are ignored and the color is treated as fully opaque. -* **`true`** - Uses the system's default accent color from user preferences in System Settings. -* **`false`** - Explicitly disables accent color highlighting for the window. +* **Color string** - Like `true`, but sets a custom accent color using standard CSS color formats (Hex, RGB, RGBA, HSL, HSLA, or named colors). Alpha values in RGBA/HSLA formats are ignored and the color is treated as fully opaque. +* **`true`** - Enable accent color highlighting for the window with the system accent color regardless of whether accent colors are enabled for windows in System `Settings.` +* **`false`** - Disable accent color highlighting for the window regardless of whether accent colors are currently enabled for windows in System Settings. +* **`null`** - Reset window accent color behavior to follow behavior set in System Settings. Examples: @@ -1283,11 +1284,14 @@ win.setAccentColor('#ff0000') // RGB format (alpha ignored if present). win.setAccentColor('rgba(255,0,0,0.5)') -// Use system accent color. +// Enable accent color, using the color specified in System Settings. win.setAccentColor(true) // Disable accent color. win.setAccentColor(false) + +// Reset window accent color behavior to follow behavior set in System Settings. +win.setAccentColor(null) ``` #### `win.getAccentColor()` _Windows_ diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index a399f22b645e7..3000d803f8c5c 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -1442,15 +1442,16 @@ Sets the properties for the window's taskbar button. #### `win.setAccentColor(accentColor)` _Windows_ -* `accentColor` boolean | string - The accent color for the window. By default, follows user preference in System Settings. +* `accentColor` boolean | string | null - The accent color for the window. By default, follows user preference in System Settings. To reset to system default, pass `null`. Sets the system accent color and highlighting of active window border. The `accentColor` parameter accepts the following values: -* **Color string** - Sets a custom accent color using standard CSS color formats (Hex, RGB, RGBA, HSL, HSLA, or named colors). Alpha values in RGBA/HSLA formats are ignored and the color is treated as fully opaque. -* **`true`** - Uses the system's default accent color from user preferences in System Settings. -* **`false`** - Explicitly disables accent color highlighting for the window. +* **Color string** - Like `true`, but sets a custom accent color using standard CSS color formats (Hex, RGB, RGBA, HSL, HSLA, or named colors). Alpha values in RGBA/HSLA formats are ignored and the color is treated as fully opaque. +* **`true`** - Enable accent color highlighting for the window with the system accent color regardless of whether accent colors are enabled for windows in System `Settings.` +* **`false`** - Disable accent color highlighting for the window regardless of whether accent colors are currently enabled for windows in System Settings. +* **`null`** - Reset window accent color behavior to follow behavior set in System Settings. Examples: @@ -1463,11 +1464,14 @@ win.setAccentColor('#ff0000') // RGB format (alpha ignored if present). win.setAccentColor('rgba(255,0,0,0.5)') -// Use system accent color. +// Enable accent color, using the color specified in System Settings. win.setAccentColor(true) // Disable accent color. win.setAccentColor(false) + +// Reset window accent color behavior to follow behavior set in System Settings. +win.setAccentColor(null) ``` #### `win.getAccentColor()` _Windows_ diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index 5570733ca4f0b..fff85198ea617 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -39,6 +39,7 @@ #endif #if BUILDFLAG(IS_WIN) +#include <variant> #include "shell/browser/ui/views/win_frame_view.h" #include "shell/browser/ui/win/taskbar_host.h" #include "ui/base/win/shell.h" @@ -1100,6 +1101,12 @@ void BaseWindow::SetAccentColor(gin::Arguments* const args) { v8::Local<v8::Value> ac_val; args->GetNext(&ac_val); + if (!ac_val.IsEmpty() && ac_val->IsNull()) { + window_->SetAccentColor(std::monostate{}); + window_->UpdateWindowAccentColor(window_->IsActive()); + return; + } + if (!ac_val.IsEmpty() && ac_val->IsBoolean()) { const bool ac_flag = ac_val->BooleanValue(args->isolate()); window_->SetAccentColor(ac_flag); @@ -1118,7 +1125,7 @@ void BaseWindow::SetAccentColor(gin::Arguments* const args) { } args->ThrowTypeError( - "Invalid accent color value - must be a string or boolean"); + "Invalid accent color value - must be null, hex string, or boolean"); } v8::Local<v8::Value> BaseWindow::GetAccentColor() const { diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index e790934c89db7..3e8c384f74726 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -2562,7 +2562,23 @@ describe('BrowserWindow module', () => { expect(() => { // @ts-ignore this is wrong on purpose. w.setAccentColor([1, 2, 3]); - }).to.throw('Invalid accent color value - must be a string or boolean'); + }).to.throw('Invalid accent color value - must be null, hex string, or boolean'); + }); + + it('throws if called with an invalid parameter', () => { + const w = new BrowserWindow({ show: false }); + expect(() => { + // @ts-ignore this is wrong on purpose. + w.setAccentColor(new Date()); + }).to.throw('Invalid accent color value - must be null, hex string, or boolean'); + }); + + it('can be reset with null', () => { + const w = new BrowserWindow({ show: false }); + w.setAccentColor('#FF0000'); + expect(w.getAccentColor()).to.equal('#FF0000'); + w.setAccentColor(null); + expect(w.getAccentColor()).to.not.equal('#FF0000'); }); it('returns the accent color after setting it to a string', () => { From 76ba1f4fe3109d503a3b67fe6a14d8a759e8b8b2 Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Tue, 21 Oct 2025 16:56:14 +0200 Subject: [PATCH 155/268] feat: enable more granular a11y feature management (#48042) * feat: enable more granular a11y feature management * Update docs/api/app.md Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> --------- Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> --- docs/api/app.md | 70 +++++++++++++++++++++- shell/browser/api/electron_api_app.cc | 84 +++++++++++++++++++++++++++ shell/browser/api/electron_api_app.h | 4 ++ spec/api-app-spec.ts | 57 +++++++++++++++++- 4 files changed, 213 insertions(+), 2 deletions(-) diff --git a/docs/api/app.md b/docs/api/app.md index 3e0da669086b1..c46d62cd0d888 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -1398,7 +1398,75 @@ details. Disabled by default. This API must be called after the `ready` event is emitted. > [!NOTE] -> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default. +> Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default. Calling this method will enable the following accessibility support features: `nativeAPIs`, `webContents`, `inlineTextBoxes`, and `extendedProperties`. + +### `app.getAccessibilitySupportFeatures()` _macOS_ _Windows_ + +Returns `string[]` - Array of strings naming currently enabled accessibility support components. Possible values: + +* `nativeAPIs` - Native OS accessibility APIs integration enabled. +* `webContents` - Web contents accessibility tree exposure enabled. +* `inlineTextBoxes` - Inline text boxes (character bounding boxes) enabled. +* `extendedProperties` - Extended accessibility properties enabled. +* `screenReader` - Screen reader specific mode enabled. +* `html` - HTML accessibility tree construction enabled. +* `labelImages` - Accessibility support for automatic image annotations. +* `pdfPrinting` - Accessibility support for PDF printing enabled. + +Notes: + +* The array may be empty if no accessibility modes are active. +* Use `app.isAccessibilitySupportEnabled()` for the legacy boolean check; + prefer this method for granular diagnostics or telemetry. + +Example: + +```js +const { app } = require('electron') + +app.whenReady().then(() => { + if (app.getAccessibilitySupportFeatures().includes('screenReader')) { + // Change some app UI to better work with Screen Readers. + } +}) +``` + +### `app.setAccessibilitySupportFeatures(features)` _macOS_ _Windows_ + +* `features` string[] - An array of the accessibility features to enable. + +Possible values are: + +* `nativeAPIs` - Native OS accessibility APIs integration enabled. +* `webContents` - Web contents accessibility tree exposure enabled. +* `inlineTextBoxes` - Inline text boxes (character bounding boxes) enabled. +* `extendedProperties` - Extended accessibility properties enabled. +* `screenReader` - Screen reader specific mode enabled. +* `html` - HTML accessibility tree construction enabled. +* `labelImages` - Accessibility support for automatic image annotations. +* `pdfPrinting` - Accessibility support for PDF printing enabled. + +To disable all supported features, pass an empty array `[]`. + +Example: + +```js +const { app } = require('electron') + +app.whenReady().then(() => { + // Enable a subset of features: + app.setAccessibilitySupportFeatures([ + 'screenReader', + 'pdfPrinting', + 'webContents' + ]) + + // Other logic + + // Some time later, disable all features: + app.setAccessibilitySupportFeatures([]) +}) +``` ### `app.showAboutPanel()` diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc index 777f64be02241..dd4d07c06ea0c 100644 --- a/shell/browser/api/electron_api_app.cc +++ b/shell/browser/api/electron_api_app.cc @@ -1168,6 +1168,86 @@ bool App::IsAccessibilitySupportEnabled() { return mode.has_mode(ui::kAXModeComplete.flags()); } +v8::Local<v8::Value> App::GetAccessibilitySupportFeatures() { + v8::Isolate* isolate = JavascriptEnvironment::GetIsolate(); + v8::EscapableHandleScope handle_scope(isolate); + auto* ax_state = content::BrowserAccessibilityState::GetInstance(); + ui::AXMode mode = ax_state->GetAccessibilityMode(); + + std::vector<v8::Local<v8::Value>> features; + auto push = [&](const char* name) { + features.push_back(v8::String::NewFromUtf8(isolate, name).ToLocalChecked()); + }; + + if (mode.has_mode(ui::AXMode::kNativeAPIs)) + push("nativeAPIs"); + if (mode.has_mode(ui::AXMode::kWebContents)) + push("webContents"); + if (mode.has_mode(ui::AXMode::kInlineTextBoxes)) + push("inlineTextBoxes"); + if (mode.has_mode(ui::AXMode::kExtendedProperties)) + push("extendedProperties"); + if (mode.has_mode(ui::AXMode::kHTML)) + push("html"); + if (mode.has_mode(ui::AXMode::kLabelImages)) + push("labelImages"); + if (mode.has_mode(ui::AXMode::kPDFPrinting)) + push("pdfPrinting"); + if (mode.has_mode(ui::AXMode::kScreenReader)) + push("screenReader"); + + v8::Local<v8::Array> arr = v8::Array::New(isolate, features.size()); + for (uint32_t i = 0; i < features.size(); ++i) { + arr->Set(isolate->GetCurrentContext(), i, features[i]).Check(); + } + return handle_scope.Escape(arr); +} + +void App::SetAccessibilitySupportFeatures( + gin_helper::ErrorThrower thrower, + const std::vector<std::string>& features) { + if (!Browser::Get()->is_ready()) { + thrower.ThrowError( + "app.setAccessibilitySupportFeatures() can only be called after app " + "is ready"); + return; + } + + ui::AXMode mode; + for (const auto& f : features) { + if (f == "nativeAPIs") { + mode.set_mode(ui::AXMode::kNativeAPIs, true); + } else if (f == "webContents") { + mode.set_mode(ui::AXMode::kWebContents, true); + } else if (f == "inlineTextBoxes") { + mode.set_mode(ui::AXMode::kInlineTextBoxes, true); + } else if (f == "extendedProperties") { + mode.set_mode(ui::AXMode::kExtendedProperties, true); + } else if (f == "screenReader") { + mode.set_mode(ui::AXMode::kScreenReader, true); + } else if (f == "html") { + mode.set_mode(ui::AXMode::kHTML, true); + } else if (f == "labelImages") { + mode.set_mode(ui::AXMode::kLabelImages, true); + } else if (f == "pdfPrinting") { + mode.set_mode(ui::AXMode::kPDFPrinting, true); + } else { + thrower.ThrowError("Unknown accessibility feature: " + f); + return; + } + } + + if (mode.is_mode_off()) { + scoped_accessibility_mode_.reset(); + } else { + scoped_accessibility_mode_ = + content::BrowserAccessibilityState::GetInstance() + ->CreateScopedModeForProcess(mode); + } + + Browser::Get()->OnAccessibilitySupportChanged(); +} + void App::SetAccessibilitySupportEnabled(gin_helper::ErrorThrower thrower, bool enabled) { if (!Browser::Get()->is_ready()) { @@ -1838,6 +1918,10 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuilder(v8::Isolate* isolate) { .SetMethod("relaunch", &App::Relaunch) .SetMethod("isAccessibilitySupportEnabled", &App::IsAccessibilitySupportEnabled) + .SetMethod("getAccessibilitySupportFeatures", + &App::GetAccessibilitySupportFeatures) + .SetMethod("setAccessibilitySupportFeatures", + &App::SetAccessibilitySupportFeatures) .SetMethod("setAccessibilitySupportEnabled", &App::SetAccessibilitySupportEnabled) .SetMethod("disableHardwareAcceleration", diff --git a/shell/browser/api/electron_api_app.h b/shell/browser/api/electron_api_app.h index 066790f492809..504affb315106 100644 --- a/shell/browser/api/electron_api_app.h +++ b/shell/browser/api/electron_api_app.h @@ -215,6 +215,10 @@ class App final : public gin::Wrappable<App>, void DisableHardwareAcceleration(gin_helper::ErrorThrower thrower); void DisableDomainBlockingFor3DAPIs(gin_helper::ErrorThrower thrower); bool IsAccessibilitySupportEnabled(); + v8::Local<v8::Value> GetAccessibilitySupportFeatures(); + void SetAccessibilitySupportFeatures( + gin_helper::ErrorThrower thrower, + const std::vector<std::string>& features); void SetAccessibilitySupportEnabled(gin_helper::ErrorThrower thrower, bool enabled); v8::Local<v8::Value> GetLoginItemSettings(gin::Arguments* args); diff --git a/spec/api-app-spec.ts b/spec/api-app-spec.ts index 34983c484e9e6..30e5e96abcb7b 100644 --- a/spec/api-app-spec.ts +++ b/spec/api-app-spec.ts @@ -1019,7 +1019,7 @@ describe('app module', () => { }); }); - ifdescribe(process.platform !== 'linux')('accessibilitySupportEnabled property', () => { + ifdescribe(process.platform !== 'linux')('accessibility support functionality', () => { it('is mutable', () => { const values = [false, true, false]; const setters: Array<(arg: boolean) => void> = [ @@ -1037,6 +1037,61 @@ describe('app module', () => { } } }); + + it('getAccessibilitySupportFeatures returns an array with accessibility properties', () => { + const values = [ + 'nativeAPIs', + 'webContents', + 'inlineTextBoxes', + 'extendedProperties', + 'screenReader', + 'html', + 'labelImages', + 'pdfPrinting' + ]; + + app.setAccessibilitySupportEnabled(false); + + const disabled = app.getAccessibilitySupportFeatures(); + expect(disabled).to.be.an('array'); + expect(disabled.includes('complete')).to.equal(false); + + app.setAccessibilitySupportEnabled(true); + const enabled = app.getAccessibilitySupportFeatures(); + expect(enabled).to.be.an('array').with.length.greaterThan(0); + + const boolEnabled = app.isAccessibilitySupportEnabled(); + if (boolEnabled) { + expect(enabled.some(f => values.includes(f))).to.equal(true); + } + }); + + it('setAccessibilitySupportFeatures can enable a subset of features', () => { + app.setAccessibilitySupportEnabled(false); + expect(app.isAccessibilitySupportEnabled()).to.equal(false); + expect(app.getAccessibilitySupportFeatures()).to.be.an('array').that.is.empty(); + + const subsetA = ['webContents', 'html']; + app.setAccessibilitySupportFeatures(subsetA); + const afterSubsetA = app.getAccessibilitySupportFeatures(); + expect(afterSubsetA).to.deep.equal(subsetA); + + const subsetB = [ + 'nativeAPIs', + 'webContents', + 'inlineTextBoxes', + 'extendedProperties' + ]; + app.setAccessibilitySupportFeatures(subsetB); + const afterSubsetB = app.getAccessibilitySupportFeatures(); + expect(afterSubsetB).to.deep.equal(subsetB); + }); + + it('throws when an unknown accessibility feature is requested', () => { + expect(() => { + app.setAccessibilitySupportFeatures(['unknownFeature']); + }).to.throw('Unknown accessibility feature: unknownFeature'); + }); }); ifdescribe(process.platform === 'win32')('setJumpList(categories)', () => { From fc1b3668ac71e319f68f758dd051e943fd72b06b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Tue, 21 Oct 2025 14:12:05 -0400 Subject: [PATCH 156/268] build(deps): bump actions/checkout from 4.2.2 to 5.0.0 (#48051) * build(deps): bump actions/checkout from 4.2.2 to 5.0.0 Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.2 to 5.0.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/11bd71901bbe5b1630ceea73d27597364c9af683...08c6903cd8c0fde910a37f88322edcfb5dd907a8) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 5.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * chore: remove inaccurate version information Version can easily be determined from sha * ci: link node 24 for linux arm testing --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> --- .github/workflows/archaeologist-dig.yml | 2 +- .github/workflows/build-git-cache.yml | 6 +++--- .github/workflows/build.yml | 8 ++++---- .github/workflows/linux-publish.yml | 2 +- .github/workflows/macos-publish.yml | 2 +- .github/workflows/pipeline-electron-docs-only.yml | 4 ++-- .github/workflows/pipeline-electron-lint.yml | 2 +- .github/workflows/pipeline-segment-electron-build.yml | 4 ++-- .github/workflows/pipeline-segment-electron-gn-check.yml | 4 ++-- .github/workflows/pipeline-segment-electron-test.yml | 3 ++- .github/workflows/pipeline-segment-node-nan-test.yml | 4 ++-- .github/workflows/scorecards.yml | 2 +- .github/workflows/windows-publish.yml | 2 +- 13 files changed, 23 insertions(+), 22 deletions(-) diff --git a/.github/workflows/archaeologist-dig.yml b/.github/workflows/archaeologist-dig.yml index 07c32d17a3742..b527446a65f22 100644 --- a/.github/workflows/archaeologist-dig.yml +++ b/.github/workflows/archaeologist-dig.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.0.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: fetch-depth: 0 - name: Setup Node.js/npm diff --git a/.github/workflows/build-git-cache.yml b/.github/workflows/build-git-cache.yml index 43daf56e5aa36..fc981786321d5 100644 --- a/.github/workflows/build-git-cache.yml +++ b/.github/workflows/build-git-cache.yml @@ -19,7 +19,7 @@ jobs: GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' steps: - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 @@ -41,7 +41,7 @@ jobs: TARGET_OS: 'win' steps: - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 @@ -64,7 +64,7 @@ jobs: GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac' steps: - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 17cc18a1d9778..f734ec3215126 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,7 +54,7 @@ jobs: build-image-sha: ${{ steps.set-output.outputs.build-image-sha }} docs-only: ${{ steps.set-output.outputs.docs-only }} steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.0.2 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: ref: ${{ github.event.pull_request.head.sha }} - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 @@ -111,7 +111,7 @@ jobs: build-image-sha: ${{ needs.setup.outputs.build-image-sha }} steps: - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 @@ -141,7 +141,7 @@ jobs: build-image-sha: ${{ needs.setup.outputs.build-image-sha}} steps: - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 @@ -171,7 +171,7 @@ jobs: build-image-sha: ${{ needs.setup.outputs.build-image-sha}} steps: - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 diff --git a/.github/workflows/linux-publish.yml b/.github/workflows/linux-publish.yml index 5903fc925c4b0..93ed359ab3dba 100644 --- a/.github/workflows/linux-publish.yml +++ b/.github/workflows/linux-publish.yml @@ -31,7 +31,7 @@ jobs: GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' steps: - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 diff --git a/.github/workflows/macos-publish.yml b/.github/workflows/macos-publish.yml index a932fb75629b9..2464edc859241 100644 --- a/.github/workflows/macos-publish.yml +++ b/.github/workflows/macos-publish.yml @@ -32,7 +32,7 @@ jobs: GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac' steps: - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 diff --git a/.github/workflows/pipeline-electron-docs-only.yml b/.github/workflows/pipeline-electron-docs-only.yml index a1d2dc5256163..3cac1f4f0650d 100644 --- a/.github/workflows/pipeline-electron-docs-only.yml +++ b/.github/workflows/pipeline-electron-docs-only.yml @@ -23,7 +23,7 @@ jobs: container: ${{ fromJSON(inputs.container) }} steps: - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 @@ -39,7 +39,7 @@ jobs: with: target-platform: linux - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 diff --git a/.github/workflows/pipeline-electron-lint.yml b/.github/workflows/pipeline-electron-lint.yml index 7c1b27d0a33b8..772e80c8f0cb4 100644 --- a/.github/workflows/pipeline-electron-lint.yml +++ b/.github/workflows/pipeline-electron-lint.yml @@ -23,7 +23,7 @@ jobs: container: ${{ fromJSON(inputs.container) }} steps: - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 diff --git a/.github/workflows/pipeline-segment-electron-build.yml b/.github/workflows/pipeline-segment-electron-build.yml index 620c6563456fc..f29d8db8e636c 100644 --- a/.github/workflows/pipeline-segment-electron-build.yml +++ b/.github/workflows/pipeline-segment-electron-build.yml @@ -91,7 +91,7 @@ jobs: run: | mkdir src - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 @@ -159,7 +159,7 @@ jobs: if: ${{ inputs.target-platform == 'linux' }} uses: ./src/electron/.github/actions/restore-cache-aks - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 diff --git a/.github/workflows/pipeline-segment-electron-gn-check.yml b/.github/workflows/pipeline-segment-electron-gn-check.yml index 48fe703078145..329d4241a6b84 100644 --- a/.github/workflows/pipeline-segment-electron-gn-check.yml +++ b/.github/workflows/pipeline-segment-electron-gn-check.yml @@ -44,7 +44,7 @@ jobs: container: ${{ fromJSON(inputs.check-container) }} steps: - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 @@ -111,7 +111,7 @@ jobs: - name: Add CHROMIUM_BUILDTOOLS_PATH to env run: echo "CHROMIUM_BUILDTOOLS_PATH=$(pwd)/src/buildtools" >> $GITHUB_ENV - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 diff --git a/.github/workflows/pipeline-segment-electron-test.yml b/.github/workflows/pipeline-segment-electron-test.yml index b376f9dd2bee0..d56b815d08bd7 100644 --- a/.github/workflows/pipeline-segment-electron-test.yml +++ b/.github/workflows/pipeline-segment-electron-test.yml @@ -68,6 +68,7 @@ jobs: if: ${{ inputs.target-arch == 'arm' && inputs.target-platform == 'linux' }} run: | cp $(which node) /mnt/runner-externals/node20/bin/ + cp $(which node) /mnt/runner-externals/node24/bin/ - name: Setup Node.js/npm if: ${{ inputs.target-platform == 'win' }} uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 @@ -117,7 +118,7 @@ jobs: if: ${{ inputs.target-platform == 'macos' }} run: sudo xcode-select --switch /Applications/Xcode_16.4.app - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 diff --git a/.github/workflows/pipeline-segment-node-nan-test.yml b/.github/workflows/pipeline-segment-node-nan-test.yml index 568754a862001..5a4e4b3eec8d3 100644 --- a/.github/workflows/pipeline-segment-node-nan-test.yml +++ b/.github/workflows/pipeline-segment-node-nan-test.yml @@ -46,7 +46,7 @@ jobs: container: ${{ fromJSON(inputs.test-container) }} steps: - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 @@ -100,7 +100,7 @@ jobs: container: ${{ fromJSON(inputs.test-container) }} steps: - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 85aa61ca70bad..0c897d43166d5 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -22,7 +22,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false diff --git a/.github/workflows/windows-publish.yml b/.github/workflows/windows-publish.yml index b72e045d7679d..33091b383ffc4 100644 --- a/.github/workflows/windows-publish.yml +++ b/.github/workflows/windows-publish.yml @@ -36,7 +36,7 @@ jobs: build-image-sha: ${{ inputs.build-image-sha }} steps: - name: Checkout Electron - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 with: path: src/electron fetch-depth: 0 From 45added2a4e795a0cb92c946d09fbfac1108f0c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tau=20G=C3=A4rtli?= <nilay2014@gmail.com> Date: Tue, 21 Oct 2025 20:26:30 +0200 Subject: [PATCH 157/268] feat: Add `getAccentColor` on Linux (#48027) * feat: Implement `getAccentColor` on Linux * doc: Update OS support for accent color APIs --- docs/api/system-preferences.md | 4 +-- .../api/electron_api_system_preferences.cc | 36 ++++++++++++++++++- .../api/electron_api_system_preferences.h | 20 ++++++++++- spec/api-system-preferences-spec.ts | 12 +++++-- 4 files changed, 65 insertions(+), 7 deletions(-) diff --git a/docs/api/system-preferences.md b/docs/api/system-preferences.md index 8af85f757dcf0..ce5f4bf8b5e71 100644 --- a/docs/api/system-preferences.md +++ b/docs/api/system-preferences.md @@ -14,7 +14,7 @@ console.log(systemPreferences.getEffectiveAppearance()) The `systemPreferences` object emits the following events: -### Event: 'accent-color-changed' _Windows_ +### Event: 'accent-color-changed' _Windows_ _Linux_ Returns: @@ -182,7 +182,7 @@ Some popular `key` and `type`s are: Removes the `key` in `NSUserDefaults`. This can be used to restore the default or global value of a `key` previously set with `setUserDefault`. -### `systemPreferences.getAccentColor()` _Windows_ _macOS_ +### `systemPreferences.getAccentColor()` Returns `string` - The users current system wide accent color preference in RGBA hexadecimal form. diff --git a/shell/browser/api/electron_api_system_preferences.cc b/shell/browser/api/electron_api_system_preferences.cc index 053cd89728aee..52ac57acd0ab8 100644 --- a/shell/browser/api/electron_api_system_preferences.cc +++ b/shell/browser/api/electron_api_system_preferences.cc @@ -10,6 +10,12 @@ #include "shell/common/gin_helper/handle.h" #include "shell/common/node_includes.h" #include "ui/gfx/animation/animation.h" +#if BUILDFLAG(IS_LINUX) +#include "content/public/browser/browser_task_traits.h" +#include "content/public/browser/browser_thread.h" +#include "shell/browser/api/electron_api_system_preferences.h" +#include "shell/common/color_util.h" +#endif namespace electron::api { @@ -20,6 +26,11 @@ gin::DeprecatedWrapperInfo SystemPreferences::kWrapperInfo = { SystemPreferences::SystemPreferences() { InitializeWindow(); } +#elif BUILDFLAG(IS_LINUX) +SystemPreferences::SystemPreferences() + : ui_theme_(ui::NativeTheme::GetInstanceForNativeUi()) { + ui_theme_->AddObserver(this); +} #else SystemPreferences::SystemPreferences() = default; #endif @@ -44,6 +55,29 @@ v8::Local<v8::Value> SystemPreferences::GetAnimationSettings( return dict.GetHandle(); } +#if BUILDFLAG(IS_LINUX) +std::string SystemPreferences::GetAccentColor() { + auto const color = ui_theme_->user_color(); + if (!color.has_value()) + return ""; + return ToRGBAHex(*color); +} + +void SystemPreferences::OnNativeThemeUpdatedOnUI() { + auto const new_accent_color = GetAccentColor(); + if (current_accent_color_ == new_accent_color) + return; + Emit("accent-color-changed", new_accent_color); + current_accent_color_ = new_accent_color; +} + +void SystemPreferences::OnNativeThemeUpdated(ui::NativeTheme* theme) { + content::GetUIThreadTaskRunner({})->PostTask( + FROM_HERE, base::BindOnce(&SystemPreferences::OnNativeThemeUpdatedOnUI, + base::Unretained(this))); +} +#endif + // static gin_helper::Handle<SystemPreferences> SystemPreferences::Create( v8::Isolate* isolate) { @@ -54,9 +88,9 @@ gin::ObjectTemplateBuilder SystemPreferences::GetObjectTemplateBuilder( v8::Isolate* isolate) { return gin_helper::EventEmitterMixin< SystemPreferences>::GetObjectTemplateBuilder(isolate) + .SetMethod("getAccentColor", &SystemPreferences::GetAccentColor) #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) .SetMethod("getColor", &SystemPreferences::GetColor) - .SetMethod("getAccentColor", &SystemPreferences::GetAccentColor) .SetMethod("getMediaAccessStatus", &SystemPreferences::GetMediaAccessStatus) #endif diff --git a/shell/browser/api/electron_api_system_preferences.h b/shell/browser/api/electron_api_system_preferences.h index 5cf6632a86dcf..442f2e2c1100f 100644 --- a/shell/browser/api/electron_api_system_preferences.h +++ b/shell/browser/api/electron_api_system_preferences.h @@ -18,6 +18,11 @@ #include "shell/browser/browser.h" #include "shell/browser/browser_observer.h" #endif +#if BUILDFLAG(IS_LINUX) +#include "base/memory/raw_ptr.h" +#include "ui/native_theme/native_theme.h" +#include "ui/native_theme/native_theme_observer.h" +#endif namespace gin_helper { template <typename T> @@ -44,6 +49,9 @@ class SystemPreferences final #if BUILDFLAG(IS_WIN) , public BrowserObserver +#elif BUILDFLAG(IS_LINUX) + , + public ui::NativeThemeObserver #endif { public: @@ -55,8 +63,8 @@ class SystemPreferences final v8::Isolate* isolate) override; const char* GetTypeName() override; + std::string GetAccentColor(); #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) - static std::string GetAccentColor(); std::string GetColor(gin_helper::ErrorThrower thrower, const std::string& color); std::string GetMediaAccessStatus(gin_helper::ErrorThrower thrower, @@ -117,6 +125,10 @@ class SystemPreferences final // TODO(MarshallOfSound): Write tests for these methods once we // are running tests on a Mojave machine v8::Local<v8::Value> GetEffectiveAppearance(v8::Isolate* isolate); + +#elif BUILDFLAG(IS_LINUX) + // ui::NativeThemeObserver: + void OnNativeThemeUpdated(ui::NativeTheme* theme) override; #endif v8::Local<v8::Value> GetAnimationSettings(v8::Isolate* isolate); @@ -162,6 +174,12 @@ class SystemPreferences final // Color/high contrast mode change observer. base::CallbackListSubscription hwnd_subscription_; #endif +#if BUILDFLAG(IS_LINUX) + void OnNativeThemeUpdatedOnUI(); + + raw_ptr<ui::NativeTheme> ui_theme_; + std::string current_accent_color_; +#endif }; } // namespace electron::api diff --git a/spec/api-system-preferences-spec.ts b/spec/api-system-preferences-spec.ts index 05de0b91e8565..5c10b433183a0 100644 --- a/spec/api-system-preferences-spec.ts +++ b/spec/api-system-preferences-spec.ts @@ -2,11 +2,17 @@ import { systemPreferences } from 'electron/main'; import { expect } from 'chai'; -import { ifdescribe } from './lib/spec-helpers'; +import { ifdescribe, ifit } from './lib/spec-helpers'; describe('systemPreferences module', () => { - ifdescribe(process.platform === 'win32')('systemPreferences.getAccentColor', () => { - it('should return a non-empty string', () => { + ifdescribe(['win32', 'linux'].includes(process.platform))('systemPreferences.getAccentColor', () => { + ifit(process.platform === 'linux')('should return a string', () => { + // Testing this properly (i.e. non-empty string) requires + // some tricky D-Bus mock setup. + const accentColor = systemPreferences.getAccentColor(); + expect(accentColor).to.be.a('string'); + }); + ifit(process.platform === 'win32')('should return a non-empty string', () => { const accentColor = systemPreferences.getAccentColor(); expect(accentColor).to.be.a('string').that.is.not.empty('accent color'); }); From 7491f8dbd6427d2b4981404ebb01d59d4133a99a Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Tue, 21 Oct 2025 21:12:26 +0200 Subject: [PATCH 158/268] fix: icon in Windows toast notification (#48543) --- .../win/notification_presenter_win.cc | 17 +++++++++-------- .../win/windows_toast_notification.cc | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/shell/browser/notifications/win/notification_presenter_win.cc b/shell/browser/notifications/win/notification_presenter_win.cc index 39acd451247eb..7bf69ec2838d2 100644 --- a/shell/browser/notifications/win/notification_presenter_win.cc +++ b/shell/browser/notifications/win/notification_presenter_win.cc @@ -30,9 +30,8 @@ namespace { bool SaveIconToPath(const SkBitmap& bitmap, const base::FilePath& path) { std::optional<std::vector<uint8_t>> png_data = gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false); - if (!png_data.has_value()) + if (!png_data.has_value() || !png_data.value().size()) return false; - return base::WriteFile(path, png_data.value()); } @@ -64,8 +63,10 @@ bool NotificationPresenterWin::Init() { std::wstring NotificationPresenterWin::SaveIconToFilesystem( const SkBitmap& icon, const GURL& origin) { - std::string filename; + if (icon.drawsNothing()) + return L""; + std::string filename; if (origin.is_valid()) { filename = base::MD5String(origin.spec()) + ".png"; } else { @@ -75,11 +76,11 @@ std::wstring NotificationPresenterWin::SaveIconToFilesystem( ScopedAllowBlockingForElectron allow_blocking; base::FilePath path = temp_dir_.GetPath().Append(base::UTF8ToWide(filename)); - if (base::PathExists(path)) - return path.value(); - if (SaveIconToPath(icon, path)) - return path.value(); - return base::UTF8ToWide(origin.spec()); + + if (!SaveIconToPath(icon, path)) + return L""; + + return path.value(); } Notification* NotificationPresenterWin::CreateNotificationObject( diff --git a/shell/browser/notifications/win/windows_toast_notification.cc b/shell/browser/notifications/win/windows_toast_notification.cc index aecf564384e01..d377e03cf102e 100644 --- a/shell/browser/notifications/win/windows_toast_notification.cc +++ b/shell/browser/notifications/win/windows_toast_notification.cc @@ -353,6 +353,7 @@ std::u16string WindowsToastNotification::GetToastXml( // Optional icon as app logo override (small icon). if (!icon_path.empty()) { xml_writer.StartElement(kImage); + xml_writer.AddAttribute(kID, "1"); xml_writer.AddAttribute(kPlacement, kAppLogoOverride); xml_writer.AddAttribute(kHintCrop, kHintCropNone); xml_writer.AddAttribute(kSrc, base::WideToUTF8(icon_path)); From c20789a648a42f426ec40b45e7c495e89e8d33ad Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Thu, 23 Oct 2025 08:30:29 -0500 Subject: [PATCH 159/268] chore: bump chromium to 143.0.7485.0 (main) (#48618) * chore: bump chromium in DEPS to 143.0.7485.0 * chore: update allow_disabling_blink_scheduler_throttling_per_renderview.patch Move SetSupportsDraggableRegions mojom IPC from chrome/ and extensions/ to blink/ | https://chromium-review.googlesource.com/c/chromium/src/+/7043264 Patch applied manually due to context shear * Move SetSupportsDraggableRegions mojom IPC from chrome/ and extensions/ to blink/ | https://chromium-review.googlesource.com/c/chromium/src/+/7043264 * chore: e patches all * chore: check for file existence before setting utime * chore: stop disabling kWinDelaySpellcheckServiceInit [cleanup] Remove feature WinDelaySpellcheckServiceInit | https://chromium-review.googlesource.com/c/chromium/src/+/7012087 This flag has been removed upstream. We've used it since c2d7164 (#38248) to fix a crash originally described in 97b353a (#34993): > Delaying spell check initialization is causing specs for > 'custom dictionary word list API' to fail in Electron. Since we haven't touched this in a few years, and since there's a clear success criteria (a passing/failing spec), and since the patch to restore this flag would be pretty large (~750 lines), I'm going to try just removing the flag from our source to see if the spec passes or fails. * Revert "chore: stop disabling kWinDelaySpellcheckServiceInit" This reverts commit e688880396e9ea538aa6a8823091d0d6d187b24c. Unfortunately, the crash persists. * Revert [cleanup] Remove feature WinDelaySpellcheckServiceInit | https://chromium-review.googlesource.com/c/chromium/src/+/7012087 We currently need this feature * fixup! chore: check for file existence before setting utime * fixup! Move SetSupportsDraggableRegions mojom IPC from chrome/ and extensions/ to blink/ | https://chromium-review.googlesource.com/c/chromium/src/+/7043264 Address Robo's code review @ https://github.com/electron/electron/pull/48618/files/64c7fd21ed4cf7fbbfd9b688a21c942c5e7535ff * fixup! fixup! chore: check for file existence before setting utime fix: oops typo --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> --- DEPS | 2 +- patches/chromium/.patches | 2 + .../add_didinstallconditionalfeatures.patch | 4 +- ..._scheduler_throttling_per_renderview.patch | 30 +- ..._depend_on_packed_resource_integrity.patch | 12 +- patches/chromium/can_create_window.patch | 12 +- ...ameter_in_script_lifecycle_observers.patch | 4 +- ...fy_chromium_handling_of_mouse_events.patch | 8 +- .../chromium/chore_partial_revert_of.patch | 4 +- .../chore_patch_out_profile_methods.patch | 2 +- ...screationoverridden_with_full_params.patch | 12 +- patches/chromium/disable_hidden.patch | 4 +- .../chromium/enable_reset_aspect_ratio.patch | 4 +- ...to_add_observers_on_created_hunspell.patch | 6 +- ...moothing_css_rule_and_blink_painting.patch | 6 +- ...dless_mode_handling_in_native_widget.patch | 20 +- ..._file_existence_before_setting_mtime.patch | 27 + ...board_hides_on_input_blur_in_webview.patch | 12 +- ..._material_update_issue_on_windows_11.patch | 4 +- ..._avoid_private_macos_api_usage.patch.patch | 24 +- .../chromium/notification_provenance.patch | 2 +- ...r_changes_to_the_webcontentsobserver.patch | 14 +- ...efactor_unfilter_unresponsive_events.patch | 4 +- ...eature_windelayspellcheckserviceinit.patch | 765 ++++++++++++++++++ ...ean_up_stale_macwebcontentsocclusion.patch | 8 +- ...al_remove_unused_prehandlemouseevent.patch | 8 +- ...windowtreehostwin_window_enlargement.patch | 20 +- .../support_mixed_sandbox_with_zygote.patch | 2 +- patches/chromium/web_contents.patch | 8 +- patches/chromium/webview_fullscreen.patch | 10 +- .../browser/api/electron_api_web_contents.cc | 9 +- .../electron_render_frame_observer.cc | 5 - 32 files changed, 922 insertions(+), 132 deletions(-) create mode 100644 patches/chromium/fix_check_for_file_existence_before_setting_mtime.patch create mode 100644 patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch diff --git a/DEPS b/DEPS index db368a1d01312..97f071c50130c 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '143.0.7483.0', + '143.0.7485.0', 'node_version': 'v22.20.0', 'nan_version': diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 6c87b070d5616..5de666c64bcd2 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -141,3 +141,5 @@ revert_partial_remove_unused_prehandlemouseevent.patch allow_electron_to_depend_on_components_os_crypt_sync.patch expose_referrerscriptinfo_hostdefinedoptionsindex.patch chore_disable_protocol_handler_dcheck.patch +fix_check_for_file_existence_before_setting_mtime.patch +revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index 56f1c1cae1411..e02c2891cf3e0 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -40,10 +40,10 @@ index 792ecdf43c810d19641251d3f5eeddccc4c621e9..99d368046177dd92c8b36743f461d348 int world_id) { for (auto& observer : observers_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index b0528c4f02bdbf54dc490f9163fbf4f24e3471db..542eddb03c98eac5c03c9bc208af2c863d552b2d 100644 +index ce1d8807d624b35fa63ef83e3a95c7cba8f1f22f..61d4ef338cc4c0e99c144d6d95bbe0adba9d3556 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -604,6 +604,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -603,6 +603,8 @@ class CONTENT_EXPORT RenderFrameImpl void DidObserveLayoutShift(double score, bool after_input_or_scroll) override; void DidCreateScriptContext(v8::Local<v8::Context> context, int world_id) override; diff --git a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch index 2b0e89e649cee..cbeeb5603a2a3 100644 --- a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -6,11 +6,11 @@ Subject: allow disabling blink scheduler throttling per RenderView This allows us to disable throttling for hidden windows. diff --git a/content/browser/renderer_host/navigation_controller_impl_unittest.cc b/content/browser/renderer_host/navigation_controller_impl_unittest.cc -index 94a67b61edb0bc2f3faa5db44e99d1493f38d5a0..e4a953c199f8c1e5d68e552f73c593d308946957 100644 +index 74b39146bbb8151a66ecb4f138f769fffc2525b2..a54948fa36c85c5c5dd04b9836951b1ce1279038 100644 --- a/content/browser/renderer_host/navigation_controller_impl_unittest.cc +++ b/content/browser/renderer_host/navigation_controller_impl_unittest.cc -@@ -168,6 +168,12 @@ class MockPageBroadcast : public blink::mojom::PageBroadcast { - (std::optional<blink::NoiseToken> canvas_noise_token), +@@ -173,6 +173,12 @@ class MockPageBroadcast : public blink::mojom::PageBroadcast { + (bool supports_draggable_regions), (override)); + MOCK_METHOD( @@ -51,10 +51,10 @@ index 7944fe64e0da112fc670358b75506bb199bb5e4a..0e3c16c6af2a078943e9f39808134ab2 void SendRendererPreferencesToRenderer( const blink::RendererPreferences& preferences); diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index 08fc2be8e60d16de952ca7f76701ca4eea722c4b..8ad61a86598ac2249496e44113f31ebb21dc616b 100644 +index d97cbb4fd8e12bcbff19bf8cc8378997110c60c0..1041d25d5ef78abdcf7b85fe8457ec2a20e2a759 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -578,8 +578,8 @@ void RenderWidgetHostViewAura::ShowImpl(PageVisibilityState page_visibility) { +@@ -632,8 +632,8 @@ void RenderWidgetHostViewAura::ShowImpl(PageVisibilityState page_visibility) { // OnShowWithPageVisibility will not call NotifyHostAndDelegateOnWasShown, // which updates `visibility_`, unless the host is hidden. Make sure no update // is needed. @@ -80,31 +80,31 @@ index 782bed0fdc08d57eceb059f398f253fab9233b1b..f1ab5b981ea68af1b11313e67f2c5060 // This interface should only be implemented inside content. friend class RenderViewHostImpl; diff --git a/content/test/test_page_broadcast.h b/content/test/test_page_broadcast.h -index 82ae7ab6279427e492ead6d1d386608eb9d3d844..2b79149bfcc0de968ffb45e310d697c5393f0d43 100644 +index 8762811ec25069ddd0c57e3ffb50d158532a39b1..f5cdae891cc3b98371ae18dbc119b5e7f379f2bf 100644 --- a/content/test/test_page_broadcast.h +++ b/content/test/test_page_broadcast.h -@@ -53,6 +53,7 @@ class TestPageBroadcast : public blink::mojom::PageBroadcast { - const blink::ColorProviderColorMaps& color_provider_colors) override; +@@ -54,6 +54,7 @@ class TestPageBroadcast : public blink::mojom::PageBroadcast { void UpdateCanvasNoiseToken( std::optional<blink::NoiseToken> canvas_noise_token) override; + void SetSupportsDraggableRegions(bool supports_draggable_regions) override; + void SetSchedulerThrottling(bool allowed) override {} mojo::AssociatedReceiver<blink::mojom::PageBroadcast> receiver_; }; diff --git a/third_party/blink/public/mojom/page/page.mojom b/third_party/blink/public/mojom/page/page.mojom -index e7be05ec6dc5f517b4a6f849a262d12dc6c1ca3d..5f4f425c77c8aadf269edfaec658a8d2ad74b2cd 100644 +index fb846303b126c0bbaa252b8b6c5b9b2971100c62..e6dcf94dcde8515e9cf73656d6c1659492aac4b4 100644 --- a/third_party/blink/public/mojom/page/page.mojom +++ b/third_party/blink/public/mojom/page/page.mojom -@@ -182,4 +182,7 @@ interface PageBroadcast { - // the noise token at ReadyToCommit time and update blink::WebViews that - // were made at request time. - UpdateCanvasNoiseToken(blink.mojom.NoiseToken? canvas_noise_token); +@@ -186,4 +186,7 @@ interface PageBroadcast { + // Indicates that the page's main frame should collect draggable regions set + // using the app-region CSS property. + SetSupportsDraggableRegions(bool supports_draggable_regions); + + // Whether to enable the Renderer scheduler background throttling. + SetSchedulerThrottling(bool allowed); }; diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h -index 9c0fe6ad62872f05cfb1179b4b979139008976d2..6aca43e61ef7f1caea74c30e5c3ce4496d4c4188 100644 +index 11a31c9ed26b5abde0ea812eae6b219340ed711c..a72cf76b820cb86b9495ea147efbdcf53b8a9845 100644 --- a/third_party/blink/public/web/web_view.h +++ b/third_party/blink/public/web/web_view.h @@ -366,6 +366,7 @@ class BLINK_EXPORT WebView { @@ -155,7 +155,7 @@ index 071ede882b2503e22ff97967a7f9cbfd96d048bd..baf06a06756ac7cdcd7f7aef15f812d5 // Do not throttle if the page should be painting. bool is_visible = diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h -index 83e4be6692496d1d05dcd4110009c68763683128..f8deed2f22387c5dcc35d93c7b45ba54a77625e5 100644 +index 9b9dd237525793b149f1e79d26e9e8043131c363..ec1d8054289b1ae6eb5a579fc82b90a92fe438ff 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h @@ -452,6 +452,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index 8fa24a6310177..8f69086b913ec 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -33,10 +33,10 @@ index e7ee2d88b136be97e0668874a309085554041a5a..1ed28fa85bf906bea9628da146627067 "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 7ad4a62c8bfb97d36fbd86a08d5deccdc77da129..0e281fc366c4ee35efdec3625425f2fc8ced135a 100644 +index 03767f1fa536107112eee7106323238caeeedf2c..0df5df319e4d84daed9d9017691950579fce7ae3 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4813,7 +4813,7 @@ static_library("browser") { +@@ -4811,7 +4811,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index 7ad4a62c8bfb97d36fbd86a08d5deccdc77da129..0e281fc366c4ee35efdec3625425f2fc # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 5befc9056f87e389a296ebf2bbbc6faad96d0b67..76f632121c7a6f3582cdcbbb076df979be749cb8 100644 +index 932793506ca9259d6c4f67f6e2bbbd654b2c7be3..eff32d19f785d871e9ec9a63fe52151ee485dc1e 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7557,9 +7557,12 @@ test("unit_tests") { +@@ -7563,9 +7563,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index 5befc9056f87e389a296ebf2bbbc6faad96d0b67..76f632121c7a6f3582cdcbbb076df979 "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8493,6 +8496,10 @@ test("unit_tests") { +@@ -8499,6 +8502,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index 5befc9056f87e389a296ebf2bbbc6faad96d0b67..76f632121c7a6f3582cdcbbb076df979 sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8549,7 +8556,6 @@ test("unit_tests") { +@@ -8555,7 +8562,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 9f86c6afffc94..3d1dffa2ba4fa 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,10 +9,10 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index e2a33a8275974c726148b73aae61ed23fa524a31..6635ed3b341ffc63d80d895dc5746c79092f53ab 100644 +index 55ba21754555cccb095707d30fcefeaf15ea13c6..e76cccefbbf77fcfb886c41d501bcff4fd27be2f 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -9854,6 +9854,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -9861,6 +9861,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To<Referrer>(), params->frame_name, params->disposition, *params->features, @@ -21,10 +21,10 @@ index e2a33a8275974c726148b73aae61ed23fa524a31..6635ed3b341ffc63d80d895dc5746c79 &no_javascript_access); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index cd6abd23d61ea7f12ac4caf9f9c5d5c1822c6c05..4472f8020547631c921860a07637c110c1d8f080 100644 +index 49d18f7595e463cc98c888a942f837757a27a596..a7ea73a46936ab4f82880121767376383864959b 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5338,6 +5338,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5350,6 +5350,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( create_params.initially_hidden = renderer_started_hidden; create_params.initial_popup_url = params.target_url; @@ -35,7 +35,7 @@ index cd6abd23d61ea7f12ac4caf9f9c5d5c1822c6c05..4472f8020547631c921860a07637c110 // Even though all codepaths leading here are in response to a renderer // trying to open a new window, if the new window ends up in a different // browsing instance, then the RenderViewHost, RenderWidgetHost, -@@ -5392,6 +5396,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5404,6 +5408,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( // Sets the newly created WebContents WindowOpenDisposition. new_contents_impl->original_window_open_disposition_ = params.disposition; @@ -48,7 +48,7 @@ index cd6abd23d61ea7f12ac4caf9f9c5d5c1822c6c05..4472f8020547631c921860a07637c110 // If the new frame has a name, make sure any SiteInstances that can find // this named frame have proxies for it. Must be called after // SetSessionStorageNamespace, since this calls CreateRenderView, which uses -@@ -5433,12 +5443,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5445,12 +5455,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( AddWebContentsDestructionObserver(new_contents_impl); } diff --git a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch index c9b22b691bd0d..00844d5913ce1 100644 --- a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch +++ b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch @@ -52,10 +52,10 @@ index 99d368046177dd92c8b36743f461d348bbf19a2e..b0a1859d22063cf6d5a73b5ccd5ea6fb void RenderFrameImpl::DidChangeScrollOffset() { diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index 542eddb03c98eac5c03c9bc208af2c863d552b2d..e91c0f20d4e401a43936a9de9b6a6b6c1199612c 100644 +index 61d4ef338cc4c0e99c144d6d95bbe0adba9d3556..ce7ba31d2a2ebab213be4b123f6af93c99b74149 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -606,7 +606,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -605,7 +605,8 @@ class CONTENT_EXPORT RenderFrameImpl int world_id) override; void DidInstallConditionalFeatures(v8::Local<v8::Context> context, int world_id) override; diff --git a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch index 715165f195843..4bf6e635cbd41 100644 --- a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch +++ b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch @@ -34,10 +34,10 @@ index 2dc44d4787d5198cff7be2cf98ad5acf2d3a9a0b..27a0335aac2bd4239616cf71f5d015c9 class ScrollEvent; diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index d2651f4fcbb7991e9ec8f164e5bee51dab405c5a..d58b59288d881a2d74ea357f1e9e27870d24ac72 100644 +index 5dd2b9b0897131897596e88e74701293c69e012d..89287b68398e9121959e7750644d37072e8e489b 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -@@ -1378,6 +1378,10 @@ HBRUSH DesktopWindowTreeHostWin::GetBackgroundPaintBrush() { +@@ -1382,6 +1382,10 @@ HBRUSH DesktopWindowTreeHostWin::GetBackgroundPaintBrush() { return background_paint_brush_; } @@ -49,10 +49,10 @@ index d2651f4fcbb7991e9ec8f164e5bee51dab405c5a..d58b59288d881a2d74ea357f1e9e2787 DesktopWindowTreeHostWin::GetSingletonDesktopNativeCursorManager() { return new DesktopNativeCursorManagerWin(); diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -index b65ced55f997d5064b9d9338190567f8c264fce8..e8acd2828ed05deefa335ce2bb461f0c3be8d7b7 100644 +index 8b34b44095ba7884947d5e83da847783126b3e62..1e30bce5ca5bf47726fd846f2f26705d52a8ce57 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -@@ -273,6 +273,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin +@@ -274,6 +274,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin void HandleWindowScaleFactorChanged(float window_scale_factor) override; void HandleHeadlessWindowBoundsChanged(const gfx::Rect& bounds) override; HBRUSH GetBackgroundPaintBrush() override; diff --git a/patches/chromium/chore_partial_revert_of.patch b/patches/chromium/chore_partial_revert_of.patch index b5304565622df..d453ebd302a67 100644 --- a/patches/chromium/chore_partial_revert_of.patch +++ b/patches/chromium/chore_partial_revert_of.patch @@ -14,10 +14,10 @@ track down the source of this problem & figure out if we can fix it by changing something in Electron. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 0d2e6fb394799980c61c0855d4cb4c1933719a6e..8f7467af5365f7ea0a76027256748d62b6cb7531 100644 +index 2636b49a902570bf3b92675db7792893fcc949f9..b489867c2567739ac200cd1e4c4863b3a0aa8235 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5309,7 +5309,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5321,7 +5321,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( : IsGuest(); // While some guest types do not have a guest SiteInstance, the ones that // don't all override WebContents creation above. diff --git a/patches/chromium/chore_patch_out_profile_methods.patch b/patches/chromium/chore_patch_out_profile_methods.patch index 8437d0128557e..c4341b254e8c2 100644 --- a/patches/chromium/chore_patch_out_profile_methods.patch +++ b/patches/chromium/chore_patch_out_profile_methods.patch @@ -84,7 +84,7 @@ index bc0bad82ebcdceadc505e912ff27202b452fefab..6b77c57fccc4619a1df3b4ed661d2bdd ProfileSelection ProfileSelections::GetProfileSelection( diff --git a/chrome/browser/spellchecker/spellcheck_service.cc b/chrome/browser/spellchecker/spellcheck_service.cc -index 4c52386f9ddf13f1453903cda3954b6c596028f2..8fbb2025d157e58c90c701f9e3478f6c99b88aa1 100644 +index eba2400655be58628ad1dbf37692a963cc031bf8..02da80b42f936f347c9043f4499d9a324bdf43d2 100644 --- a/chrome/browser/spellchecker/spellcheck_service.cc +++ b/chrome/browser/spellchecker/spellcheck_service.cc @@ -21,8 +21,10 @@ diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index f9f547e2ba1dd..d915c8d0b90be 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -80,10 +80,10 @@ index 39fa45f0a0f9076bd7ac0be6f455dd540a276512..3d0381d463eed73470b28085830f2a23 content::WebContents* source, const content::OpenURLParams& params, diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index a66f503e1ffcf5c7435d3bfa5b8af6eda707f125..9af4329932a838c05a3ef7aa5f5da884a501c342 100644 +index 78a55026a56c5c2846c7cf13a6080456f8022ddc..f507a45212491b46954e1e30f8fc8c525aff0b25 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc -@@ -2373,7 +2373,8 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2378,7 +2378,8 @@ bool Browser::IsWebContentsCreationOverridden( content::mojom::WindowContainerType window_container_type, const GURL& opener_url, const std::string& frame_name, @@ -93,7 +93,7 @@ index a66f503e1ffcf5c7435d3bfa5b8af6eda707f125..9af4329932a838c05a3ef7aa5f5da884 if (HasActorTask(profile(), opener)) { // If an ExecutionEngine is acting on the opener, prevent it from creating a // new WebContents. We'll instead force the navigation to happen in the same -@@ -2386,7 +2387,7 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2391,7 +2392,7 @@ bool Browser::IsWebContentsCreationOverridden( return (window_container_type == content::mojom::WindowContainerType::BACKGROUND && ShouldCreateBackgroundContents(source_site_instance, opener_url, @@ -103,7 +103,7 @@ index a66f503e1ffcf5c7435d3bfa5b8af6eda707f125..9af4329932a838c05a3ef7aa5f5da884 WebContents* Browser::CreateCustomWebContents( diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h -index 370f70ca0cce817fa396b284f95cda3e814eeed0..bcc9b602d361df1307a7d4a67315900a167a716d 100644 +index 12b5a5ca3603b815182621f81827635667528ca0..0bfd322dd59de0247a7e8bd09b462b943e206f3c 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -943,8 +943,7 @@ class Browser : public TabStripModelObserver, @@ -222,10 +222,10 @@ index b969f1d97b7e3396119b579cfbe61e19ff7d2dd4..b8d6169652da28266a514938b45b39c5 content::WebContents* AddNewContents( content::WebContents* source, diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 3897ca794fd23f337b73c7305b37da7a97f9c550..2451f06b6b6dc96da44494da1db5e1f47654dad4 100644 +index 6efc40408fb64d4e4c4e6671b606912edc013a41..35fe43c6ac99666d070036f7d862529ad364a359 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5272,8 +5272,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5284,8 +5284,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( if (delegate_ && delegate_->IsWebContentsCreationOverridden( opener, source_site_instance, params.window_container_type, diff --git a/patches/chromium/disable_hidden.patch b/patches/chromium/disable_hidden.patch index 8c1a5072c0186..56b8901e177fa 100644 --- a/patches/chromium/disable_hidden.patch +++ b/patches/chromium/disable_hidden.patch @@ -34,10 +34,10 @@ index 2d32d91eb98fe749ae262ba06a1a399813aa7bab..8ebf542046ffba6823804b797e373c80 // |routing_id| must not be IPC::mojom::kRoutingIdNone. // If this object outlives |delegate|, DetachDelegate() must be called when diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index e5eb88eaed395182081a387fee2a13c3b60adf23..08fc2be8e60d16de952ca7f76701ca4eea722c4b 100644 +index 816bb7c6f1c00c121f66e67d20d709008c33f02f..d97cbb4fd8e12bcbff19bf8cc8378997110c60c0 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -642,7 +642,7 @@ void RenderWidgetHostViewAura::HideImpl() { +@@ -696,7 +696,7 @@ void RenderWidgetHostViewAura::HideImpl() { CHECK(visibility_ == Visibility::HIDDEN || visibility_ == Visibility::OCCLUDED); diff --git a/patches/chromium/enable_reset_aspect_ratio.patch b/patches/chromium/enable_reset_aspect_ratio.patch index 16762cdaa4ef6..3af1a5d8345bb 100644 --- a/patches/chromium/enable_reset_aspect_ratio.patch +++ b/patches/chromium/enable_reset_aspect_ratio.patch @@ -6,10 +6,10 @@ Subject: feat: enable setting aspect ratio to 0 Make SetAspectRatio accept 0 as valid input, which would reset to null. diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 35469ecb01a680315b2f92e2599a3b56b5fc7549..d2651f4fcbb7991e9ec8f164e5bee51dab405c5a 100644 +index 55caef964e9302e939a1580494e753fac347c99e..5dd2b9b0897131897596e88e74701293c69e012d 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -@@ -614,7 +614,7 @@ void DesktopWindowTreeHostWin::SetOpacity(float opacity) { +@@ -618,7 +618,7 @@ void DesktopWindowTreeHostWin::SetOpacity(float opacity) { void DesktopWindowTreeHostWin::SetAspectRatio( const gfx::SizeF& aspect_ratio, const gfx::Size& excluded_margin) { diff --git a/patches/chromium/feat_allow_embedders_to_add_observers_on_created_hunspell.patch b/patches/chromium/feat_allow_embedders_to_add_observers_on_created_hunspell.patch index a7491a3747ab8..6ba0b7d2a0f45 100644 --- a/patches/chromium/feat_allow_embedders_to_add_observers_on_created_hunspell.patch +++ b/patches/chromium/feat_allow_embedders_to_add_observers_on_created_hunspell.patch @@ -7,10 +7,10 @@ Subject: feat: allow embedders to add observers on created hunspell This patch is used by Electron to implement spellchecker events. diff --git a/chrome/browser/spellchecker/spellcheck_service.cc b/chrome/browser/spellchecker/spellcheck_service.cc -index 3928d6fdbda8aac5fb89ab148adaa18218e135f8..4c52386f9ddf13f1453903cda3954b6c596028f2 100644 +index dbc05afd488118396c191c61a37692aba1fe858b..eba2400655be58628ad1dbf37692a963cc031bf8 100644 --- a/chrome/browser/spellchecker/spellcheck_service.cc +++ b/chrome/browser/spellchecker/spellcheck_service.cc -@@ -478,6 +478,8 @@ void SpellcheckService::LoadDictionaries() { +@@ -476,6 +476,8 @@ void SpellcheckService::LoadDictionaries() { std::make_unique<SpellcheckHunspellDictionary>( dictionary, platform_spellcheck_language, context_, this)); hunspell_dictionaries_.back()->AddObserver(this); @@ -19,7 +19,7 @@ index 3928d6fdbda8aac5fb89ab148adaa18218e135f8..4c52386f9ddf13f1453903cda3954b6c hunspell_dictionaries_.back()->Load(); } -@@ -532,6 +534,20 @@ bool SpellcheckService::IsSpellcheckEnabled() const { +@@ -526,6 +528,20 @@ bool SpellcheckService::IsSpellcheckEnabled() const { (!hunspell_dictionaries_.empty() || enable_if_uninitialized); } diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index c9ed9dc10b8b7..c0276d8cfa50e 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -45,10 +45,10 @@ index e189d584f05f2ce6354c03a9b19f56985df8a15e..41b430e8f2416be098494f5c49fb97ca 'internal-forced-visited-'): internal_visited_order = 0 diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 -index 5e4e2becfabf4a85d9253b590ecc86297aa37ce4..a916e3dd149f33ad2a98d031303a38f9c673c9b8 100644 +index 122347f812e07a1843914b2c160922433712b7c8..3a619b6e6a970609431ecf67801c05f1d401e807 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5 -@@ -9040,6 +9040,26 @@ +@@ -9036,6 +9036,26 @@ property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], }, @@ -312,7 +312,7 @@ index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index c5c94ad6f34aa3bd060224ae01ccc705354e5158..0331b41978697787c0ea2cf6360ac9d2b5ed85a1 100644 +index 34c13ec5ff7ed98c9472abb5840c164a5ce5456d..3fe2753c8bba305a51fa5992e7ff9f1e2daf1e0c 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch index 3d2e18ed2414c..4a1bf4e695d35 100644 --- a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch +++ b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch @@ -19,7 +19,7 @@ https://chromium-review.googlesource.com/c/chromium/src/+/6936895 as we depend on the removed functionality in this patch. diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm -index f651286bc85f3640ec072b05eb2f0d118e02417a..94ee607bc9de2bf388a736c438613b51de1a5ac2 100644 +index ce52245628c72018da8ec4a3155dafa74e42c8e3..89a078d1ce00667bd83def21e341b03ca6c79ee3 100644 --- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm +++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm @@ -522,7 +522,7 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) { @@ -45,10 +45,10 @@ index 11954a3adfb6d517b6dc8e780a4a9aba8a0bf98a..1ddc1f34055c8b42177703ccc2f0d006 // window's workspace and fullscreen state, and can be retrieved from or // applied to a window. diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.h b/ui/views/cocoa/native_widget_mac_ns_window_host.h -index e523151fb670af28cf2c54548c5009825fdbed92..66d5724f848b328a19362a3c0f6346704ddb50ac 100644 +index 2239b085ac7fd87fe06aef1001551f8afe8e21e4..9ead3ab0755fe5c3500893325f0597e07e7241cc 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.h +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h -@@ -554,6 +554,7 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost +@@ -556,6 +556,7 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost bool is_miniaturized_ = false; bool is_window_key_ = false; bool is_mouse_capture_active_ = false; @@ -57,10 +57,10 @@ index e523151fb670af28cf2c54548c5009825fdbed92..66d5724f848b328a19362a3c0f634670 gfx::Rect window_bounds_before_fullscreen_; diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -index e1a1cdb2ec192d2ee5a555ecccf041f757336f79..68a210eaf34d6d410a14478ad5bf0c78faa30388 100644 +index ae113be147f5bfe9d6218a20495897600cc5299d..cb67460205f4db04a3256151d49a2713688c7627 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -@@ -465,6 +465,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -467,6 +467,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, if (!is_tooltip) { tooltip_manager_ = std::make_unique<TooltipManagerMac>(GetNSWindowMojo()); } @@ -68,7 +68,7 @@ index e1a1cdb2ec192d2ee5a555ecccf041f757336f79..68a210eaf34d6d410a14478ad5bf0c78 if (params.workspace.length()) { std::string restoration_data; -@@ -482,6 +483,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -484,6 +485,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, window_params->modal_type = widget->widget_delegate()->GetModalType(); window_params->is_translucent = params.opacity == Widget::InitParams::WindowOpacity::kTranslucent; @@ -76,7 +76,7 @@ index e1a1cdb2ec192d2ee5a555ecccf041f757336f79..68a210eaf34d6d410a14478ad5bf0c78 window_params->is_tooltip = is_tooltip; // macOS likes to put shadows on most things. However, frameless windows -@@ -663,9 +665,10 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -665,9 +667,10 @@ void HandleAccelerator(const ui::Accelerator& accelerator, // case it will never become visible but we want its compositor to produce // frames for screenshooting and screencasting. UpdateCompositorProperties(); @@ -90,7 +90,7 @@ index e1a1cdb2ec192d2ee5a555ecccf041f757336f79..68a210eaf34d6d410a14478ad5bf0c78 // Register the CGWindowID (used to identify this window for video capture) diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc -index 566acaeff6b746c97db606cbda71b29e82570453..28f14b53aa9f2daf25431231539a5dbfc3c42b95 100644 +index 45c684170a028198ec12b75dfe8f51c1271d55f6..f52d5bdfbdd108b55d7e9b2882eb8d5039ef279c 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -222,6 +222,18 @@ ui::ZOrderLevel Widget::InitParams::EffectiveZOrderLevel() const { @@ -121,7 +121,7 @@ index 566acaeff6b746c97db606cbda71b29e82570453..28f14b53aa9f2daf25431231539a5dbf if (params.opacity == views::Widget::InitParams::WindowOpacity::kInferred && diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h -index ce34d038564570f4edc8e36fd29524bd93c0b462..808abf2ce1c797591304a8ece9e8a169f034273e 100644 +index e2ea4ca2fb5f10045466d2ece7e9148c01b84f29..7cd620467634d267d1c1b0806cea338edfe5837d 100644 --- a/ui/views/widget/widget.h +++ b/ui/views/widget/widget.h @@ -324,6 +324,11 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, @@ -158,7 +158,7 @@ index ce34d038564570f4edc8e36fd29524bd93c0b462..808abf2ce1c797591304a8ece9e8a169 // True if the window size will follow the content preferred size. bool is_autosized() const { return is_autosized_; } -@@ -1715,6 +1728,9 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, +@@ -1716,6 +1729,9 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, // If true, the mouse is currently down. bool is_mouse_button_pressed_ = false; diff --git a/patches/chromium/fix_check_for_file_existence_before_setting_mtime.patch b/patches/chromium/fix_check_for_file_existence_before_setting_mtime.patch new file mode 100644 index 0000000000000..37b0f1ff31649 --- /dev/null +++ b/patches/chromium/fix_check_for_file_existence_before_setting_mtime.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Charles Kerr <charles@charleskerr.com> +Date: Tue, 21 Oct 2025 18:44:52 -0500 +Subject: fix: check for file existence before setting mtime + +Check for broken links by confirming the file exists before setting its utime. + +This patch should be upstreamed & removed. + +diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py +index bcf4c9b192234aa1d470662e4036ac7a23ce2262..724ccef88dc6d798bb948d3fc89a84640d863174 100755 +--- a/tools/clang/scripts/update.py ++++ b/tools/clang/scripts/update.py +@@ -201,10 +201,9 @@ def DownloadAndUnpack(url, output_dir, path_prefixes=None, is_known_zip=False): + # The nicest way to do this would be by passing a filter to extractall, + # but that functionality is not available in macOS system Python (3.9.6). + for m in members: +- # Confusingly, this checks if you're allowed to _not_ follow symlinks. +- if os.utime in os.supports_follow_symlinks: +- os.utime(os.path.join(output_dir, m.name), follow_symlinks=False) +- else: ++ # check for broken links before setting the file's utime ++ member_path = os.path.join(output_dir, m.name) ++ if os.path.exists(member_path): + os.utime(os.path.join(output_dir, m.name)) + + diff --git a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch index 9677db4f76d1b..a51b18152f77f 100644 --- a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch +++ b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch @@ -9,10 +9,10 @@ focus node change via TextInputManager. chromium-bug: https://crbug.com/1369605 diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index 8ad61a86598ac2249496e44113f31ebb21dc616b..36eb119c30531faffb85c4456572f22a9735316d 100644 +index 1041d25d5ef78abdcf7b85fe8457ec2a20e2a759..f91f346c93749ff77844143b53d27d14735a6a06 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -3248,6 +3248,12 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( +@@ -3332,6 +3332,12 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( } } @@ -26,10 +26,10 @@ index 8ad61a86598ac2249496e44113f31ebb21dc616b..36eb119c30531faffb85c4456572f22a RenderWidgetHostViewAura* popup_child_host_view) { popup_child_host_view_ = popup_child_host_view; diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h -index 943006033c5f9c6d5cfdbc50ede2723fa8494834..49eb7cb18d1fa114d78048a6e41b8883afdcf674 100644 +index da64a2093e5ab60b320a1ea2b12a920956ef9605..9f1e856d0947c3ce1f21e001c5278f61cbda05d3 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h -@@ -657,6 +657,8 @@ class CONTENT_EXPORT RenderWidgetHostViewAura +@@ -664,6 +664,8 @@ class CONTENT_EXPORT RenderWidgetHostViewAura RenderWidgetHostViewBase* updated_view) override; void OnTextSelectionChanged(TextInputManager* text_input_mangager, RenderWidgetHostViewBase* updated_view) override; @@ -87,10 +87,10 @@ index 75df43e3cd2721a92c90c18154d53d5c203e2465..ce42c75c8face36d21f53f44c0201ac4 // The view with active text input state, i.e., a focused <input> element. // It will be nullptr if no such view exists. Note that the active view diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 208fe58f95557ee103555858c2cda39e732ca991..0d2e6fb394799980c61c0855d4cb4c1933719a6e 100644 +index cbfa2ec56627994541548a49a4afe33b6e42c2d7..2636b49a902570bf3b92675db7792893fcc949f9 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10143,7 +10143,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( +@@ -10142,7 +10142,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( "WebContentsImpl::OnFocusedElementChangedInFrame", "render_frame_host", frame); RenderWidgetHostViewBase* root_view = diff --git a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch index c2dc3c73b72d5..cc6d4cf8ba649 100644 --- a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch +++ b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch @@ -8,7 +8,7 @@ such as the background turning black when maximizing the window and dynamic background material settings not taking effect. diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 956dc87cb07559038a63cec0b5174cec09619bdb..68635b0c0153c3464ab6c7d317177098a7ec644c 100644 +index 29bf4dfbe2cf0af5a1369c4d3e17e50a198c78c6..40a405af0ecde4f649e1fc27d7e4bf739fe0efd0 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -183,6 +183,10 @@ void DesktopWindowTreeHostWin::FinishTouchDrag(gfx::Point screen_point) { @@ -23,7 +23,7 @@ index 956dc87cb07559038a63cec0b5174cec09619bdb..68635b0c0153c3464ab6c7d317177098 void DesktopWindowTreeHostWin::Init(const Widget::InitParams& params) { diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -index 0cd07fd5fb55dcc0d972de4c027fcb895d156592..0f4d335e1d54b5e92fc217080d86513db94d4122 100644 +index 2529a00eb6ec30e4269f19c685997a778647bd51..c3e59f3cfefb965c39482539b06c964166e8b78e 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h @@ -93,6 +93,8 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index 14423a2a2b95e..f59037611bd31 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -35,7 +35,7 @@ system font by checking if it's kCTFontPriorityAttribute is set to system priority. diff --git a/base/BUILD.gn b/base/BUILD.gn -index d73ee1145fa64c309eddd02c62af6ee735c62e00..99810c2a0bd3550385ca2be80e4286eb78f201c9 100644 +index e6625d8ecf9274c00fe450cc2c7c479914eb0dd6..853cbd806f2fb16ad724767b15b6c6a7f5c4a286 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -1069,6 +1069,7 @@ component("base") { @@ -452,7 +452,7 @@ index 433f12928857e288b6b0d4f4dd3d1f29da08cf6c..bb95aabec2e0d5c7b3a5d315c9a3f8cb bool shouldShowWindowTitle = YES; if (_bridge) diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm -index f9f453e713b1beff8fda2fcd2a21907640c19817..f651286bc85f3640ec072b05eb2f0d118e02417a 100644 +index f3ea2bf2d15d815a2409441a9033a92d5d8967c1..ce52245628c72018da8ec4a3155dafa74e42c8e3 100644 --- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm +++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm @@ -42,6 +42,7 @@ @@ -986,10 +986,10 @@ index 6cde211f88439af0925296b0c8c9500aecadc034..08e7053117478ea898264040eea119dc } // namespace #endif diff --git a/net/dns/BUILD.gn b/net/dns/BUILD.gn -index 4428896957be15908ce992189db2a0fe95ba3bbd..07987fad41d194bf38a6f4265ccbd853c1273689 100644 +index 5ed1605df7339b504838dfd949772b47ed72a89f..07ccbd74e0835f20edfeef76d0e5e1241a48a65c 100644 --- a/net/dns/BUILD.gn +++ b/net/dns/BUILD.gn -@@ -195,6 +195,8 @@ source_set("dns") { +@@ -197,6 +197,8 @@ source_set("dns") { ":host_resolver_manager", ":mdns_client", ] @@ -1882,7 +1882,7 @@ index dd2fcedc84417c324021e4aba4e78a84ff098803..ed3b4b5b8e9d931e7b7f9b5d91f93f5f sources += [ "test/desktop_window_tree_host_win_test_api.cc", diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.h b/ui/views/cocoa/native_widget_mac_ns_window_host.h -index e855d05f466059f20a31022a1a2810eeadeb4fff..e523151fb670af28cf2c54548c5009825fdbed92 100644 +index fdc7eb4e4c5e8338c725f7d317559b091d8b38fe..2239b085ac7fd87fe06aef1001551f8afe8e21e4 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.h +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h @@ -19,6 +19,7 @@ @@ -1903,7 +1903,7 @@ index e855d05f466059f20a31022a1a2810eeadeb4fff..e523151fb670af28cf2c54548c500982 @class NSView; namespace remote_cocoa { -@@ -504,10 +507,12 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost +@@ -506,10 +509,12 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost mojo::AssociatedRemote<remote_cocoa::mojom::NativeWidgetNSWindow> remote_ns_window_remote_; @@ -1917,7 +1917,7 @@ index e855d05f466059f20a31022a1a2810eeadeb4fff..e523151fb670af28cf2c54548c500982 // Used to force the NSApplication's focused accessibility element to be the // views::Views accessibility tree when the NSView for this is focused. diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -index ac4257215c61f3cb388e14f4439e23ac29f1307d..e1a1cdb2ec192d2ee5a555ecccf041f757336f79 100644 +index 99bac834cb77f16b061c7dcf209b4f90cc6da8d8..ae113be147f5bfe9d6218a20495897600cc5299d 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm @@ -21,6 +21,7 @@ @@ -1928,7 +1928,7 @@ index ac4257215c61f3cb388e14f4439e23ac29f1307d..e1a1cdb2ec192d2ee5a555ecccf041f7 #include "mojo/public/cpp/bindings/self_owned_associated_receiver.h" #include "ui/accelerated_widget_mac/window_resize_helper_mac.h" #include "ui/accessibility/accessibility_features.h" -@@ -360,8 +361,12 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -362,8 +363,12 @@ void HandleAccelerator(const ui::Accelerator& accelerator, if (in_process_ns_window_bridge_) { return gfx::NativeViewAccessible(in_process_ns_window_bridge_->ns_view()); } @@ -1941,7 +1941,7 @@ index ac4257215c61f3cb388e14f4439e23ac29f1307d..e1a1cdb2ec192d2ee5a555ecccf041f7 } gfx::NativeViewAccessible -@@ -377,8 +382,12 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -379,8 +384,12 @@ void HandleAccelerator(const ui::Accelerator& accelerator, [in_process_ns_window_bridge_->ns_view() window]); } @@ -1954,7 +1954,7 @@ index ac4257215c61f3cb388e14f4439e23ac29f1307d..e1a1cdb2ec192d2ee5a555ecccf041f7 } remote_cocoa::mojom::NativeWidgetNSWindow* -@@ -1445,9 +1454,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -1447,9 +1456,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator, // for PWAs. However this breaks accessibility on in-process windows, // so set it back to NO when a local window gains focus. See // https://crbug.com/41485830. @@ -1966,7 +1966,7 @@ index ac4257215c61f3cb388e14f4439e23ac29f1307d..e1a1cdb2ec192d2ee5a555ecccf041f7 // Explicitly set the keyboard accessibility state on regaining key // window status. if (is_key && is_content_first_responder) { -@@ -1588,17 +1599,20 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -1602,17 +1613,20 @@ void HandleAccelerator(const ui::Accelerator& accelerator, void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens( const std::vector<uint8_t>& window_token, const std::vector<uint8_t>& view_token) { @@ -1987,7 +1987,7 @@ index ac4257215c61f3cb388e14f4439e23ac29f1307d..e1a1cdb2ec192d2ee5a555ecccf041f7 *pid = getpid(); id element_id = GetNativeViewAccessible(); -@@ -1611,6 +1625,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -1625,6 +1639,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, } *token = ui::RemoteAccessibility::GetTokenForLocalElement(element_id); diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index 2a74eef0fc7fc..05e233f4783da 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -133,7 +133,7 @@ index 5be62a3fb27e37f3c1db6b811172f6dfebe18f61..34349f9832fe4b9a3d48db613a789afb const GURL& document_url, const WeakDocumentPtr& weak_document_ptr, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 659d42adfea710b9ff9e315cffa6268a61d68243..e4df51e2fac09cd2c97bb125b9187aede4138f23 100644 +index d689ab09609595e9738a771d723f2923f629d6cb..ae46fafbb67668d3c0a147cb0d8cf8fda958409a 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -2314,7 +2314,7 @@ void RenderProcessHostImpl::CreateNotificationService( diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index 5d9be1df69f62..845f1c7ec322b 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -44,10 +44,10 @@ index 3a820b1b9c9aab336c724ef8c0d823eddb330e1e..9a24c153e47b3f3878fa6ea92fb99d14 void RenderWidgetHostImpl::ShowContextMenuAtPoint( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 4472f8020547631c921860a07637c110c1d8f080..3897ca794fd23f337b73c7305b37da7a97f9c550 100644 +index a7ea73a46936ab4f82880121767376383864959b..6efc40408fb64d4e4c4e6671b606912edc013a41 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -6149,6 +6149,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { +@@ -6161,6 +6161,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { return text_input_manager_.get(); } @@ -60,10 +60,10 @@ index 4472f8020547631c921860a07637c110c1d8f080..3897ca794fd23f337b73c7305b37da7a RenderWidgetHostImpl* render_widget_host) { return render_widget_host == GetPrimaryMainFrame()->GetRenderWidgetHost(); diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index 8e26b26988f910aefd3775f56b024f3fae331fce..247e71fa9a43116b40cfffd8da0169223272d9c9 100644 +index 82c714ebe0e18cd7715e028836c396c214283d24..9b065992fc577084ef16aaef1436fd0855e32981 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -1176,6 +1176,7 @@ class CONTENT_EXPORT WebContentsImpl +@@ -1183,6 +1183,7 @@ class CONTENT_EXPORT WebContentsImpl void SendScreenRects() override; void SendActiveState(bool active) override; TextInputManager* GetTextInputManager() override; @@ -72,10 +72,10 @@ index 8e26b26988f910aefd3775f56b024f3fae331fce..247e71fa9a43116b40cfffd8da016922 RenderWidgetHostImpl* render_widget_host) override; bool IsShowingContextMenuOnPage() const override; diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h -index 4faff4e44a441cd9e95ee926d6e62a9249424433..bf06dcb8b69001f914541423824a144ac331f190 100644 +index 8e0a8b0e3e005d81c7fec493eca9e8262edb2853..1fb13e811d5ee2875b6c4162c6b9843d3e59d431 100644 --- a/content/public/browser/web_contents_observer.h +++ b/content/public/browser/web_contents_observer.h -@@ -34,6 +34,7 @@ +@@ -33,6 +33,7 @@ #include "third_party/blink/public/mojom/frame/viewport_intersection_state.mojom-forward.h" #include "third_party/blink/public/mojom/loader/resource_load_info.mojom-forward.h" #include "third_party/blink/public/mojom/media/capture_handle_config.mojom-forward.h" @@ -83,7 +83,7 @@ index 4faff4e44a441cd9e95ee926d6e62a9249424433..bf06dcb8b69001f914541423824a144a #include "ui/base/page_transition_types.h" #include "ui/base/window_open_disposition.h" -@@ -642,6 +643,9 @@ class CONTENT_EXPORT WebContentsObserver : public base::CheckedObserver { +@@ -641,6 +642,9 @@ class CONTENT_EXPORT WebContentsObserver : public base::CheckedObserver { // Invoked when the primary main frame changes size. virtual void PrimaryMainFrameWasResized(bool width_changed) {} diff --git a/patches/chromium/refactor_unfilter_unresponsive_events.patch b/patches/chromium/refactor_unfilter_unresponsive_events.patch index f80c72602a662..4be2e480bc965 100644 --- a/patches/chromium/refactor_unfilter_unresponsive_events.patch +++ b/patches/chromium/refactor_unfilter_unresponsive_events.patch @@ -15,10 +15,10 @@ This CL removes these filters so the unresponsive event can still be accessed from our JS event. The filtering is moved into Electron's code. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 8f7467af5365f7ea0a76027256748d62b6cb7531..a9813ead175b478227bb91daf0d23cffc1bedca6 100644 +index b489867c2567739ac200cd1e4c4863b3a0aa8235..6edd4d673dd61b396aaf121ff3e6810fd0b4ba00 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10281,25 +10281,13 @@ void WebContentsImpl::RendererUnresponsive( +@@ -10291,25 +10291,13 @@ void WebContentsImpl::RendererUnresponsive( base::RepeatingClosure hang_monitor_restarter) { OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RendererUnresponsive", "render_widget_host", render_widget_host); diff --git a/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch b/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch new file mode 100644 index 0000000000000..b83845dbe2a3d --- /dev/null +++ b/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch @@ -0,0 +1,765 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Charles Kerr <charles@charleskerr.com> +Date: Tue, 21 Oct 2025 21:45:33 -0500 +Subject: Revert "[cleanup] Remove feature WinDelaySpellcheckServiceInit" + +This reverts commit 5fe1e59226f59c4d6fb70e7410d1a0ab83688ae2. + +Our codebase currently needs the ability to delay this service. +It was added in c2d7164 (#38248) to fix a crash originally +described in 97b353a (#34993): + +> Delaying spell check initialization is causing specs for +> 'custom dictionary word list API' to fail in Electron. + +This patch can be removed when we fix that crash. + +diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc +index 9cb826530cf567e98baf91a60ca1f7496aca9431..2d0e92f9f373f8ef6ffa3c292811df957d457c95 100644 +--- a/chrome/browser/chrome_browser_main.cc ++++ b/chrome/browser/chrome_browser_main.cc +@@ -1412,6 +1412,17 @@ void ChromeBrowserMainParts::PostProfileInit(Profile* profile, + profile->GetPath())); + } + ++#if BUILDFLAG(USE_BROWSER_SPELLCHECKER) ++ // Create the spellcheck service. This will asynchronously retrieve the ++ // Windows platform spellcheck dictionary language tags used to populate the ++ // context menu for editable content. ++ if (spellcheck::UseBrowserSpellChecker() && ++ profile->GetPrefs()->GetBoolean(spellcheck::prefs::kSpellCheckEnable) && ++ !base::FeatureList::IsEnabled( ++ spellcheck::kWinDelaySpellcheckServiceInit)) { ++ SpellcheckServiceFactory::GetForContext(profile); ++ } ++#endif + #endif // BUILDFLAG(IS_WIN) + + #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || \ +diff --git a/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc b/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc +index 5bad748fdfc7944a44dbe4dd7891eda31e3128d3..c1701b71a76695c3e941009bdd55777167907834 100644 +--- a/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc ++++ b/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc +@@ -275,15 +275,21 @@ LanguageSettingsPrivateGetLanguageListFunction::Run() { + + #if BUILDFLAG(IS_WIN) + if (spellcheck::UseBrowserSpellChecker()) { +- // Asynchronously load the dictionaries to determine platform support. +- SpellcheckService* service = +- SpellcheckServiceFactory::GetForContext(browser_context()); +- AddRef(); // Balanced in OnDictionariesInitialized +- service->InitializeDictionaries( +- base::BindOnce(&LanguageSettingsPrivateGetLanguageListFunction:: +- OnDictionariesInitialized, +- base::Unretained(this))); +- return RespondLater(); ++ if (!base::FeatureList::IsEnabled( ++ spellcheck::kWinDelaySpellcheckServiceInit)) { ++ // Platform dictionary support already determined at browser startup. ++ UpdateSupportedPlatformDictionaries(); ++ } else { ++ // Asynchronously load the dictionaries to determine platform support. ++ SpellcheckService* service = ++ SpellcheckServiceFactory::GetForContext(browser_context()); ++ AddRef(); // Balanced in OnDictionariesInitialized ++ service->InitializeDictionaries( ++ base::BindOnce(&LanguageSettingsPrivateGetLanguageListFunction:: ++ OnDictionariesInitialized, ++ base::Unretained(this))); ++ return RespondLater(); ++ } + } + #endif // BUILDFLAG(IS_WIN) + +diff --git a/chrome/browser/extensions/api/language_settings_private/language_settings_private_api_unittest.cc b/chrome/browser/extensions/api/language_settings_private/language_settings_private_api_unittest.cc +index 272d50c9b060a8984a15d2dfbf2297e931482b57..e74b37ed7e596ea57728694eab9a398e94bde08c 100644 +--- a/chrome/browser/extensions/api/language_settings_private/language_settings_private_api_unittest.cc ++++ b/chrome/browser/extensions/api/language_settings_private/language_settings_private_api_unittest.cc +@@ -116,6 +116,8 @@ class LanguageSettingsPrivateApiTest : public ExtensionServiceTestBase { + protected: + void RunGetLanguageListTest(); + ++ virtual void InitFeatures() {} ++ + #if BUILDFLAG(IS_WIN) + virtual void AddSpellcheckLanguagesForTesting( + const std::vector<std::string>& spellcheck_languages_for_testing) { +@@ -134,6 +136,8 @@ class LanguageSettingsPrivateApiTest : public ExtensionServiceTestBase { + EventRouterFactory::GetInstance()->SetTestingFactory( + profile(), base::BindRepeating(&BuildEventRouter)); + ++ InitFeatures(); ++ + LanguageSettingsPrivateDelegateFactory::GetInstance()->SetTestingFactory( + profile(), base::BindRepeating(&BuildLanguageSettingsPrivateDelegate)); + +@@ -291,6 +295,28 @@ TEST_F(LanguageSettingsPrivateApiTest, GetNeverTranslateLanguagesListTest) { + } + } + ++class LanguageSettingsPrivateApiGetLanguageListTest ++ : public LanguageSettingsPrivateApiTest { ++ public: ++ LanguageSettingsPrivateApiGetLanguageListTest() = default; ++ ~LanguageSettingsPrivateApiGetLanguageListTest() override = default; ++ ++ protected: ++ void InitFeatures() override { ++#if BUILDFLAG(IS_WIN) ++ // Disable the delayed init feature since that case is tested in ++ // LanguageSettingsPrivateApiTestDelayInit below. ++ feature_list_.InitAndDisableFeature( ++ spellcheck::kWinDelaySpellcheckServiceInit); ++#endif // BUILDFLAG(IS_WIN) ++ } ++}; ++ ++TEST_F(LanguageSettingsPrivateApiGetLanguageListTest, GetLanguageList) { ++ translate::TranslateDownloadManager::GetInstance()->ResetForTesting(); ++ RunGetLanguageListTest(); ++} ++ + void LanguageSettingsPrivateApiTest::RunGetLanguageListTest() { + struct LanguageToTest { + std::string accept_language; +@@ -700,6 +726,13 @@ class LanguageSettingsPrivateApiTestDelayInit + LanguageSettingsPrivateApiTestDelayInit() = default; + + protected: ++ void InitFeatures() override { ++ // Force Windows hybrid spellcheck and delayed initialization of the ++ // spellcheck service to be enabled. ++ feature_list_.InitAndEnableFeature( ++ spellcheck::kWinDelaySpellcheckServiceInit); ++ } ++ + void AddSpellcheckLanguagesForTesting( + const std::vector<std::string>& spellcheck_languages_for_testing) + override { +diff --git a/chrome/browser/renderer_context_menu/spelling_menu_observer_browsertest.cc b/chrome/browser/renderer_context_menu/spelling_menu_observer_browsertest.cc +index bd0d77323277ee422ec4f75cee9f7d4e9bf198b3..d0ed451fe104b9671d6002ca72e8ca3a620cb111 100644 +--- a/chrome/browser/renderer_context_menu/spelling_menu_observer_browsertest.cc ++++ b/chrome/browser/renderer_context_menu/spelling_menu_observer_browsertest.cc +@@ -30,7 +30,7 @@ namespace { + // accesses resources. + class SpellingMenuObserverTest : public InProcessBrowserTest { + public: +- SpellingMenuObserverTest() = default; ++ SpellingMenuObserverTest(); + + void SetUpOnMainThread() override { + Reset(false); +@@ -54,12 +54,6 @@ class SpellingMenuObserverTest : public InProcessBrowserTest { + content::BrowserContext* context) { + auto spellcheck_service = std::make_unique<SpellcheckService>(context); + +- // With delayed initialization, we need to initialize dictionaries. +- spellcheck_service->InitializeDictionaries( +- base::BindOnce(&SpellingMenuObserverTest::OnSuggestionsComplete, +- base::Unretained(this))); +- RunUntilCallbackReceived(); +- + // Call SetLanguage to assure that the platform spellchecker is initialized. + spellcheck_platform::SetLanguage( + spellcheck_service->platform_spell_checker(), "en-US", +@@ -173,6 +167,16 @@ class SpellingMenuObserverTest : public InProcessBrowserTest { + #endif // BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) + }; + ++#if BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) ++SpellingMenuObserverTest::SpellingMenuObserverTest() { ++ feature_list_.InitWithFeatures( ++ /*enabled_features=*/{}, ++ /*disabled_features=*/{spellcheck::kWinDelaySpellcheckServiceInit}); ++} ++#else ++SpellingMenuObserverTest::SpellingMenuObserverTest() = default; ++#endif // BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) ++ + SpellingMenuObserverTest::~SpellingMenuObserverTest() = default; + + } // namespace +diff --git a/chrome/browser/site_isolation/spellcheck_per_process_browsertest.cc b/chrome/browser/site_isolation/spellcheck_per_process_browsertest.cc +index 8aef94fbd6788d1216648d873cdea3136d8e51c0..1a18086f01c21b34e1ce5ecf750591456a8f3d32 100644 +--- a/chrome/browser/site_isolation/spellcheck_per_process_browsertest.cc ++++ b/chrome/browser/site_isolation/spellcheck_per_process_browsertest.cc +@@ -133,21 +133,26 @@ class MockSpellCheckHost : spellcheck::mojom::SpellCheckHost { + #if BUILDFLAG(IS_WIN) + void InitializeDictionaries( + InitializeDictionariesCallback callback) override { +- SpellcheckService* spellcheck = SpellcheckServiceFactory::GetForContext( +- process_host()->GetBrowserContext()); +- +- if (!spellcheck) { // Teardown. +- std::move(callback).Run(/*dictionaries=*/{}, /*custom_words=*/{}, +- /*enable=*/false); ++ if (base::FeatureList::IsEnabled( ++ spellcheck::kWinDelaySpellcheckServiceInit)) { ++ SpellcheckService* spellcheck = SpellcheckServiceFactory::GetForContext( ++ process_host()->GetBrowserContext()); ++ ++ if (!spellcheck) { // Teardown. ++ std::move(callback).Run(/*dictionaries=*/{}, /*custom_words=*/{}, ++ /*enable=*/false); ++ return; ++ } ++ ++ dictionaries_loaded_callback_ = std::move(callback); ++ ++ spellcheck->InitializeDictionaries( ++ base::BindOnce(&MockSpellCheckHost::OnDictionariesInitialized, ++ base::Unretained(this))); + return; + } + +- dictionaries_loaded_callback_ = std::move(callback); +- +- spellcheck->InitializeDictionaries( +- base::BindOnce(&MockSpellCheckHost::OnDictionariesInitialized, +- base::Unretained(this))); +- return; ++ NOTREACHED(); + } + + void OnDictionariesInitialized() { +@@ -259,7 +264,17 @@ class ChromeSitePerProcessSpellCheckTest : public ChromeSitePerProcessTest { + public: + ChromeSitePerProcessSpellCheckTest() = default; + +- void SetUp() override { ChromeSitePerProcessTest::SetUp(); } ++ void SetUp() override { ++#if BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) ++ // When delayed initialization of the spellcheck service is enabled by ++ // default, want to maintain test coverage for the older code path that ++ // initializes spellcheck on browser startup. ++ feature_list_.InitAndDisableFeature( ++ spellcheck::kWinDelaySpellcheckServiceInit); ++#endif // BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) ++ ++ ChromeSitePerProcessTest::SetUp(); ++ } + + protected: + // Tests that spelling in out-of-process subframes is checked. +@@ -366,3 +381,29 @@ IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessSpellCheckTest, + EXPECT_TRUE(host->SpellingPanelVisible()); + } + #endif // BUILDFLAG(HAS_SPELLCHECK_PANEL) ++ ++#if BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) ++class ChromeSitePerProcessSpellCheckTestDelayInit ++ : public ChromeSitePerProcessSpellCheckTest { ++ public: ++ ChromeSitePerProcessSpellCheckTestDelayInit() = default; ++ ++ void SetUp() override { ++ // Don't initialize the SpellcheckService on browser launch. ++ feature_list_.InitAndEnableFeature( ++ spellcheck::kWinDelaySpellcheckServiceInit); ++ ++ ChromeSitePerProcessTest::SetUp(); ++ } ++}; ++ ++IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessSpellCheckTestDelayInit, ++ OOPIFSpellCheckTest) { ++ RunOOPIFSpellCheckTest(); ++} ++ ++IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessSpellCheckTestDelayInit, ++ OOPIFDisabledSpellCheckTest) { ++ RunOOPIFDisabledSpellCheckTest(); ++} ++#endif // BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) +diff --git a/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc b/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc +index c51c5747f45010548fe0cb7d31016605cf43c8e3..a99eb10c4ba77a1d3a89a308acffb5064d690b4a 100644 +--- a/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc ++++ b/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc +@@ -186,21 +186,27 @@ void SpellCheckHostChromeImpl::InitializeDictionaries( + InitializeDictionariesCallback callback) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + +- // Initialize the spellcheck service if needed. Initialization must +- // happen on UI thread. +- SpellcheckService* spellcheck = GetSpellcheckService(); ++ if (base::FeatureList::IsEnabled( ++ spellcheck::kWinDelaySpellcheckServiceInit)) { ++ // Initialize the spellcheck service if needed. Initialization must ++ // happen on UI thread. ++ SpellcheckService* spellcheck = GetSpellcheckService(); ++ ++ if (!spellcheck) { // Teardown. ++ std::move(callback).Run(/*dictionaries=*/{}, /*custom_words=*/{}, ++ /*enable=*/false); ++ return; ++ } + +- if (!spellcheck) { // Teardown. +- std::move(callback).Run(/*dictionaries=*/{}, /*custom_words=*/{}, +- /*enable=*/false); ++ dictionaries_loaded_callback_ = std::move(callback); ++ ++ spellcheck->InitializeDictionaries( ++ base::BindOnce(&SpellCheckHostChromeImpl::OnDictionariesInitialized, ++ weak_factory_.GetWeakPtr())); + return; + } + +- dictionaries_loaded_callback_ = std::move(callback); +- +- spellcheck->InitializeDictionaries( +- base::BindOnce(&SpellCheckHostChromeImpl::OnDictionariesInitialized, +- weak_factory_.GetWeakPtr())); ++ NOTREACHED(); + } + + void SpellCheckHostChromeImpl::OnDictionariesInitialized() { +diff --git a/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc b/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc +index 31ab441aedd69c08c6f1beefa2129e60bd44a7f3..308c90516a9881b82da5cedec5d80208dbccdced 100644 +--- a/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc ++++ b/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc +@@ -32,7 +32,12 @@ class SpellCheckHostChromeImplWinBrowserTest : public InProcessBrowserTest { + public: + SpellCheckHostChromeImplWinBrowserTest() = default; + +- void SetUp() override { InProcessBrowserTest::SetUp(); } ++ void SetUp() override { ++ // Don't delay initialization of the SpellcheckService on browser launch. ++ feature_list_.InitAndDisableFeature( ++ spellcheck::kWinDelaySpellcheckServiceInit); ++ InProcessBrowserTest::SetUp(); ++ } + + void SetUpOnMainThread() override { + content::BrowserContext* context = browser()->profile(); +@@ -50,22 +55,7 @@ class SpellCheckHostChromeImplWinBrowserTest : public InProcessBrowserTest { + + void TearDownOnMainThread() override { renderer_.reset(); } + +- void InitializeSpellcheckService() { +- spell_check_host_->InitializeDictionaries(base::BindOnce( +- &SpellCheckHostChromeImplWinBrowserTest::InitializeDictionariesCallback, +- base::Unretained(this))); +- RunUntilResultReceived(); +- } +- +- void InitializeDictionariesCallback( +- std::vector<spellcheck::mojom::SpellCheckBDictLanguagePtr> dictionaries, +- const std::vector<std::string>& custom_words, +- bool enable) { +- received_result_ = true; +- if (quit_) { +- std::move(quit_).Run(); +- } +- } ++ virtual void InitializeSpellcheckService() {} + + void OnSpellcheckResult(const std::vector<SpellCheckResult>& result) { + received_result_ = true; +@@ -139,3 +129,41 @@ void SpellCheckHostChromeImplWinBrowserTest::RunSpellCheckReturnMessageTest() { + EXPECT_EQ(result_[0].length, 2); + EXPECT_EQ(result_[0].decoration, SpellCheckResult::SPELLING); + } ++ ++class SpellCheckHostChromeImplWinBrowserTestDelayInit ++ : public SpellCheckHostChromeImplWinBrowserTest { ++ public: ++ SpellCheckHostChromeImplWinBrowserTestDelayInit() = default; ++ ++ void SetUp() override { ++ // Don't initialize the SpellcheckService on browser launch. ++ feature_list_.InitAndEnableFeature( ++ spellcheck::kWinDelaySpellcheckServiceInit); ++ InProcessBrowserTest::SetUp(); ++ } ++ ++ void InitializeSpellcheckService() override { ++ // With the kWinDelaySpellcheckServiceInit feature flag set, the spellcheck ++ // service is not initialized when instantiated. Call InitializeDictionaries ++ // to load the dictionaries. ++ spell_check_host_->InitializeDictionaries( ++ base::BindOnce(&SpellCheckHostChromeImplWinBrowserTestDelayInit:: ++ InitializeDictionariesCallback, ++ base::Unretained(this))); ++ RunUntilResultReceived(); ++ } ++ ++ void InitializeDictionariesCallback( ++ std::vector<spellcheck::mojom::SpellCheckBDictLanguagePtr> dictionaries, ++ const std::vector<std::string>& custom_words, ++ bool enable) { ++ received_result_ = true; ++ if (quit_) ++ std::move(quit_).Run(); ++ } ++}; ++ ++IN_PROC_BROWSER_TEST_F(SpellCheckHostChromeImplWinBrowserTestDelayInit, ++ SpellCheckReturnMessage) { ++ RunSpellCheckReturnMessageTest(); ++} +diff --git a/chrome/browser/spellchecker/spellcheck_service.cc b/chrome/browser/spellchecker/spellcheck_service.cc +index 02da80b42f936f347c9043f4499d9a324bdf43d2..8fbb2025d157e58c90c701f9e3478f6c99b88aa1 100644 +--- a/chrome/browser/spellchecker/spellcheck_service.cc ++++ b/chrome/browser/spellchecker/spellcheck_service.cc +@@ -170,7 +170,9 @@ SpellcheckService::SpellcheckService(content::BrowserContext* context) + custom_dictionary_->Load(); + + #if BUILDFLAG(IS_WIN) +- if (spellcheck::UseBrowserSpellChecker()) { ++ if (spellcheck::UseBrowserSpellChecker() && ++ base::FeatureList::IsEnabled( ++ spellcheck::kWinDelaySpellcheckServiceInit)) { + // If initialization of the spellcheck service is on-demand, it is up to the + // instantiator of the spellcheck service to call InitializeDictionaries + // with a callback. +@@ -492,7 +494,9 @@ void SpellcheckService::LoadDictionaries() { + } + + #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) +- if (spellcheck::UseBrowserSpellChecker()) { ++ if (base::FeatureList::IsEnabled( ++ spellcheck::kWinDelaySpellcheckServiceInit) && ++ spellcheck::UseBrowserSpellChecker()) { + // Only want to fire the callback on first call to LoadDictionaries + // originating from InitializeDictionaries, since supported platform + // dictionaries are cached throughout the browser session and not +@@ -520,7 +524,9 @@ bool SpellcheckService::IsSpellcheckEnabled() const { + + bool enable_if_uninitialized = false; + #if BUILDFLAG(IS_WIN) +- if (spellcheck::UseBrowserSpellChecker()) { ++ if (spellcheck::UseBrowserSpellChecker() && ++ base::FeatureList::IsEnabled( ++ spellcheck::kWinDelaySpellcheckServiceInit)) { + // If initialization of the spellcheck service is on-demand, the + // renderer-side SpellCheck object needs to start out as enabled in order + // for a click on editable content to initialize the spellcheck service. +diff --git a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc +index d99667b86795215717dbb25dfefdf0a32f7cd089..5a6dd4dcc4467601a3197f5b273231b2c95d8cdf 100644 +--- a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc ++++ b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc +@@ -712,6 +712,32 @@ class SpellcheckServiceWindowsHybridBrowserTest + : SpellcheckServiceBrowserTest(/* use_browser_spell_checker=*/true) {} + }; + ++IN_PROC_BROWSER_TEST_F(SpellcheckServiceWindowsHybridBrowserTest, ++ WindowsHybridSpellcheck) { ++ // This test specifically covers the case where spellcheck delayed ++ // initialization is not enabled, so return early if it is. Other tests ++ // cover the case where delayed initialization is enabled. ++ if (base::FeatureList::IsEnabled(spellcheck::kWinDelaySpellcheckServiceInit)) ++ return; ++ ++ ASSERT_TRUE(spellcheck::UseBrowserSpellChecker()); ++ ++ // Note that the base class forces dictionary sync to not be performed, which ++ // on its own would have created a SpellcheckService object. So testing here ++ // that we are still instantiating the SpellcheckService as a browser startup ++ // task to support hybrid spellchecking. ++ SpellcheckService* service = static_cast<SpellcheckService*>( ++ SpellcheckServiceFactory::GetInstance()->GetServiceForBrowserContext( ++ GetContext(), /* create */ false)); ++ ASSERT_NE(nullptr, service); ++ ++ // The list of Windows spellcheck languages should have been populated by at ++ // least one language. This assures that the spellcheck context menu will ++ // include Windows spellcheck languages that lack Hunspell support. ++ EXPECT_TRUE(service->dictionaries_loaded()); ++ EXPECT_FALSE(service->windows_spellcheck_dictionary_map_.empty()); ++} ++ + class SpellcheckServiceWindowsHybridBrowserTestDelayInit + : public SpellcheckServiceBrowserTest { + public: +@@ -719,6 +745,10 @@ class SpellcheckServiceWindowsHybridBrowserTestDelayInit + : SpellcheckServiceBrowserTest(/* use_browser_spell_checker=*/true) {} + + void SetUp() override { ++ // Don't initialize the SpellcheckService on browser launch. ++ feature_list_.InitAndEnableFeature( ++ spellcheck::kWinDelaySpellcheckServiceInit); ++ + // Add command line switch that forces first run state, to test whether + // primary preferred language has its spellcheck dictionary enabled by + // default for non-Hunspell languages. +@@ -808,9 +838,10 @@ IN_PROC_BROWSER_TEST_F(SpellcheckServiceWindowsHybridBrowserTestDelayInit, + WindowsHybridSpellcheckDelayInit) { + ASSERT_TRUE(spellcheck::UseBrowserSpellChecker()); + +- // The base class forces dictionary sync to be skipped, so the +- // SpellcheckService object should not have been created on browser startup +- // because. Verify this is the case. ++ // Note that the base class forces dictionary sync to not be performed, and ++ // the kWinDelaySpellcheckServiceInit flag is set, which together should ++ // prevent creation of a SpellcheckService object on browser startup. So ++ // testing here that this is indeed the case. + SpellcheckService* service = static_cast<SpellcheckService*>( + SpellcheckServiceFactory::GetInstance()->GetServiceForBrowserContext( + GetContext(), /* create */ false)); +diff --git a/chrome/browser/spellchecker/spellcheck_service_unittest.cc b/chrome/browser/spellchecker/spellcheck_service_unittest.cc +index be073ddd362c6a8e9b93961eba2c5a7d4a978b5e..68c479ca1e8fd93ef661258823122cbc6277ad95 100644 +--- a/chrome/browser/spellchecker/spellcheck_service_unittest.cc ++++ b/chrome/browser/spellchecker/spellcheck_service_unittest.cc +@@ -181,11 +181,15 @@ class SpellcheckServiceHybridUnitTestBase + + protected: + void SetUp() override { ++ InitFeatures(); ++ + // Use SetTestingFactoryAndUse to force creation and initialization. + SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse( + &profile_, base::BindRepeating(&BuildSpellcheckService)); + } + ++ virtual void InitFeatures() {} ++ + virtual void InitializeSpellcheckService( + const std::vector<std::string>& spellcheck_languages_for_testing) { + // Fake the presence of Windows spellcheck dictionaries. +@@ -215,6 +219,8 @@ class SpellcheckServiceHybridUnitTestBase + static const std::vector<std::string> + windows_spellcheck_languages_for_testing_; + ++ base::test::ScopedFeatureList feature_list_; ++ + raw_ptr<SpellcheckService> spellcheck_service_; + }; + +@@ -327,6 +333,18 @@ const std::vector<std::string> SpellcheckServiceHybridUnitTestBase:: + // dictionaries. + }; + ++class GetDictionariesHybridUnitTestNoDelayInit ++ : public SpellcheckServiceHybridUnitTestBase, ++ public testing::WithParamInterface<TestCase> { ++ protected: ++ void InitFeatures() override { ++ // Disable kWinDelaySpellcheckServiceInit, as the case where it's enabled ++ // is tested in SpellcheckServiceWindowsDictionaryMappingUnitTestDelayInit. ++ feature_list_.InitAndDisableFeature( ++ spellcheck::kWinDelaySpellcheckServiceInit); ++ } ++}; ++ + static const TestCase kHybridGetDictionariesParams[] = { + // Galician (gl) has only Windows support, no Hunspell dictionary. Croatian + // (hr) has only Hunspell support, no local Windows dictionary. First +@@ -379,6 +397,16 @@ static const TestCase kHybridGetDictionariesParams[] = { + TestCase("it,it-IT", {"it", "it-IT"}, {"it", "it-IT"}, {"it", "it-IT"}), + }; + ++INSTANTIATE_TEST_SUITE_P(TestCases, ++ GetDictionariesHybridUnitTestNoDelayInit, ++ testing::ValuesIn(kHybridGetDictionariesParams)); ++ ++TEST_P(GetDictionariesHybridUnitTestNoDelayInit, GetDictionaries) { ++ RunGetDictionariesTest(GetParam().accept_languages, ++ GetParam().spellcheck_dictionaries, ++ GetParam().expected_dictionaries); ++} ++ + struct DictionaryMappingTestCase { + std::string full_tag; + std::string expected_accept_language; +@@ -401,6 +429,18 @@ std::ostream& operator<<(std::ostream& out, + return out; + } + ++class SpellcheckServiceWindowsDictionaryMappingUnitTest ++ : public SpellcheckServiceHybridUnitTestBase, ++ public testing::WithParamInterface<DictionaryMappingTestCase> { ++ protected: ++ void InitFeatures() override { ++ // Disable kWinDelaySpellcheckServiceInit, as the case where it's enabled ++ // is tested in SpellcheckServiceWindowsDictionaryMappingUnitTestDelayInit. ++ feature_list_.InitAndDisableFeature( ++ spellcheck::kWinDelaySpellcheckServiceInit); ++ } ++}; ++ + static const DictionaryMappingTestCase kHybridDictionaryMappingsParams[] = { + DictionaryMappingTestCase({"en-CA", "en-CA", "en-CA", "en", "en"}), + DictionaryMappingTestCase({"en-PH", "en", "en", "", ""}), +@@ -423,6 +463,18 @@ static const DictionaryMappingTestCase kHybridDictionaryMappingsParams[] = { + DictionaryMappingTestCase({"pt-BR", "pt-BR", "pt-BR", "pt", "pt"}), + }; + ++INSTANTIATE_TEST_SUITE_P(TestCases, ++ SpellcheckServiceWindowsDictionaryMappingUnitTest, ++ testing::ValuesIn(kHybridDictionaryMappingsParams)); ++ ++TEST_P(SpellcheckServiceWindowsDictionaryMappingUnitTest, CheckMappings) { ++ RunDictionaryMappingTest( ++ GetParam().full_tag, GetParam().expected_accept_language, ++ GetParam().expected_tag_passed_to_spellcheck, ++ GetParam().expected_accept_language_generic, ++ GetParam().expected_tag_passed_to_spellcheck_generic); ++} ++ + class SpellcheckServiceHybridUnitTestDelayInitBase + : public SpellcheckServiceHybridUnitTestBase { + public: +@@ -435,6 +487,12 @@ class SpellcheckServiceHybridUnitTestDelayInitBase + } + + protected: ++ void InitFeatures() override { ++ // Don't initialize the SpellcheckService on browser launch. ++ feature_list_.InitAndEnableFeature( ++ spellcheck::kWinDelaySpellcheckServiceInit); ++ } ++ + void InitializeSpellcheckService( + const std::vector<std::string>& spellcheck_languages_for_testing) + override { +diff --git a/components/spellcheck/common/spellcheck_features.cc b/components/spellcheck/common/spellcheck_features.cc +index ab07d966779449efcb0bad95ebe05e6018300048..527fa5d72369bb1194684527312eb093946d41c0 100644 +--- a/components/spellcheck/common/spellcheck_features.cc ++++ b/components/spellcheck/common/spellcheck_features.cc +@@ -41,6 +41,8 @@ ScopedDisableBrowserSpellCheckerForTesting:: + g_browser_spell_checker_enabled = previous_value_; + } + ++BASE_FEATURE(kWinDelaySpellcheckServiceInit, base::FEATURE_ENABLED_BY_DEFAULT); ++ + #endif // BUILDFLAG(IS_WIN) + + #if BUILDFLAG(IS_ANDROID) +diff --git a/components/spellcheck/common/spellcheck_features.h b/components/spellcheck/common/spellcheck_features.h +index 01e193221c74f0e0bd8620627455f92741448075..7929156c59d078b3d4299bb44ea28bc61bbe0086 100644 +--- a/components/spellcheck/common/spellcheck_features.h ++++ b/components/spellcheck/common/spellcheck_features.h +@@ -30,6 +30,25 @@ class ScopedDisableBrowserSpellCheckerForTesting { + const bool previous_value_; + }; + ++// If the kWinDelaySpellcheckServiceInit feature flag is enabled, don't ++// initialize the spellcheck dictionaries when the SpellcheckService is ++// instantiated. With this flag set: (1) Completing the initialization of the ++// spellcheck service is on-demand, invoked by calling ++// SpellcheckService::InitializeDictionaries with a callback to indicate when ++// the operation completes. (2) The call to create the spellcheck service in ++// ChromeBrowserMainParts::PreMainMessageLoopRunImpl will be skipped. Chromium ++// will still by default instantiate the spellcheck service on startup for ++// custom dictionary synchronization, but will not load Windows spellcheck ++// dictionaries. The command line for launching the browser with Windows hybrid ++// spellchecking enabled but no initialization of the spellcheck service is: ++// chrome ++// --enable-features=WinDelaySpellcheckServiceInit ++// and if instantiation of the spellcheck service needs to be completely ++// disabled: ++// chrome ++// --enable-features=WinDelaySpellcheckServiceInit ++// --disable-sync-types="Dictionary" ++BASE_DECLARE_FEATURE(kWinDelaySpellcheckServiceInit); + #endif // BUILDFLAG(IS_WIN) + + #if BUILDFLAG(IS_ANDROID) +diff --git a/components/spellcheck/renderer/spellcheck_provider.cc b/components/spellcheck/renderer/spellcheck_provider.cc +index 20e73dd66865f1d7573adc092d8747e3b3252cfd..0bec57f9a7276c3623edd4fcf009d7b35e453df4 100644 +--- a/components/spellcheck/renderer/spellcheck_provider.cc ++++ b/components/spellcheck/renderer/spellcheck_provider.cc +@@ -126,7 +126,9 @@ void SpellCheckProvider::RequestTextChecking( + #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) + if (spellcheck::UseBrowserSpellChecker()) { + #if BUILDFLAG(IS_WIN) +- if (!dictionaries_loaded_) { ++ if (base::FeatureList::IsEnabled( ++ spellcheck::kWinDelaySpellcheckServiceInit) && ++ !dictionaries_loaded_) { + // Initialize the spellcheck service on demand (this spellcheck request + // could be the result of the first click in editable content), then + // complete the text check request when the dictionaries are loaded. +diff --git a/components/spellcheck/renderer/spellcheck_provider_test.cc b/components/spellcheck/renderer/spellcheck_provider_test.cc +index 04dcb599f5dd93d3e381c243e5ba81fbec8a3790..12c32fd631ff93f1d1ff3c7d2a19924e8909c099 100644 +--- a/components/spellcheck/renderer/spellcheck_provider_test.cc ++++ b/components/spellcheck/renderer/spellcheck_provider_test.cc +@@ -188,8 +188,14 @@ void TestingSpellCheckProvider::FillSuggestionList(const std::u16string&, + #if BUILDFLAG(IS_WIN) + void TestingSpellCheckProvider::InitializeDictionaries( + InitializeDictionariesCallback callback) { +- std::move(callback).Run(/*dictionaries=*/{}, /*custom_words=*/{}, +- /*enable=*/false); ++ if (base::FeatureList::IsEnabled( ++ spellcheck::kWinDelaySpellcheckServiceInit)) { ++ std::move(callback).Run(/*dictionaries=*/{}, /*custom_words=*/{}, ++ /*enable=*/false); ++ return; ++ } ++ ++ NOTREACHED(); + } + #endif // BUILDFLAG(IS_WIN) + #endif // BUILDFLAG(USE_BROWSER_SPELLCHECKER) +diff --git a/components/spellcheck/renderer/spellcheck_provider_unittest.cc b/components/spellcheck/renderer/spellcheck_provider_unittest.cc +index 487cdb1f871868a7fed8ae2ba1adc816c581d0e2..6e1da0564754063e78ad69997be71bbc95e27b39 100644 +--- a/components/spellcheck/renderer/spellcheck_provider_unittest.cc ++++ b/components/spellcheck/renderer/spellcheck_provider_unittest.cc +@@ -65,12 +65,34 @@ class HybridSpellCheckTest + HybridSpellCheckTest() : provider_(&embedder_provider_) {} + ~HybridSpellCheckTest() override = default; + ++ void SetUp() override { ++ // Don't delay initialization of the SpellcheckService on browser launch. ++ feature_list_.InitAndDisableFeature( ++ spellcheck::kWinDelaySpellcheckServiceInit); ++ } ++ ++ void RunShouldUseBrowserSpellCheckOnlyWhenNeededTest(); ++ + protected: ++ base::test::ScopedFeatureList feature_list_; + base::test::SingleThreadTaskEnvironment task_environment_; + spellcheck::EmptyLocalInterfaceProvider embedder_provider_; + TestingSpellCheckProvider provider_; + }; + ++// Test fixture for testing hybrid check cases with delayed initialization of ++// the spellcheck service. ++class HybridSpellCheckTestDelayInit : public HybridSpellCheckTest { ++ public: ++ HybridSpellCheckTestDelayInit() = default; ++ ++ void SetUp() override { ++ // Don't initialize the SpellcheckService on browser launch. ++ feature_list_.InitAndEnableFeature( ++ spellcheck::kWinDelaySpellcheckServiceInit); ++ } ++}; ++ + // Test fixture for testing combining results from both the native spell checker + // and Hunspell. + class CombineSpellCheckResultsTest +@@ -173,6 +195,10 @@ INSTANTIATE_TEST_SUITE_P( + testing::ValuesIn(kSpellCheckProviderHybridTestsParams)); + + TEST_P(HybridSpellCheckTest, ShouldUseBrowserSpellCheckOnlyWhenNeeded) { ++ RunShouldUseBrowserSpellCheckOnlyWhenNeededTest(); ++} ++ ++void HybridSpellCheckTest::RunShouldUseBrowserSpellCheckOnlyWhenNeededTest() { + const auto& test_case = GetParam(); + + FakeTextCheckingResult completion; +@@ -191,6 +217,20 @@ TEST_P(HybridSpellCheckTest, ShouldUseBrowserSpellCheckOnlyWhenNeeded) { + EXPECT_EQ(completion.cancellation_count_, 0U); + } + ++// Tests that the SpellCheckProvider calls into the native spell checker only ++// when needed when the code path through ++// SpellCheckProvider::RequestTextChecking is that used when the spellcheck ++// service is initialized on demand. ++INSTANTIATE_TEST_SUITE_P( ++ SpellCheckProviderHybridTests, ++ HybridSpellCheckTestDelayInit, ++ testing::ValuesIn(kSpellCheckProviderHybridTestsParams)); ++ ++TEST_P(HybridSpellCheckTestDelayInit, ++ ShouldUseBrowserSpellCheckOnlyWhenNeeded) { ++ RunShouldUseBrowserSpellCheckOnlyWhenNeededTest(); ++} ++ + // Tests that the SpellCheckProvider can correctly combine results from the + // native spell checker and Hunspell. + INSTANTIATE_TEST_SUITE_P( diff --git a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch index e382469f1636b..45d1d7819a206 100644 --- a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch +++ b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch @@ -254,10 +254,10 @@ index 17d6d7d935f93afefa9123f56ef9c138c3070f93..8dfa7501a6a2998e107bf9b51f5e5c3d } diff --git a/content/common/features.cc b/content/common/features.cc -index 942f204b4c09787870c14e068dba543e7b64d442..6ccd0081e3c3ef88794ab82fc1282a1d91e047ea 100644 +index 4419e36c81aca962e85892cc2e0af3dee31a86c3..5b1bfeba20bd5dde48145ab2f94632735d63d316 100644 --- a/content/common/features.cc +++ b/content/common/features.cc -@@ -305,6 +305,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); +@@ -306,6 +306,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kIOSurfaceCapturer, base::FEATURE_ENABLED_BY_DEFAULT); #endif @@ -273,10 +273,10 @@ index 942f204b4c09787870c14e068dba543e7b64d442..6ccd0081e3c3ef88794ab82fc1282a1d BASE_FEATURE(kKeepChildProcessAfterIPCReset, base::FEATURE_DISABLED_BY_DEFAULT); diff --git a/content/common/features.h b/content/common/features.h -index 243c4b57083c58c889e9e9d8034dc109420e2fc2..13b7a0c529e7214369c4affebe8fb95e2ddc256e 100644 +index faef439b47b162b75a26a5979ae31dc0532bb214..39e283445c643e11847b0ffdc8c06f79028988c7 100644 --- a/content/common/features.h +++ b/content/common/features.h -@@ -107,6 +107,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); +@@ -110,6 +110,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); #if BUILDFLAG(IS_MAC) CONTENT_EXPORT BASE_DECLARE_FEATURE(kIOSurfaceCapturer); #endif diff --git a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch index 31d175faff32c..ca66130e02407 100644 --- a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch +++ b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch @@ -54,10 +54,10 @@ index 5b0f0b28c3f36315d5bb12ad7e35f21c91a1e8b6..08ca1a3fc2add9cf93b078b9136d9aa6 if (mouse_event_callback.Run(mouse_event)) { return; diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index a9813ead175b478227bb91daf0d23cffc1bedca6..4777db11f1fbde96c7b117dfe0241bb5c34db126 100644 +index 6edd4d673dd61b396aaf121ff3e6810fd0b4ba00..3c25f0d1111eaebf4fb62c9241d237dea3c2a416 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4466,6 +4466,12 @@ void WebContentsImpl::RenderWidgetWasResized( +@@ -4478,6 +4478,12 @@ void WebContentsImpl::RenderWidgetWasResized( width_changed); } @@ -71,10 +71,10 @@ index a9813ead175b478227bb91daf0d23cffc1bedca6..4777db11f1fbde96c7b117dfe0241bb5 const gfx::PointF& client_pt) { if (delegate_) { diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index 247e71fa9a43116b40cfffd8da0169223272d9c9..48ac6629a904a135f3e3ca7e1f924807e575675a 100644 +index 9b065992fc577084ef16aaef1436fd0855e32981..0f230a7ecaa04e8050899525d606541432dada1e 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -1107,6 +1107,7 @@ class CONTENT_EXPORT WebContentsImpl +@@ -1114,6 +1114,7 @@ class CONTENT_EXPORT WebContentsImpl double GetPendingZoomLevel(RenderWidgetHostImpl* rwh) override; diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index 845cf01a24d83..5ee7a16fd7f97 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index 7884bdff1cce1a7a52221f1d7bf5933cd4518b83..be66b04538b2969ba3f8ada0f63660eea586c42b 100644 +index 6d478df9ae82edc4bf6994e775a4d716770fdad1..5b7c4a7e4baef8a2dab1a41ff9962f2bbbbd95a9 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25301,6 +25301,21 @@ +@@ -25347,6 +25347,21 @@ ] } ], @@ -67,7 +67,7 @@ index c1d8107ec3e32d31811572aa1d7a7c7a242da7d9..463abf871c7e169dc1ca9f523d74fc14 } // namespace views::features diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index d58b59288d881a2d74ea357f1e9e27870d24ac72..956dc87cb07559038a63cec0b5174cec09619bdb 100644 +index 89287b68398e9121959e7750644d37072e8e489b..29bf4dfbe2cf0af5a1369c4d3e17e50a198c78c6 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -84,6 +84,23 @@ namespace { @@ -94,7 +94,7 @@ index d58b59288d881a2d74ea357f1e9e27870d24ac72..956dc87cb07559038a63cec0b5174cec // Updates the cursor clip region. Used for mouse locking. void UpdateMouseLockRegion(aura::Window* window, bool locked) { if (!locked) { -@@ -329,9 +346,14 @@ bool DesktopWindowTreeHostWin::IsVisible() const { +@@ -333,9 +350,14 @@ bool DesktopWindowTreeHostWin::IsVisible() const { } void DesktopWindowTreeHostWin::SetSize(const gfx::Size& size) { @@ -111,7 +111,7 @@ index d58b59288d881a2d74ea357f1e9e27870d24ac72..956dc87cb07559038a63cec0b5174cec } void DesktopWindowTreeHostWin::StackAbove(aura::Window* window) { -@@ -346,30 +368,40 @@ void DesktopWindowTreeHostWin::StackAtTop() { +@@ -350,30 +372,40 @@ void DesktopWindowTreeHostWin::StackAtTop() { } void DesktopWindowTreeHostWin::CenterWindow(const gfx::Size& size) { @@ -154,7 +154,7 @@ index d58b59288d881a2d74ea357f1e9e27870d24ac72..956dc87cb07559038a63cec0b5174cec return display::win::GetScreenWin()->ScreenToDIPRect(GetHWND(), pixel_bounds); } -@@ -677,37 +709,44 @@ void DesktopWindowTreeHostWin::HideImpl() { +@@ -681,37 +713,44 @@ void DesktopWindowTreeHostWin::HideImpl() { // other get/set methods work in DIP. gfx::Rect DesktopWindowTreeHostWin::GetBoundsInPixels() const { @@ -219,7 +219,7 @@ index d58b59288d881a2d74ea357f1e9e27870d24ac72..956dc87cb07559038a63cec0b5174cec } gfx::Rect -@@ -917,21 +956,29 @@ int DesktopWindowTreeHostWin::GetNonClientComponent( +@@ -921,21 +960,29 @@ int DesktopWindowTreeHostWin::GetNonClientComponent( void DesktopWindowTreeHostWin::GetWindowMask(const gfx::Size& size_px, SkPath* path) { @@ -264,10 +264,10 @@ index d58b59288d881a2d74ea357f1e9e27870d24ac72..956dc87cb07559038a63cec0b5174cec } diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -index e8acd2828ed05deefa335ce2bb461f0c3be8d7b7..0cd07fd5fb55dcc0d972de4c027fcb895d156592 100644 +index 1e30bce5ca5bf47726fd846f2f26705d52a8ce57..2529a00eb6ec30e4269f19c685997a778647bd51 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -@@ -175,7 +175,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin +@@ -176,7 +176,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin void ShowImpl() override; void HideImpl() override; gfx::Rect GetBoundsInPixels() const override; @@ -276,7 +276,7 @@ index e8acd2828ed05deefa335ce2bb461f0c3be8d7b7..0cd07fd5fb55dcc0d972de4c027fcb89 gfx::Rect GetBoundsInAcceleratedWidgetPixelCoordinates() override; gfx::Point GetLocationOnScreenInPixels() const override; void SetCapture() override; -@@ -328,6 +328,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin +@@ -329,6 +329,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin gfx::Vector2d window_expansion_top_left_delta_; gfx::Vector2d window_expansion_bottom_right_delta_; diff --git a/patches/chromium/support_mixed_sandbox_with_zygote.patch b/patches/chromium/support_mixed_sandbox_with_zygote.patch index 635a98ef33db7..bc0d2fa1e179d 100644 --- a/patches/chromium/support_mixed_sandbox_with_zygote.patch +++ b/patches/chromium/support_mixed_sandbox_with_zygote.patch @@ -22,7 +22,7 @@ However, the patch would need to be reviewed by the security team, as it does touch a security-sensitive class. diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index e4df51e2fac09cd2c97bb125b9187aede4138f23..20a9e4536e722e5f0c8f5bdb55504b7c19d2a29e 100644 +index ae46fafbb67668d3c0a147cb0d8cf8fda958409a..3cda71f0b6c606b9df9b457e3f94ee7d3af051b6 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -1905,6 +1905,10 @@ bool RenderProcessHostImpl::Init() { diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index 104e72890124f..6123dc383e933 100644 --- a/patches/chromium/web_contents.patch +++ b/patches/chromium/web_contents.patch @@ -9,10 +9,10 @@ is needed for OSR. Originally landed in https://github.com/electron/libchromiumcontent/pull/226. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 2451f06b6b6dc96da44494da1db5e1f47654dad4..ee597638585d787617b5a1d7b9ccac6782fb93ef 100644 +index 35fe43c6ac99666d070036f7d862529ad364a359..825dd5a2cda02d88f17c04e50b05b89157439538 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4197,6 +4197,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -4209,6 +4209,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, params.main_frame_name, GetOpener(), primary_main_frame_policy, base::UnguessableToken::Create()); @@ -26,7 +26,7 @@ index 2451f06b6b6dc96da44494da1db5e1f47654dad4..ee597638585d787617b5a1d7b9ccac67 std::unique_ptr<WebContentsViewDelegate> delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -4207,6 +4214,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -4219,6 +4226,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, view_ = CreateWebContentsView(this, std::move(delegate), &render_view_host_delegate_view_); } @@ -35,7 +35,7 @@ index 2451f06b6b6dc96da44494da1db5e1f47654dad4..ee597638585d787617b5a1d7b9ccac67 CHECK(view_.get()); diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index c7efc2aba74899b239140c77126666f571c127c3..e620d4c33e95c247495f3ed78952b8fc365cfb99 100644 +index ef60f27657953a92f720a0342c8bb08f24684b54..8d614d26117ec41dfe1ecffecbcfb2170c534c9a 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h @@ -130,11 +130,14 @@ class PrerenderHandle; diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index 13d20b000e2f2..92bfa2c2aa55a 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,10 +15,10 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 6635ed3b341ffc63d80d895dc5746c79092f53ab..5a3acb372b87ed34a62478967c72aeeec83e9db9 100644 +index e76cccefbbf77fcfb886c41d501bcff4fd27be2f..d4f0278019e7d5ea43d6989b48fbefcbd5b05482 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -8960,6 +8960,17 @@ void RenderFrameHostImpl::EnterFullscreen( +@@ -8967,6 +8967,17 @@ void RenderFrameHostImpl::EnterFullscreen( } } @@ -37,10 +37,10 @@ index 6635ed3b341ffc63d80d895dc5746c79092f53ab..5a3acb372b87ed34a62478967c72aeee if (had_fullscreen_token && !GetView()->HasFocus()) GetView()->Focus(); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index ee597638585d787617b5a1d7b9ccac6782fb93ef..208fe58f95557ee103555858c2cda39e732ca991 100644 +index 825dd5a2cda02d88f17c04e50b05b89157439538..cbfa2ec56627994541548a49a4afe33b6e42c2d7 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4483,21 +4483,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( +@@ -4495,21 +4495,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( const input::NativeWebKeyboardEvent& event) { OPTIONAL_TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("content.verbose"), "WebContentsImpl::PreHandleKeyboardEvent"); @@ -80,7 +80,7 @@ index ee597638585d787617b5a1d7b9ccac6782fb93ef..208fe58f95557ee103555858c2cda39e } bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) { -@@ -4656,7 +4660,7 @@ void WebContentsImpl::EnterFullscreenMode( +@@ -4668,7 +4672,7 @@ void WebContentsImpl::EnterFullscreenMode( OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::EnterFullscreenMode"); DCHECK(CanEnterFullscreenMode(requesting_frame)); DCHECK(requesting_frame->IsActive()); diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 1fa2247ef0834..984154b8c7877 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -1770,14 +1770,15 @@ void WebContents::RenderFrameCreated( return; } - content::RenderFrameHost::LifecycleState lifecycle_state = - render_frame_host->GetLifecycleState(); - if (lifecycle_state == content::RenderFrameHost::LifecycleState::kActive) { + if (render_frame_host->GetLifecycleState() == + content::RenderFrameHost::LifecycleState::kActive) { v8::Isolate* isolate = JavascriptEnvironment::GetIsolate(); - v8::HandleScope handle_scope(isolate); + v8::HandleScope handle_scope{isolate}; auto details = gin_helper::Dictionary::CreateEmpty(isolate); details.SetGetter("frame", render_frame_host); Emit("frame-created", details); + content::WebContents::FromRenderFrameHost(render_frame_host) + ->SetSupportsDraggableRegions(true); } } diff --git a/shell/renderer/electron_render_frame_observer.cc b/shell/renderer/electron_render_frame_observer.cc index cc25ed14d0d64..a9d08b836f47d 100644 --- a/shell/renderer/electron_render_frame_observer.cc +++ b/shell/renderer/electron_render_frame_observer.cc @@ -59,11 +59,6 @@ ElectronRenderFrameObserver::ElectronRenderFrameObserver( renderer_client_(renderer_client) { // Initialise resource for directory listing. net::NetModule::SetResourceProvider(NetResourceProvider); - - // In Chrome, app regions are only supported in the main frame. - // However, we need to support draggable regions on other - // local frames/windows, so extend support beyond the main frame. - render_frame_->GetWebView()->SetSupportsDraggableRegions(true); } void ElectronRenderFrameObserver::DidClearWindowObject() { From b9ded2b5454dced1e93f28c1037dce5505328634 Mon Sep 17 00:00:00 2001 From: Niklas Wenzel <nilay2014@gmail.com> Date: Thu, 23 Oct 2025 16:45:45 +0200 Subject: [PATCH 160/268] docs: fix Ubuntu version used to build Electron (#48638) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ab98ce41009b..11e07d80a7df7 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Each Electron release provides binaries for macOS, Windows, and Linux. * macOS (Big Sur and up): Electron provides 64-bit Intel and Apple Silicon / ARM binaries for macOS. * Windows (Windows 10 and up): Electron provides `ia32` (`x86`), `x64` (`amd64`), and `arm64` binaries for Windows. Windows on ARM support was added in Electron 5.0.8. Support for Windows 7, 8 and 8.1 was [removed in Electron 23, in line with Chromium's Windows deprecation policy](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice). -* Linux: The prebuilt binaries of Electron are built on Ubuntu 20.04. They have also been verified to work on: +* Linux: The prebuilt binaries of Electron are built on Ubuntu 22.04. They have also been verified to work on: * Ubuntu 18.04 and newer * Fedora 32 and newer * Debian 10 and newer From e20f6727dab90e4e997cd2604ce905bd6538305e Mon Sep 17 00:00:00 2001 From: David Sanders <nilay2014@gmail.com> Date: Thu, 23 Oct 2025 08:58:18 -0700 Subject: [PATCH 161/268] ci: add more fields to Slack payload for backport requested message (#48148) * ci: add more fields to Slack payload for backport requested message * chore: wrap values with toJSON --- .github/workflows/pull-request-labeled.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-labeled.yml b/.github/workflows/pull-request-labeled.yml index 51bfcb86705f5..7cb86e3010e5d 100644 --- a/.github/workflows/pull-request-labeled.yml +++ b/.github/workflows/pull-request-labeled.yml @@ -19,7 +19,10 @@ jobs: webhook-type: webhook-trigger payload: | { - "url": "${{ github.event.pull_request.html_url }}" + "base_ref": ${{ toJSON(github.event.pull_request.base.ref) }}, + "title": ${{ toJSON(github.event.pull_request.title) }}, + "url": ${{ toJSON(github.event.pull_request.html_url) }}, + "user": ${{ toJSON(github.event.pull_request.user.login) }} } pull-request-labeled-deprecation-review-complete: name: deprecation-review/complete label added From 3aa5710a91a2c2de43a01472a062d85ac85f63c4 Mon Sep 17 00:00:00 2001 From: Calvin <nilay2014@gmail.com> Date: Thu, 23 Oct 2025 12:58:40 -0600 Subject: [PATCH 162/268] chore: bump nan to 2.23.0 (#48591) * chore: bump nan to 2.23.0 * Fix C++ flags passed to C compiler in NAN spec runner Passing C++-specific flags to the C compiler caused failures building native test modules. NAN uprgaded the version of node-gyp it uses, triggering a new codepath with the C compiler that didn't occur before. In that new branch, the C++ flags present in the CFLAGS environment variable we were passing in caused the C compiler to error out: ``` error: invalid argument '-std=c++20' not allowed with 'C' ``` The fix is to only pass C++-specific flags to the C++ compiler, and not the C compiler. This is done by separating out the CFLAGS and CXXFLAGS environment variables in our nan-spec-runner.js script. I'm curious to know more about why each of these flags are necessary, but for now this change restores the previous behavior where native test modules could be built successfully. * test: use v8 version check instead of node version check (patch) * Re-enable `methodswithdata-test` --- DEPS | 2 +- patches/nan/.patches | 8 +- patches/nan/apply_allcan_read_write.patch | 141 ----------- ...precated_functioncallbackinfo_holder.patch | 30 --- ...eturnvalue_void_set_nonempty_for_new.patch | 18 +- ...copyablepersistenttraits_for_v8_12_5.patch | 44 ---- ..._replace_deprecated_get_setprototype.patch | 4 +- ...f_removed_writeutf8_with_writeutf8v2.patch | 10 +- ...amedpropertyhandlerconfiguration_and.patch | 220 ------------------ ..._v8_isolate_idlenotificationdeadline.patch | 28 --- ...eral_apis_deprecated_in_version_12_6.patch | 41 ---- ..._check_instead_of_node_version_check.patch | 61 +++++ ...nstructor_for_scriptorigin_when_17_x.patch | 33 --- script/nan-spec-runner.js | 16 +- 14 files changed, 90 insertions(+), 566 deletions(-) delete mode 100644 patches/nan/apply_allcan_read_write.patch delete mode 100644 patches/nan/chore_remove_deprecated_functioncallbackinfo_holder.patch delete mode 100644 patches/nan/fix_define_nan_copyablepersistenttraits_for_v8_12_5.patch delete mode 100644 patches/nan/fix_support_new_variant_of_namedpropertyhandlerconfiguration_and.patch delete mode 100644 patches/nan/remove_deprecated_v8_isolate_idlenotificationdeadline.patch delete mode 100644 patches/nan/remove_several_apis_deprecated_in_version_12_6.patch create mode 100644 patches/nan/test_use_v8_version_check_instead_of_node_version_check.patch delete mode 100644 patches/nan/use_new_constructor_for_scriptorigin_when_17_x.patch diff --git a/DEPS b/DEPS index 97f071c50130c..7e073a3818def 100644 --- a/DEPS +++ b/DEPS @@ -6,7 +6,7 @@ vars = { 'node_version': 'v22.20.0', 'nan_version': - 'e14bdcd1f72d62bca1d541b66da43130384ec213', + '675cefebca42410733da8a454c8d9391fcebfbc2', 'squirrel.mac_version': '0e5d146ba13101a1302d59ea6e6e0b3cace4ae38', 'reactiveobjc_version': diff --git a/patches/nan/.patches b/patches/nan/.patches index af858c2ddfa52..cbc4d0d7f659f 100644 --- a/patches/nan/.patches +++ b/patches/nan/.patches @@ -1,10 +1,4 @@ -use_new_constructor_for_scriptorigin_when_17_x.patch -fix_define_nan_copyablepersistenttraits_for_v8_12_5.patch -remove_deprecated_v8_isolate_idlenotificationdeadline.patch -remove_several_apis_deprecated_in_version_12_6.patch -apply_allcan_read_write.patch -fix_support_new_variant_of_namedpropertyhandlerconfiguration_and.patch fix_correct_usages_of_v8_returnvalue_void_set_nonempty_for_new.patch -chore_remove_deprecated_functioncallbackinfo_holder.patch fix_replace_deprecated_get_setprototype.patch fix_replace_usage_of_removed_writeutf8_with_writeutf8v2.patch +test_use_v8_version_check_instead_of_node_version_check.patch diff --git a/patches/nan/apply_allcan_read_write.patch b/patches/nan/apply_allcan_read_write.patch deleted file mode 100644 index 23f899dd8fa72..0000000000000 --- a/patches/nan/apply_allcan_read_write.patch +++ /dev/null @@ -1,141 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Keeley Hammond <khammond@slack-corp.com> -Date: Thu, 20 Jun 2024 14:42:08 -0700 -Subject: Check for NODE_21_0_MODULE_VERSION - -Refs https://chromium-review.googlesource.com/c/v8/v8/+/5006387 -Should be upstreamed. - -Module version checks are made against 119 since that is the current assigned version -for Electron 28 in https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json. -The version should be updateed to the one assinged for Electron 29 when it is available. - -Steps for upstreaming this patch: - -- Get a new module version assigned for Electron 29 in nodejs/node -- Update NODE_21_0_MODULE_VERSION to the new version number -- Upstream patch to nodejs/nan before Electron 29 is branched - -diff --git a/nan.h b/nan.h -index 9a9112afe0cc94ce58ed3cce9763ace7c160a932..f4865a77e60d5105ed2426037984ddcbfa58bbca 100644 ---- a/nan.h -+++ b/nan.h -@@ -47,6 +47,7 @@ - #define NODE_18_0_MODULE_VERSION 108 - #define NODE_19_0_MODULE_VERSION 111 - #define NODE_20_0_MODULE_VERSION 115 -+#define NODE_21_0_MODULE_VERSION 119 - - #ifdef _MSC_VER - # define NAN_HAS_CPLUSPLUS_11 (_MSC_VER >= 1800) -@@ -2525,7 +2526,9 @@ NAN_DEPRECATED inline void SetAccessor( - , GetterCallback getter - , SetterCallback setter - , v8::Local<v8::Value> data -+#if (NODE_MODULE_VERSION < NODE_21_0_MODULE_VERSION) - , v8::AccessControl settings -+#endif - , v8::PropertyAttribute attribute - , imp::Sig signature) { - HandleScope scope; -@@ -2553,17 +2556,28 @@ NAN_DEPRECATED inline void SetAccessor( - obj->SetInternalField(imp::kDataIndex, data); - } - -+#if (NODE_MODULE_VERSION >= NODE_21_0_MODULE_VERSION) -+ tpl->SetNativeDataProperty( -+ name -+ , getter_ -+ , setter_ -+ , obj -+ , attribute); -+#else - tpl->SetAccessor( - name - , getter_ - , setter_ - , obj -+#if (NODE_MODULE_VERSION < NODE_21_0_MODULE_VERSION) - , settings -+#endif - , attribute - #if (NODE_MODULE_VERSION < NODE_16_0_MODULE_VERSION) - , signature - #endif - ); -+#endif - } - - inline void SetAccessor( -@@ -2572,7 +2586,9 @@ inline void SetAccessor( - , GetterCallback getter - , SetterCallback setter = 0 - , v8::Local<v8::Value> data = v8::Local<v8::Value>() -+#if (NODE_MODULE_VERSION < NODE_21_0_MODULE_VERSION) - , v8::AccessControl settings = v8::DEFAULT -+#endif - , v8::PropertyAttribute attribute = v8::None) { - HandleScope scope; - -@@ -2599,14 +2615,25 @@ inline void SetAccessor( - obj->SetInternalField(imp::kDataIndex, data); - } - -+#if (NODE_MODULE_VERSION >= NODE_21_0_MODULE_VERSION) -+ tpl->SetNativeDataProperty( -+ name -+ , getter_ -+ , setter_ -+ , obj -+ , attribute); -+#else - tpl->SetAccessor( - name - , getter_ - , setter_ - , obj -+#if (NODE_MODULE_VERSION < NODE_21_0_MODULE_VERSION) - , settings -+#endif - , attribute - ); -+#endif - } - - inline bool SetAccessor( -@@ -2642,7 +2669,15 @@ inline bool SetAccessor( - , New<v8::External>(reinterpret_cast<void *>(setter))); - } - --#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) -+#if (NODE_MODULE_VERSION >= NODE_21_0_MODULE_VERSION) -+ return obj->SetNativeDataProperty( -+ GetCurrentContext() -+ , name -+ , getter_ -+ , setter_ -+ , dataobj -+ , attribute).FromMaybe(false); -+#elif (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) - return obj->SetAccessor( - GetCurrentContext() - , name -diff --git a/test/js/accessors-test.js b/test/js/accessors-test.js -index e6ad45737e2ac18da3fa936b1de618e7389933bc..025f5b66774c2f5fe0ccb98c91fc714dd916fcb1 100644 ---- a/test/js/accessors-test.js -+++ b/test/js/accessors-test.js -@@ -11,7 +11,7 @@ const test = require('tap').test - , bindings = require('bindings')({ module_root: testRoot, bindings: 'accessors' }); - - test('accessors', function (t) { -- t.plan(7) -+ t.plan(6) - var settergetter = bindings.create() - t.equal(settergetter.prop1, 'this is property 1') - t.ok(settergetter.prop2 === '') -@@ -28,5 +28,4 @@ test('accessors', function (t) { - t.equal(derived.prop1, 'this is property 1') - derived.prop2 = 'setting a new value' - t.equal(derived.prop2, 'setting a new value') -- t.equal(settergetter.prop2, 'setting a new value') - }) diff --git a/patches/nan/chore_remove_deprecated_functioncallbackinfo_holder.patch b/patches/nan/chore_remove_deprecated_functioncallbackinfo_holder.patch deleted file mode 100644 index c6ee275913d23..0000000000000 --- a/patches/nan/chore_remove_deprecated_functioncallbackinfo_holder.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: John Kleinschmidt <jkleinsc@electronjs.org> -Date: Fri, 28 Feb 2025 11:17:01 -0500 -Subject: chore remove deprecated FunctionCallbackInfo Holder - -v8 version 13.5.191 removed the deprecated FunctionCallbackInfo::Holder(). - -Callers are supposed to use FunctionCallbackInfo::This() instead. - -See https://chromium-review.googlesource.com/c/v8/v8/+/6309166 - -diff --git a/nan_callbacks_12_inl.h b/nan_callbacks_12_inl.h -index 1af2459efcf54fa97ff24aaa221892eede6eb0d3..e8505247a5070dba572954ba63bc193c9fd51eb6 100644 ---- a/nan_callbacks_12_inl.h -+++ b/nan_callbacks_12_inl.h -@@ -109,7 +109,14 @@ class FunctionCallbackInfo { - inline v8::Local<v8::Function> Callee() const { return info_.Callee(); } - #endif - inline v8::Local<v8::Value> Data() const { return data_; } -+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION < 13 || \ -+(V8_MAJOR_VERSION == 13 && defined(V8_MINOR_VERSION) && \ -+(V8_MINOR_VERSION < 5 || (V8_MINOR_VERSION == 5 && \ -+defined(V8_BUILD_NUMBER) && V8_BUILD_NUMBER < 191)))) - inline v8::Local<v8::Object> Holder() const { return info_.Holder(); } -+#else -+ inline v8::Local<v8::Object> Holder() const { return info_.This(); } -+#endif - inline bool IsConstructCall() const { return info_.IsConstructCall(); } - inline int Length() const { return info_.Length(); } - inline v8::Local<v8::Value> operator[](int i) const { return info_[i]; } diff --git a/patches/nan/fix_correct_usages_of_v8_returnvalue_void_set_nonempty_for_new.patch b/patches/nan/fix_correct_usages_of_v8_returnvalue_void_set_nonempty_for_new.patch index 5ae158c3ab354..26cb0e8e3473e 100644 --- a/patches/nan/fix_correct_usages_of_v8_returnvalue_void_set_nonempty_for_new.patch +++ b/patches/nan/fix_correct_usages_of_v8_returnvalue_void_set_nonempty_for_new.patch @@ -14,10 +14,10 @@ succeeded or not which was incorrect. This should be upstreamed. diff --git a/test/cpp/indexedinterceptors.cpp b/test/cpp/indexedinterceptors.cpp -index f2cd97ac9c40070c127bf9d682401c33955d6d6a..38f1298c2b44130eca73d9d005d2d7ab5f234926 100644 +index 11f573f15109620c5105f1c212a5555bedd7e246..19b7673ff4c07236b11e1947d805979c21a0876e 100644 --- a/test/cpp/indexedinterceptors.cpp +++ b/test/cpp/indexedinterceptors.cpp -@@ -90,9 +90,9 @@ NAN_INDEX_SETTER(IndexedInterceptor::PropertySetter) { +@@ -91,9 +91,9 @@ NAN_INDEX_SETTER(IndexedInterceptor::PropertySetter) { interceptor->buf , *Nan::Utf8String(value) , sizeof (interceptor->buf)); @@ -27,21 +27,21 @@ index f2cd97ac9c40070c127bf9d682401c33955d6d6a..38f1298c2b44130eca73d9d005d2d7ab - info.GetReturnValue().Set(info.This()); + info.GetReturnValue().Set(True()); } + return Intercepted::Yes(); } - diff --git a/test/cpp/namedinterceptors.cpp b/test/cpp/namedinterceptors.cpp -index 8ab5f47db4b9830dd18c36d1a7cb0fced5925355..ae67f2391906fa0e9a60bc406bde86550965dab9 100644 +index 4d8bf5c56ad888234e789f638859142ec92c0fd8..9f4b3b2000188fbeb53a5ec53969226916bac9da 100644 --- a/test/cpp/namedinterceptors.cpp +++ b/test/cpp/namedinterceptors.cpp -@@ -90,10 +90,8 @@ NAN_PROPERTY_SETTER(NamedInterceptor::PropertySetter) { +@@ -91,9 +91,9 @@ NAN_PROPERTY_SETTER(NamedInterceptor::PropertySetter) { interceptor->buf , *Nan::Utf8String(value) , sizeof (interceptor->buf)); - info.GetReturnValue().Set(info.This()); -- } else { ++ info.GetReturnValue().Set(True()); + } else { - info.GetReturnValue().Set(info.This()); ++ info.GetReturnValue().Set(True()); } -+ info.GetReturnValue().Set(True()); + return Intercepted::Yes(); } - - NAN_PROPERTY_ENUMERATOR(NamedInterceptor::PropertyEnumerator) { diff --git a/patches/nan/fix_define_nan_copyablepersistenttraits_for_v8_12_5.patch b/patches/nan/fix_define_nan_copyablepersistenttraits_for_v8_12_5.patch deleted file mode 100644 index 5479a1e97ff9e..0000000000000 --- a/patches/nan/fix_define_nan_copyablepersistenttraits_for_v8_12_5.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: deepak1556 <hop2deep@gmail.com> -Date: Fri, 12 Apr 2024 22:16:58 +0900 -Subject: fix: define Nan::CopyablePersistentTraits for v8 >= 12.5 - -Refs https://chromium-review.googlesource.com/c/v8/v8/+/5403708 -Should be upstreamed. - -diff --git a/nan.h b/nan.h -index 2a68349448c163fa29af327a03b11678e61f5789..42285328055ddb7c76548258f3c4847d2c278ad6 100644 ---- a/nan.h -+++ b/nan.h -@@ -203,9 +203,11 @@ typedef v8::String::ExternalOneByteStringResource - template<typename T> - class NonCopyablePersistentTraits : - public v8::NonCopyablePersistentTraits<T> {}; -+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION <= 12 && V8_MINOR_VERSION < 5) - template<typename T> - class CopyablePersistentTraits : - public v8::CopyablePersistentTraits<T> {}; -+#endif - - template<typename T> - class PersistentBase : -diff --git a/nan_persistent_12_inl.h b/nan_persistent_12_inl.h -index d9649e867606c6356e393e9964b5607a08ea4e3a..ad89657e204259018f1e3814a864410a0917a915 100644 ---- a/nan_persistent_12_inl.h -+++ b/nan_persistent_12_inl.h -@@ -129,4 +129,15 @@ class Global : public v8::UniquePersistent<T> { - }; - #endif - -+#if defined(V8_MAJOR_VERSION) && ((V8_MAJOR_VERSION >= 12 && V8_MINOR_VERSION >= 5) || V8_MAJOR_VERSION >= 13) -+template<typename T> -+struct CopyablePersistentTraits { -+ typedef v8::Persistent<T, CopyablePersistentTraits<T> > CopyablePersistent; -+ static const bool kResetInDestructor = true; -+ template<typename S, typename M> -+ static inline void Copy(const v8::Persistent<S, M> &source, -+ CopyablePersistent *dest) {} -+}; -+#endif -+ - #endif // NAN_PERSISTENT_12_INL_H_ diff --git a/patches/nan/fix_replace_deprecated_get_setprototype.patch b/patches/nan/fix_replace_deprecated_get_setprototype.patch index e1dc28af2e2c2..9e0a3a494e72e 100644 --- a/patches/nan/fix_replace_deprecated_get_setprototype.patch +++ b/patches/nan/fix_replace_deprecated_get_setprototype.patch @@ -8,7 +8,7 @@ https://chromium-review.googlesource.com/c/v8/v8/+/6983465 Replaces the deprecated usage of SetPrototype. diff --git a/nan_maybe_43_inl.h b/nan_maybe_43_inl.h -index c04ce30d2fa3bfb555c96754d93de64e8a83e36b..aa06dbad2f0b3d564917dbcd29ac608ad468327b 100644 +index f37ce9732d556b58e4b755e1688cfb481ee40b61..8c3362e5d9dfeac385089100bf6414f628a98f33 100644 --- a/nan_maybe_43_inl.h +++ b/nan_maybe_43_inl.h @@ -207,7 +207,7 @@ inline Maybe<bool> SetPrototype( @@ -21,7 +21,7 @@ index c04ce30d2fa3bfb555c96754d93de64e8a83e36b..aa06dbad2f0b3d564917dbcd29ac608a inline MaybeLocal<v8::String> ObjectProtoToString( diff --git a/nan_maybe_pre_43_inl.h b/nan_maybe_pre_43_inl.h -index 83325ae0897f95f2fe5354e9ab720796a7cefd7c..c309ace8c69feb6d01f136d4c0a33443886c467a 100644 +index 84e2c11c26d5706bf345d347bc405b90bd14607c..4e0cfa183405142aa3013080d0f938dd2d731168 100644 --- a/nan_maybe_pre_43_inl.h +++ b/nan_maybe_pre_43_inl.h @@ -174,7 +174,7 @@ MaybeLocal<v8::Array> GetOwnPropertyNames(v8::Handle<v8::Object> obj) { diff --git a/patches/nan/fix_replace_usage_of_removed_writeutf8_with_writeutf8v2.patch b/patches/nan/fix_replace_usage_of_removed_writeutf8_with_writeutf8v2.patch index 369ccb946f410..ff87e083bc9e8 100644 --- a/patches/nan/fix_replace_usage_of_removed_writeutf8_with_writeutf8v2.patch +++ b/patches/nan/fix_replace_usage_of_removed_writeutf8_with_writeutf8v2.patch @@ -6,10 +6,10 @@ Subject: fix: replace usage of removed WriteUtf8 with WriteUtf8V2 Refs https://chromium-review.googlesource.com/c/v8/v8/+/6495189 diff --git a/nan.h b/nan.h -index f4865a77e60d5105ed2426037984ddcbfa58bbca..d0b3e919f275bd4451eef9ad6aa1a78629ce862c 100644 +index f0bfc0c6cc01b97156cb900615ec2df4b70ef5e8..0f120365630e7e2a37964f09cc129d05c6648c90 100644 --- a/nan.h +++ b/nan.h -@@ -418,12 +418,18 @@ template<typename P> class WeakCallbackInfo; +@@ -427,12 +427,18 @@ template<typename P> class WeakCallbackInfo; namespace imp { static const size_t kMaxLength = 0x3fffffff; @@ -31,7 +31,7 @@ index f4865a77e60d5105ed2426037984ddcbfa58bbca..d0b3e919f275bd4451eef9ad6aa1a786 static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8; #else static const unsigned kReplaceInvalidUtf8 = 0; -@@ -1157,11 +1163,11 @@ class Utf8String { +@@ -1167,11 +1173,11 @@ class Utf8String { str_ = static_cast<char*>(malloc(len)); assert(str_ != 0); } @@ -47,7 +47,7 @@ index f4865a77e60d5105ed2426037984ddcbfa58bbca..d0b3e919f275bd4451eef9ad6aa1a786 #else // See https://github.com/nodejs/nan/issues/832. // Disable the warning as there is no way around it. -@@ -1173,6 +1179,8 @@ class Utf8String { +@@ -1183,6 +1189,8 @@ class Utf8String { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif @@ -56,7 +56,7 @@ index f4865a77e60d5105ed2426037984ddcbfa58bbca..d0b3e919f275bd4451eef9ad6aa1a786 length_ = string->WriteUtf8(str_, static_cast<int>(len), 0, flags); #ifdef __GNUC__ #pragma GCC diagnostic pop -@@ -1499,9 +1507,10 @@ class Utf8String { +@@ -1509,9 +1517,10 @@ class Utf8String { str_ = static_cast<char*>(malloc(len)); assert(str_ != 0); } diff --git a/patches/nan/fix_support_new_variant_of_namedpropertyhandlerconfiguration_and.patch b/patches/nan/fix_support_new_variant_of_namedpropertyhandlerconfiguration_and.patch deleted file mode 100644 index 688b76a5bf8da..0000000000000 --- a/patches/nan/fix_support_new_variant_of_namedpropertyhandlerconfiguration_and.patch +++ /dev/null @@ -1,220 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samuel Attard <marshallofsound@electronjs.org> -Date: Fri, 28 Jun 2024 11:45:44 -0700 -Subject: fix: support new variant of NamedPropertyHandlerConfiguration and - IndexedPropertyHandlerConfiguration - -Ref: https://chromium-review.googlesource.com/c/v8/v8/+/5630388 - -This should be upstreamed, the reinterpret_cast is funky but works, but require more review when upstreaming. - -diff --git a/nan_callbacks_12_inl.h b/nan_callbacks_12_inl.h -index bbcde4d65dec73139fee53339f154babd8f83b28..1af2459efcf54fa97ff24aaa221892eede6eb0d3 100644 ---- a/nan_callbacks_12_inl.h -+++ b/nan_callbacks_12_inl.h -@@ -255,7 +255,98 @@ typedef void (*NativeSetter)( - , const v8::PropertyCallbackInfo<void> &); - #endif - --#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION -+#if NODE_MODULE_VERSION > NODE_21_0_MODULE_VERSION -+static -+v8::Intercepted PropertyGetterCallbackWrapper( -+ v8::Local<v8::Name> property -+ , const v8::PropertyCallbackInfo<v8::Value> &info) { -+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>(); -+ PropertyCallbackInfo<v8::Value> -+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>()); -+ PropertyGetterCallback callback = reinterpret_cast<PropertyGetterCallback>( -+ reinterpret_cast<intptr_t>( -+ obj->GetInternalField(kPropertyGetterIndex) -+ .As<v8::Value>().As<v8::External>()->Value())); -+ callback(property.As<v8::String>(), cbinfo); -+ return v8::Intercepted::kYes; -+} -+ -+typedef v8::Intercepted (*NativePropertyGetter) -+ (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &); -+ -+static -+v8::Intercepted PropertySetterCallbackWrapper( -+ v8::Local<v8::Name> property -+ , v8::Local<v8::Value> value -+ , const v8::PropertyCallbackInfo<void> &info) { -+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>(); -+ PropertyCallbackInfo<void> -+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>()); -+ PropertySetterCallback callback = reinterpret_cast<PropertySetterCallback>( -+ reinterpret_cast<intptr_t>( -+ obj->GetInternalField(kPropertySetterIndex) -+ .As<v8::Value>().As<v8::External>()->Value())); -+ callback(property.As<v8::String>(), value, *reinterpret_cast<PropertyCallbackInfo<v8::Value>*>(&cbinfo)); -+ return v8::Intercepted::kYes; -+} -+ -+typedef v8::Intercepted (*NativePropertySetter)( -+ v8::Local<v8::Name> -+ , v8::Local<v8::Value> -+ , const v8::PropertyCallbackInfo<void> &); -+ -+static -+void PropertyEnumeratorCallbackWrapper( -+ const v8::PropertyCallbackInfo<v8::Array> &info) { -+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>(); -+ PropertyCallbackInfo<v8::Array> -+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>()); -+ PropertyEnumeratorCallback callback = -+ reinterpret_cast<PropertyEnumeratorCallback>(reinterpret_cast<intptr_t>( -+ obj->GetInternalField(kPropertyEnumeratorIndex) -+ .As<v8::Value>().As<v8::External>()->Value())); -+ callback(cbinfo); -+} -+ -+typedef void (*NativePropertyEnumerator) -+ (const v8::PropertyCallbackInfo<v8::Array> &); -+ -+static -+v8::Intercepted PropertyDeleterCallbackWrapper( -+ v8::Local<v8::Name> property -+ , const v8::PropertyCallbackInfo<v8::Boolean> &info) { -+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>(); -+ PropertyCallbackInfo<v8::Boolean> -+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>()); -+ PropertyDeleterCallback callback = reinterpret_cast<PropertyDeleterCallback>( -+ reinterpret_cast<intptr_t>( -+ obj->GetInternalField(kPropertyDeleterIndex) -+ .As<v8::Value>().As<v8::External>()->Value())); -+ callback(property.As<v8::String>(), cbinfo); -+ return v8::Intercepted::kYes; -+} -+ -+typedef v8::Intercepted (NativePropertyDeleter) -+ (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Boolean> &); -+ -+static -+v8::Intercepted PropertyQueryCallbackWrapper( -+ v8::Local<v8::Name> property -+ , const v8::PropertyCallbackInfo<v8::Integer> &info) { -+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>(); -+ PropertyCallbackInfo<v8::Integer> -+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>()); -+ PropertyQueryCallback callback = reinterpret_cast<PropertyQueryCallback>( -+ reinterpret_cast<intptr_t>( -+ obj->GetInternalField(kPropertyQueryIndex) -+ .As<v8::Value>().As<v8::External>()->Value())); -+ callback(property.As<v8::String>(), cbinfo); -+ return v8::Intercepted::kYes; -+} -+ -+typedef v8::Intercepted (*NativePropertyQuery) -+ (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Integer> &); -+#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION - static - void PropertyGetterCallbackWrapper( - v8::Local<v8::Name> property -@@ -431,6 +522,96 @@ typedef void (*NativePropertyQuery) - (v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Integer> &); - #endif - -+#if NODE_MODULE_VERSION > NODE_21_0_MODULE_VERSION -+static -+v8::Intercepted IndexGetterCallbackWrapper( -+ uint32_t index, const v8::PropertyCallbackInfo<v8::Value> &info) { -+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>(); -+ PropertyCallbackInfo<v8::Value> -+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>()); -+ IndexGetterCallback callback = reinterpret_cast<IndexGetterCallback>( -+ reinterpret_cast<intptr_t>( -+ obj->GetInternalField(kIndexPropertyGetterIndex) -+ .As<v8::Value>().As<v8::External>()->Value())); -+ callback(index, cbinfo); -+ return v8::Intercepted::kYes; -+} -+ -+typedef v8::Intercepted (*NativeIndexGetter) -+ (uint32_t, const v8::PropertyCallbackInfo<v8::Value> &); -+ -+static -+v8::Intercepted IndexSetterCallbackWrapper( -+ uint32_t index -+ , v8::Local<v8::Value> value -+ , const v8::PropertyCallbackInfo<void> &info) { -+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>(); -+ PropertyCallbackInfo<void> -+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>()); -+ IndexSetterCallback callback = reinterpret_cast<IndexSetterCallback>( -+ reinterpret_cast<intptr_t>( -+ obj->GetInternalField(kIndexPropertySetterIndex) -+ .As<v8::Value>().As<v8::External>()->Value())); -+ callback(index, value, *reinterpret_cast<PropertyCallbackInfo<v8::Value>*>(&cbinfo)); -+ return v8::Intercepted::kYes; -+} -+ -+typedef v8::Intercepted (*NativeIndexSetter)( -+ uint32_t -+ , v8::Local<v8::Value> -+ , const v8::PropertyCallbackInfo<void> &); -+ -+static -+void IndexEnumeratorCallbackWrapper( -+ const v8::PropertyCallbackInfo<v8::Array> &info) { -+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>(); -+ PropertyCallbackInfo<v8::Array> -+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>()); -+ IndexEnumeratorCallback callback = reinterpret_cast<IndexEnumeratorCallback>( -+ reinterpret_cast<intptr_t>( -+ obj->GetInternalField( -+ kIndexPropertyEnumeratorIndex) -+ .As<v8::Value>().As<v8::External>()->Value())); -+ callback(cbinfo); -+} -+ -+typedef void (*NativeIndexEnumerator) -+ (const v8::PropertyCallbackInfo<v8::Array> &); -+ -+static -+v8::Intercepted IndexDeleterCallbackWrapper( -+ uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean> &info) { -+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>(); -+ PropertyCallbackInfo<v8::Boolean> -+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>()); -+ IndexDeleterCallback callback = reinterpret_cast<IndexDeleterCallback>( -+ reinterpret_cast<intptr_t>( -+ obj->GetInternalField(kIndexPropertyDeleterIndex) -+ .As<v8::Value>().As<v8::External>()->Value())); -+ callback(index, cbinfo); -+ return v8::Intercepted::kYes; -+} -+ -+typedef v8::Intercepted (*NativeIndexDeleter) -+ (uint32_t, const v8::PropertyCallbackInfo<v8::Boolean> &); -+ -+static -+v8::Intercepted IndexQueryCallbackWrapper( -+ uint32_t index, const v8::PropertyCallbackInfo<v8::Integer> &info) { -+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>(); -+ PropertyCallbackInfo<v8::Integer> -+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>()); -+ IndexQueryCallback callback = reinterpret_cast<IndexQueryCallback>( -+ reinterpret_cast<intptr_t>( -+ obj->GetInternalField(kIndexPropertyQueryIndex) -+ .As<v8::Value>().As<v8::External>()->Value())); -+ callback(index, cbinfo); -+ return v8::Intercepted::kYes; -+} -+ -+typedef v8::Intercepted (*NativeIndexQuery) -+ (uint32_t, const v8::PropertyCallbackInfo<v8::Integer> &); -+#else - static - void IndexGetterCallbackWrapper( - uint32_t index, const v8::PropertyCallbackInfo<v8::Value> &info) { -@@ -515,6 +696,8 @@ void IndexQueryCallbackWrapper( - - typedef void (*NativeIndexQuery) - (uint32_t, const v8::PropertyCallbackInfo<v8::Integer> &); -+#endif -+ - } // end of namespace imp - - #endif // NAN_CALLBACKS_12_INL_H_ diff --git a/patches/nan/remove_deprecated_v8_isolate_idlenotificationdeadline.patch b/patches/nan/remove_deprecated_v8_isolate_idlenotificationdeadline.patch deleted file mode 100644 index e8faa2277cf9c..0000000000000 --- a/patches/nan/remove_deprecated_v8_isolate_idlenotificationdeadline.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: John Kleinschmidt <jkleinsc@electronjs.org> -Date: Thu, 6 Jun 2024 15:16:49 -0400 -Subject: Remove deprecated v8::Isolate::IdleNotificationDeadline - -See https://chromium-review.googlesource.com/c/v8/v8/+/5539852 - -Also https://github.com/nodejs/nan/issues/953#issuecomment-1791163429 - -diff --git a/nan.h b/nan.h -index 42285328055ddb7c76548258f3c4847d2c278ad6..9a9112afe0cc94ce58ed3cce9763ace7c160a932 100644 ---- a/nan.h -+++ b/nan.h -@@ -684,7 +684,13 @@ inline uv_loop_t* GetCurrentEventLoop() { - v8::Isolate::GetCurrent()->SetAddHistogramSampleFunction(cb); - } - --#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ -+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 11 || \ -+ (V8_MAJOR_VERSION == 11 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -+ inline bool IdleNotification(int idle_time_in_ms) { -+ v8::Isolate::GetCurrent()->MemoryPressureNotification(v8::MemoryPressureLevel::kModerate); -+ return true; -+ } -+#elif defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - inline bool IdleNotification(int idle_time_in_ms) { - return v8::Isolate::GetCurrent()->IdleNotificationDeadline( diff --git a/patches/nan/remove_several_apis_deprecated_in_version_12_6.patch b/patches/nan/remove_several_apis_deprecated_in_version_12_6.patch deleted file mode 100644 index eb9d213975b94..0000000000000 --- a/patches/nan/remove_several_apis_deprecated_in_version_12_6.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: John Kleinschmidt <jkleinsc@electronjs.org> -Date: Thu, 6 Jun 2024 15:17:39 -0400 -Subject: Remove several APIs deprecated in version 12.6 - -See https://chromium-review.googlesource.com/c/v8/v8/+/5539888 - -ScriptOrigin constructor with isolate has been removed; -Deprecation instructions were to "Use constructor without the isolate." - -diff --git a/nan_scriptorigin.h b/nan_scriptorigin.h -index ce79cdf8dc931d61633c74079a4c38efd3c785ed..85202aaba148540644d39ea2cdf88de0dd101fe4 100644 ---- a/nan_scriptorigin.h -+++ b/nan_scriptorigin.h -@@ -11,7 +11,25 @@ - - class ScriptOrigin : public v8::ScriptOrigin { - public: --#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 9 || \ -+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \ -+ (V8_MAJOR_VERSION == 12 && (defined(V8_MINOR_VERSION) && (V8_MINOR_VERSION > 6\ -+ || (V8_MINOR_VERSION == 7 && defined(V8_BUILD_NUMBER) \ -+ && V8_BUILD_NUMBER >= 1))))) -+ explicit ScriptOrigin(v8::Local<v8::Value> name) : -+ v8::ScriptOrigin(name) {} -+ -+ ScriptOrigin(v8::Local<v8::Value> name -+ , v8::Local<v8::Integer> line) : -+ v8::ScriptOrigin(name -+ , To<int32_t>(line).FromMaybe(0)) {} -+ -+ ScriptOrigin(v8::Local<v8::Value> name -+ , v8::Local<v8::Integer> line -+ , v8::Local<v8::Integer> column) : -+ v8::ScriptOrigin(name -+ , To<int32_t>(line).FromMaybe(0) -+ , To<int32_t>(column).FromMaybe(0)) {} -+#elif defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 9 || \ - (V8_MAJOR_VERSION == 9 && (defined(V8_MINOR_VERSION) && (V8_MINOR_VERSION > 0\ - || (V8_MINOR_VERSION == 0 && defined(V8_BUILD_NUMBER) \ - && V8_BUILD_NUMBER >= 1))))) diff --git a/patches/nan/test_use_v8_version_check_instead_of_node_version_check.patch b/patches/nan/test_use_v8_version_check_instead_of_node_version_check.patch new file mode 100644 index 0000000000000..63eea29e2a52a --- /dev/null +++ b/patches/nan/test_use_v8_version_check_instead_of_node_version_check.patch @@ -0,0 +1,61 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Calvin Watford <clavin@electronjs.org> +Date: Mon, 20 Oct 2025 10:04:13 -0600 +Subject: test: use v8 version check instead of node version check + +A few tests use a Node.js version check to determine expected V8 +behavior, but since Electron ships with a different V8 version than +Node.js, this can lead to incorrect test expectations. This change +updates the tests to use the V8 version directly for more accurate +results. + +The existing check was for Node.js version > 22. Node.js v22 ships with +V8 v12.4, and Node.js v23 ships with V8 v12.9. So, the new check uses +V8 version >= 12.9 to match the previous behavior. The actual V8 +behavior change may have occurred somewhere between those versions, so +further work should verify the exact cutoff. + +This patch should be upstreamed. The only additional work is to verify +the V8 version to check against. + +diff --git a/test/js/accessors-test.js b/test/js/accessors-test.js +index 85ff490c0a23277f54ceaeae2f98ceb24f4d5727..21064e1eae8d64c79a0e77a3785945a9b49e60c4 100644 +--- a/test/js/accessors-test.js ++++ b/test/js/accessors-test.js +@@ -9,12 +9,12 @@ + const test = require('tap').test + , testRoot = require('path').resolve(__dirname, '..') + , bindings = require('bindings')({ module_root: testRoot, bindings: 'accessors' }); +-const nodeVersion = parseInt(process.versions.node.split('.')[0]); ++const v8Version = process.versions.v8.split('.').map(parseInt); + + test('accessors', function (t) { + var settergetter = bindings.create() + var derived = Object.create(settergetter) +- if(nodeVersion > 22){ ++ if(v8Version[0] > 12 || (v8Version[0] === 12 && v8Version[1] >= 9)) { + t.plan(9) + t.equal(settergetter.prop1, 'this is property 1') + t.ok(settergetter.prop2 === '') +diff --git a/test/js/methodswithdata-test.js b/test/js/methodswithdata-test.js +index dec024a3d8b6a117d0d0a20ffa13e25088938dc9..8458272def0739c3edc111e6122f676b44e04fd7 100644 +--- a/test/js/methodswithdata-test.js ++++ b/test/js/methodswithdata-test.js +@@ -9,7 +9,7 @@ + const test = require('tap').test + , testRoot = require('path').resolve(__dirname, '..') + , bindings = require('bindings')({ module_root: testRoot, bindings: 'methodswithdata' }) +-const nodeVersion = parseInt(process.versions.node.split('.')[0]); ++const v8Version = process.versions.v8.split('.').map(parseInt); + + test('SetMethod with data', function (t) { + t.plan(1); +@@ -19,7 +19,7 @@ test('SetMethod with data', function (t) { + test('accessors with data', function (t) { + var settergetter = bindings.create() + var derived = Object.create(settergetter) +- if (nodeVersion > 22) { ++ if(v8Version[0] > 12 || (v8Version[0] === 12 && v8Version[1] >= 9)) { + t.plan(9) + t.equal(settergetter.prop1, 'this is property 1') + t.ok(settergetter.prop2 === '') diff --git a/patches/nan/use_new_constructor_for_scriptorigin_when_17_x.patch b/patches/nan/use_new_constructor_for_scriptorigin_when_17_x.patch deleted file mode 100644 index da73959ba262e..0000000000000 --- a/patches/nan/use_new_constructor_for_scriptorigin_when_17_x.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jeremy Rose <japthorp@slack-corp.com> -Date: Thu, 5 May 2022 14:14:36 -0700 -Subject: use new constructor for ScriptOrigin when >= 17.x - -https://chromium-review.googlesource.com/c/v8/v8/+/3395880 - -Also -See https://chromium-review.googlesource.com/c/v8/v8/+/5539888 -ScriptOrigin constructor with isolate has been removed; - -diff --git a/test/cpp/news.cpp b/test/cpp/news.cpp -index a218167c7e3a5ec90c6668943cb395dba2bbe3a7..b1fa6e2a77e926e38006bf47ffcda2ae86555d17 100644 ---- a/test/cpp/news.cpp -+++ b/test/cpp/news.cpp -@@ -115,7 +115,7 @@ NAN_METHOD(NewScript) { - - NAN_METHOD(NewScript2) { - v8::ScriptOrigin origin( --#if NODE_MODULE_VERSION >= NODE_18_0_MODULE_VERSION -+#if NODE_MODULE_VERSION >= NODE_17_0_MODULE_VERSION && NODE_MODULE_VERSION < NODE_20_0_MODULE_VERSION - info.GetIsolate(), - #endif - New<v8::String>("x").ToLocalChecked()); -@@ -136,7 +136,7 @@ NAN_METHOD(CompileScript) { - - NAN_METHOD(CompileScript2) { - v8::ScriptOrigin origin( --#if NODE_MODULE_VERSION >= NODE_18_0_MODULE_VERSION -+#if NODE_MODULE_VERSION >= NODE_17_0_MODULE_VERSION && NODE_MODULE_VERSION < NODE_20_0_MODULE_VERSION - info.GetIsolate(), - #endif - New<v8::String>("x").ToLocalChecked()); diff --git a/script/nan-spec-runner.js b/script/nan-spec-runner.js index e4675cb8981f2..2c40c1e850f1f 100644 --- a/script/nan-spec-runner.js +++ b/script/nan-spec-runner.js @@ -65,6 +65,12 @@ async function main () { platformFlags.push(`-isysroot ${path.resolve(sdkPath, sdkToUse)}`); } + const cflags = [ + '-Wno-trigraphs', + '-fPIC', + ...platformFlags + ].join(' '); + const cxxflags = [ '-std=c++20', '-Wno-trigraphs', @@ -92,10 +98,10 @@ async function main () { if (process.platform !== 'win32') { env.CC = cc; - env.CFLAGS = cxxflags; + env.CFLAGS = cflags; env.CXX = cxx; - env.LD = ld; env.CXXFLAGS = cxxflags; + env.LD = ld; env.LDFLAGS = ldflags; } @@ -129,9 +135,9 @@ async function main () { const DISABLED_TESTS = new Set([ 'nannew-test.js', 'buffer-test.js', - // we can't patch this test because it uses CRLF line endings - 'methodswithdata-test.js', - // these two are incompatible with crrev.com/c/4733273 + // These two are incompatible with crrev.com/c/4733273 + // They are disabled upstream starting in "Node.js 24" (note: the incompatible change above + // landed in V8 v13.7), so we can remove them from this list once we upgrade Node.js to 24. 'weak-test.js', 'weak2-test.js' ]); From 359ff9bc458ac963a8f9d9577fe5e0ffb65830ce Mon Sep 17 00:00:00 2001 From: Ruben R <nilay2014@gmail.com> Date: Thu, 23 Oct 2025 14:20:04 -0500 Subject: [PATCH 163/268] fix: remove `killed` check to allow multiple signals (#40667) * fix: remove `killed` check to allow multiple signals * fix: signal forwarding --- npm/cli.js | 5 ++++- script/start.js | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/npm/cli.js b/npm/cli.js index 7dbb3d5a3c0cf..026f0f2b46f21 100755 --- a/npm/cli.js +++ b/npm/cli.js @@ -5,7 +5,9 @@ const proc = require('child_process'); const electron = require('./'); const child = proc.spawn(electron, process.argv.slice(2), { stdio: 'inherit', windowsHide: false }); +let childClosed = false; child.on('close', function (code, signal) { + childClosed = true; if (code === null) { console.error(electron, 'exited with signal', signal); process.exit(1); @@ -15,7 +17,7 @@ child.on('close', function (code, signal) { const handleTerminationSignal = function (signal) { process.on(signal, function signalHandler () { - if (!child.killed) { + if (!childClosed) { child.kill(signal); } }); @@ -23,3 +25,4 @@ const handleTerminationSignal = function (signal) { handleTerminationSignal('SIGINT'); handleTerminationSignal('SIGTERM'); +handleTerminationSignal('SIGUSR2'); diff --git a/script/start.js b/script/start.js index 4f158e3f931f2..b4c5b127a29aa 100644 --- a/script/start.js +++ b/script/start.js @@ -5,11 +5,15 @@ const utils = require('./lib/utils'); const electronPath = utils.getAbsoluteElectronExec(); const child = cp.spawn(electronPath, process.argv.slice(2), { stdio: 'inherit' }); -child.on('close', (code) => process.exit(code)); +let childClosed = false; +child.on('close', (code) => { + childClosed = true; + process.exit(code); +}); const handleTerminationSignal = (signal) => process.on(signal, () => { - if (!child.killed) { + if (!childClosed) { child.kill(signal); } }); From 5d53790d032ef27029fccc57a92d5cedffda1ca0 Mon Sep 17 00:00:00 2001 From: Teaveloper <nilay2014@gmail.com> Date: Thu, 23 Oct 2025 22:11:55 +0200 Subject: [PATCH 164/268] =?UTF-8?q?docs:=20security.md=20mark=20'Enable=20?= =?UTF-8?q?process=20sandboxing'=20as=20active=20by=20defau=E2=80=A6=20(#4?= =?UTF-8?q?3247)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: security.md mark 'Enable process sandboxing' as active by default since electron 20 * Adjusted according to feedback * Updated according to feedback - adjusted sandbox.md * formatting * Fixed broken markup * Implemented docs linting suggestions * docs: docs/tutorial/sandbox.md - fixed typo Co-authored-by: Erick Zhao <erick@hotmail.ca> * docs: web-preferences.md - sandbox: mention default value and relation to nodeIntegration --------- Co-authored-by: Erick Zhao <erick@hotmail.ca> --- docs/api/structures/web-preferences.md | 4 +++- docs/tutorial/sandbox.md | 15 +++++++++++++-- docs/tutorial/security.md | 14 ++++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/docs/api/structures/web-preferences.md b/docs/api/structures/web-preferences.md index b0ca4cc1090c6..ceb55730148e2 100644 --- a/docs/api/structures/web-preferences.md +++ b/docs/api/structures/web-preferences.md @@ -21,7 +21,9 @@ associated with the window, making it compatible with the Chromium OS-level sandbox and disabling the Node.js engine. This is not the same as the `nodeIntegration` option and the APIs available to the preload script - are more limited. Read more about the option [here](../../tutorial/sandbox.md). + are more limited. Default is `true` since Electron 20. The sandbox will + automatically be disabled when `nodeIntegration` is set to `true`. + Read more about the option [here](../../tutorial/sandbox.md). * `session` [Session](../session.md#class-session) (optional) - Sets the session used by the page. Instead of passing the Session object directly, you can also choose to use the `partition` option instead, which accepts a partition string. When diff --git a/docs/tutorial/sandbox.md b/docs/tutorial/sandbox.md index 2580f1d92bc56..cbc0d13ae3ede 100644 --- a/docs/tutorial/sandbox.md +++ b/docs/tutorial/sandbox.md @@ -13,7 +13,13 @@ the GPU service and the network service. See Chromium's [Sandbox design document][sandbox] for more information. Starting from Electron 20, the sandbox is enabled for renderer processes without any -further configuration. If you want to disable the sandbox for a process, see the +further configuration. + +Sandboxing is tied to Node.js integration. _Enabling Node.js integration_ for a +renderer process by setting `nodeIntegration: true` _disables the sandbox_ for the +process. + +If you want to disable the sandbox for a process, see the [Disabling the sandbox for a single process](#disabling-the-sandbox-for-a-single-process) section. @@ -98,7 +104,8 @@ app.whenReady().then(() => { ``` Sandboxing is also disabled whenever Node.js integration is enabled in the renderer. -This can be done through the BrowserWindow constructor with the `nodeIntegration: true` flag. +This can be done through the BrowserWindow constructor with the `nodeIntegration: true` flag +or by providing the respective HTML boolean attribute for a `webview`. ```js title='main.js' app.whenReady().then(() => { @@ -111,6 +118,10 @@ app.whenReady().then(() => { }) ``` +```html title='index.html (Renderer Process)' +<webview nodeIntegration src="page.html"></webview> +``` + ### Enabling the sandbox globally If you want to force sandboxing for all renderers, you can also use the diff --git a/docs/tutorial/security.md b/docs/tutorial/security.md index f7dcd3ebe5b8b..3bbbd139dae79 100644 --- a/docs/tutorial/security.md +++ b/docs/tutorial/security.md @@ -244,6 +244,10 @@ to enable this behavior. Even when `nodeIntegration: false` is used, to truly enforce strong isolation and prevent the use of Node primitives `contextIsolation` **must** also be used. +Beware that _disabling context isolation_ for a renderer process by setting +`nodeIntegration: true` _also disables process sandboxing_ for that process. +See section below. + :::info For more information on what `contextIsolation` is and how to enable it please see our dedicated [Context Isolation](context-isolation.md) document. @@ -251,6 +255,16 @@ see our dedicated [Context Isolation](context-isolation.md) document. ### 4. Enable process sandboxing +:::info +This recommendation is the default behavior in Electron since 20.0.0. + +Additionally, process sandboxing can be enforced for all renderer processes +application wide: [Enabling the sandbox globally](sandbox.md#enabling-the-sandbox-globally) + +_Disabling context isolation_ (see above) _also disables process sandboxing_, +regardless of the default, `sandbox: false` or globally enabled sandboxing! +::: + [Sandboxing](https://chromium.googlesource.com/chromium/src/+/HEAD/docs/design/sandbox.md) is a Chromium feature that uses the operating system to significantly limit what renderer processes have access to. You should enable From 12ba6444c779f48f7fd570f1dd923b7d89058c3c Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Thu, 23 Oct 2025 16:28:51 -0400 Subject: [PATCH 165/268] chore: bump chromium to 143.0.7489.0 (main) (#48642) * chore: bump chromium in DEPS to 143.0.7489.0 * chore: update add_didinstallconditionalfeatures.patch no manual changes; patch applied with fuzz * chore: update allow_in-process_windows_to_have_different_web_prefs.patch patch reapplied manually due to context shear Remove BackForwardTransitions flag | https://chromium-review.googlesource.com/c/chromium/src/+/7022596 * chore: update process_singleton.patch patch reapplied manually due to context shear Use an empty prefix for socket temporary directory. | https://chromium-review.googlesource.com/c/chromium/src/+/7062192 * chore: update add_electron_deps_to_license_credits_file.patch no manual changes; patch applied with fuzz * chore: update expose_ripemd160.patch Apply modernize-use-nullptr fixes in all .cc files | https://boringssl-review.googlesource.com/c/boringssl/+/83067 * chore: update feat_expose_several_extra_cipher_functions.patch Apply modernize-use-nullptr fixes in all .cc files | https://boringssl-review.googlesource.com/c/boringssl/+/83067 * Pass Bus::Options by value with std::move. | https://chromium-review.googlesource.com/c/chromium/src/+/7056670 * chore: update patches * Remove some includes of base/callback_list.h | https://chromium-review.googlesource.com/c/chromium/src/+/7055621 * chore: run gen-libc++-filenames.js --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> --- DEPS | 2 +- filenames.libcxx.gni | 1 - patches/boringssl/expose_ripemd160.patch | 24 +++--- ...xpose_several_extra_cipher_functions.patch | 86 +++++++++---------- ...ack_ssl_error_zero_return_explicitly.patch | 4 +- .../add_didinstallconditionalfeatures.patch | 16 ++-- ...lectron_deps_to_license_credits_file.patch | 6 +- ..._scheduler_throttling_per_renderview.patch | 12 +-- ..._windows_to_have_different_web_prefs.patch | 28 +++--- patches/chromium/blink_local_frame.patch | 2 +- ..._depend_on_packed_resource_integrity.patch | 14 +-- patches/chromium/build_gn.patch | 2 +- patches/chromium/can_create_window.patch | 34 ++++---- ...ameter_in_script_lifecycle_observers.patch | 14 +-- ..._introduce_blocking_api_for_electron.patch | 4 +- ...fy_chromium_handling_of_mouse_events.patch | 16 ++-- .../chromium/chore_partial_revert_of.patch | 4 +- ...screationoverridden_with_full_params.patch | 14 +-- .../chromium/enable_reset_aspect_ratio.patch | 6 +- ...xpose_setuseragent_on_networkcontext.patch | 10 +-- .../extend_apply_webpreferences.patch | 4 +- ...t_allow_code_cache_in_custom_schemes.patch | 6 +- ...moothing_css_rule_and_blink_painting.patch | 2 +- ...allback_for_sync_and_async_clipboard.patch | 2 +- ...dless_mode_handling_in_native_widget.patch | 6 +- .../fix_aspect_ratio_with_max_size.patch | 4 +- ...ding_non-standard_schemes_in_iframes.patch | 2 +- ...board_hides_on_input_blur_in_webview.patch | 4 +- ...x_remove_caption-removing_style_call.patch | 2 +- ..._material_update_issue_on_windows_11.patch | 6 +- ...from_localframe_requestexecutescript.patch | 14 +-- ...t_menu_item_when_opened_via_keyboard.patch | 6 +- patches/chromium/frame_host_manager.patch | 8 +- patches/chromium/gtk_visibility.patch | 2 +- ..._avoid_private_macos_api_usage.patch.patch | 26 +++--- ...emote_certificate_verification_logic.patch | 16 ++-- patches/chromium/process_singleton.patch | 4 +- ...r_changes_to_the_webcontentsobserver.patch | 4 +- ..._expose_file_system_access_blocklist.patch | 12 +-- ..._electron_permissiontypes_into_blink.patch | 2 +- ...efactor_unfilter_unresponsive_events.patch | 4 +- patches/chromium/resource_file_conflict.patch | 6 +- ...ean_up_stale_macwebcontentsocclusion.patch | 6 +- ...al_remove_unused_prehandlemouseevent.patch | 4 +- ...windowtreehostwin_window_enlargement.patch | 20 ++--- patches/chromium/scroll_bounce_flag.patch | 4 +- patches/chromium/web_contents.patch | 8 +- patches/chromium/webview_fullscreen.patch | 10 +-- ...i_to_allow_electron_to_set_dock_side.patch | 4 +- .../api/electron_api_web_view_manager.cc | 1 + shell/browser/ui/file_dialog_linux_portal.cc | 3 +- shell/browser/ui/x/x_window_utils.cc | 3 +- shell/browser/web_contents_zoom_controller.h | 1 + shell/browser/zoom_level_delegate.cc | 1 + shell/browser/zoom_level_delegate.h | 1 + 55 files changed, 253 insertions(+), 254 deletions(-) diff --git a/DEPS b/DEPS index 7e073a3818def..b5e446201f98b 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '143.0.7485.0', + '143.0.7489.0', 'node_version': 'v22.20.0', 'nan_version': diff --git a/filenames.libcxx.gni b/filenames.libcxx.gni index 026eb45ed200b..310b66fa36764 100644 --- a/filenames.libcxx.gni +++ b/filenames.libcxx.gni @@ -1369,7 +1369,6 @@ libcxx_headers = [ "//third_party/libc++/src/include/__tuple/sfinae_helpers.h", "//third_party/libc++/src/include/__tuple/tuple_element.h", "//third_party/libc++/src/include/__tuple/tuple_like.h", - "//third_party/libc++/src/include/__tuple/tuple_like_ext.h", "//third_party/libc++/src/include/__tuple/tuple_like_no_subrange.h", "//third_party/libc++/src/include/__tuple/tuple_size.h", "//third_party/libc++/src/include/__tuple/tuple_types.h", diff --git a/patches/boringssl/expose_ripemd160.patch b/patches/boringssl/expose_ripemd160.patch index 0e91bdcc7774a..f78887ad38c01 100644 --- a/patches/boringssl/expose_ripemd160.patch +++ b/patches/boringssl/expose_ripemd160.patch @@ -10,7 +10,7 @@ this patch is required to provide ripemd160 support in the nodejs crypto module. diff --git a/crypto/digest/digest_extra.cc b/crypto/digest/digest_extra.cc -index 345c94f6e26e88aac77b9feb92bd8d6665234981..8ef2ab8987da63f321d1dbb79f2eded8b8209bfc 100644 +index ea1709ae6b50faedc786c0eaeb5f9002fd0db7d8..5b0ed4dc6aaf3fafad034e9ecc62cd47b9e3034f 100644 --- a/crypto/digest/digest_extra.cc +++ b/crypto/digest/digest_extra.cc @@ -47,6 +47,7 @@ static const struct nid_to_digest nid_to_digest_mapping[] = { @@ -62,22 +62,22 @@ index 3a3bfd3f0560fcd7b5fdbdf4cc29a56e0346b90a..a7335ca03b5b3b918c4321d890b45649 + #undef CHECK diff --git a/decrepit/evp/evp_do_all.cc b/decrepit/evp/evp_do_all.cc -index e04b80cd6a1a215fc87f8fd8d750c3d258c3974f..8fdf1c624794f568bfc77b7b6b0c510b23905a4d 100644 +index feaf17c72cecb8099bc11ac10747fbad719ddca9..891a73f229e3f0838cb2fa99b8fb24fdeac1962b 100644 --- a/decrepit/evp/evp_do_all.cc +++ b/decrepit/evp/evp_do_all.cc @@ -79,6 +79,7 @@ void EVP_MD_do_all_sorted(void (*callback)(const EVP_MD *cipher, - callback(EVP_sha384(), "SHA384", NULL, arg); - callback(EVP_sha512(), "SHA512", NULL, arg); - callback(EVP_sha512_256(), "SHA512-256", NULL, arg); -+ callback(EVP_ripemd160(), "ripemd160", NULL, arg); + callback(EVP_sha384(), "SHA384", nullptr, arg); + callback(EVP_sha512(), "SHA512", nullptr, arg); + callback(EVP_sha512_256(), "SHA512-256", nullptr, arg); ++ callback(EVP_ripemd160(), "ripemd160", nullptr, arg); - callback(EVP_md4(), "md4", NULL, arg); - callback(EVP_md5(), "md5", NULL, arg); + callback(EVP_md4(), "md4", nullptr, arg); + callback(EVP_md5(), "md5", nullptr, arg); @@ -88,6 +89,7 @@ void EVP_MD_do_all_sorted(void (*callback)(const EVP_MD *cipher, - callback(EVP_sha384(), "sha384", NULL, arg); - callback(EVP_sha512(), "sha512", NULL, arg); - callback(EVP_sha512_256(), "sha512-256", NULL, arg); -+ callback(EVP_ripemd160(), "ripemd160", NULL, arg); + callback(EVP_sha384(), "sha384", nullptr, arg); + callback(EVP_sha512(), "sha512", nullptr, arg); + callback(EVP_sha512_256(), "sha512-256", nullptr, arg); ++ callback(EVP_ripemd160(), "ripemd160", nullptr, arg); } void EVP_MD_do_all(void (*callback)(const EVP_MD *cipher, const char *name, diff --git a/patches/boringssl/feat_expose_several_extra_cipher_functions.patch b/patches/boringssl/feat_expose_several_extra_cipher_functions.patch index f597b35e64321..13677b92e986f 100644 --- a/patches/boringssl/feat_expose_several_extra_cipher_functions.patch +++ b/patches/boringssl/feat_expose_several_extra_cipher_functions.patch @@ -64,59 +64,59 @@ index 6513df01c4b3e4d33fc6b521d9aae78ec5499e73..52eb7fea420e3d81d274fd5c1e21e4da const EVP_CIPHER *EVP_get_cipherbynid(int nid) { diff --git a/decrepit/evp/evp_do_all.cc b/decrepit/evp/evp_do_all.cc -index 8fdf1c624794f568bfc77b7b6b0c510b23905a4d..2e40c031e8c681fe921331b26dbf63f4df2fcf71 100644 +index 891a73f229e3f0838cb2fa99b8fb24fdeac1962b..f7d0c5dc66f016eb9338c15e7f5ef59e6de2969d 100644 --- a/decrepit/evp/evp_do_all.cc +++ b/decrepit/evp/evp_do_all.cc @@ -20,8 +20,10 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher, const char *unused, void *arg), void *arg) { - callback(EVP_aes_128_cbc(), "AES-128-CBC", NULL, arg); -+ callback(EVP_aes_128_cfb128(), "AES-128-CFB", NULL, arg); - callback(EVP_aes_192_cbc(), "AES-192-CBC", NULL, arg); - callback(EVP_aes_256_cbc(), "AES-256-CBC", NULL, arg); -+ callback(EVP_aes_256_cfb128(), "AES-256-CFB", NULL, arg); - callback(EVP_aes_128_ctr(), "AES-128-CTR", NULL, arg); - callback(EVP_aes_192_ctr(), "AES-192-CTR", NULL, arg); - callback(EVP_aes_256_ctr(), "AES-256-CTR", NULL, arg); + callback(EVP_aes_128_cbc(), "AES-128-CBC", nullptr, arg); ++ callback(EVP_aes_128_cfb128(), "AES-128-CFB", nullptr, arg); + callback(EVP_aes_192_cbc(), "AES-192-CBC", nullptr, arg); + callback(EVP_aes_256_cbc(), "AES-256-CBC", nullptr, arg); ++ callback(EVP_aes_256_cfb128(), "AES-256-CFB", nullptr, arg); + callback(EVP_aes_128_ctr(), "AES-128-CTR", nullptr, arg); + callback(EVP_aes_192_ctr(), "AES-192-CTR", nullptr, arg); + callback(EVP_aes_256_ctr(), "AES-256-CTR", nullptr, arg); @@ -34,9 +36,13 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher, - callback(EVP_aes_128_gcm(), "AES-128-GCM", NULL, arg); - callback(EVP_aes_192_gcm(), "AES-192-GCM", NULL, arg); - callback(EVP_aes_256_gcm(), "AES-256-GCM", NULL, arg); -+ callback(EVP_bf_cbc(), "BF-CBC", NULL, arg); -+ callback(EVP_bf_cfb(), "BF-CFB", NULL, arg); -+ callback(EVP_bf_ecb(), "BF-ECB", NULL, arg); - callback(EVP_des_cbc(), "DES-CBC", NULL, arg); - callback(EVP_des_ecb(), "DES-ECB", NULL, arg); - callback(EVP_des_ede(), "DES-EDE", NULL, arg); -+ callback(EVP_des_ede3(), "DES-EDE3", NULL, arg); - callback(EVP_des_ede_cbc(), "DES-EDE-CBC", NULL, arg); - callback(EVP_des_ede3_cbc(), "DES-EDE3-CBC", NULL, arg); - callback(EVP_rc2_cbc(), "RC2-CBC", NULL, arg); + callback(EVP_aes_128_gcm(), "AES-128-GCM", nullptr, arg); + callback(EVP_aes_192_gcm(), "AES-192-GCM", nullptr, arg); + callback(EVP_aes_256_gcm(), "AES-256-GCM", nullptr, arg); ++ callback(EVP_bf_cbc(), "BF-CBC", nullptr, arg); ++ callback(EVP_bf_cfb(), "BF-CFB", nullptr, arg); ++ callback(EVP_bf_ecb(), "BF-ECB", nullptr, arg); + callback(EVP_des_cbc(), "DES-CBC", nullptr, arg); + callback(EVP_des_ecb(), "DES-ECB", nullptr, arg); + callback(EVP_des_ede(), "DES-EDE", nullptr, arg); ++ callback(EVP_des_ede3(), "DES-EDE3", nullptr, arg); + callback(EVP_des_ede_cbc(), "DES-EDE-CBC", nullptr, arg); + callback(EVP_des_ede3_cbc(), "DES-EDE3-CBC", nullptr, arg); + callback(EVP_rc2_cbc(), "RC2-CBC", nullptr, arg); @@ -44,8 +50,10 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher, // OpenSSL returns everything twice, the second time in lower case. - callback(EVP_aes_128_cbc(), "aes-128-cbc", NULL, arg); -+ callback(EVP_aes_128_cfb128(), "aes-128-cfb", NULL, arg); - callback(EVP_aes_192_cbc(), "aes-192-cbc", NULL, arg); - callback(EVP_aes_256_cbc(), "aes-256-cbc", NULL, arg); -+ callback(EVP_aes_256_cfb128(), "aes-256-cfb", NULL, arg); - callback(EVP_aes_128_ctr(), "aes-128-ctr", NULL, arg); - callback(EVP_aes_192_ctr(), "aes-192-ctr", NULL, arg); - callback(EVP_aes_256_ctr(), "aes-256-ctr", NULL, arg); + callback(EVP_aes_128_cbc(), "aes-128-cbc", nullptr, arg); ++ callback(EVP_aes_128_cfb128(), "aes-128-cfb", nullptr, arg); + callback(EVP_aes_192_cbc(), "aes-192-cbc", nullptr, arg); + callback(EVP_aes_256_cbc(), "aes-256-cbc", nullptr, arg); ++ callback(EVP_aes_256_cfb128(), "aes-256-cfb", nullptr, arg); + callback(EVP_aes_128_ctr(), "aes-128-ctr", nullptr, arg); + callback(EVP_aes_192_ctr(), "aes-192-ctr", nullptr, arg); + callback(EVP_aes_256_ctr(), "aes-256-ctr", nullptr, arg); @@ -58,9 +66,13 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher, - callback(EVP_aes_128_gcm(), "aes-128-gcm", NULL, arg); - callback(EVP_aes_192_gcm(), "aes-192-gcm", NULL, arg); - callback(EVP_aes_256_gcm(), "aes-256-gcm", NULL, arg); -+ callback(EVP_bf_cbc(), "bf-cbc", NULL, arg); -+ callback(EVP_bf_cfb(), "bf-cfb", NULL, arg); -+ callback(EVP_bf_ecb(), "bf-ecb", NULL, arg); - callback(EVP_des_cbc(), "des-cbc", NULL, arg); - callback(EVP_des_ecb(), "des-ecb", NULL, arg); - callback(EVP_des_ede(), "des-ede", NULL, arg); -+ callback(EVP_des_ede3(), "des-ede3", NULL, arg); - callback(EVP_des_ede_cbc(), "des-ede-cbc", NULL, arg); - callback(EVP_des_ede3_cbc(), "des-ede3-cbc", NULL, arg); - callback(EVP_rc2_cbc(), "rc2-cbc", NULL, arg); + callback(EVP_aes_128_gcm(), "aes-128-gcm", nullptr, arg); + callback(EVP_aes_192_gcm(), "aes-192-gcm", nullptr, arg); + callback(EVP_aes_256_gcm(), "aes-256-gcm", nullptr, arg); ++ callback(EVP_bf_cbc(), "bf-cbc", nullptr, arg); ++ callback(EVP_bf_cfb(), "bf-cfb", nullptr, arg); ++ callback(EVP_bf_ecb(), "bf-ecb", nullptr, arg); + callback(EVP_des_cbc(), "des-cbc", nullptr, arg); + callback(EVP_des_ecb(), "des-ecb", nullptr, arg); + callback(EVP_des_ede(), "des-ede", nullptr, arg); ++ callback(EVP_des_ede3(), "des-ede3", nullptr, arg); + callback(EVP_des_ede_cbc(), "des-ede-cbc", nullptr, arg); + callback(EVP_des_ede3_cbc(), "des-ede3-cbc", nullptr, arg); + callback(EVP_rc2_cbc(), "rc2-cbc", nullptr, arg); diff --git a/include/openssl/cipher.h b/include/openssl/cipher.h index 13e68ad20ac08a462bb577d7f99e2c6f167579fa..4960d0eeb8f31bec4347ed2a1b63beba530de700 100644 --- a/include/openssl/cipher.h diff --git a/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch b/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch index be7e74afb2a9d..ab15299ae5cac 100644 --- a/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch +++ b/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch @@ -8,7 +8,7 @@ This reverts commit ebd8b8965c74ab06bb91f7a00b23822e1f1f26ca. It is causing significant TLS failures in Node.js. diff --git a/ssl/ssl_buffer.cc b/ssl/ssl_buffer.cc -index 2cdcbc346175eeee69402ecee7f169e61c655199..f7226fe711e4214b216ea2c5173a02124b80f9ef 100644 +index 8c5c7bcd96229cfcfb605bd4728c52c3c03d6062..ad8f1e7a26c665fd471b62bd694aad1655500d33 100644 --- a/ssl/ssl_buffer.cc +++ b/ssl/ssl_buffer.cc @@ -230,7 +230,6 @@ int ssl_handle_open_record(SSL *ssl, bool *out_retry, ssl_open_record_t ret, @@ -20,7 +20,7 @@ index 2cdcbc346175eeee69402ecee7f169e61c655199..f7226fe711e4214b216ea2c5173a0212 case ssl_open_record_error: diff --git a/ssl/ssl_lib.cc b/ssl/ssl_lib.cc -index bbe428f20af5e67cf1335c7f1e42516638234af2..507f85f983bdc4a8c654dd10caf38a42634f5026 100644 +index f64b103fbb7a298a22fe0ff4bc95a4415c58e305..9bc3e1c3114ae67c0eb6a31de05b85e517ea6ae2 100644 --- a/ssl/ssl_lib.cc +++ b/ssl/ssl_lib.cc @@ -1211,7 +1211,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) { diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index e02c2891cf3e0..8258c893a8f0b 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -23,10 +23,10 @@ index 5196f155cdc641b66c4faa77d8b00097145a1290..bbfac47a74f989482343c222b78f187b int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 792ecdf43c810d19641251d3f5eeddccc4c621e9..99d368046177dd92c8b36743f461d348bbf19a2e 100644 +index e523ab3906d71740a99d28336b9a50a8a50bb7c3..b17bdec409a6a0023e3aae3899d828ff007cf7c1 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4723,6 +4723,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, +@@ -4659,6 +4659,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, observer.DidCreateScriptContext(context, world_id); } @@ -40,7 +40,7 @@ index 792ecdf43c810d19641251d3f5eeddccc4c621e9..99d368046177dd92c8b36743f461d348 int world_id) { for (auto& observer : observers_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index ce1d8807d624b35fa63ef83e3a95c7cba8f1f22f..61d4ef338cc4c0e99c144d6d95bbe0adba9d3556 100644 +index f3f84ed452c1eb9fe662631781bc1c93301e8ea0..0677883a806d342734dc970f7c3c665cc9663dd0 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h @@ -603,6 +603,8 @@ class CONTENT_EXPORT RenderFrameImpl @@ -67,10 +67,10 @@ index 5c1d0c1581b7ef6214f3dde6a4053a23c8673b74..4520c9edccf63bdb9e35bf3a99a8ddb3 virtual void WillReleaseScriptContext(v8::Local<v8::Context>, int32_t world_id) {} diff --git a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc -index b963abd8c4bf6ffaea1930a8d1f647a8a8c266bc..2e8653654686f4fc775288f059ff27daa38e02d5 100644 +index 3ce1ef340780075951fb8c1b65f2ec90569f34ef..898d7caac98727210ac5780b576526a71ec5a5aa 100644 --- a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc +++ b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc -@@ -216,6 +216,7 @@ void LocalWindowProxy::Initialize() { +@@ -217,6 +217,7 @@ void LocalWindowProxy::Initialize() { } InstallConditionalFeatures(); @@ -92,11 +92,11 @@ index 36baf908d3be8aed44ff60b8de2cffe2eee15efe..8d73ddb12013ce195026b9f63050cf33 int32_t world_id) = 0; virtual bool AllowScriptExtensions() = 0; diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -index b02b60ff5f6650332c54ecc66f6fdb274b737aa7..1aacf6f66b543a4ede6ab5d885143dd4a0821e8a 100644 +index 019445e625257f909875adffdc5e967fb65a3728..11475d1a22054a884f2f1e7e5c933e9ae8d3379f 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc +++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -@@ -295,6 +295,13 @@ void LocalFrameClientImpl::DidCreateScriptContext( - web_frame_->Client()->DidCreateScriptContext(context, world_id); +@@ -300,6 +300,13 @@ void LocalFrameClientImpl::DidCreateScriptContext( + } } +void LocalFrameClientImpl::DidInstallConditionalFeatures( diff --git a/patches/chromium/add_electron_deps_to_license_credits_file.patch b/patches/chromium/add_electron_deps_to_license_credits_file.patch index ac26567594ab7..e47e7225699cc 100644 --- a/patches/chromium/add_electron_deps_to_license_credits_file.patch +++ b/patches/chromium/add_electron_deps_to_license_credits_file.patch @@ -7,12 +7,12 @@ Ensure that licenses for the dependencies introduced by Electron are included in `LICENSES.chromium.html` diff --git a/tools/licenses/licenses.py b/tools/licenses/licenses.py -index f5bfe41e67b5f9a34db16377528e7fae58f642ab..58d0af6a561a9d309a5a49894786ea382149c034 100755 +index 833a80f1387c64eec418b57d74373dd93130a9dc..a85714b903fc934593258192bc61d72cc557615b 100755 --- a/tools/licenses/licenses.py +++ b/tools/licenses/licenses.py -@@ -342,6 +342,31 @@ SPECIAL_CASES = { +@@ -356,6 +356,31 @@ SPECIAL_CASES = { "License": "Apache 2.0", - "License File": ["//third_party/dawn/third_party/khronos/LICENSE"], + "License File": ["//third_party/sample3/the_license"], }, + os.path.join('third_party', 'electron_node'): { + "Name": "Node.js", diff --git a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch index cbeeb5603a2a3..ff4822bc8d855 100644 --- a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -23,10 +23,10 @@ index 74b39146bbb8151a66ecb4f138f769fffc2525b2..a54948fa36c85c5c5dd04b9836951b1c return receiver_.BindNewEndpointAndPassDedicatedRemote(); } diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc -index 270750b9180a8ddab4f3cd2508fd398e07bf6377..20b2ae081a3710443ec919f1487dfbfe8f15de11 100644 +index a9e4dbfd99b56167d05aa6c30c09408036bc897d..1b0f636cc3705eda221389967d9cd3acf563f00d 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc -@@ -785,6 +785,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) { +@@ -779,6 +779,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) { GetWidget()->GetAssociatedFrameWidget()->SetBackgroundOpaque(opaque); } @@ -116,10 +116,10 @@ index 11a31c9ed26b5abde0ea812eae6b219340ed711c..a72cf76b820cb86b9495ea147efbdcf5 // Visibility ----------------------------------------------------------- diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index 071ede882b2503e22ff97967a7f9cbfd96d048bd..baf06a06756ac7cdcd7f7aef15f812d5d64c04d3 100644 +index 9d1d25758c8f5f7adb613516a87e81c33e31072b..de1c308b599377dd2598a75427347dc5c980fc07 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -2512,6 +2512,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( +@@ -2501,6 +2501,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( TRACE_EVENT2("navigation", "WebViewImpl::SetPageLifecycleStateInternal", "old_state", old_state, "new_state", new_state); @@ -130,7 +130,7 @@ index 071ede882b2503e22ff97967a7f9cbfd96d048bd..baf06a06756ac7cdcd7f7aef15f812d5 bool storing_in_bfcache = new_state->is_in_back_forward_cache && !old_state->is_in_back_forward_cache; bool restoring_from_bfcache = !new_state->is_in_back_forward_cache && -@@ -4029,10 +4033,23 @@ PageScheduler* WebViewImpl::Scheduler() const { +@@ -4018,10 +4022,23 @@ PageScheduler* WebViewImpl::Scheduler() const { return GetPage()->GetPageScheduler(); } @@ -155,7 +155,7 @@ index 071ede882b2503e22ff97967a7f9cbfd96d048bd..baf06a06756ac7cdcd7f7aef15f812d5 // Do not throttle if the page should be painting. bool is_visible = diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h -index 9b9dd237525793b149f1e79d26e9e8043131c363..ec1d8054289b1ae6eb5a579fc82b90a92fe438ff 100644 +index 5dd87ed6a78156cf7d1fc130fc2db6b399227d76..6bd345d2fb854c5d2a79bfcfa9d8618c35bd8489 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h @@ -452,6 +452,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, diff --git a/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch b/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch index 38ab1192d214e..709249b55a4b9 100644 --- a/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch +++ b/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch @@ -8,7 +8,7 @@ WebPreferences of in-process child windows, rather than relying on process-level command line switches, as before. diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc -index dd803e6537c9c7eb1d6e5b36c4268ce2c2314622..c84364663dbb0bcbc51048f1d41bfb6f962dfea4 100644 +index 845edd77da72cfe2d9a56e15cf1e50bdd391be49..9b50605b67c0da8692653816c8638ea89561282f 100644 --- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc +++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc @@ -148,6 +148,19 @@ bool StructTraits<blink::mojom::WebPreferencesDataView, @@ -32,7 +32,7 @@ index dd803e6537c9c7eb1d6e5b36c4268ce2c2314622..c84364663dbb0bcbc51048f1d41bfb6f out->accelerated_video_decode_enabled = data.accelerated_video_decode_enabled(); diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h -index 2a2ccea94b2a1af9ed54b884e1c0cdf67c4a6c32..24c3c81c5170291974cef00f201d69a9ce93ef0f 100644 +index da99e295dd7c063b5416d310fe91d422e74bf5fb..0c91e14c0fb760dd075f517731d110caa3f7739a 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences.h +++ b/third_party/blink/public/common/web_preferences/web_preferences.h @@ -9,6 +9,7 @@ @@ -43,8 +43,8 @@ index 2a2ccea94b2a1af9ed54b884e1c0cdf67c4a6c32..24c3c81c5170291974cef00f201d69a9 #include "build/build_config.h" #include "net/nqe/effective_connection_type.h" #include "third_party/blink/public/common/common_export.h" -@@ -463,6 +464,19 @@ struct BLINK_COMMON_EXPORT WebPreferences { - bool increment_local_surface_id_for_mainframe_same_doc_navigation = true; +@@ -460,6 +461,19 @@ struct BLINK_COMMON_EXPORT WebPreferences { + bool should_screenshot_on_mainframe_same_doc_navigation = true; #endif // BUILDFLAG(IS_ANDROID) + // Begin Electron-specific WebPreferences. @@ -64,7 +64,7 @@ index 2a2ccea94b2a1af9ed54b884e1c0cdf67c4a6c32..24c3c81c5170291974cef00f201d69a9 // chrome, except for the cases where it would require lots of extra work for // the embedder to use the same default value. diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h -index ccba9b7353c87d2e2bced7770920c976865c0d65..4d93ef8c1976cf533c32bc9c17dbf6b81f2b59c6 100644 +index b46fc738d5813a71212c4e1a29a8d08fc15982b3..f65ece291742e9776612cd1e5d2bf2f741c6a400 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h +++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h @@ -8,6 +8,7 @@ @@ -129,22 +129,18 @@ index ccba9b7353c87d2e2bced7770920c976865c0d65..4d93ef8c1976cf533c32bc9c17dbf6b8 return r.cookie_enabled; } diff --git a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom -index a8bae4875ba2a8dd3d2574f55d6c229fc8025aa0..b5162c90cc3036ce97ceae590ef905033e10b399 100644 +index 03ae611eda0f4b9888c498b89e4b805dbe629268..b96998d728c9b107532b2ec67320367eaa6b1f94 100644 --- a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom +++ b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom -@@ -8,9 +8,11 @@ import "third_party/blink/public/mojom/css/preferred_color_scheme.mojom"; - import "third_party/blink/public/mojom/css/preferred_contrast.mojom"; - import "third_party/blink/public/mojom/v8_cache_options.mojom"; - import "url/mojom/url.mojom"; +@@ -4,6 +4,7 @@ + + module blink.mojom; + +import "mojo/public/mojom/base/file_path.mojom"; import "mojo/public/mojom/base/string16.mojom"; import "skia/public/mojom/skcolor.mojom"; - -+ - enum PointerType { - kPointerNone = 1, // 1 << 0 - kPointerFirstType = kPointerNone, -@@ -217,6 +219,19 @@ struct WebPreferences { + import "third_party/blink/public/mojom/css/preferred_color_scheme.mojom"; +@@ -223,6 +224,19 @@ struct WebPreferences { // If true, stylus handwriting recognition to text input will be available in // editable input fields which are non-password type. bool stylus_handwriting_enabled; diff --git a/patches/chromium/blink_local_frame.patch b/patches/chromium/blink_local_frame.patch index 31cfeaf20972f..0cdb9b3279d2a 100644 --- a/patches/chromium/blink_local_frame.patch +++ b/patches/chromium/blink_local_frame.patch @@ -49,7 +49,7 @@ index cdb5b9246087b5678cf6a0f2713f6238dafc13de..7efbe7524c5ddd3785fff0e2d8901f93 // its owning reference back to our owning LocalFrame. client_->Detached(type); diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index 9338d883b1441e1ddd4b39a87f56cd62d6c0eff7..e7f9b2ebfd5a04290b8d2d8a75141534e35bc4c6 100644 +index 0b8972e0ab8ff854fc169b39d762790299f7bf9c..fdbafb9177d345181339fcdf2d95aebbd8665a49 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc @@ -747,10 +747,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index 8f69086b913ec..291c13db16aa2 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -11,7 +11,7 @@ if we ever align our .pak file generation with Chrome we can remove this patch. diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index e7ee2d88b136be97e0668874a309085554041a5a..1ed28fa85bf906bea9628da146627067b105d94f 100644 +index c51468e6fdb46634b5458b387d1c78caf2dd083f..7236611d2a392008f43b1b83ae125e945673f31c 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn @@ -196,11 +196,16 @@ if (!is_android && !is_mac) { @@ -33,10 +33,10 @@ index e7ee2d88b136be97e0668874a309085554041a5a..1ed28fa85bf906bea9628da146627067 "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 03767f1fa536107112eee7106323238caeeedf2c..0df5df319e4d84daed9d9017691950579fce7ae3 100644 +index 47d0c5d24812b020c06ed869d2da7265da344095..a2b00b396d12c66006f5b4e37286d98673504055 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4811,7 +4811,7 @@ static_library("browser") { +@@ -4813,7 +4813,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index 03767f1fa536107112eee7106323238caeeedf2c..0df5df319e4d84daed9d901769195057 # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 932793506ca9259d6c4f67f6e2bbbd654b2c7be3..eff32d19f785d871e9ec9a63fe52151ee485dc1e 100644 +index c2230d2935c650bd2e0ef63f765418b4f7a02253..447fc511f664629f4fde5adec4df6fe21d0174ca 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7563,9 +7563,12 @@ test("unit_tests") { +@@ -7575,9 +7575,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index 932793506ca9259d6c4f67f6e2bbbd654b2c7be3..eff32d19f785d871e9ec9a63fe52151e "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8499,6 +8502,10 @@ test("unit_tests") { +@@ -8512,6 +8515,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index 932793506ca9259d6c4f67f6e2bbbd654b2c7be3..eff32d19f785d871e9ec9a63fe52151e sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8555,7 +8562,6 @@ test("unit_tests") { +@@ -8568,7 +8575,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/build_gn.patch b/patches/chromium/build_gn.patch index c5bf815419783..3f71363a80432 100644 --- a/patches/chromium/build_gn.patch +++ b/patches/chromium/build_gn.patch @@ -7,7 +7,7 @@ These are variables we add to the root BUILDCONFIG so that they're available everywhere, without having to import("//electron/.../flags.gni"). diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn -index 29b0bbeae4dd412876fdaa15688bd248c93216b4..1a1b2fa45cf6e565359ae84256e6dbe5246322c5 100644 +index 69f7eb1ac466fbd4e528e3cf2e4e2f96e622424f..05f540daf67de55c09befa81b487a8fb9c45e751 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -123,6 +123,9 @@ if (current_os == "") { diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 3d1dffa2ba4fa..40595547fb45c 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,10 +9,10 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 55ba21754555cccb095707d30fcefeaf15ea13c6..e76cccefbbf77fcfb886c41d501bcff4fd27be2f 100644 +index 1b285942c248e50721bd443f8ba8d6343444cc3b..56f90a6a69017aa188d878d20a3c2214ab1e06e1 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -9861,6 +9861,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -9837,6 +9837,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To<Referrer>(), params->frame_name, params->disposition, *params->features, @@ -21,10 +21,10 @@ index 55ba21754555cccb095707d30fcefeaf15ea13c6..e76cccefbbf77fcfb886c41d501bcff4 &no_javascript_access); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 49d18f7595e463cc98c888a942f837757a27a596..a7ea73a46936ab4f82880121767376383864959b 100644 +index 00aed23367f1a408b9304c04df45619a042d8839..0349d17c34e1beb031290f711ec66fcfb4abb6bf 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5350,6 +5350,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5351,6 +5351,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( create_params.initially_hidden = renderer_started_hidden; create_params.initial_popup_url = params.target_url; @@ -35,7 +35,7 @@ index 49d18f7595e463cc98c888a942f837757a27a596..a7ea73a46936ab4f8288012176737638 // Even though all codepaths leading here are in response to a renderer // trying to open a new window, if the new window ends up in a different // browsing instance, then the RenderViewHost, RenderWidgetHost, -@@ -5404,6 +5408,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5405,6 +5409,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( // Sets the newly created WebContents WindowOpenDisposition. new_contents_impl->original_window_open_disposition_ = params.disposition; @@ -48,7 +48,7 @@ index 49d18f7595e463cc98c888a942f837757a27a596..a7ea73a46936ab4f8288012176737638 // If the new frame has a name, make sure any SiteInstances that can find // this named frame have proxies for it. Must be called after // SetSessionStorageNamespace, since this calls CreateRenderView, which uses -@@ -5445,12 +5455,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5446,12 +5456,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( AddWebContentsDestructionObserver(new_contents_impl); } @@ -62,10 +62,10 @@ index 49d18f7595e463cc98c888a942f837757a27a596..a7ea73a46936ab4f8288012176737638 new_contents_impl, opener, params.target_url, params.referrer.To<Referrer>(), params.disposition, diff --git a/content/common/frame.mojom b/content/common/frame.mojom -index 15a83f61ed4e31ba34cbc19995cd9d68b1599f1d..9cf9fefad46a6c2ead4085adc76e0c07369f641a 100644 +index 3ef244ccfe40506e22b5c3d293a25d04e908ddcf..d17fd7226d7f8a585e82a9f155459a6835504be4 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom -@@ -662,6 +662,10 @@ struct CreateNewWindowParams { +@@ -658,6 +658,10 @@ struct CreateNewWindowParams { pending_associated_remote<blink.mojom.Widget> widget; pending_associated_receiver<blink.mojom.FrameWidgetHost> frame_widget_host; pending_associated_remote<blink.mojom.FrameWidget> frame_widget; @@ -77,10 +77,10 @@ index 15a83f61ed4e31ba34cbc19995cd9d68b1599f1d..9cf9fefad46a6c2ead4085adc76e0c07 // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 7b813d46382672421e569f68204f6f127bab7dce..64ad3e62245ad9b1fd0b8e0487b6d14d34a6d5f3 100644 +index 8b5d431fbde7eed1ae322976261c2c5dcc123a43..28a7381fbbf521d006f25e2cb29a0e9d8d738988 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -881,6 +881,8 @@ bool ContentBrowserClient::CanCreateWindow( +@@ -883,6 +883,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -90,10 +90,10 @@ index 7b813d46382672421e569f68204f6f127bab7dce..64ad3e62245ad9b1fd0b8e0487b6d14d bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 3f0599ae229b9785146fcd29528d183f2d04a8e7..ef9073ffcf8a5fa51fa028667cf3328cfae6f994 100644 +index 0383d12fe337b59d596fee5b82b1329d72561e09..b5a87bb69b745a91f93019b0b63feecc84db8a1c 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -196,6 +196,7 @@ class NetworkService; +@@ -202,6 +202,7 @@ class NetworkService; class TrustedURLLoaderHeaderClient; } // namespace mojom struct ResourceRequest; @@ -101,7 +101,7 @@ index 3f0599ae229b9785146fcd29528d183f2d04a8e7..ef9073ffcf8a5fa51fa028667cf3328c } // namespace network namespace sandbox { -@@ -1454,6 +1455,8 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -1460,6 +1461,8 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -170,10 +170,10 @@ index caf97e0c94edfa1106b465e793190c82f646ebdb..38b61d04446736bcc44a412f633c01ed // typically happens when popups are created. virtual void WebContentsCreated(WebContents* source_contents, diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 66714ce46183169853952879cca77069ad248017..792ecdf43c810d19641251d3f5eeddccc4c621e9 100644 +index 10da319a245982b03e9bd4edbf7d544641447a2d..e523ab3906d71740a99d28336b9a50a8a50bb7c3 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -6815,6 +6815,10 @@ WebView* RenderFrameImpl::CreateNewWindow( +@@ -6739,6 +6739,10 @@ WebView* RenderFrameImpl::CreateNewWindow( request.HasUserGesture(), GetWebFrame()->IsAdFrame(), GetWebFrame()->IsAdScriptInStack()); @@ -232,10 +232,10 @@ index 82e9d3dfb5f7da76d89fe15ae61d379fa46e177d..fd035512099a54dff6cc951a2226c23a } // namespace blink diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc -index 29a3e6f8640c8c574803dde123639d52e089e421..15f9762af0726b52657982e2005d8a40a011a848 100644 +index 305f89e1d942ddcfc84d54eef451e7eb51ebf944..98bd30288f49b8e1cc1667d38a544830f0e6e8c0 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc -@@ -2347,6 +2347,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, +@@ -2339,6 +2339,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, WebWindowFeatures window_features = GetWindowFeaturesFromString(features, entered_window); diff --git a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch index 00844d5913ce1..119be55346fb3 100644 --- a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch +++ b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch @@ -34,10 +34,10 @@ index bbfac47a74f989482343c222b78f187b70297e4e..3677ca3345fbc775d139684a12fe3624 virtual void DidClearWindowObject() {} virtual void DidChangeScrollOffset() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 99d368046177dd92c8b36743f461d348bbf19a2e..b0a1859d22063cf6d5a73b5ccd5ea6fb86f9a6b9 100644 +index b17bdec409a6a0023e3aae3899d828ff007cf7c1..232af22141b37f2b381347df77b86fbd8e4d00c3 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4729,10 +4729,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( +@@ -4665,10 +4665,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( observer.DidInstallConditionalFeatures(context, world_id); } @@ -52,7 +52,7 @@ index 99d368046177dd92c8b36743f461d348bbf19a2e..b0a1859d22063cf6d5a73b5ccd5ea6fb void RenderFrameImpl::DidChangeScrollOffset() { diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index 61d4ef338cc4c0e99c144d6d95bbe0adba9d3556..ce7ba31d2a2ebab213be4b123f6af93c99b74149 100644 +index 0677883a806d342734dc970f7c3c665cc9663dd0..64806e8a6ce5bbd3795bd8b8b519697a6b5b8c67 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h @@ -605,7 +605,8 @@ class CONTENT_EXPORT RenderFrameImpl @@ -181,10 +181,10 @@ index 4520c9edccf63bdb9e35bf3a99a8ddb39170da24..dd2c5bd50075c345262b05952ecf3f2a // Geometry notifications ---------------------------------------------- diff --git a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc -index 2e8653654686f4fc775288f059ff27daa38e02d5..b0e061525f442952e5f8a90fed7002830dbb4bc3 100644 +index 898d7caac98727210ac5780b576526a71ec5a5aa..3fdd5b3c41fd8d5dc920bed710dc10741e7e7423 100644 --- a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc +++ b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc -@@ -108,11 +108,12 @@ void LocalWindowProxy::DisposeContext(Lifecycle next_status, +@@ -109,11 +109,12 @@ void LocalWindowProxy::DisposeContext(Lifecycle next_status, ScriptState::Scope scope(script_state_); v8::Local<v8::Context> context = script_state_->GetContext(); @@ -214,10 +214,10 @@ index 8d73ddb12013ce195026b9f63050cf33f0bfb0fd..078f0e67e8de6a05178e8e2410f61784 virtual bool AllowScriptExtensions() = 0; diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -index 1aacf6f66b543a4ede6ab5d885143dd4a0821e8a..c695d942e295d9137a284e5536a10d49a055bbf4 100644 +index 11475d1a22054a884f2f1e7e5c933e9ae8d3379f..8d260dead59d366148983a1739b5252fa59b862a 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc +++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -@@ -303,10 +303,11 @@ void LocalFrameClientImpl::DidInstallConditionalFeatures( +@@ -308,10 +308,11 @@ void LocalFrameClientImpl::DidInstallConditionalFeatures( } void LocalFrameClientImpl::WillReleaseScriptContext( diff --git a/patches/chromium/chore_introduce_blocking_api_for_electron.patch b/patches/chromium/chore_introduce_blocking_api_for_electron.patch index 29ad9652dc014..f2477753120b1 100644 --- a/patches/chromium/chore_introduce_blocking_api_for_electron.patch +++ b/patches/chromium/chore_introduce_blocking_api_for_electron.patch @@ -7,7 +7,7 @@ This patch comes after Chromium removed the ScopedAllowIO API in favor of explicitly adding ScopedAllowBlocking calls as friends. diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h -index f10a4040b9460baf1b962f53b3dd54d01f49cdc7..ab2858e7a0fd7fcbc0c03b1a8c086ec4ce90c515 100644 +index 975130c0e02a1152e578d80cc9e2e76afa0aaeb7..2bd4172065d44c97421a8fa45641eada61a64446 100644 --- a/base/threading/thread_restrictions.h +++ b/base/threading/thread_restrictions.h @@ -133,6 +133,7 @@ class KeyStorageLinux; @@ -28,7 +28,7 @@ index f10a4040b9460baf1b962f53b3dd54d01f49cdc7..ab2858e7a0fd7fcbc0c03b1a8c086ec4 namespace enterprise_connectors { class LinuxKeyRotationCommand; } // namespace enterprise_connectors -@@ -574,6 +578,7 @@ class BASE_EXPORT ScopedAllowBlocking { +@@ -575,6 +579,7 @@ class BASE_EXPORT ScopedAllowBlocking { friend class ::DesktopNotificationBalloon; friend class ::FirefoxProfileLock; friend class ::GaiaConfig; diff --git a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch index 4bf6e635cbd41..4177114ec79f5 100644 --- a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch +++ b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch @@ -34,10 +34,10 @@ index 2dc44d4787d5198cff7be2cf98ad5acf2d3a9a0b..27a0335aac2bd4239616cf71f5d015c9 class ScrollEvent; diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 5dd2b9b0897131897596e88e74701293c69e012d..89287b68398e9121959e7750644d37072e8e489b 100644 +index d2651f4fcbb7991e9ec8f164e5bee51dab405c5a..d58b59288d881a2d74ea357f1e9e27870d24ac72 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -@@ -1382,6 +1382,10 @@ HBRUSH DesktopWindowTreeHostWin::GetBackgroundPaintBrush() { +@@ -1378,6 +1378,10 @@ HBRUSH DesktopWindowTreeHostWin::GetBackgroundPaintBrush() { return background_paint_brush_; } @@ -49,10 +49,10 @@ index 5dd2b9b0897131897596e88e74701293c69e012d..89287b68398e9121959e7750644d3707 DesktopWindowTreeHostWin::GetSingletonDesktopNativeCursorManager() { return new DesktopNativeCursorManagerWin(); diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -index 8b34b44095ba7884947d5e83da847783126b3e62..1e30bce5ca5bf47726fd846f2f26705d52a8ce57 100644 +index b65ced55f997d5064b9d9338190567f8c264fce8..e8acd2828ed05deefa335ce2bb461f0c3be8d7b7 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -@@ -274,6 +274,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin +@@ -273,6 +273,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin void HandleWindowScaleFactorChanged(float window_scale_factor) override; void HandleHeadlessWindowBoundsChanged(const gfx::Rect& bounds) override; HBRUSH GetBackgroundPaintBrush() override; @@ -61,10 +61,10 @@ index 8b34b44095ba7884947d5e83da847783126b3e62..1e30bce5ca5bf47726fd846f2f26705d Widget* GetWidget(); const Widget* GetWidget() const; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 10480326f56bcfebd6f9851d5cef401ee56f010c..0265177961817083e32e8357117e7ae158ba6ef3 100644 +index 75a21333701b3501f785229ae9a358c5cac685df..579becb9a32704d932b8dfba477515af8529a2d4 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -3240,15 +3240,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -3243,15 +3243,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, } // We must let Windows handle the caption buttons if it's drawing them, or // they won't work. @@ -86,7 +86,7 @@ index 10480326f56bcfebd6f9851d5cef401ee56f010c..0265177961817083e32e8357117e7ae1 return 0; } } -@@ -3271,6 +3275,7 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -3274,6 +3278,7 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, // handle alt-space, or in the frame itself. is_right_mouse_pressed_on_caption_ = false; ReleaseCapture(); @@ -94,7 +94,7 @@ index 10480326f56bcfebd6f9851d5cef401ee56f010c..0265177961817083e32e8357117e7ae1 // |point| is in window coordinates, but WM_NCHITTEST and TrackPopupMenu() // expect screen coordinates. POINT screen_point = CR_POINT_INITIALIZER_FROM_LPARAM(l_param); -@@ -3278,7 +3283,17 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -3281,7 +3286,17 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, w_param = static_cast<WPARAM>(SendMessage( hwnd(), WM_NCHITTEST, 0, MAKELPARAM(screen_point.x, screen_point.y))); if (w_param == HTCAPTION || w_param == HTSYSMENU) { diff --git a/patches/chromium/chore_partial_revert_of.patch b/patches/chromium/chore_partial_revert_of.patch index d453ebd302a67..a886549d9e936 100644 --- a/patches/chromium/chore_partial_revert_of.patch +++ b/patches/chromium/chore_partial_revert_of.patch @@ -14,10 +14,10 @@ track down the source of this problem & figure out if we can fix it by changing something in Electron. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 2636b49a902570bf3b92675db7792893fcc949f9..b489867c2567739ac200cd1e4c4863b3a0aa8235 100644 +index f75313c18778ff41d12e246fb20a5e4d5a83e57a..dbe99b7478117d1c19da57381c83bffd7b459eef 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5321,7 +5321,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5322,7 +5322,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( : IsGuest(); // While some guest types do not have a guest SiteInstance, the ones that // don't all override WebContents creation above. diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index d915c8d0b90be..55773e2396852 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -80,10 +80,10 @@ index 39fa45f0a0f9076bd7ac0be6f455dd540a276512..3d0381d463eed73470b28085830f2a23 content::WebContents* source, const content::OpenURLParams& params, diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index 78a55026a56c5c2846c7cf13a6080456f8022ddc..f507a45212491b46954e1e30f8fc8c525aff0b25 100644 +index 7477bbc1a4e6ccb536d2c63ffe7c2b0982a5d298..5bfbf89e19e9c35c942b856276b35707a75fc0ef 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc -@@ -2378,7 +2378,8 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2366,7 +2366,8 @@ bool Browser::IsWebContentsCreationOverridden( content::mojom::WindowContainerType window_container_type, const GURL& opener_url, const std::string& frame_name, @@ -93,7 +93,7 @@ index 78a55026a56c5c2846c7cf13a6080456f8022ddc..f507a45212491b46954e1e30f8fc8c52 if (HasActorTask(profile(), opener)) { // If an ExecutionEngine is acting on the opener, prevent it from creating a // new WebContents. We'll instead force the navigation to happen in the same -@@ -2391,7 +2392,7 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2379,7 +2380,7 @@ bool Browser::IsWebContentsCreationOverridden( return (window_container_type == content::mojom::WindowContainerType::BACKGROUND && ShouldCreateBackgroundContents(source_site_instance, opener_url, @@ -103,10 +103,10 @@ index 78a55026a56c5c2846c7cf13a6080456f8022ddc..f507a45212491b46954e1e30f8fc8c52 WebContents* Browser::CreateCustomWebContents( diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h -index 12b5a5ca3603b815182621f81827635667528ca0..0bfd322dd59de0247a7e8bd09b462b943e206f3c 100644 +index 5eb967dec8c8ec8b8959b361438807a987011d04..784c2ad55d22bc82b5e629f364561d3f49c00887 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h -@@ -943,8 +943,7 @@ class Browser : public TabStripModelObserver, +@@ -935,8 +935,7 @@ class Browser : public TabStripModelObserver, content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -222,10 +222,10 @@ index b969f1d97b7e3396119b579cfbe61e19ff7d2dd4..b8d6169652da28266a514938b45b39c5 content::WebContents* AddNewContents( content::WebContents* source, diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 6efc40408fb64d4e4c4e6671b606912edc013a41..35fe43c6ac99666d070036f7d862529ad364a359 100644 +index c84898c652184696bc5025e1224f792b0320b4a0..90ceea58861df00cd9f81d46c94377451158250f 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5284,8 +5284,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5285,8 +5285,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( if (delegate_ && delegate_->IsWebContentsCreationOverridden( opener, source_site_instance, params.window_container_type, diff --git a/patches/chromium/enable_reset_aspect_ratio.patch b/patches/chromium/enable_reset_aspect_ratio.patch index 3af1a5d8345bb..1bda66453a2d6 100644 --- a/patches/chromium/enable_reset_aspect_ratio.patch +++ b/patches/chromium/enable_reset_aspect_ratio.patch @@ -6,10 +6,10 @@ Subject: feat: enable setting aspect ratio to 0 Make SetAspectRatio accept 0 as valid input, which would reset to null. diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 55caef964e9302e939a1580494e753fac347c99e..5dd2b9b0897131897596e88e74701293c69e012d 100644 +index 35469ecb01a680315b2f92e2599a3b56b5fc7549..d2651f4fcbb7991e9ec8f164e5bee51dab405c5a 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -@@ -618,7 +618,7 @@ void DesktopWindowTreeHostWin::SetOpacity(float opacity) { +@@ -614,7 +614,7 @@ void DesktopWindowTreeHostWin::SetOpacity(float opacity) { void DesktopWindowTreeHostWin::SetAspectRatio( const gfx::SizeF& aspect_ratio, const gfx::Size& excluded_margin) { @@ -19,7 +19,7 @@ index 55caef964e9302e939a1580494e753fac347c99e..5dd2b9b0897131897596e88e74701293 excluded_margin); } diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 4331e6268871f06f842ddd6323932b5feac6e418..9c048b941eed92f599dc0b1d1273b215816376dd 100644 +index 86aa7d062e6bfc4ceb79f8852bef34998538a338..14c6a37e16d66967a229c08de83c54192ccdc3c5 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -1050,8 +1050,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen, diff --git a/patches/chromium/expose_setuseragent_on_networkcontext.patch b/patches/chromium/expose_setuseragent_on_networkcontext.patch index 3e79ededccf11..40d3fddf59c3f 100644 --- a/patches/chromium/expose_setuseragent_on_networkcontext.patch +++ b/patches/chromium/expose_setuseragent_on_networkcontext.patch @@ -33,7 +33,7 @@ index 0ab8187b0db8ae6db46d81738f653a2bc4c566f6..de3d55e85c22317f7f9375eb94d0d5d4 } // namespace net diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index 3dab10eb45b641b8a720e73cb8578fe9508f723c..4f9f7ac2c89bad694621fd3b1bbe5460a09c054e 100644 +index cf1cee2251d8ba88535acc1e41cf82986b62f259..27c1a38d0f1b06cbc0722f2067fe39a4f86f0903 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc @@ -1910,6 +1910,13 @@ void NetworkContext::EnableDurableMessageCollector( @@ -51,7 +51,7 @@ index 3dab10eb45b641b8a720e73cb8578fe9508f723c..4f9f7ac2c89bad694621fd3b1bbe5460 // This may only be called on NetworkContexts created with the constructor // that calls MakeURLRequestContext(). diff --git a/services/network/network_context.h b/services/network/network_context.h -index d73d6500b354805fa7436705801fa740dd01e8ea..5426624e27a58292ef760d07898c145f396cb343 100644 +index 90cf1a70c068771ac98b2d5a283cba5e54c05ff4..0dc8de8d4e37e48cb28d8112c0233ac80cfb9ba5 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h @@ -336,6 +336,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext @@ -63,10 +63,10 @@ index d73d6500b354805fa7436705801fa740dd01e8ea..5426624e27a58292ef760d07898c145f void SetEnableReferrers(bool enable_referrers) override; #if BUILDFLAG(IS_CT_SUPPORTED) diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index e6bf2df4c3de555c4be3bb7ec7b90b87d3c2c240..9455b44b740af80a799aa5a01b67ed68d3b7a6ac 100644 +index 00374e2ad12939733983fc6ea4643ff72134942a..ed149b049cb837adb17dfbd302f3ccc597c85fba 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -1352,6 +1352,9 @@ interface NetworkContext { +@@ -1353,6 +1353,9 @@ interface NetworkContext { mojo_base.mojom.UnguessableToken throttling_profile_id, pending_receiver<DurableMessageCollector> receiver); @@ -77,7 +77,7 @@ index e6bf2df4c3de555c4be3bb7ec7b90b87d3c2c240..9455b44b740af80a799aa5a01b67ed68 SetAcceptLanguage(string new_accept_language); diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h -index 8648cafcc01af1d8835f782f1303df2b5a84a674..4e7472dbda6da1b7ed85026a9fd84e9fc4c521a8 100644 +index ebcacbcb16057912693a6674e6b9ef5eeb671f91..1f3f18979b76be720a7c202f2a45fcc593c8fc01 100644 --- a/services/network/test/test_network_context.h +++ b/services/network/test/test_network_context.h @@ -162,6 +162,7 @@ class TestNetworkContext : public mojom::NetworkContext { diff --git a/patches/chromium/extend_apply_webpreferences.patch b/patches/chromium/extend_apply_webpreferences.patch index 5bad3454fd7fa..faf0c635ad23f 100644 --- a/patches/chromium/extend_apply_webpreferences.patch +++ b/patches/chromium/extend_apply_webpreferences.patch @@ -15,10 +15,10 @@ Ideally we could add an embedder observer pattern here but that can be done in future work. diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index baf06a06756ac7cdcd7f7aef15f812d5d64c04d3..ca2e14d97532f17143ae80ce5ef7efc18463f2ce 100644 +index de1c308b599377dd2598a75427347dc5c980fc07..1b6bf9c45f70b904b4f5648a04067fe372d88f6c 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -1906,6 +1906,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, +@@ -1901,6 +1901,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, #if BUILDFLAG(IS_MAC) web_view_impl->SetMaximumLegibleScale( prefs.default_maximum_page_scale_factor); diff --git a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch index 6b491599922d1..1c2f4a6842538 100644 --- a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch +++ b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch @@ -391,7 +391,7 @@ index 225e017909b8869231b870eaaf161a0b5e93e2a0..846a5251429630b8528a84a3d67ed56c if (schemes.allow_non_standard_schemes_in_origins) url::EnableNonStandardSchemesForAndroidWebView(); diff --git a/content/public/common/content_client.h b/content/public/common/content_client.h -index 52f16979b05b692ef72762d0cbc16bcb361b047e..b658ebeb9c572158b27d94af56331be8cbb519e6 100644 +index 70a23343d5815db0722e2977d966219b824a83b1..85ac45c1868832c47460108f93d86a51118daa53 100644 --- a/content/public/common/content_client.h +++ b/content/public/common/content_client.h @@ -139,6 +139,9 @@ class CONTENT_EXPORT ContentClient { @@ -405,7 +405,7 @@ index 52f16979b05b692ef72762d0cbc16bcb361b047e..b658ebeb9c572158b27d94af56331be8 std::vector<std::string> extension_schemes; // Registers a URL scheme with a predefined default custom handler. diff --git a/url/url_util.cc b/url/url_util.cc -index c374142a54d7c6bf4902c94267991ec09fb26f87..07de14ed198d85d7811323d04a69f13022f0e709 100644 +index 3006be26ce9e137a55d0d74386d976d7d2b249fc..3a3c8c61dbbcfcfd60374a2e9ab4abf9ef1b2d7c 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -136,6 +136,9 @@ struct SchemeRegistry { @@ -418,7 +418,7 @@ index c374142a54d7c6bf4902c94267991ec09fb26f87..07de14ed198d85d7811323d04a69f130 // Schemes with a predefined default custom handler. std::vector<SchemeWithHandler> predefined_handler_schemes; -@@ -689,6 +692,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() { +@@ -683,6 +686,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() { return GetSchemeRegistry().empty_document_schemes; } diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index c0276d8cfa50e..3ecdef6363045 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -312,7 +312,7 @@ index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index 34c13ec5ff7ed98c9472abb5840c164a5ce5456d..3fe2753c8bba305a51fa5992e7ff9f1e2daf1e0c 100644 +index 878bb6d0c14adcc90681b7505923481e361d6d08..619f91400a2223f02b099254c1bc3344d82d7234 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch index ea4b4f4badd35..f0131d2947eb4 100644 --- a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch +++ b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch @@ -91,7 +91,7 @@ index 5c82a641538802bc459782ea422a1186045b054a..c286d87043ec4cb2e51ec9d82d08e4c8 // Always keep this at the end. NUM, diff --git a/third_party/blink/public/mojom/permissions/permission.mojom b/third_party/blink/public/mojom/permissions/permission.mojom -index 411412e3e9c08afad09321d8105dd4d628fe508a..549f9079c004ce8427ab2be0dba2e5b24471a8c9 100644 +index da2bcae965ddc183b5794bc8c44aec4f1754f1d2..2b24e692042a352e931278ead6a06e057f73eda6 100644 --- a/third_party/blink/public/mojom/permissions/permission.mojom +++ b/third_party/blink/public/mojom/permissions/permission.mojom @@ -43,7 +43,8 @@ enum PermissionName { diff --git a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch index 4a1bf4e695d35..8fc0e9d0dbee4 100644 --- a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch +++ b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch @@ -90,7 +90,7 @@ index ae113be147f5bfe9d6218a20495897600cc5299d..cb67460205f4db04a3256151d49a2713 // Register the CGWindowID (used to identify this window for video capture) diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc -index 45c684170a028198ec12b75dfe8f51c1271d55f6..f52d5bdfbdd108b55d7e9b2882eb8d5039ef279c 100644 +index c44058711170316552ea05f97b8b8af694da8ca3..2895f8d17e7d045a3fae3f83e4dc117d48b7b29f 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -222,6 +222,18 @@ ui::ZOrderLevel Widget::InitParams::EffectiveZOrderLevel() const { @@ -121,7 +121,7 @@ index 45c684170a028198ec12b75dfe8f51c1271d55f6..f52d5bdfbdd108b55d7e9b2882eb8d50 if (params.opacity == views::Widget::InitParams::WindowOpacity::kInferred && diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h -index e2ea4ca2fb5f10045466d2ece7e9148c01b84f29..7cd620467634d267d1c1b0806cea338edfe5837d 100644 +index 40bba1d16a37f0b3c563faef86402641418dd994..bad7f48f50d5cd1c716963f660f63c7ec0d6449a 100644 --- a/ui/views/widget/widget.h +++ b/ui/views/widget/widget.h @@ -324,6 +324,11 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, @@ -158,7 +158,7 @@ index e2ea4ca2fb5f10045466d2ece7e9148c01b84f29..7cd620467634d267d1c1b0806cea338e // True if the window size will follow the content preferred size. bool is_autosized() const { return is_autosized_; } -@@ -1716,6 +1729,9 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, +@@ -1718,6 +1731,9 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, // If true, the mouse is currently down. bool is_mouse_button_pressed_ = false; diff --git a/patches/chromium/fix_aspect_ratio_with_max_size.patch b/patches/chromium/fix_aspect_ratio_with_max_size.patch index c562d8ac9f96c..bbbb88a7985e4 100644 --- a/patches/chromium/fix_aspect_ratio_with_max_size.patch +++ b/patches/chromium/fix_aspect_ratio_with_max_size.patch @@ -11,10 +11,10 @@ enlarge window above dimensions set during creation of the BrowserWindow. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 9c048b941eed92f599dc0b1d1273b215816376dd..10480326f56bcfebd6f9851d5cef401ee56f010c 100644 +index 14c6a37e16d66967a229c08de83c54192ccdc3c5..75a21333701b3501f785229ae9a358c5cac685df 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -3828,17 +3828,30 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param, +@@ -3831,17 +3831,30 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param, delegate_->GetMinMaxSize(&min_window_size, &max_window_size); min_window_size = delegate_->DIPToScreenSize(min_window_size); max_window_size = delegate_->DIPToScreenSize(max_window_size); diff --git a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch index 8b3c29165ad6e..7cf2553c57bb6 100644 --- a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch +++ b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch @@ -28,7 +28,7 @@ The patch should be removed in favor of either: Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397. diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index 50ae4f25dd7c7e992fd59a0045fbda90e950a377..fde88d492f765d605eab7e2c3ff752acef3d8853 100644 +index a53b19a02c0c609048e432d5f3d126239c7e352a..9fce50c1da957527c69d1253eddac42942689655 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc @@ -11428,6 +11428,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { diff --git a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch index a51b18152f77f..169528da67c9c 100644 --- a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch +++ b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch @@ -87,10 +87,10 @@ index 75df43e3cd2721a92c90c18154d53d5c203e2465..ce42c75c8face36d21f53f44c0201ac4 // The view with active text input state, i.e., a focused <input> element. // It will be nullptr if no such view exists. Note that the active view diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index cbfa2ec56627994541548a49a4afe33b6e42c2d7..2636b49a902570bf3b92675db7792893fcc949f9 100644 +index 9eced24cc88ef33a4fafa427582401e9a9a6aff8..f75313c18778ff41d12e246fb20a5e4d5a83e57a 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10142,7 +10142,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( +@@ -10157,7 +10157,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( "WebContentsImpl::OnFocusedElementChangedInFrame", "render_frame_host", frame); RenderWidgetHostViewBase* root_view = diff --git a/patches/chromium/fix_remove_caption-removing_style_call.patch b/patches/chromium/fix_remove_caption-removing_style_call.patch index a6c391433ab06..8de69c9bfe130 100644 --- a/patches/chromium/fix_remove_caption-removing_style_call.patch +++ b/patches/chromium/fix_remove_caption-removing_style_call.patch @@ -18,7 +18,7 @@ or resizing, but Electron does not seem to run into that issue for opaque frameless windows even with that block commented out. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 0265177961817083e32e8357117e7ae158ba6ef3..0db716837b525cf8f7e2f498fc6db7953754b079 100644 +index 579becb9a32704d932b8dfba477515af8529a2d4..9e7e2740481af8e6a63e02e6c8ca4e448c25b0be 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -1857,7 +1857,23 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) { diff --git a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch index cc6d4cf8ba649..ea9f46b255e31 100644 --- a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch +++ b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch @@ -8,7 +8,7 @@ such as the background turning black when maximizing the window and dynamic background material settings not taking effect. diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 29bf4dfbe2cf0af5a1369c4d3e17e50a198c78c6..40a405af0ecde4f649e1fc27d7e4bf739fe0efd0 100644 +index 956dc87cb07559038a63cec0b5174cec09619bdb..68635b0c0153c3464ab6c7d317177098a7ec644c 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -183,6 +183,10 @@ void DesktopWindowTreeHostWin::FinishTouchDrag(gfx::Point screen_point) { @@ -23,7 +23,7 @@ index 29bf4dfbe2cf0af5a1369c4d3e17e50a198c78c6..40a405af0ecde4f649e1fc27d7e4bf73 void DesktopWindowTreeHostWin::Init(const Widget::InitParams& params) { diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -index 2529a00eb6ec30e4269f19c685997a778647bd51..c3e59f3cfefb965c39482539b06c964166e8b78e 100644 +index 0cd07fd5fb55dcc0d972de4c027fcb895d156592..0f4d335e1d54b5e92fc217080d86513db94d4122 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h @@ -93,6 +93,8 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin @@ -36,7 +36,7 @@ index 2529a00eb6ec30e4269f19c685997a778647bd51..c3e59f3cfefb965c39482539b06c9641 // Overridden from DesktopWindowTreeHost: void Init(const Widget::InitParams& params) override; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 0db716837b525cf8f7e2f498fc6db7953754b079..a5a640219294f9bf6a1a86e89624919247a70cb9 100644 +index 9e7e2740481af8e6a63e02e6c8ca4e448c25b0be..8449383866c668ffac830852b894c8fa525d5814 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -994,13 +994,13 @@ void HWNDMessageHandler::FrameTypeChanged() { diff --git a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch index 817f76ac79836..e779192a6ff4b 100644 --- a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch +++ b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch @@ -59,10 +59,10 @@ index cba373664bec3a32abad6fe0396bd67b53b7e67f..a54f1b3351efd2d8f324436f7f35cd43 #endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_SCRIPT_EXECUTION_CALLBACK_H_ diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index e7f9b2ebfd5a04290b8d2d8a75141534e35bc4c6..d4b4eee7a179904913ac1003781600ceaf5033ba 100644 +index fdbafb9177d345181339fcdf2d95aebbd8665a49..56472f526e751790d9163a3445d5ac15b86e187d 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc -@@ -3186,6 +3186,7 @@ void LocalFrame::RequestExecuteScript( +@@ -3188,6 +3188,7 @@ void LocalFrame::RequestExecuteScript( mojom::blink::EvaluationTiming evaluation_timing, mojom::blink::LoadEventBlockingOption blocking_option, WebScriptExecutionCallback callback, @@ -70,7 +70,7 @@ index e7f9b2ebfd5a04290b8d2d8a75141534e35bc4c6..d4b4eee7a179904913ac1003781600ce BackForwardCacheAware back_forward_cache_aware, mojom::blink::WantResultOption want_result_option, mojom::blink::PromiseResultOption promise_behavior) { -@@ -3243,7 +3244,7 @@ void LocalFrame::RequestExecuteScript( +@@ -3245,7 +3246,7 @@ void LocalFrame::RequestExecuteScript( PausableScriptExecutor::CreateAndRun( script_state, std::move(script_sources), execute_script_policy, user_gesture, evaluation_timing, blocking_option, want_result_option, @@ -80,7 +80,7 @@ index e7f9b2ebfd5a04290b8d2d8a75141534e35bc4c6..d4b4eee7a179904913ac1003781600ce void LocalFrame::SetEvictCachedSessionStorageOnFreezeOrUnload() { diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h -index 1f0313622e2f1672a9d5464c2b9250cd17654dfb..43eb1f9294a00b4f4f836c9f60f0712edb8d3da2 100644 +index 4dc94a550c58420ad75f76de882985c25841f9d7..f878b132293b4eec0669a52cc4c260d5fa43862d 100644 --- a/third_party/blink/renderer/core/frame/local_frame.h +++ b/third_party/blink/renderer/core/frame/local_frame.h @@ -826,6 +826,7 @@ class CORE_EXPORT LocalFrame final @@ -203,7 +203,7 @@ index fa65331f40b90d812b71a489fd560e9359152d2b..390714d631dc88ef92d59ef9618a5706 const mojom::blink::UserActivationOption user_activation_option_; const mojom::blink::LoadEventBlockingOption blocking_option_; diff --git a/third_party/blink/renderer/core/frame/web_frame_test.cc b/third_party/blink/renderer/core/frame/web_frame_test.cc -index eb2dae117ece11bce06bac2197fd2198f54e3b08..80687e766019eafed602efa1bfd37483c703eadf 100644 +index 865bb234bce920120dd8a78f701a598fe38388c7..f052ea9f89abffde2345d398eb6d683d761879f5 100644 --- a/third_party/blink/renderer/core/frame/web_frame_test.cc +++ b/third_party/blink/renderer/core/frame/web_frame_test.cc @@ -295,6 +295,7 @@ void ExecuteScriptsInMainWorld( @@ -215,10 +215,10 @@ index eb2dae117ece11bce06bac2197fd2198f54e3b08..80687e766019eafed602efa1bfd37483 mojom::blink::WantResultOption::kWantResult, wait_for_promise); } diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -index 57d2bc0f0247b116859bc16bab54ae5e18c4bb23..2dfb326accfbc2e3540a160c2c1f7f2a21807783 100644 +index 3b5083071269dea475c18165ebbc5db46520e640..838838d2065c2e22661f3c83b8e18480cce7fa41 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -@@ -1125,14 +1125,15 @@ void WebLocalFrameImpl::RequestExecuteScript( +@@ -1127,14 +1127,15 @@ void WebLocalFrameImpl::RequestExecuteScript( mojom::blink::EvaluationTiming evaluation_timing, mojom::blink::LoadEventBlockingOption blocking_option, WebScriptExecutionCallback callback, diff --git a/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch b/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch index 67dfa426bce2b..d0134997677d7 100644 --- a/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch +++ b/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch @@ -6,10 +6,10 @@ Subject: fix: select the first menu item when opened via keyboard This fixes an accessibility issue where the root view is 'focused' to the screen reader instead of the first menu item as with all other native menus. This patch will be upstreamed. diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc -index cfc9d7bac42a8d6b8fd81d9b0d8f98d55fdc43f4..1091903f786f5455ed6831796afcc2a5dfae36bd 100644 +index 2b537c6e6e3db1b7512bf41dbb0a44df752aeada..6b06366c31906c71d266966414d75534b10a875b 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc -@@ -740,6 +740,16 @@ void MenuController::Run(Widget* parent, +@@ -713,6 +713,16 @@ void MenuController::Run(Widget* parent, SetSelection(root, SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY); } @@ -26,7 +26,7 @@ index cfc9d7bac42a8d6b8fd81d9b0d8f98d55fdc43f4..1091903f786f5455ed6831796afcc2a5 if (button_controller) { pressed_lock_ = button_controller->TakeLock( false, ui::LocatedEvent::FromIfValid(event)); -@@ -2502,18 +2512,15 @@ void MenuController::OpenMenuImpl(MenuItemView* item, bool show) { +@@ -2475,18 +2485,15 @@ void MenuController::OpenMenuImpl(MenuItemView* item, bool show) { } item->GetSubmenu()->ShowAt(params); diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index 9092dd5b24ac9..98b104924bc38 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -6,10 +6,10 @@ Subject: frame_host_manager.patch Allows embedder to intercept site instances created by chromium. diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc -index c0895a2316b447dfea2359e47d9de19dbc262537..d9d49f35463f13967a9f5bead419d33505795a99 100644 +index 2300582c6dd1b9758066d3774338450baae54d81..9dd66581313d8b42bb81baea8821c3bc13db8b99 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc -@@ -4797,6 +4797,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -4794,6 +4794,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( request->ResetStateForSiteInstanceChange(); } @@ -20,10 +20,10 @@ index c0895a2316b447dfea2359e47d9de19dbc262537..d9d49f35463f13967a9f5bead419d335 } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index ef9073ffcf8a5fa51fa028667cf3328cfae6f994..c7f660c6602a2cead04540245da10c0b99a27910 100644 +index b5a87bb69b745a91f93019b0b63feecc84db8a1c..38010d4ed724b22dcea9c766834af64f150e5e3c 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -334,6 +334,11 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -340,6 +340,11 @@ class CONTENT_EXPORT ContentBrowserClient { virtual ~ContentBrowserClient() = default; diff --git a/patches/chromium/gtk_visibility.patch b/patches/chromium/gtk_visibility.patch index 6c8d876475640..8b0eeae1b0426 100644 --- a/patches/chromium/gtk_visibility.patch +++ b/patches/chromium/gtk_visibility.patch @@ -18,7 +18,7 @@ index fdc3442590bddda969681d49c451d32f086bd5d1..b6fd63c0c845e5d7648e8693f1639b1f # on GTK. "//examples:peerconnection_client", diff --git a/ui/ozone/platform/x11/BUILD.gn b/ui/ozone/platform/x11/BUILD.gn -index e0febafa0b15711b129f9d34b88156cd76216238..f1d77b3a066d35f1d5f137f6e21e32261b4ed49a 100644 +index b7b958cf96138334f356f1d27eaabd2de75e4b5a..81e45be92cf02ea5ef9e4180d6c03c681dd1e864 100644 --- a/ui/ozone/platform/x11/BUILD.gn +++ b/ui/ozone/platform/x11/BUILD.gn @@ -6,7 +6,7 @@ import("//build/config/chromeos/ui_mode.gni") diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index f59037611bd31..e6a3895031e0f 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -35,7 +35,7 @@ system font by checking if it's kCTFontPriorityAttribute is set to system priority. diff --git a/base/BUILD.gn b/base/BUILD.gn -index e6625d8ecf9274c00fe450cc2c7c479914eb0dd6..853cbd806f2fb16ad724767b15b6c6a7f5c4a286 100644 +index c03043d632b1a622d1a15bdd68f09b51132f04a4..fbf07b9b0dda620c5a30c4193eb3342f3e9f11b6 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -1069,6 +1069,7 @@ component("base") { @@ -582,10 +582,10 @@ index e51fd827f7afc01a5189737f86a2414627a6546e..bb50f03ba5622c2bfb96bc75d145f471 return kAttributes; } diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index 6fcfee8ce0bc2685f7a06d2ee47022cd00025d56..00db1039db13a2fa11be738f80d806a6aa0883ec 100644 +index 9b0fea4c6ff8f43c695c437b5c295fcd41326d40..adf889c805e177d8d09700aa9d7f5ff2306b6826 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn -@@ -343,6 +343,7 @@ source_set("browser") { +@@ -344,6 +344,7 @@ source_set("browser") { "//ui/webui/resources", "//v8", "//v8:v8_version", @@ -797,7 +797,7 @@ index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbe } // namespace content diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn -index 9143e3b761afec9420aa39d9f6760297dfb1acad..ab90bd4aff1f8842013708b92982f285ef1ce7a6 100644 +index 90eebe0904107f2fc3463df61b0d7eba7fca7b3a..a6a1614483673b5196986f22da7d9bf3e52536f5 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn @@ -703,6 +703,7 @@ static_library("test_support") { @@ -808,7 +808,7 @@ index 9143e3b761afec9420aa39d9f6760297dfb1acad..ab90bd4aff1f8842013708b92982f285 ] data_deps = [ -@@ -1175,6 +1176,8 @@ static_library("browsertest_support") { +@@ -1178,6 +1179,8 @@ static_library("browsertest_support") { # TODO(crbug.com/40031409): Fix code that adds exit-time destructors and # enable the diagnostic by removing this line. configs += [ "//build/config/compiler:no_exit_time_destructors" ] @@ -817,7 +817,7 @@ index 9143e3b761afec9420aa39d9f6760297dfb1acad..ab90bd4aff1f8842013708b92982f285 } mojom("content_test_mojo_bindings") { -@@ -2065,6 +2068,7 @@ test("content_browsertests") { +@@ -2067,6 +2070,7 @@ test("content_browsertests") { "//ui/shell_dialogs", "//ui/snapshot", "//ui/webui:test_support", @@ -825,7 +825,7 @@ index 9143e3b761afec9420aa39d9f6760297dfb1acad..ab90bd4aff1f8842013708b92982f285 ] if (!(is_chromeos && target_cpu == "arm64" && current_cpu == "arm")) { -@@ -3402,6 +3406,7 @@ test("content_unittests") { +@@ -3404,6 +3408,7 @@ test("content_unittests") { "//ui/shell_dialogs", "//ui/webui:test_support", "//url", @@ -950,7 +950,7 @@ index 9388ffac4f70746b04e533b51faf4f2d55ab3358..98f45dc973159b5823d8a0433dfd4bc6 if (is_ios) { diff --git a/media/audio/apple/audio_low_latency_input.cc b/media/audio/apple/audio_low_latency_input.cc -index 6cde211f88439af0925296b0c8c9500aecadc034..08e7053117478ea898264040eea119dcc21ae8e2 100644 +index 50bd341c97daf4cfe585b5e7eb5d26cb747cd8e0..683c53da81e6a1820ccff04d571a43e17b6f0820 100644 --- a/media/audio/apple/audio_low_latency_input.cc +++ b/media/audio/apple/audio_low_latency_input.cc @@ -29,6 +29,7 @@ @@ -961,7 +961,7 @@ index 6cde211f88439af0925296b0c8c9500aecadc034..08e7053117478ea898264040eea119dc #include "media/audio/apple/audio_manager_apple.h" #include "media/audio/apple/scoped_audio_unit.h" #include "media/base/audio_bus.h" -@@ -41,19 +42,23 @@ +@@ -42,19 +43,23 @@ namespace { extern "C" { @@ -1775,10 +1775,10 @@ index 41572ec01d71f56eb8815cf9845e2c4ccefb9964..90c72f19b557d985581c7250187616ee deps += [ "//build:ios_buildflags" ] } diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm -index 7f08f6e5870b021e578fe29f42fd6476ab53a8df..88e884c1510ad617b86678ed31a7bbaa71518742 100644 +index 890d86acb0e92760590b4d0860dd41eaa70486c7..2e9e16cb47606f627b1473a479a6e8ae514cb88e 100644 --- a/ui/display/mac/screen_mac.mm +++ b/ui/display/mac/screen_mac.mm -@@ -34,6 +34,7 @@ +@@ -29,6 +29,7 @@ #include "build/build_config.h" #include "components/device_event_log/device_event_log.h" #include "components/viz/common/resources/shared_image_format.h" @@ -1786,7 +1786,7 @@ index 7f08f6e5870b021e578fe29f42fd6476ab53a8df..88e884c1510ad617b86678ed31a7bbaa #include "ui/display/display.h" #include "ui/display/display_change_notifier.h" #include "ui/display/mac/screen_mac_headless.h" -@@ -184,7 +185,17 @@ DisplayMac BuildDisplayForScreen(NSScreen* screen) { +@@ -179,7 +180,17 @@ DisplayMac BuildDisplayForScreen(NSScreen* screen) { display.set_color_depth(Display::kDefaultBitsPerPixel); display.set_depth_per_component(Display::kDefaultBitsPerComponent); } @@ -1805,7 +1805,7 @@ index 7f08f6e5870b021e578fe29f42fd6476ab53a8df..88e884c1510ad617b86678ed31a7bbaa // Query the display's refresh rate. double refresh_rate = 1.0 / screen.minimumRefreshInterval; diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn -index a48fbe958c15817eabb031afa6cff55404c75353..3967406db04ebedb077430479e5cb5c8cb9d2344 100644 +index f29089286f4848400a67c3b7eaf21a1ba291cc1e..fa92acfa219f82cf53207e3a7479e44b223e9050 100644 --- a/ui/gfx/BUILD.gn +++ b/ui/gfx/BUILD.gn @@ -333,6 +333,12 @@ component("gfx") { diff --git a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch index 1c73f4db7ce1f..2d9df1d6f2562 100644 --- a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch +++ b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch @@ -7,7 +7,7 @@ This adds a callback from the network service that's used to implement session.setCertificateVerifyCallback. diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index a05f512367518549294eb82bb778671d542483a0..3dab10eb45b641b8a720e73cb8578fe9508f723c 100644 +index ecff85f3bdb1eb56f76bf71b2d365bba2c42a415..cf1cee2251d8ba88535acc1e41cf82986b62f259 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc @@ -166,6 +166,11 @@ @@ -148,7 +148,7 @@ index a05f512367518549294eb82bb778671d542483a0..3dab10eb45b641b8a720e73cb8578fe9 void NetworkContext::CreateURLLoaderFactory( mojo::PendingReceiver<mojom::URLLoaderFactory> receiver, mojom::URLLoaderFactoryParamsPtr params) { -@@ -2687,6 +2804,10 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( +@@ -2688,6 +2805,10 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( cert_verifier = std::make_unique<net::CachingCertVerifier>( std::make_unique<net::CoalescingCertVerifier>( std::move(cert_verifier))); @@ -160,7 +160,7 @@ index a05f512367518549294eb82bb778671d542483a0..3dab10eb45b641b8a720e73cb8578fe9 builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier( diff --git a/services/network/network_context.h b/services/network/network_context.h -index 02378d3f3e501d006fba8f9c7026b6699b69912c..d73d6500b354805fa7436705801fa740dd01e8ea 100644 +index 3795ce4def719c36e1dace911be53b0103aeafc5..90cf1a70c068771ac98b2d5a283cba5e54c05ff4 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h @@ -117,6 +117,7 @@ class URLMatcher; @@ -180,7 +180,7 @@ index 02378d3f3e501d006fba8f9c7026b6699b69912c..d73d6500b354805fa7436705801fa740 void ResetURLLoaderFactories() override; void GetViaObliviousHttp( mojom::ObliviousHttpRequestPtr request, -@@ -991,6 +994,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext +@@ -995,6 +998,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext std::vector<base::OnceClosure> dismount_closures_; #endif // BUILDFLAG(IS_DIRECTORY_TRANSFER_REQUIRED) @@ -190,10 +190,10 @@ index 02378d3f3e501d006fba8f9c7026b6699b69912c..d73d6500b354805fa7436705801fa740 std::unique_ptr<HostResolver> internal_host_resolver_; std::set<std::unique_ptr<HostResolver>, base::UniquePtrComparator> diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index c85aee5a260900a788d7d406e9be485fd2f9846d..e6bf2df4c3de555c4be3bb7ec7b90b87d3c2c240 100644 +index 2d27a56d773140749469444af635b11d302793c1..00374e2ad12939733983fc6ea4643ff72134942a 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -315,6 +315,17 @@ struct SocketBrokerRemotes { +@@ -316,6 +316,17 @@ struct SocketBrokerRemotes { pending_remote<SocketBroker> server; }; @@ -211,7 +211,7 @@ index c85aee5a260900a788d7d406e9be485fd2f9846d..e6bf2df4c3de555c4be3bb7ec7b90b87 // Parameters for constructing a network context. struct NetworkContextParams { // The user agent string. -@@ -1008,6 +1019,9 @@ interface NetworkContext { +@@ -1009,6 +1020,9 @@ interface NetworkContext { // Sets a client for this network context. SetClient(pending_remote<NetworkContextClient> client); @@ -222,7 +222,7 @@ index c85aee5a260900a788d7d406e9be485fd2f9846d..e6bf2df4c3de555c4be3bb7ec7b90b87 CreateURLLoaderFactory( pending_receiver<URLLoaderFactory> url_loader_factory, diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h -index 95276b525cb08748ce5b9f4e256e5e25b653715a..8648cafcc01af1d8835f782f1303df2b5a84a674 100644 +index 56971f00eea555b3e67e0c20d5e7a8572444690b..ebcacbcb16057912693a6674e6b9ef5eeb671f91 100644 --- a/services/network/test/test_network_context.h +++ b/services/network/test/test_network_context.h @@ -63,6 +63,8 @@ class TestNetworkContext : public mojom::NetworkContext { diff --git a/patches/chromium/process_singleton.patch b/patches/chromium/process_singleton.patch index 11fc6d2189648..421e9fcb26143 100644 --- a/patches/chromium/process_singleton.patch +++ b/patches/chromium/process_singleton.patch @@ -51,7 +51,7 @@ index c19313c0b58baf0597a99d52ed7fcdb7faacc934..2748dd196fe1f56357348a204e24f0b8 base::win::MessageWindow window_; // The message-only window. bool is_virtualized_; // Stuck inside Microsoft Softricity VM environment. diff --git a/chrome/browser/process_singleton_posix.cc b/chrome/browser/process_singleton_posix.cc -index e0cfeb40e887545830a3294d865c2df466dda8fe..08cbe32a258bf478f1da0a07064d3e9ef14c44a5 100644 +index 9d7be37f1d1fbde55773b4005878d8ff03cac22a..08cbe32a258bf478f1da0a07064d3e9ef14c44a5 100644 --- a/chrome/browser/process_singleton_posix.cc +++ b/chrome/browser/process_singleton_posix.cc @@ -59,6 +59,7 @@ @@ -133,7 +133,7 @@ index e0cfeb40e887545830a3294d865c2df466dda8fe..08cbe32a258bf478f1da0a07064d3e9e // Create the socket file somewhere in /tmp which is usually mounted as a // normal filesystem. Some network filesystems (notably AFS) are screwy and // do not support Unix domain sockets. -- if (!socket_dir_.CreateUniqueTempDir()) { +- if (!socket_dir_.CreateUniqueTempDir(/*prefix=*/FILE_PATH_LITERAL(""))) { - LOG(ERROR) << "Failed to create socket directory."; + base::FilePath tmp_dir; + if (!base::GetTempDir(&tmp_dir)) { diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index 845f1c7ec322b..dde01a7f524e2 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -44,10 +44,10 @@ index 3a820b1b9c9aab336c724ef8c0d823eddb330e1e..9a24c153e47b3f3878fa6ea92fb99d14 void RenderWidgetHostImpl::ShowContextMenuAtPoint( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index a7ea73a46936ab4f82880121767376383864959b..6efc40408fb64d4e4c4e6671b606912edc013a41 100644 +index 0349d17c34e1beb031290f711ec66fcfb4abb6bf..c84898c652184696bc5025e1224f792b0320b4a0 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -6161,6 +6161,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { +@@ -6162,6 +6162,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { return text_input_manager_.get(); } diff --git a/patches/chromium/refactor_expose_file_system_access_blocklist.patch b/patches/chromium/refactor_expose_file_system_access_blocklist.patch index 423a731c735de..96eb9137c03e6 100644 --- a/patches/chromium/refactor_expose_file_system_access_blocklist.patch +++ b/patches/chromium/refactor_expose_file_system_access_blocklist.patch @@ -8,7 +8,7 @@ it in Electron and prevent drift from Chrome's blocklist. We should look for a w to upstream this change to Chrome. diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc -index ef6e8792bf1ff3299a16e36f508108abd791c0f1..a69088723f763738598c4efbefe96668ee05e0ad 100644 +index dcbd14a2e6c8f39a68f0ce7ea9dbc17a0deef070..43c66151ae48983d6f36fdec3637cfdad8863a37 100644 --- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc +++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc @@ -84,11 +84,13 @@ @@ -220,7 +220,7 @@ index ef6e8792bf1ff3299a16e36f508108abd791c0f1..a69088723f763738598c4efbefe96668 // Checks if `path` should be blocked by the `rules`. // The BlockType of the nearest ancestor of a path to check is what -@@ -1404,16 +1226,6 @@ struct ChromeFileSystemAccessPermissionContext::OriginState { +@@ -1405,16 +1227,6 @@ struct ChromeFileSystemAccessPermissionContext::OriginState { std::unique_ptr<base::RetainingOneShotTimer> cleanup_timer; }; @@ -237,7 +237,7 @@ index ef6e8792bf1ff3299a16e36f508108abd791c0f1..a69088723f763738598c4efbefe96668 ChromeFileSystemAccessPermissionContext:: ChromeFileSystemAccessPermissionContext(content::BrowserContext* context, const base::Clock* clock) -@@ -1432,7 +1244,7 @@ ChromeFileSystemAccessPermissionContext:: +@@ -1433,7 +1245,7 @@ ChromeFileSystemAccessPermissionContext:: #if BUILDFLAG(IS_ANDROID) one_time_permissions_tracker_.Observe( OneTimePermissionsTrackerFactory::GetForBrowserContext(context)); @@ -246,7 +246,7 @@ index ef6e8792bf1ff3299a16e36f508108abd791c0f1..a69088723f763738598c4efbefe96668 auto* provider = web_app::WebAppProvider::GetForWebApps( Profile::FromBrowserContext(profile_)); if (provider) { -@@ -2817,7 +2629,7 @@ void ChromeFileSystemAccessPermissionContext::OnShutdown() { +@@ -2818,7 +2630,7 @@ void ChromeFileSystemAccessPermissionContext::OnShutdown() { one_time_permissions_tracker_.Reset(); } @@ -255,7 +255,7 @@ index ef6e8792bf1ff3299a16e36f508108abd791c0f1..a69088723f763738598c4efbefe96668 void ChromeFileSystemAccessPermissionContext::OnWebAppInstalled( const webapps::AppId& app_id) { if (!base::FeatureList::IsEnabled( -@@ -3175,11 +2987,7 @@ bool ChromeFileSystemAccessPermissionContext:: +@@ -3176,11 +2988,7 @@ bool ChromeFileSystemAccessPermissionContext:: HandleType handle_type, UserAction user_action, GrantType grant_type) { @@ -268,7 +268,7 @@ index ef6e8792bf1ff3299a16e36f508108abd791c0f1..a69088723f763738598c4efbefe96668 if (!base::FeatureList::IsEnabled( features::kFileSystemAccessPersistentPermissions)) { return false; -@@ -3230,6 +3038,7 @@ bool ChromeFileSystemAccessPermissionContext:: +@@ -3231,6 +3039,7 @@ bool ChromeFileSystemAccessPermissionContext:: return false; #endif // BUILDFLAG(IS_ANDROID) diff --git a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch index 3de47bd38b025..1ea9d34d1701c 100644 --- a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch +++ b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch @@ -164,7 +164,7 @@ index c286d87043ec4cb2e51ec9d82d08e4c84f5a270c..164a2a446947dae687922363d324a6d3 // Always keep this at the end. NUM, diff --git a/third_party/blink/public/mojom/permissions/permission.mojom b/third_party/blink/public/mojom/permissions/permission.mojom -index 549f9079c004ce8427ab2be0dba2e5b24471a8c9..e7276b12b22035730fda18103dad604e87fff4a9 100644 +index 2b24e692042a352e931278ead6a06e057f73eda6..8bee55daa5e1d1fe115693dbf020c7bc7d3b61fd 100644 --- a/third_party/blink/public/mojom/permissions/permission.mojom +++ b/third_party/blink/public/mojom/permissions/permission.mojom @@ -44,7 +44,15 @@ enum PermissionName { diff --git a/patches/chromium/refactor_unfilter_unresponsive_events.patch b/patches/chromium/refactor_unfilter_unresponsive_events.patch index 4be2e480bc965..6a024e31dc587 100644 --- a/patches/chromium/refactor_unfilter_unresponsive_events.patch +++ b/patches/chromium/refactor_unfilter_unresponsive_events.patch @@ -15,10 +15,10 @@ This CL removes these filters so the unresponsive event can still be accessed from our JS event. The filtering is moved into Electron's code. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index b489867c2567739ac200cd1e4c4863b3a0aa8235..6edd4d673dd61b396aaf121ff3e6810fd0b4ba00 100644 +index dbe99b7478117d1c19da57381c83bffd7b459eef..ae0044328aaf90dd73c96db93be5808d7f45fa8b 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10291,25 +10291,13 @@ void WebContentsImpl::RendererUnresponsive( +@@ -10306,25 +10306,13 @@ void WebContentsImpl::RendererUnresponsive( base::RepeatingClosure hang_monitor_restarter) { OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RendererUnresponsive", "render_widget_host", render_widget_host); diff --git a/patches/chromium/resource_file_conflict.patch b/patches/chromium/resource_file_conflict.patch index 9e3d8afcbf322..e2717c98c2d53 100644 --- a/patches/chromium/resource_file_conflict.patch +++ b/patches/chromium/resource_file_conflict.patch @@ -52,10 +52,10 @@ Some alternatives to this patch: None of these options seems like a substantial maintainability win over this patch to me (@nornagon). diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index 6ca05f8839773f1908c1559c4031af7f21a2d412..e7ee2d88b136be97e0668874a309085554041a5a 100644 +index d3ca849dce4a2138e7d5edf126e70149211d4946..c51468e6fdb46634b5458b387d1c78caf2dd083f 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn -@@ -1541,7 +1541,7 @@ if (is_chrome_branded && !is_android) { +@@ -1537,7 +1537,7 @@ if (is_chrome_branded && !is_android) { } } @@ -64,7 +64,7 @@ index 6ca05f8839773f1908c1559c4031af7f21a2d412..e7ee2d88b136be97e0668874a3090855 chrome_paks("packed_resources") { if (is_mac) { output_dir = "$root_gen_dir/repack" -@@ -1587,6 +1587,12 @@ repack("browser_tests_pak") { +@@ -1583,6 +1583,12 @@ repack("browser_tests_pak") { deps = [ "//chrome/test/data/webui:resources" ] } diff --git a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch index 45d1d7819a206..4d7e3f1e76187 100644 --- a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch +++ b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch @@ -254,10 +254,10 @@ index 17d6d7d935f93afefa9123f56ef9c138c3070f93..8dfa7501a6a2998e107bf9b51f5e5c3d } diff --git a/content/common/features.cc b/content/common/features.cc -index 4419e36c81aca962e85892cc2e0af3dee31a86c3..5b1bfeba20bd5dde48145ab2f94632735d63d316 100644 +index a79d4b37402c1982d7a4896c670e501d2055d618..8562333442891b7788d5ea37e67900f6da4810c8 100644 --- a/content/common/features.cc +++ b/content/common/features.cc -@@ -306,6 +306,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); +@@ -313,6 +313,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kIOSurfaceCapturer, base::FEATURE_ENABLED_BY_DEFAULT); #endif @@ -273,7 +273,7 @@ index 4419e36c81aca962e85892cc2e0af3dee31a86c3..5b1bfeba20bd5dde48145ab2f9463273 BASE_FEATURE(kKeepChildProcessAfterIPCReset, base::FEATURE_DISABLED_BY_DEFAULT); diff --git a/content/common/features.h b/content/common/features.h -index faef439b47b162b75a26a5979ae31dc0532bb214..39e283445c643e11847b0ffdc8c06f79028988c7 100644 +index 026ae45de3356078c75bdef23453a1a1b2de7821..488d486021f4b62cc599a8166e8c93ed0fd04960 100644 --- a/content/common/features.h +++ b/content/common/features.h @@ -110,6 +110,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); diff --git a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch index ca66130e02407..5fc8d8f9945fb 100644 --- a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch +++ b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch @@ -54,10 +54,10 @@ index 5b0f0b28c3f36315d5bb12ad7e35f21c91a1e8b6..08ca1a3fc2add9cf93b078b9136d9aa6 if (mouse_event_callback.Run(mouse_event)) { return; diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 6edd4d673dd61b396aaf121ff3e6810fd0b4ba00..3c25f0d1111eaebf4fb62c9241d237dea3c2a416 100644 +index ae0044328aaf90dd73c96db93be5808d7f45fa8b..a50429f5503e2a227828cf6cef94f848d1dcbb90 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4478,6 +4478,12 @@ void WebContentsImpl::RenderWidgetWasResized( +@@ -4479,6 +4479,12 @@ void WebContentsImpl::RenderWidgetWasResized( width_changed); } diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index 5ee7a16fd7f97..34b7afa3e5971 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index 6d478df9ae82edc4bf6994e775a4d716770fdad1..5b7c4a7e4baef8a2dab1a41ff9962f2bbbbd95a9 100644 +index a0cf1404aa4628cdc023fed4031628a11d89405c..f1e8ec973708f371d5f5a3ddd7e569f4b37a25a4 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25347,6 +25347,21 @@ +@@ -25196,6 +25196,21 @@ ] } ], @@ -67,7 +67,7 @@ index c1d8107ec3e32d31811572aa1d7a7c7a242da7d9..463abf871c7e169dc1ca9f523d74fc14 } // namespace views::features diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 89287b68398e9121959e7750644d37072e8e489b..29bf4dfbe2cf0af5a1369c4d3e17e50a198c78c6 100644 +index d58b59288d881a2d74ea357f1e9e27870d24ac72..956dc87cb07559038a63cec0b5174cec09619bdb 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -84,6 +84,23 @@ namespace { @@ -94,7 +94,7 @@ index 89287b68398e9121959e7750644d37072e8e489b..29bf4dfbe2cf0af5a1369c4d3e17e50a // Updates the cursor clip region. Used for mouse locking. void UpdateMouseLockRegion(aura::Window* window, bool locked) { if (!locked) { -@@ -333,9 +350,14 @@ bool DesktopWindowTreeHostWin::IsVisible() const { +@@ -329,9 +346,14 @@ bool DesktopWindowTreeHostWin::IsVisible() const { } void DesktopWindowTreeHostWin::SetSize(const gfx::Size& size) { @@ -111,7 +111,7 @@ index 89287b68398e9121959e7750644d37072e8e489b..29bf4dfbe2cf0af5a1369c4d3e17e50a } void DesktopWindowTreeHostWin::StackAbove(aura::Window* window) { -@@ -350,30 +372,40 @@ void DesktopWindowTreeHostWin::StackAtTop() { +@@ -346,30 +368,40 @@ void DesktopWindowTreeHostWin::StackAtTop() { } void DesktopWindowTreeHostWin::CenterWindow(const gfx::Size& size) { @@ -154,7 +154,7 @@ index 89287b68398e9121959e7750644d37072e8e489b..29bf4dfbe2cf0af5a1369c4d3e17e50a return display::win::GetScreenWin()->ScreenToDIPRect(GetHWND(), pixel_bounds); } -@@ -681,37 +713,44 @@ void DesktopWindowTreeHostWin::HideImpl() { +@@ -677,37 +709,44 @@ void DesktopWindowTreeHostWin::HideImpl() { // other get/set methods work in DIP. gfx::Rect DesktopWindowTreeHostWin::GetBoundsInPixels() const { @@ -219,7 +219,7 @@ index 89287b68398e9121959e7750644d37072e8e489b..29bf4dfbe2cf0af5a1369c4d3e17e50a } gfx::Rect -@@ -921,21 +960,29 @@ int DesktopWindowTreeHostWin::GetNonClientComponent( +@@ -917,21 +956,29 @@ int DesktopWindowTreeHostWin::GetNonClientComponent( void DesktopWindowTreeHostWin::GetWindowMask(const gfx::Size& size_px, SkPath* path) { @@ -264,10 +264,10 @@ index 89287b68398e9121959e7750644d37072e8e489b..29bf4dfbe2cf0af5a1369c4d3e17e50a } diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -index 1e30bce5ca5bf47726fd846f2f26705d52a8ce57..2529a00eb6ec30e4269f19c685997a778647bd51 100644 +index e8acd2828ed05deefa335ce2bb461f0c3be8d7b7..0cd07fd5fb55dcc0d972de4c027fcb895d156592 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -@@ -176,7 +176,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin +@@ -175,7 +175,7 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin void ShowImpl() override; void HideImpl() override; gfx::Rect GetBoundsInPixels() const override; @@ -276,7 +276,7 @@ index 1e30bce5ca5bf47726fd846f2f26705d52a8ce57..2529a00eb6ec30e4269f19c685997a77 gfx::Rect GetBoundsInAcceleratedWidgetPixelCoordinates() override; gfx::Point GetLocationOnScreenInPixels() const override; void SetCapture() override; -@@ -329,6 +329,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin +@@ -328,6 +328,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin gfx::Vector2d window_expansion_top_left_delta_; gfx::Vector2d window_expansion_bottom_right_delta_; diff --git a/patches/chromium/scroll_bounce_flag.patch b/patches/chromium/scroll_bounce_flag.patch index 2fc9a233a265a..5f73920366559 100644 --- a/patches/chromium/scroll_bounce_flag.patch +++ b/patches/chromium/scroll_bounce_flag.patch @@ -6,10 +6,10 @@ Subject: scroll_bounce_flag.patch Patch to make scrollBounce option work. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc -index 348191bb49b4e94ba0073beda02dee1cc29b4e36..56ffe822150ab05ca1df726a77a2a34cd96a291c 100644 +index 8e9c4ced0e595f972281c84adfbbd7a2d5845d60..8c0cd8a98feb8e1390bdb0e2482ab5d5c233e2a3 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc -@@ -1208,7 +1208,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { +@@ -1209,7 +1209,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { } bool RenderThreadImpl::IsElasticOverscrollEnabled() { diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index 6123dc383e933..745e19ebf1303 100644 --- a/patches/chromium/web_contents.patch +++ b/patches/chromium/web_contents.patch @@ -9,10 +9,10 @@ is needed for OSR. Originally landed in https://github.com/electron/libchromiumcontent/pull/226. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 35fe43c6ac99666d070036f7d862529ad364a359..825dd5a2cda02d88f17c04e50b05b89157439538 100644 +index 90ceea58861df00cd9f81d46c94377451158250f..2467b959fb3ea289ca14614901977ca40099fd0b 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4209,6 +4209,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -4210,6 +4210,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, params.main_frame_name, GetOpener(), primary_main_frame_policy, base::UnguessableToken::Create()); @@ -26,7 +26,7 @@ index 35fe43c6ac99666d070036f7d862529ad364a359..825dd5a2cda02d88f17c04e50b05b891 std::unique_ptr<WebContentsViewDelegate> delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -4219,6 +4226,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -4220,6 +4227,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, view_ = CreateWebContentsView(this, std::move(delegate), &render_view_host_delegate_view_); } @@ -35,7 +35,7 @@ index 35fe43c6ac99666d070036f7d862529ad364a359..825dd5a2cda02d88f17c04e50b05b891 CHECK(view_.get()); diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index ef60f27657953a92f720a0342c8bb08f24684b54..8d614d26117ec41dfe1ecffecbcfb2170c534c9a 100644 +index 221839a555727d62e5d6546377baa9aa08ef52bb..ab55df1817cb0c0213c3db7102c8c6d561dd1b87 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h @@ -130,11 +130,14 @@ class PrerenderHandle; diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index 92bfa2c2aa55a..b65e8a45604e8 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,10 +15,10 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index e76cccefbbf77fcfb886c41d501bcff4fd27be2f..d4f0278019e7d5ea43d6989b48fbefcbd5b05482 100644 +index 56f90a6a69017aa188d878d20a3c2214ab1e06e1..08b66e1423c1ab25b4c6f5004761eddf4a15df84 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -8967,6 +8967,17 @@ void RenderFrameHostImpl::EnterFullscreen( +@@ -8943,6 +8943,17 @@ void RenderFrameHostImpl::EnterFullscreen( } } @@ -37,10 +37,10 @@ index e76cccefbbf77fcfb886c41d501bcff4fd27be2f..d4f0278019e7d5ea43d6989b48fbefcb if (had_fullscreen_token && !GetView()->HasFocus()) GetView()->Focus(); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 825dd5a2cda02d88f17c04e50b05b89157439538..cbfa2ec56627994541548a49a4afe33b6e42c2d7 100644 +index 2467b959fb3ea289ca14614901977ca40099fd0b..9eced24cc88ef33a4fafa427582401e9a9a6aff8 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4495,21 +4495,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( +@@ -4496,21 +4496,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( const input::NativeWebKeyboardEvent& event) { OPTIONAL_TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("content.verbose"), "WebContentsImpl::PreHandleKeyboardEvent"); @@ -80,7 +80,7 @@ index 825dd5a2cda02d88f17c04e50b05b89157439538..cbfa2ec56627994541548a49a4afe33b } bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) { -@@ -4668,7 +4672,7 @@ void WebContentsImpl::EnterFullscreenMode( +@@ -4669,7 +4673,7 @@ void WebContentsImpl::EnterFullscreenMode( OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::EnterFullscreenMode"); DCHECK(CanEnterFullscreenMode(requesting_frame)); DCHECK(requesting_frame->IsActive()); diff --git a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch index 540f033e0bb68..0ee44ae9ac9d5 100644 --- a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch +++ b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch @@ -10,10 +10,10 @@ to handle this without patching, but this is fairly clean for now and no longer patching legacy devtools code. diff --git a/front_end/entrypoints/main/MainImpl.ts b/front_end/entrypoints/main/MainImpl.ts -index 38e8831e13bcebcc13963081844f94d5cc2e82f8..7550fdaf993af0d8c53ad38de1a0e4d11f9ccc6a 100644 +index c91ceb8c245e29db221afbf32b315620a109b735..00e6b28473cf93c75de60ffca0c980245c1dd84d 100644 --- a/front_end/entrypoints/main/MainImpl.ts +++ b/front_end/entrypoints/main/MainImpl.ts -@@ -765,6 +765,8 @@ export class MainImpl { +@@ -760,6 +760,8 @@ export class MainImpl { globalThis.Main = globalThis.Main || {}; // @ts-expect-error Exported for Tests.js globalThis.Main.Main = MainImpl; diff --git a/shell/browser/api/electron_api_web_view_manager.cc b/shell/browser/api/electron_api_web_view_manager.cc index 03938517bf28b..32bf53cb5b566 100644 --- a/shell/browser/api/electron_api_web_view_manager.cc +++ b/shell/browser/api/electron_api_web_view_manager.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. +#include "base/callback_list.h" #include "content/public/browser/browser_context.h" #include "shell/browser/javascript_environment.h" #include "shell/browser/web_contents_preferences.h" diff --git a/shell/browser/ui/file_dialog_linux_portal.cc b/shell/browser/ui/file_dialog_linux_portal.cc index bd2c986fb8edb..e1bcbfafd9435 100644 --- a/shell/browser/ui/file_dialog_linux_portal.cc +++ b/shell/browser/ui/file_dialog_linux_portal.cc @@ -72,7 +72,8 @@ void CheckPortalAvailabilityOnBusThread() { options.bus_type = dbus::Bus::SESSION; options.connection_type = dbus::Bus::PRIVATE; options.dbus_task_runner = g_electron_dbus_thread_task_runner.Get(); - scoped_refptr<dbus::Bus> bus = base::MakeRefCounted<dbus::Bus>(options); + scoped_refptr<dbus::Bus> bus = + base::MakeRefCounted<dbus::Bus>(std::move(options)); dbus_utils::CheckForServiceAndStart( bus, kXdgPortalService, base::BindOnce( diff --git a/shell/browser/ui/x/x_window_utils.cc b/shell/browser/ui/x/x_window_utils.cc index fd0c5ec3aa305..bc69f5fedb8e8 100644 --- a/shell/browser/ui/x/x_window_utils.cc +++ b/shell/browser/ui/x/x_window_utils.cc @@ -34,8 +34,7 @@ bool ShouldUseGlobalMenuBar() { if (env->HasVar("ELECTRON_FORCE_WINDOW_MENU_BAR")) return false; - dbus::Bus::Options options; - auto bus = base::MakeRefCounted<dbus::Bus>(options); + auto bus = base::MakeRefCounted<dbus::Bus>(dbus::Bus::Options{}); dbus::ObjectProxy* object_proxy = bus->GetObjectProxy(DBUS_SERVICE_DBUS, dbus::ObjectPath(DBUS_PATH_DBUS)); diff --git a/shell/browser/web_contents_zoom_controller.h b/shell/browser/web_contents_zoom_controller.h index 94b7f7c67c8f8..40686061019bf 100644 --- a/shell/browser/web_contents_zoom_controller.h +++ b/shell/browser/web_contents_zoom_controller.h @@ -5,6 +5,7 @@ #ifndef ELECTRON_SHELL_BROWSER_WEB_CONTENTS_ZOOM_CONTROLLER_H_ #define ELECTRON_SHELL_BROWSER_WEB_CONTENTS_ZOOM_CONTROLLER_H_ +#include "base/callback_list.h" #include "base/memory/raw_ptr.h" #include "base/observer_list.h" #include "content/public/browser/host_zoom_map.h" diff --git a/shell/browser/zoom_level_delegate.cc b/shell/browser/zoom_level_delegate.cc index d1e3a764922c3..c79435b22cee2 100644 --- a/shell/browser/zoom_level_delegate.cc +++ b/shell/browser/zoom_level_delegate.cc @@ -7,6 +7,7 @@ #include <utility> #include <vector> +#include "base/callback_list.h" #include "base/files/file_path.h" #include "base/functional/bind.h" #include "base/strings/string_number_conversions.h" diff --git a/shell/browser/zoom_level_delegate.h b/shell/browser/zoom_level_delegate.h index 56146f78b2385..c241206bef96f 100644 --- a/shell/browser/zoom_level_delegate.h +++ b/shell/browser/zoom_level_delegate.h @@ -7,6 +7,7 @@ #include <string> +#include "base/callback_list.h" #include "base/memory/raw_ptr.h" #include "base/values.h" #include "content/public/browser/host_zoom_map.h" From af8790a7c16da210a06ff03dcc7bbd148133a900 Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Fri, 24 Oct 2025 16:54:44 -0500 Subject: [PATCH 166/268] chore: bump chromium to 143.0.7491.0 (main) (#48650) * chore: bump chromium in DEPS to 143.0.7490.0 * chore: bump chromium in DEPS to 143.0.7491.0 * chore: update add_didinstallconditionalfeatures.patch no manual changes; patch applied with fuzz Revert "Remove BackForwardTransitions flag" | https://chromium-review.googlesource.com/c/chromium/src/+/7078209 * chore: update allow_in-process_windows_to_have_different_web_prefs.patch patch reapplied manually due to context shear Remove BackForwardTransitions flag | https://chromium-review.googlesource.com/c/chromium/src/+/7022596 * chore: update allow_electron_to_depend_on_components_os_crypt_sync.patch no manual changes; patch applied with fuzz Remove usage of os_crypt/sync in chrome/browser/ui | https://chromium-review.googlesource.com/c/chromium/src/+/7062066 * chore: update patches --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> --- DEPS | 2 +- .../add_didinstallconditionalfeatures.patch | 8 +++--- ...o_depend_on_components_os_crypt_sync.patch | 4 +-- ..._windows_to_have_different_web_prefs.patch | 24 ++++++++--------- ..._depend_on_packed_resource_integrity.patch | 12 ++++----- patches/chromium/can_create_window.patch | 26 +++++++++---------- ...ameter_in_script_lifecycle_observers.patch | 6 ++--- ..._introduce_blocking_api_for_electron.patch | 4 +-- .../chromium/chore_partial_revert_of.patch | 4 +-- ...screationoverridden_with_full_params.patch | 4 +-- ...t_allow_code_cache_in_custom_schemes.patch | 4 +-- ...e_launch_options_for_service_process.patch | 14 +++++----- ...moothing_css_rule_and_blink_painting.patch | 12 ++++----- ...ding_non-standard_schemes_in_iframes.patch | 2 +- ...board_hides_on_input_blur_in_webview.patch | 4 +-- patches/chromium/frame_host_manager.patch | 2 +- .../chromium/gritsettings_resource_ids.patch | 2 +- ..._avoid_private_macos_api_usage.patch.patch | 16 ++++++------ ...xture_remove_keyed_mutex_on_win_dxgi.patch | 6 ++--- ...r_changes_to_the_webcontentsobserver.patch | 4 +-- ...efactor_unfilter_unresponsive_events.patch | 4 +-- ...al_remove_unused_prehandlemouseevent.patch | 4 +-- ...windowtreehostwin_window_enlargement.patch | 4 +-- patches/chromium/web_contents.patch | 8 +++--- patches/chromium/webview_fullscreen.patch | 10 +++---- 25 files changed, 95 insertions(+), 95 deletions(-) diff --git a/DEPS b/DEPS index b5e446201f98b..33d393e57b21d 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '143.0.7489.0', + '143.0.7491.0', 'node_version': 'v22.20.0', 'nan_version': diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index 8258c893a8f0b..11cdf51cf9059 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -23,7 +23,7 @@ index 5196f155cdc641b66c4faa77d8b00097145a1290..bbfac47a74f989482343c222b78f187b int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index e523ab3906d71740a99d28336b9a50a8a50bb7c3..b17bdec409a6a0023e3aae3899d828ff007cf7c1 100644 +index 298387873e7ded5f96c788bc53ad7256a8f5b13e..7e64e34a2ebd9738d33bfc9cc7fd827b8757037d 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -4659,6 +4659,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, @@ -92,11 +92,11 @@ index 36baf908d3be8aed44ff60b8de2cffe2eee15efe..8d73ddb12013ce195026b9f63050cf33 int32_t world_id) = 0; virtual bool AllowScriptExtensions() = 0; diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -index 019445e625257f909875adffdc5e967fb65a3728..11475d1a22054a884f2f1e7e5c933e9ae8d3379f 100644 +index b02b60ff5f6650332c54ecc66f6fdb274b737aa7..1aacf6f66b543a4ede6ab5d885143dd4a0821e8a 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc +++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -@@ -300,6 +300,13 @@ void LocalFrameClientImpl::DidCreateScriptContext( - } +@@ -295,6 +295,13 @@ void LocalFrameClientImpl::DidCreateScriptContext( + web_frame_->Client()->DidCreateScriptContext(context, world_id); } +void LocalFrameClientImpl::DidInstallConditionalFeatures( diff --git a/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch b/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch index 82e11dcadee4c..b7be8fb2d6048 100644 --- a/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch +++ b/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch @@ -10,7 +10,7 @@ so we can remove this patch once we migrate our code to use os_crypt async. diff --git a/components/os_crypt/sync/BUILD.gn b/components/os_crypt/sync/BUILD.gn -index 43d25c4826c00af26fad9b4ed3c3bf0fee091fd4..bc1c9d9fe49c54cb635b1ea75bd5bc23ba5e4df2 100644 +index 4b648046b325fe0df7f014b1718664222c8754af..885225d96ed91a1c7df3796acb8d860d4439b561 100644 --- a/components/os_crypt/sync/BUILD.gn +++ b/components/os_crypt/sync/BUILD.gn @@ -10,6 +10,7 @@ import("//components/os_crypt/sync/features.gni") @@ -19,5 +19,5 @@ index 43d25c4826c00af26fad9b4ed3c3bf0fee091fd4..bc1c9d9fe49c54cb635b1ea75bd5bc23 visibility = [ + "//electron:*", "//chrome/browser", - "//chrome/browser/ui", "//chrome/test:test_support", + "//components/os_crypt/async/browser:dpapi_key_provider", diff --git a/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch b/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch index 709249b55a4b9..b080942396386 100644 --- a/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch +++ b/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch @@ -8,7 +8,7 @@ WebPreferences of in-process child windows, rather than relying on process-level command line switches, as before. diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc -index 845edd77da72cfe2d9a56e15cf1e50bdd391be49..9b50605b67c0da8692653816c8638ea89561282f 100644 +index aee37cbec8726ad81058b2ab76adb2638e33727e..7abd664b73b201da0fdf9f3f759ed94b172c9b23 100644 --- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc +++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc @@ -148,6 +148,19 @@ bool StructTraits<blink::mojom::WebPreferencesDataView, @@ -32,7 +32,7 @@ index 845edd77da72cfe2d9a56e15cf1e50bdd391be49..9b50605b67c0da8692653816c8638ea8 out->accelerated_video_decode_enabled = data.accelerated_video_decode_enabled(); diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h -index da99e295dd7c063b5416d310fe91d422e74bf5fb..0c91e14c0fb760dd075f517731d110caa3f7739a 100644 +index 0497353db763594f7acbaa7275cfbe0dfb57f64b..7d1a0a5976e383330d78addc8b4f45232210a946 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences.h +++ b/third_party/blink/public/common/web_preferences/web_preferences.h @@ -9,6 +9,7 @@ @@ -43,8 +43,8 @@ index da99e295dd7c063b5416d310fe91d422e74bf5fb..0c91e14c0fb760dd075f517731d110ca #include "build/build_config.h" #include "net/nqe/effective_connection_type.h" #include "third_party/blink/public/common/common_export.h" -@@ -460,6 +461,19 @@ struct BLINK_COMMON_EXPORT WebPreferences { - bool should_screenshot_on_mainframe_same_doc_navigation = true; +@@ -459,6 +460,19 @@ struct BLINK_COMMON_EXPORT WebPreferences { + bool increment_local_surface_id_for_mainframe_same_doc_navigation = true; #endif // BUILDFLAG(IS_ANDROID) + // Begin Electron-specific WebPreferences. @@ -64,7 +64,7 @@ index da99e295dd7c063b5416d310fe91d422e74bf5fb..0c91e14c0fb760dd075f517731d110ca // chrome, except for the cases where it would require lots of extra work for // the embedder to use the same default value. diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h -index b46fc738d5813a71212c4e1a29a8d08fc15982b3..f65ece291742e9776612cd1e5d2bf2f741c6a400 100644 +index f0756a3707d8219800a8ec1e9747a0cffc0f6424..5bf75fe4aab9790d22ec2de055a994030d1b8bae 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h +++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h @@ -8,6 +8,7 @@ @@ -129,18 +129,18 @@ index b46fc738d5813a71212c4e1a29a8d08fc15982b3..f65ece291742e9776612cd1e5d2bf2f7 return r.cookie_enabled; } diff --git a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom -index 03ae611eda0f4b9888c498b89e4b805dbe629268..b96998d728c9b107532b2ec67320367eaa6b1f94 100644 +index f7712ccf8a5511b1f67d54bf3972384515a15e4e..558c75d68380ea9c5d3c67823db529ea267d0bc3 100644 --- a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom +++ b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom -@@ -4,6 +4,7 @@ - - module blink.mojom; - +@@ -8,6 +8,7 @@ import "third_party/blink/public/mojom/css/preferred_color_scheme.mojom"; + import "third_party/blink/public/mojom/css/preferred_contrast.mojom"; + import "third_party/blink/public/mojom/v8_cache_options.mojom"; + import "url/mojom/url.mojom"; +import "mojo/public/mojom/base/file_path.mojom"; import "mojo/public/mojom/base/string16.mojom"; import "skia/public/mojom/skcolor.mojom"; - import "third_party/blink/public/mojom/css/preferred_color_scheme.mojom"; -@@ -223,6 +224,19 @@ struct WebPreferences { + +@@ -217,6 +218,19 @@ struct WebPreferences { // If true, stylus handwriting recognition to text input will be available in // editable input fields which are non-password type. bool stylus_handwriting_enabled; diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index 291c13db16aa2..bcf0f87bcab2a 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -33,10 +33,10 @@ index c51468e6fdb46634b5458b387d1c78caf2dd083f..7236611d2a392008f43b1b83ae125e94 "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 47d0c5d24812b020c06ed869d2da7265da344095..a2b00b396d12c66006f5b4e37286d98673504055 100644 +index 59424bd75eca1944382cdff8744a8bb02224afcf..ccccedfb24c680ab1cfe8fb5ae43e39ce29e58d8 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4813,7 +4813,7 @@ static_library("browser") { +@@ -4814,7 +4814,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index 47d0c5d24812b020c06ed869d2da7265da344095..a2b00b396d12c66006f5b4e37286d986 # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index c2230d2935c650bd2e0ef63f765418b4f7a02253..447fc511f664629f4fde5adec4df6fe21d0174ca 100644 +index f6504a7c172e61d183c648d4f50340a8fcd3520c..6d6613baf37618e5e34505f0e82fb2159383fe3a 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7575,9 +7575,12 @@ test("unit_tests") { +@@ -7581,9 +7581,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index c2230d2935c650bd2e0ef63f765418b4f7a02253..447fc511f664629f4fde5adec4df6fe2 "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8512,6 +8515,10 @@ test("unit_tests") { +@@ -8519,6 +8522,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index c2230d2935c650bd2e0ef63f765418b4f7a02253..447fc511f664629f4fde5adec4df6fe2 sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8568,7 +8575,6 @@ test("unit_tests") { +@@ -8575,7 +8582,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 40595547fb45c..9f94317091bd2 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,10 +9,10 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 1b285942c248e50721bd443f8ba8d6343444cc3b..56f90a6a69017aa188d878d20a3c2214ab1e06e1 100644 +index a9c06450f4f554aae3bc459a8b542761c4794055..db212382ebab56d46ea5d773bdce127e39f4b790 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -9837,6 +9837,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -9847,6 +9847,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To<Referrer>(), params->frame_name, params->disposition, *params->features, @@ -21,10 +21,10 @@ index 1b285942c248e50721bd443f8ba8d6343444cc3b..56f90a6a69017aa188d878d20a3c2214 &no_javascript_access); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 00aed23367f1a408b9304c04df45619a042d8839..0349d17c34e1beb031290f711ec66fcfb4abb6bf 100644 +index 5aa061cd96f291eb955892363180e412c495f1d6..f208b31c5e39cb8c4e5e50ed3dd236bdc266baa5 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5351,6 +5351,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5356,6 +5356,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( create_params.initially_hidden = renderer_started_hidden; create_params.initial_popup_url = params.target_url; @@ -35,7 +35,7 @@ index 00aed23367f1a408b9304c04df45619a042d8839..0349d17c34e1beb031290f711ec66fcf // Even though all codepaths leading here are in response to a renderer // trying to open a new window, if the new window ends up in a different // browsing instance, then the RenderViewHost, RenderWidgetHost, -@@ -5405,6 +5409,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5410,6 +5414,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( // Sets the newly created WebContents WindowOpenDisposition. new_contents_impl->original_window_open_disposition_ = params.disposition; @@ -48,7 +48,7 @@ index 00aed23367f1a408b9304c04df45619a042d8839..0349d17c34e1beb031290f711ec66fcf // If the new frame has a name, make sure any SiteInstances that can find // this named frame have proxies for it. Must be called after // SetSessionStorageNamespace, since this calls CreateRenderView, which uses -@@ -5446,12 +5456,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5451,12 +5461,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( AddWebContentsDestructionObserver(new_contents_impl); } @@ -77,10 +77,10 @@ index 3ef244ccfe40506e22b5c3d293a25d04e908ddcf..d17fd7226d7f8a585e82a9f155459a68 // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 8b5d431fbde7eed1ae322976261c2c5dcc123a43..28a7381fbbf521d006f25e2cb29a0e9d8d738988 100644 +index c367c4940023c91bf91b6e8612c8fa2cc2edf944..1c0ccc7d76c98f716409a11364c139ea9854f858 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -883,6 +883,8 @@ bool ContentBrowserClient::CanCreateWindow( +@@ -882,6 +882,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -90,7 +90,7 @@ index 8b5d431fbde7eed1ae322976261c2c5dcc123a43..28a7381fbbf521d006f25e2cb29a0e9d bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 0383d12fe337b59d596fee5b82b1329d72561e09..b5a87bb69b745a91f93019b0b63feecc84db8a1c 100644 +index 4c0c0aaedc70cf219f69a4f406eeb3c1841d8cc6..5ba465eec5408d020c0994969ac97d639f1d4c86 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -202,6 +202,7 @@ class NetworkService; @@ -170,10 +170,10 @@ index caf97e0c94edfa1106b465e793190c82f646ebdb..38b61d04446736bcc44a412f633c01ed // typically happens when popups are created. virtual void WebContentsCreated(WebContents* source_contents, diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 10da319a245982b03e9bd4edbf7d544641447a2d..e523ab3906d71740a99d28336b9a50a8a50bb7c3 100644 +index 9d495e31443cf4c50024b9c892fb7c7d0b40bed0..298387873e7ded5f96c788bc53ad7256a8f5b13e 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -6739,6 +6739,10 @@ WebView* RenderFrameImpl::CreateNewWindow( +@@ -6740,6 +6740,10 @@ WebView* RenderFrameImpl::CreateNewWindow( request.HasUserGesture(), GetWebFrame()->IsAdFrame(), GetWebFrame()->IsAdScriptInStack()); @@ -232,10 +232,10 @@ index 82e9d3dfb5f7da76d89fe15ae61d379fa46e177d..fd035512099a54dff6cc951a2226c23a } // namespace blink diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc -index 305f89e1d942ddcfc84d54eef451e7eb51ebf944..98bd30288f49b8e1cc1667d38a544830f0e6e8c0 100644 +index 04c6dad1650273f15d60f8ad6bf51ca771f77923..ae64f6f689bdaa1221634b2b434e62c52aa9084f 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc -@@ -2339,6 +2339,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, +@@ -2340,6 +2340,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, WebWindowFeatures window_features = GetWindowFeaturesFromString(features, entered_window); diff --git a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch index 119be55346fb3..a20e91fdfd242 100644 --- a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch +++ b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch @@ -34,7 +34,7 @@ index bbfac47a74f989482343c222b78f187b70297e4e..3677ca3345fbc775d139684a12fe3624 virtual void DidClearWindowObject() {} virtual void DidChangeScrollOffset() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index b17bdec409a6a0023e3aae3899d828ff007cf7c1..232af22141b37f2b381347df77b86fbd8e4d00c3 100644 +index 7e64e34a2ebd9738d33bfc9cc7fd827b8757037d..6c89f28ff89e9a5019834751acf34e73bcdb4dcb 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -4665,10 +4665,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( @@ -214,10 +214,10 @@ index 8d73ddb12013ce195026b9f63050cf33f0bfb0fd..078f0e67e8de6a05178e8e2410f61784 virtual bool AllowScriptExtensions() = 0; diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -index 11475d1a22054a884f2f1e7e5c933e9ae8d3379f..8d260dead59d366148983a1739b5252fa59b862a 100644 +index 1aacf6f66b543a4ede6ab5d885143dd4a0821e8a..c695d942e295d9137a284e5536a10d49a055bbf4 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc +++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -@@ -308,10 +308,11 @@ void LocalFrameClientImpl::DidInstallConditionalFeatures( +@@ -303,10 +303,11 @@ void LocalFrameClientImpl::DidInstallConditionalFeatures( } void LocalFrameClientImpl::WillReleaseScriptContext( diff --git a/patches/chromium/chore_introduce_blocking_api_for_electron.patch b/patches/chromium/chore_introduce_blocking_api_for_electron.patch index f2477753120b1..20437f7b8925a 100644 --- a/patches/chromium/chore_introduce_blocking_api_for_electron.patch +++ b/patches/chromium/chore_introduce_blocking_api_for_electron.patch @@ -7,7 +7,7 @@ This patch comes after Chromium removed the ScopedAllowIO API in favor of explicitly adding ScopedAllowBlocking calls as friends. diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h -index 975130c0e02a1152e578d80cc9e2e76afa0aaeb7..2bd4172065d44c97421a8fa45641eada61a64446 100644 +index 7739b7379ba67a596ee1ae2c26640f01687121d1..c69779a9e84972f1ef02451328e6eb18ec2d6716 100644 --- a/base/threading/thread_restrictions.h +++ b/base/threading/thread_restrictions.h @@ -133,6 +133,7 @@ class KeyStorageLinux; @@ -36,7 +36,7 @@ index 975130c0e02a1152e578d80cc9e2e76afa0aaeb7..2bd4172065d44c97421a8fa45641eada friend class ::ProfileImpl; friend class ::ScopedAllowBlockingForProfile; friend class ::StartupTabProviderImpl; -@@ -616,6 +621,7 @@ class BASE_EXPORT ScopedAllowBlocking { +@@ -617,6 +622,7 @@ class BASE_EXPORT ScopedAllowBlocking { friend class cronet::CronetPrefsManager; friend class crypto::ScopedAllowBlockingForNSS; // http://crbug.com/59847 friend class drive::FakeDriveService; diff --git a/patches/chromium/chore_partial_revert_of.patch b/patches/chromium/chore_partial_revert_of.patch index a886549d9e936..5431df59ddf21 100644 --- a/patches/chromium/chore_partial_revert_of.patch +++ b/patches/chromium/chore_partial_revert_of.patch @@ -14,10 +14,10 @@ track down the source of this problem & figure out if we can fix it by changing something in Electron. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index f75313c18778ff41d12e246fb20a5e4d5a83e57a..dbe99b7478117d1c19da57381c83bffd7b459eef 100644 +index 808e961195a435e747236ce982dea722267a30dc..2798b165fcd0909f7329caa1cb4c8fcbe0934ef9 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5322,7 +5322,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5327,7 +5327,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( : IsGuest(); // While some guest types do not have a guest SiteInstance, the ones that // don't all override WebContents creation above. diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index 55773e2396852..512edb0faec3d 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -222,10 +222,10 @@ index b969f1d97b7e3396119b579cfbe61e19ff7d2dd4..b8d6169652da28266a514938b45b39c5 content::WebContents* AddNewContents( content::WebContents* source, diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index c84898c652184696bc5025e1224f792b0320b4a0..90ceea58861df00cd9f81d46c94377451158250f 100644 +index c47fe83984ca1c592138acafc354651ce1b559fc..c6f031e408768a31198f7e875d03d59cacaef9a7 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5285,8 +5285,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5290,8 +5290,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( if (delegate_ && delegate_->IsWebContentsCreationOverridden( opener, source_site_instance, params.window_container_type, diff --git a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch index 1c2f4a6842538..15f06540319a0 100644 --- a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch +++ b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch @@ -405,7 +405,7 @@ index 70a23343d5815db0722e2977d966219b824a83b1..85ac45c1868832c47460108f93d86a51 std::vector<std::string> extension_schemes; // Registers a URL scheme with a predefined default custom handler. diff --git a/url/url_util.cc b/url/url_util.cc -index 3006be26ce9e137a55d0d74386d976d7d2b249fc..3a3c8c61dbbcfcfd60374a2e9ab4abf9ef1b2d7c 100644 +index 648d5e93231f077792552955dba16dde7c2d9833..19397c8344d185dac4e4e3c42db75890df491a14 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -136,6 +136,9 @@ struct SchemeRegistry { @@ -418,7 +418,7 @@ index 3006be26ce9e137a55d0d74386d976d7d2b249fc..3a3c8c61dbbcfcfd60374a2e9ab4abf9 // Schemes with a predefined default custom handler. std::vector<SchemeWithHandler> predefined_handler_schemes; -@@ -683,6 +686,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() { +@@ -680,6 +683,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() { return GetSchemeRegistry().empty_document_schemes; } diff --git a/patches/chromium/feat_configure_launch_options_for_service_process.patch b/patches/chromium/feat_configure_launch_options_for_service_process.patch index d1bfdb107c664..bba63f7e1ff59 100644 --- a/patches/chromium/feat_configure_launch_options_for_service_process.patch +++ b/patches/chromium/feat_configure_launch_options_for_service_process.patch @@ -707,7 +707,7 @@ index c5fee4ad8b246bc1113a383794c6101bade24df3..61f0a0f62795b30105c42da363205284 #if BUILDFLAG(IS_MAC) // Whether or not to disclaim TCC responsibility for the process, defaults to diff --git a/sandbox/policy/win/sandbox_win.cc b/sandbox/policy/win/sandbox_win.cc -index 6cc21567af6e65261d5cbbba067d23bd5514692c..a8d3199eae58a4427f1de4a32504187e36a507a6 100644 +index a2ceae2b3ef9f9586cd4ef068d75aeedf5d64905..dd8a2e0be806ecf0c0ff1286b8fc3cf85ab0161b 100644 --- a/sandbox/policy/win/sandbox_win.cc +++ b/sandbox/policy/win/sandbox_win.cc @@ -605,11 +605,9 @@ base::win::ScopedHandle CreateUnsandboxedJob() { @@ -723,7 +723,7 @@ index 6cc21567af6e65261d5cbbba067d23bd5514692c..a8d3199eae58a4427f1de4a32504187e options.feedback_cursor_off = true; // Network process runs in a job even when unsandboxed. This is to ensure it // does not outlive the browser, which could happen if there is a lot of I/O -@@ -914,7 +912,7 @@ bool SandboxWin::InitTargetServices(TargetServices* target_services) { +@@ -910,7 +908,7 @@ bool SandboxWin::InitTargetServices(TargetServices* target_services) { // static ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( const base::CommandLine& cmd_line, @@ -732,7 +732,7 @@ index 6cc21567af6e65261d5cbbba067d23bd5514692c..a8d3199eae58a4427f1de4a32504187e SandboxDelegate* delegate, TargetPolicy* policy) { const base::CommandLine& launcher_process_command_line = -@@ -928,7 +926,7 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( +@@ -924,7 +922,7 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( } // Add any handles to be inherited to the policy. @@ -741,7 +741,7 @@ index 6cc21567af6e65261d5cbbba067d23bd5514692c..a8d3199eae58a4427f1de4a32504187e policy->AddHandleToShare(handle); if (!policy->GetConfig()->IsConfigured()) { -@@ -943,6 +941,13 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( +@@ -939,6 +937,13 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( // have no effect. These calls can fail with SBOX_ERROR_BAD_PARAMS. policy->SetStdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE)); policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE)); @@ -755,7 +755,7 @@ index 6cc21567af6e65261d5cbbba067d23bd5514692c..a8d3199eae58a4427f1de4a32504187e #endif if (!delegate->PreSpawnTarget(policy)) -@@ -954,7 +959,7 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( +@@ -950,7 +955,7 @@ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess( // static ResultCode SandboxWin::StartSandboxedProcess( const base::CommandLine& cmd_line, @@ -764,7 +764,7 @@ index 6cc21567af6e65261d5cbbba067d23bd5514692c..a8d3199eae58a4427f1de4a32504187e SandboxDelegate* delegate, StartSandboxedProcessCallback result_callback) { SandboxLaunchTimer timer; -@@ -964,7 +969,7 @@ ResultCode SandboxWin::StartSandboxedProcess( +@@ -960,7 +965,7 @@ ResultCode SandboxWin::StartSandboxedProcess( *base::CommandLine::ForCurrentProcess())) { base::Process process; ResultCode result = @@ -773,7 +773,7 @@ index 6cc21567af6e65261d5cbbba067d23bd5514692c..a8d3199eae58a4427f1de4a32504187e DWORD last_error = GetLastError(); std::move(result_callback).Run(std::move(process), last_error, result); return SBOX_ALL_OK; -@@ -974,7 +979,7 @@ ResultCode SandboxWin::StartSandboxedProcess( +@@ -970,7 +975,7 @@ ResultCode SandboxWin::StartSandboxedProcess( timer.OnPolicyCreated(); ResultCode result = GeneratePolicyForSandboxedProcess( diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index 3ecdef6363045..031c106b64e4e 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -45,7 +45,7 @@ index e189d584f05f2ce6354c03a9b19f56985df8a15e..41b430e8f2416be098494f5c49fb97ca 'internal-forced-visited-'): internal_visited_order = 0 diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 -index 122347f812e07a1843914b2c160922433712b7c8..3a619b6e6a970609431ecf67801c05f1d401e807 100644 +index a4bd2a77564418a1924a7bc6bf5accfb1e909035..a1eaef99c77d01bc59a46f8f58bb97cc3fa9b309 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5 @@ -9036,6 +9036,26 @@ @@ -89,10 +89,10 @@ index 0de4f52f5f047f5ec8f94ad9337f4c75a5fd364d..930a0c39390043faf8c326785a4214ab return a.EmptyCells() == b.EmptyCells(); case CSSPropertyID::kFill: diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -index 634af2759e469274b0b9584c29c87dad910c0c6c..166ab54556534327189fa66de0e273882fdb4c4f 100644 +index 47239aa9e6323b78430d8bd6c9474fb07f72a1a3..5b45a43c4337a0b06afa9b9d2aef4d6d51786ae5 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -@@ -12486,5 +12486,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( +@@ -12492,5 +12492,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( CSSValueID::kNone>(stream); } @@ -130,10 +130,10 @@ index 634af2759e469274b0b9584c29c87dad910c0c6c..166ab54556534327189fa66de0e27388 } // namespace css_longhand } // namespace blink diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc -index 884e3378db56c0fcb24060ed24bae44247158347..87e5578d0cd704fcf2d7db000c4e5585d3f45d7e 100644 +index b2cfcac17cac610bf2f686ded14e6cfe3b7023a9..81e98f83c0387a4c527e3d46361fcfe4c9791e9c 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc -@@ -4116,6 +4116,15 @@ PositionTryFallback StyleBuilderConverter::ConvertSinglePositionTryFallback( +@@ -4122,6 +4122,15 @@ PositionTryFallback StyleBuilderConverter::ConvertSinglePositionTryFallback( return PositionTryFallback(scoped_name, tactic_list); } @@ -312,7 +312,7 @@ index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index 878bb6d0c14adcc90681b7505923481e361d6d08..619f91400a2223f02b099254c1bc3344d82d7234 100644 +index 26bed8a2427716c38c8afd6f73c75caed1e3c51a..c2b659a49baaa835245fbcf0e73b7724565eb52d 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch index 7cf2553c57bb6..9a8b3f344886c 100644 --- a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch +++ b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch @@ -28,7 +28,7 @@ The patch should be removed in favor of either: Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397. diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index a53b19a02c0c609048e432d5f3d126239c7e352a..9fce50c1da957527c69d1253eddac42942689655 100644 +index 4553dfcd76b0a8bd7a0d1da781592768fdc90b64..d49a7f15c86643f76d9ba0f916700930daa49904 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc @@ -11428,6 +11428,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { diff --git a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch index 169528da67c9c..01b434713291c 100644 --- a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch +++ b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch @@ -87,10 +87,10 @@ index 75df43e3cd2721a92c90c18154d53d5c203e2465..ce42c75c8face36d21f53f44c0201ac4 // The view with active text input state, i.e., a focused <input> element. // It will be nullptr if no such view exists. Note that the active view diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 9eced24cc88ef33a4fafa427582401e9a9a6aff8..f75313c18778ff41d12e246fb20a5e4d5a83e57a 100644 +index 4a7c0480ad0e9d1f350909a14ef4e6d8d7b24581..808e961195a435e747236ce982dea722267a30dc 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10157,7 +10157,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( +@@ -10162,7 +10162,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( "WebContentsImpl::OnFocusedElementChangedInFrame", "render_frame_host", frame); RenderWidgetHostViewBase* root_view = diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index 98b104924bc38..eb3a47f2c8968 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -20,7 +20,7 @@ index 2300582c6dd1b9758066d3774338450baae54d81..9dd66581313d8b42bb81baea8821c3bc } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index b5a87bb69b745a91f93019b0b63feecc84db8a1c..38010d4ed724b22dcea9c766834af64f150e5e3c 100644 +index 5ba465eec5408d020c0994969ac97d639f1d4c86..e19d7ae4a9f6cbeff126af5b18362a425ce35d48 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -340,6 +340,11 @@ class CONTENT_EXPORT ContentBrowserClient { diff --git a/patches/chromium/gritsettings_resource_ids.patch b/patches/chromium/gritsettings_resource_ids.patch index 7282a1a539420..bd8ebe7640d37 100644 --- a/patches/chromium/gritsettings_resource_ids.patch +++ b/patches/chromium/gritsettings_resource_ids.patch @@ -6,7 +6,7 @@ Subject: gritsettings_resource_ids.patch Add electron resources file to the list of resource ids generation. diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec -index 608d46c32bd650bbdfee69adc27116c0470c21d9..993cc1fc056aceb6bb30343bae4f6837cb51b69c 100644 +index 647916bff39218a0a9711405f7b98eb9b4d6f821..0d3455c124c260cb0e7c313e1e923276598781db 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec @@ -1595,6 +1595,11 @@ diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index e6a3895031e0f..8e4d7562d3931 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -35,7 +35,7 @@ system font by checking if it's kCTFontPriorityAttribute is set to system priority. diff --git a/base/BUILD.gn b/base/BUILD.gn -index c03043d632b1a622d1a15bdd68f09b51132f04a4..fbf07b9b0dda620c5a30c4193eb3342f3e9f11b6 100644 +index 7a9290fb225feb033bc3baf5227fdc5dc14d8a60..7bb8cdf811bda8c7b57cc9576f1f23d0d334e351 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -1069,6 +1069,7 @@ component("base") { @@ -195,10 +195,10 @@ index e12c1d078147d956a1d9b1bc498c1b1d6fe7b974..233362259dc4e728ed37435e65041764 } // namespace base diff --git a/components/os_crypt/sync/BUILD.gn b/components/os_crypt/sync/BUILD.gn -index 4021f6fb72cd997f502fd0f8cadf4452fd473c41..43d25c4826c00af26fad9b4ed3c3bf0fee091fd4 100644 +index 20b4524c33b4477e12025a2334380d85eb9649cb..4b648046b325fe0df7f014b1718664222c8754af 100644 --- a/components/os_crypt/sync/BUILD.gn +++ b/components/os_crypt/sync/BUILD.gn -@@ -65,6 +65,8 @@ component("sync") { +@@ -64,6 +64,8 @@ component("sync") { "os_crypt_mac.mm", ] deps += [ "//crypto:mock_apple_keychain" ] @@ -797,7 +797,7 @@ index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbe } // namespace content diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn -index 90eebe0904107f2fc3463df61b0d7eba7fca7b3a..a6a1614483673b5196986f22da7d9bf3e52536f5 100644 +index f7b00799e71eaec7ab92747e94305fcb14b667e1..0d64ec4f4f9353c6ad0aeefde34219112b081997 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn @@ -703,6 +703,7 @@ static_library("test_support") { @@ -825,7 +825,7 @@ index 90eebe0904107f2fc3463df61b0d7eba7fca7b3a..a6a1614483673b5196986f22da7d9bf3 ] if (!(is_chromeos && target_cpu == "arm64" && current_cpu == "arm")) { -@@ -3404,6 +3408,7 @@ test("content_unittests") { +@@ -3405,6 +3409,7 @@ test("content_unittests") { "//ui/shell_dialogs", "//ui/webui:test_support", "//url", @@ -950,7 +950,7 @@ index 9388ffac4f70746b04e533b51faf4f2d55ab3358..98f45dc973159b5823d8a0433dfd4bc6 if (is_ios) { diff --git a/media/audio/apple/audio_low_latency_input.cc b/media/audio/apple/audio_low_latency_input.cc -index 50bd341c97daf4cfe585b5e7eb5d26cb747cd8e0..683c53da81e6a1820ccff04d571a43e17b6f0820 100644 +index 686c7e9b126260720424cd72d91a3f27002c5af8..e181ff1b909d928a3aa3a913a267d01f0fd647ec 100644 --- a/media/audio/apple/audio_low_latency_input.cc +++ b/media/audio/apple/audio_low_latency_input.cc @@ -29,6 +29,7 @@ @@ -1408,10 +1408,10 @@ index bf9258eeacb85f6b2e424ecd7bb6b9a653673f4b..5a3da145062137ba010cffd47bae475e if (is_mac) { diff --git a/third_party/blink/renderer/core/editing/build.gni b/third_party/blink/renderer/core/editing/build.gni -index c771cee7be34f36521de34ef893ee578b648a8c8..b0bd447b848bfdb7a9ff9cd98ba95574cb846cc2 100644 +index 0dfded158c60568d10486452c9d496a5759ac946..f8393cac3f954e2eb82610d3d70857ddfff77985 100644 --- a/third_party/blink/renderer/core/editing/build.gni +++ b/third_party/blink/renderer/core/editing/build.gni -@@ -362,10 +362,14 @@ blink_core_sources_editing = [ +@@ -364,10 +364,14 @@ blink_core_sources_editing = [ if (is_mac) { blink_core_sources_editing += [ "commands/smart_replace_cf.cc", diff --git a/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch b/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch index 00d54013e9e0c..b6ebd4ffa54f6 100644 --- a/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch +++ b/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch @@ -11,10 +11,10 @@ For resolving complex conflict please pin @reitowo For more reason please see: https://crrev.com/c/5465148 diff --git a/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc b/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc -index a3b6969a20f08bc4b6f9baac645da3dcb6d1bbfb..683c36ba3e6190b03ee777ba8e5f0ed445c1047c 100644 +index a45c24e28ca25f08603ce07e53c76c28e8c2e957..e01e5b4d52b3c698d68d5f4dca869570e3e15897 100644 --- a/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc +++ b/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc -@@ -383,7 +383,8 @@ gfx::GpuMemoryBufferHandle D3DImageBackingFactory::CreateGpuMemoryBufferHandle( +@@ -381,7 +381,8 @@ gfx::GpuMemoryBufferHandle D3DImageBackingFactory::CreateGpuMemoryBufferHandle( // so make sure that the usage is one that we support. DCHECK(usage == gfx::BufferUsage::GPU_READ || usage == gfx::BufferUsage::SCANOUT || @@ -24,7 +24,7 @@ index a3b6969a20f08bc4b6f9baac645da3dcb6d1bbfb..683c36ba3e6190b03ee777ba8e5f0ed4 << "Incorrect usage, usage=" << gfx::BufferUsageToString(usage); D3D11_TEXTURE2D_DESC desc = { -@@ -397,7 +398,9 @@ gfx::GpuMemoryBufferHandle D3DImageBackingFactory::CreateGpuMemoryBufferHandle( +@@ -395,7 +396,9 @@ gfx::GpuMemoryBufferHandle D3DImageBackingFactory::CreateGpuMemoryBufferHandle( D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET, 0, D3D11_RESOURCE_MISC_SHARED_NTHANDLE | diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index dde01a7f524e2..af097e5930b30 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -44,10 +44,10 @@ index 3a820b1b9c9aab336c724ef8c0d823eddb330e1e..9a24c153e47b3f3878fa6ea92fb99d14 void RenderWidgetHostImpl::ShowContextMenuAtPoint( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 0349d17c34e1beb031290f711ec66fcfb4abb6bf..c84898c652184696bc5025e1224f792b0320b4a0 100644 +index f208b31c5e39cb8c4e5e50ed3dd236bdc266baa5..c47fe83984ca1c592138acafc354651ce1b559fc 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -6162,6 +6162,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { +@@ -6167,6 +6167,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { return text_input_manager_.get(); } diff --git a/patches/chromium/refactor_unfilter_unresponsive_events.patch b/patches/chromium/refactor_unfilter_unresponsive_events.patch index 6a024e31dc587..3fc2f5a22699a 100644 --- a/patches/chromium/refactor_unfilter_unresponsive_events.patch +++ b/patches/chromium/refactor_unfilter_unresponsive_events.patch @@ -15,10 +15,10 @@ This CL removes these filters so the unresponsive event can still be accessed from our JS event. The filtering is moved into Electron's code. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index dbe99b7478117d1c19da57381c83bffd7b459eef..ae0044328aaf90dd73c96db93be5808d7f45fa8b 100644 +index 2798b165fcd0909f7329caa1cb4c8fcbe0934ef9..36d0de8de7871204162d775930960ae0434528a1 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10306,25 +10306,13 @@ void WebContentsImpl::RendererUnresponsive( +@@ -10311,25 +10311,13 @@ void WebContentsImpl::RendererUnresponsive( base::RepeatingClosure hang_monitor_restarter) { OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RendererUnresponsive", "render_widget_host", render_widget_host); diff --git a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch index 5fc8d8f9945fb..b4c64f39f10ae 100644 --- a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch +++ b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch @@ -54,10 +54,10 @@ index 5b0f0b28c3f36315d5bb12ad7e35f21c91a1e8b6..08ca1a3fc2add9cf93b078b9136d9aa6 if (mouse_event_callback.Run(mouse_event)) { return; diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index ae0044328aaf90dd73c96db93be5808d7f45fa8b..a50429f5503e2a227828cf6cef94f848d1dcbb90 100644 +index 36d0de8de7871204162d775930960ae0434528a1..3662d82708f63f9c3d85e230d7e286693512e785 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4479,6 +4479,12 @@ void WebContentsImpl::RenderWidgetWasResized( +@@ -4484,6 +4484,12 @@ void WebContentsImpl::RenderWidgetWasResized( width_changed); } diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index 34b7afa3e5971..37e90e93821fe 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index a0cf1404aa4628cdc023fed4031628a11d89405c..f1e8ec973708f371d5f5a3ddd7e569f4b37a25a4 100644 +index da0c8ef1c8addb2f06e944546e7f40c3a1262d0b..5a6ad8c4f316709ae5493f9f010d33a3da5b508a 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25196,6 +25196,21 @@ +@@ -25357,6 +25357,21 @@ ] } ], diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index 745e19ebf1303..3d59188c4eb57 100644 --- a/patches/chromium/web_contents.patch +++ b/patches/chromium/web_contents.patch @@ -9,10 +9,10 @@ is needed for OSR. Originally landed in https://github.com/electron/libchromiumcontent/pull/226. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 90ceea58861df00cd9f81d46c94377451158250f..2467b959fb3ea289ca14614901977ca40099fd0b 100644 +index c6f031e408768a31198f7e875d03d59cacaef9a7..66c603cfa5916e377a5d978a5d8e0f0e63ddb2a3 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4210,6 +4210,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -4215,6 +4215,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, params.main_frame_name, GetOpener(), primary_main_frame_policy, base::UnguessableToken::Create()); @@ -26,7 +26,7 @@ index 90ceea58861df00cd9f81d46c94377451158250f..2467b959fb3ea289ca14614901977ca4 std::unique_ptr<WebContentsViewDelegate> delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -4220,6 +4227,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -4225,6 +4232,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, view_ = CreateWebContentsView(this, std::move(delegate), &render_view_host_delegate_view_); } @@ -35,7 +35,7 @@ index 90ceea58861df00cd9f81d46c94377451158250f..2467b959fb3ea289ca14614901977ca4 CHECK(view_.get()); diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index 221839a555727d62e5d6546377baa9aa08ef52bb..ab55df1817cb0c0213c3db7102c8c6d561dd1b87 100644 +index ef60f27657953a92f720a0342c8bb08f24684b54..8d614d26117ec41dfe1ecffecbcfb2170c534c9a 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h @@ -130,11 +130,14 @@ class PrerenderHandle; diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index b65e8a45604e8..ae0bb2b492c5e 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,10 +15,10 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 56f90a6a69017aa188d878d20a3c2214ab1e06e1..08b66e1423c1ab25b4c6f5004761eddf4a15df84 100644 +index db212382ebab56d46ea5d773bdce127e39f4b790..d58a056cefda8a2d1e1b8d85f8be7b4af401b4eb 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -8943,6 +8943,17 @@ void RenderFrameHostImpl::EnterFullscreen( +@@ -8953,6 +8953,17 @@ void RenderFrameHostImpl::EnterFullscreen( } } @@ -37,10 +37,10 @@ index 56f90a6a69017aa188d878d20a3c2214ab1e06e1..08b66e1423c1ab25b4c6f5004761eddf if (had_fullscreen_token && !GetView()->HasFocus()) GetView()->Focus(); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 2467b959fb3ea289ca14614901977ca40099fd0b..9eced24cc88ef33a4fafa427582401e9a9a6aff8 100644 +index 66c603cfa5916e377a5d978a5d8e0f0e63ddb2a3..4a7c0480ad0e9d1f350909a14ef4e6d8d7b24581 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4496,21 +4496,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( +@@ -4501,21 +4501,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( const input::NativeWebKeyboardEvent& event) { OPTIONAL_TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("content.verbose"), "WebContentsImpl::PreHandleKeyboardEvent"); @@ -80,7 +80,7 @@ index 2467b959fb3ea289ca14614901977ca40099fd0b..9eced24cc88ef33a4fafa427582401e9 } bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) { -@@ -4669,7 +4673,7 @@ void WebContentsImpl::EnterFullscreenMode( +@@ -4674,7 +4678,7 @@ void WebContentsImpl::EnterFullscreenMode( OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::EnterFullscreenMode"); DCHECK(CanEnterFullscreenMode(requesting_frame)); DCHECK(requesting_frame->IsActive()); From 4ce742b3206adabfa35880ccb4ee39ba03d1fa8c Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Sat, 25 Oct 2025 18:14:55 +0200 Subject: [PATCH 167/268] fix: crash on empty dialog extensions array on Windows (#48640) --- shell/browser/ui/file_dialog_win.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/shell/browser/ui/file_dialog_win.cc b/shell/browser/ui/file_dialog_win.cc index 5ded77f646610..9a9b218644fba 100644 --- a/shell/browser/ui/file_dialog_win.cc +++ b/shell/browser/ui/file_dialog_win.cc @@ -44,8 +44,7 @@ void ConvertFilters(const Filters& filters, std::vector<std::wstring>* buffer, std::vector<COMDLG_FILTERSPEC>* filterspec) { if (filters.empty()) { - COMDLG_FILTERSPEC spec = {L"All Files (*.*)", L"*.*"}; - filterspec->push_back(spec); + filterspec->push_back({L"All Files (*.*)", L"*.*"}); return; } @@ -55,11 +54,16 @@ void ConvertFilters(const Filters& filters, buffer->push_back(base::UTF8ToWide(filter.first)); spec.pszName = buffer->back().c_str(); - std::vector<std::string> extensions(filter.second); - for (std::string& extension : extensions) - extension.insert(0, "*."); - buffer->push_back(base::UTF8ToWide(base::JoinString(extensions, ";"))); - spec.pszSpec = buffer->back().c_str(); + if (filter.second.empty()) { + buffer->push_back(L"*.*"); + spec.pszSpec = buffer->back().c_str(); + } else { + std::vector<std::string> extensions(filter.second); + for (std::string& extension : extensions) + extension.insert(0, "*."); + buffer->push_back(base::UTF8ToWide(base::JoinString(extensions, ";"))); + spec.pszSpec = buffer->back().c_str(); + } filterspec->push_back(spec); } From c1067fdfeec1e8af55516f9a0625d8d01b3231ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Mon, 27 Oct 2025 09:21:05 +0100 Subject: [PATCH 168/268] build(deps-dev): bump webpack-cli from 5.1.4 to 6.0.1 (#48651) Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 5.1.4 to 6.0.1. - [Release notes](https://github.com/webpack/webpack-cli/releases) - [Changelog](https://github.com/webpack/webpack-cli/blob/main/CHANGELOG.md) - [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@5.1.4...webpack-cli@6.0.1) --- updated-dependencies: - dependency-name: webpack-cli dependency-version: 6.0.1 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 110 +++++++++++++++++++++++++++------------------------ 2 files changed, 60 insertions(+), 52 deletions(-) diff --git a/package.json b/package.json index 243c71d48f5f0..5f19c4d7baf8a 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "typescript": "^5.6.2", "url": "^0.11.4", "webpack": "^5.95.0", - "webpack-cli": "^5.1.4", + "webpack-cli": "^6.0.1", "wrapper-webpack-plugin": "^2.2.0" }, "private": true, diff --git a/yarn.lock b/yarn.lock index 55714825e5f1c..db252209b29e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -175,10 +175,10 @@ js-tokens "^4.0.0" picocolors "^1.0.0" -"@discoveryjs/json-ext@^0.5.0": - version "0.5.7" - resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70" - integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw== +"@discoveryjs/json-ext@^0.6.1": + version "0.6.3" + resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.6.3.tgz#f13c7c205915eb91ae54c557f5e92bddd8be0e83" + integrity sha512-4B4OijXeVNOPZlYA2oEwWOTkzyltLao+xbotHQeqN++Rv27Y6s818+n2Qkp8q+Fxhn0t/5lA5X1Mxktud8eayQ== "@dsanders11/vscode-markdown-languageservice@^0.3.0": version "0.3.0" @@ -1330,20 +1330,20 @@ "@webassemblyjs/ast" "1.12.1" "@xtuc/long" "4.2.2" -"@webpack-cli/configtest@^2.1.1": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@webpack-cli/configtest/-/configtest-2.1.1.tgz#3b2f852e91dac6e3b85fb2a314fb8bef46d94646" - integrity sha512-wy0mglZpDSiSS0XHrVR+BAdId2+yxPSoJW8fsna3ZpYSlufjvxnP4YbKTCBZnNIcGN4r6ZPXV55X4mYExOfLmw== +"@webpack-cli/configtest@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@webpack-cli/configtest/-/configtest-3.0.1.tgz#76ac285b9658fa642ce238c276264589aa2b6b57" + integrity sha512-u8d0pJ5YFgneF/GuvEiDA61Tf1VDomHHYMjv/wc9XzYj7nopltpG96nXN5dJRstxZhcNpV1g+nT6CydO7pHbjA== -"@webpack-cli/info@^2.0.2": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-2.0.2.tgz#cc3fbf22efeb88ff62310cf885c5b09f44ae0fdd" - integrity sha512-zLHQdI/Qs1UyT5UBdWNqsARasIA+AaF8t+4u2aS2nEpBQh2mWIVb8qAklq0eUENnC5mOItrIB4LiS9xMtph18A== +"@webpack-cli/info@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-3.0.1.tgz#3cff37fabb7d4ecaab6a8a4757d3826cf5888c63" + integrity sha512-coEmDzc2u/ffMvuW9aCjoRzNSPDl/XLuhPdlFRpT9tZHmJ/039az33CE7uH+8s0uL1j5ZNtfdv0HkfaKRBGJsQ== -"@webpack-cli/serve@^2.0.5": - version "2.0.5" - resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-2.0.5.tgz#325db42395cd49fe6c14057f9a900e427df8810e" - integrity sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ== +"@webpack-cli/serve@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-3.0.1.tgz#bd8b1f824d57e30faa19eb78e4c0951056f72f00" + integrity sha512-sbgw03xQaCLiT6gcY/6u3qBDn01CWw/nbaXl3gTdTFuJJ75Gffv3E3DBpgvY2fkkrdS1fpjaXNOmJlnbtKauKg== "@xmldom/xmldom@^0.8.11": version "0.8.11" @@ -2042,12 +2042,7 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -colorette@^2.0.14: - version "2.0.19" - resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.19.tgz#cdf044f47ad41a0f4b56b3a0d5b4e6e1a2d5a798" - integrity sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ== - -colorette@^2.0.20: +colorette@^2.0.14, colorette@^2.0.20: version "2.0.20" resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== @@ -2057,10 +2052,10 @@ comma-separated-tokens@^2.0.0: resolved "https://registry.yarnpkg.com/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz#4e89c9458acb61bc8fef19f4529973b2392839ee" integrity sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg== -commander@^10.0.1: - version "10.0.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" - integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== +commander@^12.1.0: + version "12.1.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3" + integrity sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA== commander@^14.0.0: version "14.0.0" @@ -2388,10 +2383,10 @@ env-paths@^2.2.0, env-paths@^2.2.1: resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2" integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A== -envinfo@^7.7.3: - version "7.8.1" - resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.8.1.tgz#06377e3e5f4d379fea7ac592d5ad8927e0c4d475" - integrity sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw== +envinfo@^7.14.0: + version "7.19.0" + resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.19.0.tgz#b4b4507a27e9900b0175f556167fd3a95f8623f1" + integrity sha512-DoSM9VyG6O3vqBf+p3Gjgr/Q52HYBBtO3v+4koAxt1MnWr+zEnxE+nke/yXS4lt2P4SYCHQ4V3f1i88LQVOpAw== environment@^1.0.0: version "1.1.0" @@ -3193,6 +3188,11 @@ flat-cache@^3.0.4: flatted "^3.1.0" rimraf "^3.0.2" +flat@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" + integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== + flatted@^3.1.0: version "3.2.7" resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" @@ -7352,7 +7352,14 @@ stringify-entities@^4.0.0: character-entities-html4 "^2.0.0" character-entities-legacy "^3.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -8093,32 +8100,33 @@ webidl-conversions@^3.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= -webpack-cli@^5.1.4: - version "5.1.4" - resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-5.1.4.tgz#c8e046ba7eaae4911d7e71e2b25b776fcc35759b" - integrity sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg== +webpack-cli@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-6.0.1.tgz#a1ce25da5ba077151afd73adfa12e208e5089207" + integrity sha512-MfwFQ6SfwinsUVi0rNJm7rHZ31GyTcpVE5pgVA3hwFRb7COD4TzjUUwhGWKfO50+xdc2MQPuEBBJoqIMGt3JDw== dependencies: - "@discoveryjs/json-ext" "^0.5.0" - "@webpack-cli/configtest" "^2.1.1" - "@webpack-cli/info" "^2.0.2" - "@webpack-cli/serve" "^2.0.5" + "@discoveryjs/json-ext" "^0.6.1" + "@webpack-cli/configtest" "^3.0.1" + "@webpack-cli/info" "^3.0.1" + "@webpack-cli/serve" "^3.0.1" colorette "^2.0.14" - commander "^10.0.1" + commander "^12.1.0" cross-spawn "^7.0.3" - envinfo "^7.7.3" + envinfo "^7.14.0" fastest-levenshtein "^1.0.12" import-local "^3.0.2" interpret "^3.1.1" rechoir "^0.8.0" - webpack-merge "^5.7.3" + webpack-merge "^6.0.1" -webpack-merge@^5.7.3: - version "5.8.0" - resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-5.8.0.tgz#2b39dbf22af87776ad744c390223731d30a68f61" - integrity sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q== +webpack-merge@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-6.0.1.tgz#50c776868e080574725abc5869bd6e4ef0a16c6a" + integrity sha512-hXXvrjtx2PLYx4qruKl+kyRSLc52V+cCvMxRjmKwoA+CBbbF5GfIBtR6kCvl0fYGqTUPKB+1ktVmTHqMOzgCBg== dependencies: clone-deep "^4.0.1" - wildcard "^2.0.0" + flat "^5.0.2" + wildcard "^2.0.1" webpack-sources@^3.2.3: version "3.2.3" @@ -8263,10 +8271,10 @@ which@^4.0.0: dependencies: isexe "^3.1.1" -wildcard@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec" - integrity sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw== +wildcard@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.1.tgz#5ab10d02487198954836b6349f74fff961e10f67" + integrity sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ== word-wrap@^1.2.5: version "1.2.5" From 695b20c338c7b85cae1b8d352881354741cb191b Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Mon, 27 Oct 2025 05:23:45 -0500 Subject: [PATCH 169/268] fix: logical bug in install.js env var handling (#48634) If either `npm_config_electron_use_remote_checksums` or `electron_use_remote_checksums` are set as environment variables, then force Electron to verify with remote checksums instead of embedded ones. Fixes #48594. --- npm/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/install.js b/npm/install.js index a0c177dea4160..9d7ecaf55d29b 100755 --- a/npm/install.js +++ b/npm/install.js @@ -44,7 +44,7 @@ downloadArtifact({ artifactName: 'electron', force: process.env.force_no_cache === 'true', cacheRoot: process.env.electron_config_cache, - checksums: process.env.electron_use_remote_checksums ?? process.env.npm_config_electron_use_remote_checksums ? undefined : require('./checksums.json'), + checksums: (process.env.electron_use_remote_checksums || process.env.npm_config_electron_use_remote_checksums) ? undefined : require('./checksums.json'), platform, arch }).then(extractFile).catch(err => { From 8615f35835dee80b0a02a7e7fef606e73d87cdf5 Mon Sep 17 00:00:00 2001 From: zoy <nilay2014@gmail.com> Date: Tue, 28 Oct 2025 01:38:05 +0800 Subject: [PATCH 170/268] docs: modify the thickFrame doc (#48579) * doc: modify the thickFrame doc * chore: update description Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com> * update format --------- Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com> --- docs/api/structures/base-window-options.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/api/structures/base-window-options.md b/docs/api/structures/base-window-options.md index 375c6adc3b59b..1dc5e545a0719 100644 --- a/docs/api/structures/base-window-options.md +++ b/docs/api/structures/base-window-options.md @@ -102,9 +102,10 @@ should have rounded corners. Default is `true`. Setting this property to `false` will prevent the window from being fullscreenable on macOS. On Windows versions older than Windows 11 Build 22000 this property has no effect, and frameless windows will not have rounded corners. -* `thickFrame` boolean (optional) - Use `WS_THICKFRAME` style for frameless windows on - Windows, which adds standard window frame. Setting it to `false` will remove - window shadow and window animations. Default is `true`. +* `thickFrame` boolean (optional) _Windows_ - Use `WS_THICKFRAME` style for + frameless windows on Windows, which adds the standard window frame. Setting it + to `false` will remove window shadow and window animations, and disable window + resizing via dragging the window edges. Default is `true`. * `vibrancy` string (optional) _macOS_ - Add a type of vibrancy effect to the window, only on macOS. Can be `appearance-based`, `titlebar`, `selection`, `menu`, `popover`, `sidebar`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, From 6c882d3b4873506e6d99479db8ed18bce1e1d113 Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Mon, 27 Oct 2025 20:03:08 +0100 Subject: [PATCH 171/268] feat: add `app.isHardwareAccelerationEnabled()` (#47614) * feat: add app.isHardwareAccelerationEnabled() * chore: address review feedback --- docs/api/app.md | 7 +++++++ shell/browser/api/electron_api_app.cc | 13 +++++++++++++ shell/browser/api/electron_api_app.h | 1 + spec/api-app-spec.ts | 6 ++++++ 4 files changed, 27 insertions(+) diff --git a/docs/api/app.md b/docs/api/app.md index c46d62cd0d888..5a7e482aff606 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -1215,6 +1215,13 @@ Disables hardware acceleration for current app. This method can only be called before app is ready. +### `app.isHardwareAccelerationEnabled()` + +Returns `boolean` - whether hardware acceleration is currently disabled. + + > [!NOTE] + > This information is only usable after the `gpu-info-update` event is emitted. + ### `app.disableDomainBlockingFor3DAPIs()` By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc index dd4d07c06ea0c..a6153ff0dad9b 100644 --- a/shell/browser/api/electron_api_app.cc +++ b/shell/browser/api/electron_api_app.cc @@ -1140,6 +1140,10 @@ void App::DisableHardwareAcceleration(gin_helper::ErrorThrower thrower) { "before app is ready"); return; } + + // If the GpuDataManager is already initialized, disable hardware + // acceleration immediately. Otherwise, set a flag to disable it in + // OnPreCreateThreads(). if (content::GpuDataManager::Initialized()) { content::GpuDataManager::GetInstance()->DisableHardwareAcceleration(); } else { @@ -1147,6 +1151,13 @@ void App::DisableHardwareAcceleration(gin_helper::ErrorThrower thrower) { } } +bool App::IsHardwareAccelerationEnabled() { + if (content::GpuDataManager::Initialized()) + return content::GpuDataManager::GetInstance() + ->HardwareAccelerationEnabled(); + return !disable_hw_acceleration_; +} + void App::DisableDomainBlockingFor3DAPIs(gin_helper::ErrorThrower thrower) { if (Browser::Get()->is_ready()) { thrower.ThrowError( @@ -1926,6 +1937,8 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuilder(v8::Isolate* isolate) { &App::SetAccessibilitySupportEnabled) .SetMethod("disableHardwareAcceleration", &App::DisableHardwareAcceleration) + .SetMethod("isHardwareAccelerationEnabled", + &App::IsHardwareAccelerationEnabled) .SetMethod("disableDomainBlockingFor3DAPIs", &App::DisableDomainBlockingFor3DAPIs) .SetMethod("getFileIcon", &App::GetFileIcon) diff --git a/shell/browser/api/electron_api_app.h b/shell/browser/api/electron_api_app.h index 504affb315106..fd0565b51c9d3 100644 --- a/shell/browser/api/electron_api_app.h +++ b/shell/browser/api/electron_api_app.h @@ -213,6 +213,7 @@ class App final : public gin::Wrappable<App>, void ReleaseSingleInstanceLock(); bool Relaunch(gin::Arguments* args); void DisableHardwareAcceleration(gin_helper::ErrorThrower thrower); + bool IsHardwareAccelerationEnabled(); void DisableDomainBlockingFor3DAPIs(gin_helper::ErrorThrower thrower); bool IsAccessibilitySupportEnabled(); v8::Local<v8::Value> GetAccessibilitySupportFeatures(); diff --git a/spec/api-app-spec.ts b/spec/api-app-spec.ts index 30e5e96abcb7b..81ab51f10e2ac 100644 --- a/spec/api-app-spec.ts +++ b/spec/api-app-spec.ts @@ -149,6 +149,12 @@ describe('app module', () => { }); }); + describe('app.isHardwareAccelerationEnabled()', () => { + it('should be a boolean', () => { + expect(app.isHardwareAccelerationEnabled()).to.be.a('boolean'); + }); + }); + describe('app.isPackaged', () => { it('should be false during tests', () => { expect(app.isPackaged).to.equal(false); From ace530a8b988a7900c944b136cd0d97b17f03a47 Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Mon, 27 Oct 2025 14:05:25 -0500 Subject: [PATCH 172/268] refactor: avoid deprecated views a11y api (#47674) * refactor: use GetViewAccessibility().SetName() instead of SetAccessibleName() Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5537333 * refactor: use GetViewAccessibility().SetRole() instead of SetAccessibleRole() Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5337377 * fixup! refactor: use GetViewAccessibility().SetRole() instead of SetAccessibleRole() --------- Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> --- shell/browser/ui/views/autofill_popup_view.cc | 7 +++++-- shell/browser/ui/views/autofill_popup_view.h | 7 +++++-- shell/browser/ui/views/client_frame_view_linux.cc | 3 ++- shell/browser/ui/views/menu_bar.cc | 7 +++++-- shell/browser/ui/views/opaque_frame_view.cc | 4 +++- shell/browser/ui/views/submenu_button.cc | 3 ++- shell/browser/ui/views/win_caption_button.cc | 3 ++- 7 files changed, 24 insertions(+), 10 deletions(-) diff --git a/shell/browser/ui/views/autofill_popup_view.cc b/shell/browser/ui/views/autofill_popup_view.cc index c80294774e74a..fe92fbc562b28 100644 --- a/shell/browser/ui/views/autofill_popup_view.cc +++ b/shell/browser/ui/views/autofill_popup_view.cc @@ -23,6 +23,7 @@ #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/text_utils.h" +#include "ui/views/accessibility/view_accessibility.h" #include "ui/views/border.h" #include "ui/views/focus/focus_manager.h" #include "ui/views/widget/widget.h" @@ -40,8 +41,10 @@ AutofillPopupView::AutofillPopupView(AutofillPopup* popup, CreateChildViews(); SetFocusBehavior(FocusBehavior::ALWAYS); set_drag_controller(this); - SetAccessibleRole(ax::mojom::Role::kMenu); - SetAccessibleName(u"Autofill Menu"); + + auto& view_a11y = GetViewAccessibility(); + view_a11y.SetRole(ax::mojom::Role::kMenu); + view_a11y.SetName(u"Autofill Menu"); } AutofillPopupView::~AutofillPopupView() { diff --git a/shell/browser/ui/views/autofill_popup_view.h b/shell/browser/ui/views/autofill_popup_view.h index 315b42d1cfb5d..e217c013db1ad 100644 --- a/shell/browser/ui/views/autofill_popup_view.h +++ b/shell/browser/ui/views/autofill_popup_view.h @@ -14,6 +14,7 @@ #include "shell/browser/osr/osr_view_proxy.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/base/metadata/metadata_impl_macros.h" +#include "ui/views/accessibility/view_accessibility.h" #include "ui/views/drag_controller.h" #include "ui/views/focus/native_view_focus_manager.h" #include "ui/views/widget/widget_delegate.h" @@ -43,8 +44,10 @@ class AutofillPopupChildView : public views::View { explicit AutofillPopupChildView(const std::u16string& suggestion) : suggestion_(suggestion) { SetFocusBehavior(FocusBehavior::ALWAYS); - SetAccessibleRole(ax::mojom::Role::kMenuItem); - SetAccessibleName(suggestion); + + auto& view_a11y = GetViewAccessibility(); + view_a11y.SetRole(ax::mojom::Role::kMenuItem); + view_a11y.SetName(suggestion); } // disable copy diff --git a/shell/browser/ui/views/client_frame_view_linux.cc b/shell/browser/ui/views/client_frame_view_linux.cc index c03a1b51f74ee..d0f0657dbd2a0 100644 --- a/shell/browser/ui/views/client_frame_view_linux.cc +++ b/shell/browser/ui/views/client_frame_view_linux.cc @@ -28,6 +28,7 @@ #include "ui/linux/nav_button_provider.h" #include "ui/native_theme/native_theme.h" #include "ui/strings/grit/ui_strings.h" +#include "ui/views/accessibility/view_accessibility.h" #include "ui/views/controls/button/image_button.h" #include "ui/views/style/typography.h" #include "ui/views/widget/widget.h" @@ -86,7 +87,7 @@ ClientFrameViewLinux::ClientFrameViewLinux() for (auto& button : nav_buttons_) { auto image_button = std::make_unique<views::ImageButton>(); image_button->SetImageVerticalAlignment(views::ImageButton::ALIGN_MIDDLE); - image_button->SetAccessibleName( + image_button->GetViewAccessibility().SetName( l10n_util::GetStringUTF16(button.accessibility_id)); button.button = AddChildView(std::move(image_button)); } diff --git a/shell/browser/ui/views/menu_bar.cc b/shell/browser/ui/views/menu_bar.cc index c451acdfb71cf..0f09312b6bc7c 100644 --- a/shell/browser/ui/views/menu_bar.cc +++ b/shell/browser/ui/views/menu_bar.cc @@ -10,6 +10,7 @@ #include "shell/browser/ui/views/submenu_button.h" #include "ui/base/mojom/menu_source_type.mojom.h" #include "ui/color/color_provider.h" +#include "ui/views/accessibility/view_accessibility.h" #include "ui/views/background.h" #include "ui/views/layout/box_layout.h" @@ -42,9 +43,11 @@ MenuBar::MenuBar(NativeWindow* window, RootView* root_view) SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kHorizontal)); window_->AddObserver(this); - SetAccessibleName(std::u16string(), + + auto& view_a11y = GetViewAccessibility(); + view_a11y.SetName(std::u16string(), ax::mojom::NameFrom::kAttributeExplicitlyEmpty); - SetAccessibleRole(ax::mojom::Role::kMenuBar); + view_a11y.SetRole(ax::mojom::Role::kMenuBar); } MenuBar::~MenuBar() { diff --git a/shell/browser/ui/views/opaque_frame_view.cc b/shell/browser/ui/views/opaque_frame_view.cc index e80535a973d71..8bc02ca34eb41 100644 --- a/shell/browser/ui/views/opaque_frame_view.cc +++ b/shell/browser/ui/views/opaque_frame_view.cc @@ -17,6 +17,7 @@ #include "ui/compositor/layer.h" #include "ui/gfx/font_list.h" #include "ui/linux/linux_ui.h" +#include "ui/views/accessibility/view_accessibility.h" #include "ui/views/background.h" #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_delegate.h" @@ -305,7 +306,8 @@ views::Button* OpaqueFrameView::CreateButton( button->SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); button->SetCallback(std::move(callback)); - button->SetAccessibleName(l10n_util::GetStringUTF16(accessibility_string_id)); + button->GetViewAccessibility().SetName( + l10n_util::GetStringUTF16(accessibility_string_id)); button->SetID(view_id); button->SetPaintToLayer(); diff --git a/shell/browser/ui/views/submenu_button.cc b/shell/browser/ui/views/submenu_button.cc index a07f2c2b0be7e..fdcdd3b1c8a88 100644 --- a/shell/browser/ui/views/submenu_button.cc +++ b/shell/browser/ui/views/submenu_button.cc @@ -9,6 +9,7 @@ #include "ui/gfx/canvas.h" #include "ui/gfx/color_utils.h" #include "ui/gfx/text_utils.h" +#include "ui/views/accessibility/view_accessibility.h" #include "ui/views/animation/flood_fill_ink_drop_ripple.h" #include "ui/views/animation/ink_drop_highlight.h" #include "ui/views/animation/ink_drop_host.h" @@ -26,7 +27,7 @@ SubmenuButton::SubmenuButton(PressedCallback callback, // Don't use native style border. SetBorder(CreateDefaultBorder()); #endif - SetAccessibleRole(ax::mojom::Role::kPopUpButton); + GetViewAccessibility().SetRole(ax::mojom::Role::kPopUpButton); if (GetUnderlinePosition(title, &accelerator_, &underline_start_, &underline_end_)) gfx::Canvas::SizeStringInt(GetText(), gfx::FontList(), &text_width_, diff --git a/shell/browser/ui/views/win_caption_button.cc b/shell/browser/ui/views/win_caption_button.cc index 9db1e70b0c8db..c966eb7422a9e 100644 --- a/shell/browser/ui/views/win_caption_button.cc +++ b/shell/browser/ui/views/win_caption_button.cc @@ -22,6 +22,7 @@ #include "ui/gfx/canvas.h" #include "ui/gfx/geometry/rect_conversions.h" #include "ui/gfx/scoped_canvas.h" +#include "ui/views/accessibility/view_accessibility.h" namespace electron { @@ -36,7 +37,7 @@ WinCaptionButton::WinCaptionButton(PressedCallback callback, SetAnimateOnStateChange(true); // Not focusable by default, only for accessibility. SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); - SetAccessibleName(accessible_name); + GetViewAccessibility().SetName(accessible_name); } WinCaptionButton::~WinCaptionButton() = default; From 16c9dfa0fdd4acbcfce08b37f263403885b34766 Mon Sep 17 00:00:00 2001 From: CuzImSlymi <nilay2014@gmail.com> Date: Mon, 27 Oct 2025 20:35:38 +0100 Subject: [PATCH 173/268] docs: add net.isOnline() to online/offline detection tutorial (#48665) * docs: add net.isOnline() to online/offline detection tutorial * chore: make linter happy docs/tutorial/online-offline-events.md:12:1 MD004/ul-style Unordered list style [Expected: dash; Actual: asterisk] docs/tutorial/online-offline-events.md:13:1 MD004/ul-style Unordered list style [Expected: dash; Actual: asterisk] --------- Co-authored-by: Charles Kerr <charles@charleskerr.com> --- docs/tutorial/online-offline-events.md | 36 ++++++++++++++++++++------ 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/docs/tutorial/online-offline-events.md b/docs/tutorial/online-offline-events.md index eb0f6dac25714..a3ff4b9b19f31 100644 --- a/docs/tutorial/online-offline-events.md +++ b/docs/tutorial/online-offline-events.md @@ -2,15 +2,15 @@ ## Overview -[Online and offline event](https://developer.mozilla.org/en-US/docs/Online_and_offline_events) -detection can be implemented in the Renderer process using the -[`navigator.onLine`](http://html5index.org/Offline%20-%20NavigatorOnLine.html) -attribute, part of standard HTML5 API. +Online and offline event detection can be implemented in both the main and renderer processes: + +- **Renderer process**: Use the [`navigator.onLine`](http://html5index.org/Offline%20-%20NavigatorOnLine.html) attribute and [online/offline events](https://developer.mozilla.org/en-US/docs/Online_and_offline_events), part of standard HTML5 API. +- **Main process**: Use the [`net.isOnline()`](../api/net.md#netisonline) method or the [`net.online`](../api/net.md#netonline-readonly) property. The `navigator.onLine` attribute returns: -* `false` if all network requests are guaranteed to fail (e.g. when disconnected from the network). -* `true` in all other cases. +- `false` if all network requests are guaranteed to fail (e.g. when disconnected from the network). +- `true` in all other cases. Since many cases return `true`, you should treat with care situations of getting false positives, as we cannot always assume that `true` value means @@ -19,7 +19,27 @@ is running a virtualization software that has virtual Ethernet adapters in "alwa connected" state. Therefore, if you want to determine the Internet access status of Electron, you should develop additional means for this check. -## Example +## Main Process Detection + +In the main process, you can use the `net` module to detect online/offline status: + +```js +const { net } = require('electron') + +// Method 1: Using net.isOnline() +const isOnline = net.isOnline() +console.log('Online status:', isOnline) + +// Method 2: Using net.online property +console.log('Online status:', net.online) +``` + +Both `net.isOnline()` and `net.online` return the same boolean value with the same reliability characteristics as `navigator.onLine` - they provide a strong indicator when offline (`false`), but a `true` value doesn't guarantee successful internet connectivity. + +> [!NOTE] +> The `net` module is only available after the app emits the `ready` event. + +## Renderer Process Example Starting with an HTML file `index.html`, this example will demonstrate how the `navigator.onLine` API can be used to build a connection status indicator. @@ -84,4 +104,4 @@ After launching the Electron application, you should see the notification: ![Connection status](../images/connection-status.png) > [!NOTE] -> If you need to communicate the connection status to the main process, use the [IPC renderer](../api/ipc-renderer.md) API. +> If you need to check the connection status in the main process, you can use [`net.isOnline()`](../api/net.md#netisonline) directly instead of communicating from the renderer process via [IPC](../api/ipc-renderer.md). From cfdd1e4a495d8c5fb5c94e90635eeb33da4e8f60 Mon Sep 17 00:00:00 2001 From: Teaveloper <nilay2014@gmail.com> Date: Mon, 27 Oct 2025 21:56:53 +0100 Subject: [PATCH 174/268] docs: security.md use runnable examples for permissions and csp (#43248) * docs: security.md use runnable examples for permissions and csp Signed-off-by: LeUser111 <florian.wiedenmann@grob.de> * Removed semi-colon for uniform js code style in examples Signed-off-by: LeUser111 <florian.wiedenmann@grob.de> * docs: security.md, session.md - added clarification on defaultSession, added csp example * docs: security.md/session.md incorporated review feedback * docs: security.md/session.md incorporated more review feedback * docs: security.md/session.md incorporated more review feedback * docs: tutorial/security.md - fixed linting issue * chore: empty commit for CI --------- Signed-off-by: LeUser111 <florian.wiedenmann@grob.de> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> --- docs/api/session.md | 2 +- docs/tutorial/security.md | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/api/session.md b/docs/api/session.md index 96f0ab6e9a1b7..2e6e61b71845b 100644 --- a/docs/api/session.md +++ b/docs/api/session.md @@ -66,7 +66,7 @@ The `session` module has the following properties: ### `session.defaultSession` -A `Session` object, the default session object of the app. +A `Session` object, the default session object of the app, available after `app.whenReady` is called. ## Class: Session diff --git a/docs/tutorial/security.md b/docs/tutorial/security.md index 3bbbd139dae79..81b4ce3c9eabc 100644 --- a/docs/tutorial/security.md +++ b/docs/tutorial/security.md @@ -299,7 +299,7 @@ const { session } = require('electron') const { URL } = require('node:url') session - .fromPartition('some-partition') + .defaultSession .setPermissionRequestHandler((webContents, permission, callback) => { const parsedUrl = new URL(webContents.getURL()) @@ -316,6 +316,8 @@ session }) ``` +Note: `session.defaultSession` is only available after `app.whenReady` is called. + ### 6. Do not disable `webSecurity` :::info @@ -406,6 +408,8 @@ session.defaultSession.webRequest.onHeadersReceived((details, callback) => { }) ``` +Note: `session.defaultSession` is only available after `app.whenReady` is called. + #### CSP meta tag CSP's preferred delivery mechanism is an HTTP header. However, it is not possible From 1709921b4a7d87763c5faf09f670b9f7dd716ac7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Tue, 28 Oct 2025 08:54:56 +0100 Subject: [PATCH 175/268] build(deps-dev): bump typescript from 5.6.2 to 5.8.3 (#48694) Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.6.2 to 5.8.3. - [Release notes](https://github.com/microsoft/TypeScript/releases) - [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release-publish.yml) - [Commits](https://github.com/microsoft/TypeScript/compare/v5.6.2...v5.8.3) --- updated-dependencies: - dependency-name: typescript dependency-version: 5.8.3 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 5f19c4d7baf8a..46faf05d9cc1c 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "timers-browserify": "1.4.2", "ts-loader": "^8.0.2", "ts-node": "6.2.0", - "typescript": "^5.6.2", + "typescript": "^5.8.3", "url": "^0.11.4", "webpack": "^5.95.0", "webpack-cli": "^6.0.1", diff --git a/yarn.lock b/yarn.lock index db252209b29e8..8bc6e537ac60d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7734,10 +7734,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^5.6.2: - version "5.6.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.2.tgz#d1de67b6bef77c41823f822df8f0b3bcff60a5a0" - integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw== +typescript@^5.8.3: + version "5.8.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.8.3.tgz#92f8a3e5e3cf497356f4178c34cd65a7f5e8440e" + integrity sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ== uc.micro@^2.0.0, uc.micro@^2.1.0: version "2.1.0" From 6942eb9154ad623d72c9e4f28e7cc822d6cd587e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Tue, 28 Oct 2025 08:58:28 +0100 Subject: [PATCH 176/268] build(deps): bump actions/download-artifact from 5.0.0 to 6.0.0 (#48693) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 5.0.0 to 6.0.0. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/634f93cb2916e3fdff6788551b99b062d0335ce0...018cc2cf5baa6db3ef3c5f8a56943fffe632ef53) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/pipeline-segment-electron-test.yml | 4 ++-- .github/workflows/pipeline-segment-node-nan-test.yml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pipeline-segment-electron-test.yml b/.github/workflows/pipeline-segment-electron-test.yml index d56b815d08bd7..cde43774bdc5b 100644 --- a/.github/workflows/pipeline-segment-electron-test.yml +++ b/.github/workflows/pipeline-segment-electron-test.yml @@ -167,12 +167,12 @@ jobs: echo "DISABLE_CRASH_REPORTER_TESTS=true" >> $GITHUB_ENV echo "IS_ASAN=true" >> $GITHUB_ENV - name: Download Generated Artifacts - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 with: name: generated_artifacts_${{ env.ARTIFACT_KEY }} path: ./generated_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }} - name: Download Src Artifacts - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 with: name: src_artifacts_${{ env.ARTIFACT_KEY }} path: ./src_artifacts_${{ matrix.build-type }}_${{ inputs.target-arch }} diff --git a/.github/workflows/pipeline-segment-node-nan-test.yml b/.github/workflows/pipeline-segment-node-nan-test.yml index 5a4e4b3eec8d3..3d6346c13cb64 100644 --- a/.github/workflows/pipeline-segment-node-nan-test.yml +++ b/.github/workflows/pipeline-segment-node-nan-test.yml @@ -61,12 +61,12 @@ jobs: - name: Install Dependencies uses: ./src/electron/.github/actions/install-dependencies - name: Download Generated Artifacts - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 with: name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }} path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }} - name: Download Src Artifacts - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 with: name: src_artifacts_linux_${{ env.TARGET_ARCH }} path: ./src_artifacts_linux_${{ env.TARGET_ARCH }} @@ -115,12 +115,12 @@ jobs: - name: Install Dependencies uses: ./src/electron/.github/actions/install-dependencies - name: Download Generated Artifacts - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 with: name: generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }} path: ./generated_artifacts_${{ env.BUILD_TYPE }}_${{ env.TARGET_ARCH }} - name: Download Src Artifacts - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 with: name: src_artifacts_linux_${{ env.TARGET_ARCH }} path: ./src_artifacts_linux_${{ env.TARGET_ARCH }} From c57912adf9d9a045e5ff5c3022db6d7ab37ed56f Mon Sep 17 00:00:00 2001 From: Erick Zhao <nilay2014@gmail.com> Date: Tue, 28 Oct 2025 01:06:23 -0700 Subject: [PATCH 177/268] ci: use `<sup>` in release notes generator (#48690) --- script/release/notes/notes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/release/notes/notes.ts b/script/release/notes/notes.ts index 2c5e97f3334ab..04a2030bd1467 100644 --- a/script/release/notes/notes.ts +++ b/script/release/notes/notes.ts @@ -684,7 +684,7 @@ function renderTrops (commit: Commit, excludeBranch: string) { .map(([branch, key]) => renderTrop(branch, key)) .join(', '); return body - ? `<span style="font-size:small;">(Also in ${body})</span>` + ? `<sup>(Also in ${body})</sup>` : body; } From 993304a0084ab51f5890a96a38a0e4470405dd1f Mon Sep 17 00:00:00 2001 From: michal-pichlinski-openfin <nilay2014@gmail.com> Date: Tue, 28 Oct 2025 13:46:33 +0100 Subject: [PATCH 178/268] feat: Focus DevTools when breakpoint is triggered (#46386) `bringToFront` DevTools message is sent when breakpoint is triggered or inspect is called and Chromium upon this message activates DevTools via `DevToolsUIBindings::Delegate::ActivateWindow`: ``` void DevToolsWindow::ActivateWindow() { if (life_stage_ != kLoadCompleted) return; \#if BUILDFLAG(IS_ANDROID) NOTIMPLEMENTED(); \#else if (is_docked_ && GetInspectedBrowserWindow()) main_web_contents_->Focus(); else if (!is_docked_ && browser_ && !browser_->window()->IsActive()) browser_->window()->Activate(); \#endif } ``` which implements: `DevToolsUIBindings::Delegate::ActivateWindow`. Electron also implements this interface in: `electron::InspectableWebContents`. However it was only setting a zoom level, therefore this commit extends it with activation of the DevTools. Only supported for DevTools manged by `electron::InspectableWebContents`. Closes: #37388 --- shell/browser/ui/inspectable_web_contents.cc | 6 +++ .../ui/inspectable_web_contents_view.cc | 17 +++++++++ .../ui/inspectable_web_contents_view.h | 1 + spec/api-web-contents-spec.ts | 37 ++++++++++++++++++- 4 files changed, 60 insertions(+), 1 deletion(-) diff --git a/shell/browser/ui/inspectable_web_contents.cc b/shell/browser/ui/inspectable_web_contents.cc index 18ae7c3f630cd..57e07ed09cc3c 100644 --- a/shell/browser/ui/inspectable_web_contents.cc +++ b/shell/browser/ui/inspectable_web_contents.cc @@ -520,6 +520,12 @@ void InspectableWebContents::UpdateDevToolsZoomLevel(double level) { } void InspectableWebContents::ActivateWindow() { + if (embedder_message_dispatcher_) { + if (managed_devtools_web_contents_ && view_) { + view_->ActivateDevTools(); + } + } + // Set the zoom level. SetZoomLevelForWebContents(GetDevToolsWebContents(), GetDevToolsZoomLevel()); } diff --git a/shell/browser/ui/inspectable_web_contents_view.cc b/shell/browser/ui/inspectable_web_contents_view.cc index 09155c1ced5e7..00fff4a08265c 100644 --- a/shell/browser/ui/inspectable_web_contents_view.cc +++ b/shell/browser/ui/inspectable_web_contents_view.cc @@ -132,6 +132,23 @@ void InspectableWebContentsView::ShowDevTools(bool activate) { } } +void InspectableWebContentsView::ActivateDevTools() { + if (!devtools_visible_) { + return; + } + if (devtools_window_) { + if (!devtools_window_->IsActive()) { + devtools_window_->Activate(); + } + return; + } + if (devtools_web_view_) { + if (!devtools_web_view_->HasFocus()) { + devtools_web_view_->RequestFocus(); + } + } +} + void InspectableWebContentsView::CloseDevTools() { if (!devtools_visible_) return; diff --git a/shell/browser/ui/inspectable_web_contents_view.h b/shell/browser/ui/inspectable_web_contents_view.h index 30c2fef8e898e..ff2ee8636555f 100644 --- a/shell/browser/ui/inspectable_web_contents_view.h +++ b/shell/browser/ui/inspectable_web_contents_view.h @@ -49,6 +49,7 @@ class InspectableWebContentsView : public views::View { void SetCornerRadii(const gfx::RoundedCornersF& corner_radii); void ShowDevTools(bool activate); + void ActivateDevTools(); void CloseDevTools(); bool IsDevToolsViewShowing(); bool IsDevToolsViewFocused(); diff --git a/spec/api-web-contents-spec.ts b/spec/api-web-contents-spec.ts index e701ff98e0890..50cf544736161 100644 --- a/spec/api-web-contents-spec.ts +++ b/spec/api-web-contents-spec.ts @@ -1,6 +1,6 @@ import { BrowserWindow, ipcMain, webContents, session, app, BrowserView, WebContents, BaseWindow, WebContentsView } from 'electron/main'; -import { expect } from 'chai'; +import { assert, expect } from 'chai'; import * as cp from 'node:child_process'; import { once } from 'node:events'; @@ -1013,6 +1013,41 @@ describe('webContents module', () => { await devToolsClosed; expect(() => { webContents.getFocusedWebContents(); }).to.not.throw(); }); + + it('Inspect activates detached devtools window', async () => { + const window = new BrowserWindow({ show: true }); + await window.loadURL('about:blank'); + const webContentsBeforeOpenedDevtools = webContents.getAllWebContents(); + + const windowWasBlurred = once(window, 'blur'); + window.webContents.openDevTools({ mode: 'detach' }); + await windowWasBlurred; + + let devToolsWebContents = null; + for (const newWebContents of webContents.getAllWebContents()) { + const oldWebContents = webContentsBeforeOpenedDevtools.find( + oldWebContents => { + return newWebContents.id === oldWebContents.id; + }); + if (oldWebContents !== null) { + devToolsWebContents = newWebContents; + break; + } + } + assert(devToolsWebContents !== null); + + const windowFocused = once(window, 'focus'); + window.focus(); + await windowFocused; + + expect(devToolsWebContents.isFocused()).to.be.false(); + const devToolsWebContentsFocused = once(devToolsWebContents, 'focus'); + window.webContents.inspectElement(100, 100); + await devToolsWebContentsFocused; + + expect(devToolsWebContents.isFocused()).to.be.true(); + expect(window.isFocused()).to.be.false(); + }); }); describe('setDevToolsWebContents() API', () => { From bf9348453ceff26f79d424ee697b97e35e79852b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Tue, 28 Oct 2025 07:49:29 -0500 Subject: [PATCH 179/268] build(deps): bump github/codeql-action from 4.30.9 to 4.31.0 (#48692) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.30.9 to 4.31.0. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/16140ae1a102900babc80a33c44059580f687047...4e94bd11f71e507f7f87df81788dff88d1dacbfb) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.31.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/scorecards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 0c897d43166d5..4176d52955d2b 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -50,6 +50,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@16140ae1a102900babc80a33c44059580f687047 # v3.29.5 + uses: github/codeql-action/upload-sarif@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v3.29.5 with: sarif_file: results.sarif From dcf0a9ae6c9a55513abc8233921a689ed2666e8d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Tue, 28 Oct 2025 07:50:01 -0500 Subject: [PATCH 180/268] build(deps): bump actions/upload-artifact from 4.6.2 to 5.0.0 (#48691) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.6.2 to 5.0.0. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/ea165f8d65b6e75b540449e92b4886f43607fa02...330a01c490aca151604b8cf639adc76d48f6c5d4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: 5.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/archaeologist-dig.yml | 2 +- .github/workflows/pipeline-segment-electron-test.yml | 2 +- .github/workflows/scorecards.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/archaeologist-dig.yml b/.github/workflows/archaeologist-dig.yml index b527446a65f22..78775ecda731b 100644 --- a/.github/workflows/archaeologist-dig.yml +++ b/.github/workflows/archaeologist-dig.yml @@ -41,7 +41,7 @@ jobs: sha-file: .dig-old filename: electron.old.d.ts - name: Upload artifacts - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2 + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 #v5.0.0 with: name: artifacts path: electron/artifacts diff --git a/.github/workflows/pipeline-segment-electron-test.yml b/.github/workflows/pipeline-segment-electron-test.yml index cde43774bdc5b..80b11005b2f6e 100644 --- a/.github/workflows/pipeline-segment-electron-test.yml +++ b/.github/workflows/pipeline-segment-electron-test.yml @@ -262,7 +262,7 @@ jobs: if: always() && !cancelled() - name: Upload Test Artifacts if: always() && !cancelled() - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 with: name: test_artifacts_${{ env.ARTIFACT_KEY }}_${{ matrix.shard }} path: src/electron/spec/artifacts diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 4176d52955d2b..d72ac359b570d 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -42,7 +42,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 with: name: SARIF file path: results.sarif From 0aca062cf4d9c81fbb04071d95303f94cd6837b6 Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Tue, 28 Oct 2025 11:17:29 -0400 Subject: [PATCH 181/268] chore: bump chromium to 143.0.7497.0 (main) (#48657) * chore: bump chromium in DEPS to 143.0.7492.0 * chore: bump chromium in DEPS to 143.0.7493.0 * chore: update mas_avoid_private_macos_api_usage.patch.patch Move os_crypt/sync and os_crypt/async shared code to os_crypt/common | https://chromium-review.googlesource.com/c/chromium/src/+/7081087 * chore: update add_didinstallconditionalfeatures.patch no manual changes; patch applied with fuzz Reland "Remove BackForwardTransitions flag" | https://chromium-review.googlesource.com/c/chromium/src/+/7079411 * chore: update printing.patch Avoid a reachable NOTREACHED() in PrintingContextLinux | https://chromium-review.googlesource.com/c/chromium/src/+/7081117 * chore: update allow_in-process_windows_to_have_different_web_prefs.patch patch reapplied manually due to context shear Reland "Remove BackForwardTransitions flag" | https://chromium-review.googlesource.com/c/chromium/src/+/7079411 * chore: update chore_provide_iswebcontentscreationoverridden_with_full_params.patch patch reapplied manually due to context shear Cleanup: format some content files | https://chromium-review.googlesource.com/c/chromium/src/+/7083290 * chore: update feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch patch manually reapplied for files moved upstream Move os_crypt/sync and os_crypt/async shared code to os_crypt/common | https://chromium-review.googlesource.com/c/chromium/src/+/7081087 * chore: update revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch no manual changes; patch applied with fuzz [spelling+grammar restrictions] fix feature param name | https://chromium-review.googlesource.com/c/chromium/src/+/7081186 * chore: update patches * chore: fix broken includes in ElectronBrowserMainParts Move os_crypt/sync and os_crypt/async shared code to os_crypt/common | https://chromium-review.googlesource.com/c/chromium/src/+/7081087 * chore: bump chromium in DEPS to 143.0.7495.0 * chore: fixup patch indices * chore: bump chromium in DEPS to 143.0.7497.0 * chore: fixup patch indices * 7085081: Roll libc++ from d6739a332fe9 to bc00f6e9f739 (1 revision) https://chromium-review.googlesource.com/c/chromium/src/+/7085081 * 7081087: Move os_crypt/sync and os_crypt/async shared code to os_crypt/common https://chromium-review.googlesource.com/c/chromium/src/+/7081087 * test: fix failing spec --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> --- BUILD.gn | 1 + DEPS | 2 +- filenames.libcxx.gni | 11 ----- patches/boringssl/expose_ripemd160.patch | 2 +- ...xpose_several_extra_cipher_functions.patch | 4 +- .../add_didinstallconditionalfeatures.patch | 8 ++-- ...o_depend_on_components_os_crypt_sync.patch | 2 +- ..._windows_to_have_different_web_prefs.patch | 24 +++++----- .../build_add_electron_tracing_category.patch | 4 +- ..._depend_on_packed_resource_integrity.patch | 12 ++--- patches/chromium/can_create_window.patch | 14 +++--- ...ameter_in_script_lifecycle_observers.patch | 8 ++-- ...screationoverridden_with_full_params.patch | 13 ++--- ...me_deprecated_wrapper_utility_in_gin.patch | 2 +- patches/chromium/disable_hidden.patch | 2 +- ...n_embedder_cleanup_callbacks_run_for.patch | 2 +- ...t_allow_code_cache_in_custom_schemes.patch | 4 +- ...moothing_css_rule_and_blink_painting.patch | 14 +++--- ...same_application_can_use_safestorage.patch | 8 ++-- ...ding_non-standard_schemes_in_iframes.patch | 4 +- ...original_resize_performance_on_macos.patch | 4 +- ...from_localframe_requestexecutescript.patch | 8 ++-- patches/chromium/frame_host_manager.patch | 6 +-- .../gin_enable_disable_v8_platform.patch | 2 +- patches/chromium/isolate_holder.patch | 2 +- ..._avoid_private_macos_api_usage.patch.patch | 47 +++++++++---------- .../chromium/notification_provenance.patch | 8 ++-- ...xture_remove_keyed_mutex_on_win_dxgi.patch | 2 +- patches/chromium/printing.patch | 10 ++-- ...r_changes_to_the_webcontentsobserver.patch | 4 +- ...pose_hostimportmoduledynamically_and.patch | 12 ++--- ...eature_windelayspellcheckserviceinit.patch | 12 ++--- ...ean_up_stale_macwebcontentsocclusion.patch | 6 +-- ...al_remove_unused_prehandlemouseevent.patch | 6 +-- ...windowtreehostwin_window_enlargement.patch | 4 +- .../support_mixed_sandbox_with_zygote.patch | 4 +- patches/chromium/web_contents.patch | 2 +- patches/chromium/webview_fullscreen.patch | 4 +- .../worker_context_will_destroy.patch | 2 +- ...feat_add_hook_to_notify_script_ready.patch | 2 +- shell/browser/electron_browser_main_parts.cc | 2 +- spec/api-web-frame-main-spec.ts | 2 + 42 files changed, 142 insertions(+), 150 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index c27602f16406a..c933f2e25b4d9 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -592,6 +592,7 @@ source_set("electron_lib") { use_libcxx_modules = false deps += [ + "//components/os_crypt/common:keychain_password_mac", "//components/remote_cocoa/app_shim", "//components/remote_cocoa/browser", "//content/browser:mac_helpers", diff --git a/DEPS b/DEPS index 33d393e57b21d..e083bdd78b00b 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '143.0.7491.0', + '143.0.7497.0', 'node_version': 'v22.20.0', 'nan_version': diff --git a/filenames.libcxx.gni b/filenames.libcxx.gni index 310b66fa36764..a4628ed2bc4b5 100644 --- a/filenames.libcxx.gni +++ b/filenames.libcxx.gni @@ -841,7 +841,6 @@ libcxx_headers = [ "//third_party/libc++/src/include/__cxx03/cmath", "//third_party/libc++/src/include/__cxx03/codecvt", "//third_party/libc++/src/include/__cxx03/complex", - "//third_party/libc++/src/include/__cxx03/complex.h", "//third_party/libc++/src/include/__cxx03/condition_variable", "//third_party/libc++/src/include/__cxx03/csetjmp", "//third_party/libc++/src/include/__cxx03/csignal", @@ -854,25 +853,20 @@ libcxx_headers = [ "//third_party/libc++/src/include/__cxx03/cstring", "//third_party/libc++/src/include/__cxx03/ctgmath", "//third_party/libc++/src/include/__cxx03/ctime", - "//third_party/libc++/src/include/__cxx03/ctype.h", "//third_party/libc++/src/include/__cxx03/cuchar", "//third_party/libc++/src/include/__cxx03/cwchar", "//third_party/libc++/src/include/__cxx03/cwctype", "//third_party/libc++/src/include/__cxx03/deque", - "//third_party/libc++/src/include/__cxx03/errno.h", "//third_party/libc++/src/include/__cxx03/exception", "//third_party/libc++/src/include/__cxx03/experimental/__config", "//third_party/libc++/src/include/__cxx03/experimental/utility", "//third_party/libc++/src/include/__cxx03/ext/__hash", "//third_party/libc++/src/include/__cxx03/ext/hash_map", "//third_party/libc++/src/include/__cxx03/ext/hash_set", - "//third_party/libc++/src/include/__cxx03/fenv.h", - "//third_party/libc++/src/include/__cxx03/float.h", "//third_party/libc++/src/include/__cxx03/forward_list", "//third_party/libc++/src/include/__cxx03/fstream", "//third_party/libc++/src/include/__cxx03/functional", "//third_party/libc++/src/include/__cxx03/future", - "//third_party/libc++/src/include/__cxx03/inttypes.h", "//third_party/libc++/src/include/__cxx03/iomanip", "//third_party/libc++/src/include/__cxx03/ios", "//third_party/libc++/src/include/__cxx03/iosfwd", @@ -899,11 +893,8 @@ libcxx_headers = [ "//third_party/libc++/src/include/__cxx03/sstream", "//third_party/libc++/src/include/__cxx03/stack", "//third_party/libc++/src/include/__cxx03/stdatomic.h", - "//third_party/libc++/src/include/__cxx03/stdbool.h", - "//third_party/libc++/src/include/__cxx03/stddef.h", "//third_party/libc++/src/include/__cxx03/stdexcept", "//third_party/libc++/src/include/__cxx03/stdint.h", - "//third_party/libc++/src/include/__cxx03/stdio.h", "//third_party/libc++/src/include/__cxx03/stdlib.h", "//third_party/libc++/src/include/__cxx03/streambuf", "//third_party/libc++/src/include/__cxx03/string", @@ -911,7 +902,6 @@ libcxx_headers = [ "//third_party/libc++/src/include/__cxx03/string_view", "//third_party/libc++/src/include/__cxx03/strstream", "//third_party/libc++/src/include/__cxx03/system_error", - "//third_party/libc++/src/include/__cxx03/tgmath.h", "//third_party/libc++/src/include/__cxx03/thread", "//third_party/libc++/src/include/__cxx03/type_traits", "//third_party/libc++/src/include/__cxx03/typeindex", @@ -924,7 +914,6 @@ libcxx_headers = [ "//third_party/libc++/src/include/__cxx03/vector", "//third_party/libc++/src/include/__cxx03/version", "//third_party/libc++/src/include/__cxx03/wchar.h", - "//third_party/libc++/src/include/__cxx03/wctype.h", "//third_party/libc++/src/include/__debug_utils/randomize_range.h", "//third_party/libc++/src/include/__debug_utils/sanitizers.h", "//third_party/libc++/src/include/__debug_utils/strict_weak_ordering_check.h", diff --git a/patches/boringssl/expose_ripemd160.patch b/patches/boringssl/expose_ripemd160.patch index f78887ad38c01..1553f657d3961 100644 --- a/patches/boringssl/expose_ripemd160.patch +++ b/patches/boringssl/expose_ripemd160.patch @@ -82,7 +82,7 @@ index feaf17c72cecb8099bc11ac10747fbad719ddca9..891a73f229e3f0838cb2fa99b8fb24fd void EVP_MD_do_all(void (*callback)(const EVP_MD *cipher, const char *name, diff --git a/include/openssl/digest.h b/include/openssl/digest.h -index b604aba00c1c6cea8002b6dc298ea5fe979589b1..1c123aa1dca09ae60c31be2a6dab9a64748eac17 100644 +index a86c18926e7798a3b0aae70c53870e03b5acd0ab..f4f27f9e803533d8db50d89e7a0125384a025a46 100644 --- a/include/openssl/digest.h +++ b/include/openssl/digest.h @@ -48,6 +48,9 @@ OPENSSL_EXPORT const EVP_MD *EVP_blake2b256(void); diff --git a/patches/boringssl/feat_expose_several_extra_cipher_functions.patch b/patches/boringssl/feat_expose_several_extra_cipher_functions.patch index 13677b92e986f..3ea9fb6531fbc 100644 --- a/patches/boringssl/feat_expose_several_extra_cipher_functions.patch +++ b/patches/boringssl/feat_expose_several_extra_cipher_functions.patch @@ -118,10 +118,10 @@ index 891a73f229e3f0838cb2fa99b8fb24fdeac1962b..f7d0c5dc66f016eb9338c15e7f5ef59e callback(EVP_des_ede3_cbc(), "des-ede3-cbc", nullptr, arg); callback(EVP_rc2_cbc(), "rc2-cbc", nullptr, arg); diff --git a/include/openssl/cipher.h b/include/openssl/cipher.h -index 13e68ad20ac08a462bb577d7f99e2c6f167579fa..4960d0eeb8f31bec4347ed2a1b63beba530de700 100644 +index a5533caf45eaacc4baef4a73d97e9bc2b6e3a942..35f24c1b22ea2c6b4766c0d87e75b6fc6b459f79 100644 --- a/include/openssl/cipher.h +++ b/include/openssl/cipher.h -@@ -448,6 +448,7 @@ OPENSSL_EXPORT const EVP_CIPHER *EVP_des_ede3_ecb(void); +@@ -461,6 +461,7 @@ OPENSSL_EXPORT const EVP_CIPHER *EVP_des_ede3_ecb(void); // EVP_aes_128_cfb128 is only available in decrepit. OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_cfb128(void); diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index 11cdf51cf9059..ec81d0cdd6ee9 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -40,7 +40,7 @@ index 298387873e7ded5f96c788bc53ad7256a8f5b13e..7e64e34a2ebd9738d33bfc9cc7fd827b int world_id) { for (auto& observer : observers_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index f3f84ed452c1eb9fe662631781bc1c93301e8ea0..0677883a806d342734dc970f7c3c665cc9663dd0 100644 +index b6acf7101932961b4a81738e1fcda07efc714edc..32dfed04e2fd7cd2e60c7cf145d182f4163feb68 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h @@ -603,6 +603,8 @@ class CONTENT_EXPORT RenderFrameImpl @@ -92,11 +92,11 @@ index 36baf908d3be8aed44ff60b8de2cffe2eee15efe..8d73ddb12013ce195026b9f63050cf33 int32_t world_id) = 0; virtual bool AllowScriptExtensions() = 0; diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -index b02b60ff5f6650332c54ecc66f6fdb274b737aa7..1aacf6f66b543a4ede6ab5d885143dd4a0821e8a 100644 +index 019445e625257f909875adffdc5e967fb65a3728..11475d1a22054a884f2f1e7e5c933e9ae8d3379f 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc +++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -@@ -295,6 +295,13 @@ void LocalFrameClientImpl::DidCreateScriptContext( - web_frame_->Client()->DidCreateScriptContext(context, world_id); +@@ -300,6 +300,13 @@ void LocalFrameClientImpl::DidCreateScriptContext( + } } +void LocalFrameClientImpl::DidInstallConditionalFeatures( diff --git a/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch b/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch index b7be8fb2d6048..ca5fb38aa2e53 100644 --- a/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch +++ b/patches/chromium/allow_electron_to_depend_on_components_os_crypt_sync.patch @@ -10,7 +10,7 @@ so we can remove this patch once we migrate our code to use os_crypt async. diff --git a/components/os_crypt/sync/BUILD.gn b/components/os_crypt/sync/BUILD.gn -index 4b648046b325fe0df7f014b1718664222c8754af..885225d96ed91a1c7df3796acb8d860d4439b561 100644 +index 23aa391aaf380f87310fb295277809f8b105d6e8..bb308187837371ecfa2482affaf35ac7ed98c1f3 100644 --- a/components/os_crypt/sync/BUILD.gn +++ b/components/os_crypt/sync/BUILD.gn @@ -10,6 +10,7 @@ import("//components/os_crypt/sync/features.gni") diff --git a/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch b/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch index b080942396386..709249b55a4b9 100644 --- a/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch +++ b/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch @@ -8,7 +8,7 @@ WebPreferences of in-process child windows, rather than relying on process-level command line switches, as before. diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc -index aee37cbec8726ad81058b2ab76adb2638e33727e..7abd664b73b201da0fdf9f3f759ed94b172c9b23 100644 +index 845edd77da72cfe2d9a56e15cf1e50bdd391be49..9b50605b67c0da8692653816c8638ea89561282f 100644 --- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc +++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc @@ -148,6 +148,19 @@ bool StructTraits<blink::mojom::WebPreferencesDataView, @@ -32,7 +32,7 @@ index aee37cbec8726ad81058b2ab76adb2638e33727e..7abd664b73b201da0fdf9f3f759ed94b out->accelerated_video_decode_enabled = data.accelerated_video_decode_enabled(); diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h -index 0497353db763594f7acbaa7275cfbe0dfb57f64b..7d1a0a5976e383330d78addc8b4f45232210a946 100644 +index da99e295dd7c063b5416d310fe91d422e74bf5fb..0c91e14c0fb760dd075f517731d110caa3f7739a 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences.h +++ b/third_party/blink/public/common/web_preferences/web_preferences.h @@ -9,6 +9,7 @@ @@ -43,8 +43,8 @@ index 0497353db763594f7acbaa7275cfbe0dfb57f64b..7d1a0a5976e383330d78addc8b4f4523 #include "build/build_config.h" #include "net/nqe/effective_connection_type.h" #include "third_party/blink/public/common/common_export.h" -@@ -459,6 +460,19 @@ struct BLINK_COMMON_EXPORT WebPreferences { - bool increment_local_surface_id_for_mainframe_same_doc_navigation = true; +@@ -460,6 +461,19 @@ struct BLINK_COMMON_EXPORT WebPreferences { + bool should_screenshot_on_mainframe_same_doc_navigation = true; #endif // BUILDFLAG(IS_ANDROID) + // Begin Electron-specific WebPreferences. @@ -64,7 +64,7 @@ index 0497353db763594f7acbaa7275cfbe0dfb57f64b..7d1a0a5976e383330d78addc8b4f4523 // chrome, except for the cases where it would require lots of extra work for // the embedder to use the same default value. diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h -index f0756a3707d8219800a8ec1e9747a0cffc0f6424..5bf75fe4aab9790d22ec2de055a994030d1b8bae 100644 +index b46fc738d5813a71212c4e1a29a8d08fc15982b3..f65ece291742e9776612cd1e5d2bf2f741c6a400 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h +++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h @@ -8,6 +8,7 @@ @@ -129,18 +129,18 @@ index f0756a3707d8219800a8ec1e9747a0cffc0f6424..5bf75fe4aab9790d22ec2de055a99403 return r.cookie_enabled; } diff --git a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom -index f7712ccf8a5511b1f67d54bf3972384515a15e4e..558c75d68380ea9c5d3c67823db529ea267d0bc3 100644 +index 03ae611eda0f4b9888c498b89e4b805dbe629268..b96998d728c9b107532b2ec67320367eaa6b1f94 100644 --- a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom +++ b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom -@@ -8,6 +8,7 @@ import "third_party/blink/public/mojom/css/preferred_color_scheme.mojom"; - import "third_party/blink/public/mojom/css/preferred_contrast.mojom"; - import "third_party/blink/public/mojom/v8_cache_options.mojom"; - import "url/mojom/url.mojom"; +@@ -4,6 +4,7 @@ + + module blink.mojom; + +import "mojo/public/mojom/base/file_path.mojom"; import "mojo/public/mojom/base/string16.mojom"; import "skia/public/mojom/skcolor.mojom"; - -@@ -217,6 +218,19 @@ struct WebPreferences { + import "third_party/blink/public/mojom/css/preferred_color_scheme.mojom"; +@@ -223,6 +224,19 @@ struct WebPreferences { // If true, stylus handwriting recognition to text input will be available in // editable input fields which are non-password type. bool stylus_handwriting_enabled; diff --git a/patches/chromium/build_add_electron_tracing_category.patch b/patches/chromium/build_add_electron_tracing_category.patch index 509ec4dc263a7..5a6cd72ec20cd 100644 --- a/patches/chromium/build_add_electron_tracing_category.patch +++ b/patches/chromium/build_add_electron_tracing_category.patch @@ -8,10 +8,10 @@ categories in use are known / declared. This patch is required for us to introduce a new Electron category for Electron-specific tracing. diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h -index 0781468366f8684b0e245bd6df85c1f48b5a915a..5d4ea347e2cba761870462ff1e623792416dbf4c 100644 +index 404faaae45884e2347fb3a7a2d77c7b95c7f6b43..e63bfce2d65a2015993de91630928029288738f4 100644 --- a/base/trace_event/builtin_categories.h +++ b/base/trace_event/builtin_categories.h -@@ -128,6 +128,7 @@ PERFETTO_DEFINE_CATEGORIES_IN_NAMESPACE_WITH_ATTRS( +@@ -131,6 +131,7 @@ PERFETTO_DEFINE_CATEGORIES_IN_NAMESPACE_WITH_ATTRS( perfetto::Category("drm"), perfetto::Category("drmcursor"), perfetto::Category("dwrite"), diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index bcf0f87bcab2a..7a97b33222a67 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -33,10 +33,10 @@ index c51468e6fdb46634b5458b387d1c78caf2dd083f..7236611d2a392008f43b1b83ae125e94 "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 59424bd75eca1944382cdff8744a8bb02224afcf..ccccedfb24c680ab1cfe8fb5ae43e39ce29e58d8 100644 +index 03b7e243f304528ed12fcb0194f084bb4475d3a6..5ae8aaea4939b6a5500f487fa79c6352ffd6d173 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4814,7 +4814,7 @@ static_library("browser") { +@@ -4823,7 +4823,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index 59424bd75eca1944382cdff8744a8bb02224afcf..ccccedfb24c680ab1cfe8fb5ae43e39c # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index f6504a7c172e61d183c648d4f50340a8fcd3520c..6d6613baf37618e5e34505f0e82fb2159383fe3a 100644 +index 870557c8f7edb33c6373d59ffa9e87483262ca27..0e7ce248a0af7b9062ae258613474f859a3e153c 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7581,9 +7581,12 @@ test("unit_tests") { +@@ -7583,9 +7583,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index f6504a7c172e61d183c648d4f50340a8fcd3520c..6d6613baf37618e5e34505f0e82fb215 "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8519,6 +8522,10 @@ test("unit_tests") { +@@ -8521,6 +8524,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index f6504a7c172e61d183c648d4f50340a8fcd3520c..6d6613baf37618e5e34505f0e82fb215 sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8575,7 +8582,6 @@ test("unit_tests") { +@@ -8577,7 +8584,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 9f94317091bd2..8dd36fe894d83 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,10 +9,10 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index a9c06450f4f554aae3bc459a8b542761c4794055..db212382ebab56d46ea5d773bdce127e39f4b790 100644 +index c6addeca2a539557c4b6bbb1c20e9904c64525f5..c50cceaf899308e126844e986abc4e01bc7497bb 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -9847,6 +9847,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -9848,6 +9848,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To<Referrer>(), params->frame_name, params->disposition, *params->features, @@ -77,10 +77,10 @@ index 3ef244ccfe40506e22b5c3d293a25d04e908ddcf..d17fd7226d7f8a585e82a9f155459a68 // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index c367c4940023c91bf91b6e8612c8fa2cc2edf944..1c0ccc7d76c98f716409a11364c139ea9854f858 100644 +index 8e4e1a3b7d84803077b0b7719d2c6a87a4ed1d91..de9ae56525931d3497881acf287abb798acc19f5 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -882,6 +882,8 @@ bool ContentBrowserClient::CanCreateWindow( +@@ -883,6 +883,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -90,7 +90,7 @@ index c367c4940023c91bf91b6e8612c8fa2cc2edf944..1c0ccc7d76c98f716409a11364c139ea bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 4c0c0aaedc70cf219f69a4f406eeb3c1841d8cc6..5ba465eec5408d020c0994969ac97d639f1d4c86 100644 +index 038f760010334a1f27a6e31bdeb87fa691f4cd17..86967a3df04e0ce4f464f399d547ca0252168af0 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -202,6 +202,7 @@ class NetworkService; @@ -133,7 +133,7 @@ index edee20df7f5bb087df9c134c7892f4befe2f14b9..df972f1ce594f2d4651202b650ff2d41 WebContents* source, const OpenURLParams& params, diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index caf97e0c94edfa1106b465e793190c82f646ebdb..38b61d04446736bcc44a412f633c01ed9aca5399 100644 +index 0c3d4f8ed4df5ca8d9db5424fa2be2d26510c4c9..98492cff13c97388d001fc33cc948261990edef1 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -18,6 +18,7 @@ @@ -152,7 +152,7 @@ index caf97e0c94edfa1106b465e793190c82f646ebdb..38b61d04446736bcc44a412f633c01ed #include "content/public/common/window_container_type.mojom-forward.h" #include "third_party/blink/public/common/input/web_mouse_event.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" -@@ -388,6 +390,16 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -385,6 +387,16 @@ class CONTENT_EXPORT WebContentsDelegate { const StoragePartitionConfig& partition_config, SessionStorageNamespace* session_storage_namespace); diff --git a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch index a20e91fdfd242..c8865d5b6b505 100644 --- a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch +++ b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch @@ -8,7 +8,7 @@ where callsites that deal with multiple contexts need to distinguish the current isolate. diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index 79d59c3f4d3d2d5ff39bd65ded489183247656a8..20b49742578ccf363738ee032228f30a4cd676ea 100644 +index 1c5a9e693fd3b09213118fb32e4509e1d4a59364..921b7bb4b817ed753e08c2c058a23a2ccdaef40e 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h @@ -398,6 +398,7 @@ class CONTENT_EXPORT ContentRendererClient { @@ -52,7 +52,7 @@ index 7e64e34a2ebd9738d33bfc9cc7fd827b8757037d..6c89f28ff89e9a5019834751acf34e73 void RenderFrameImpl::DidChangeScrollOffset() { diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index 0677883a806d342734dc970f7c3c665cc9663dd0..64806e8a6ce5bbd3795bd8b8b519697a6b5b8c67 100644 +index 32dfed04e2fd7cd2e60c7cf145d182f4163feb68..c44c488ef90f4ceaada28666f80a5919fcc0c992 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h @@ -605,7 +605,8 @@ class CONTENT_EXPORT RenderFrameImpl @@ -214,10 +214,10 @@ index 8d73ddb12013ce195026b9f63050cf33f0bfb0fd..078f0e67e8de6a05178e8e2410f61784 virtual bool AllowScriptExtensions() = 0; diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -index 1aacf6f66b543a4ede6ab5d885143dd4a0821e8a..c695d942e295d9137a284e5536a10d49a055bbf4 100644 +index 11475d1a22054a884f2f1e7e5c933e9ae8d3379f..8d260dead59d366148983a1739b5252fa59b862a 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc +++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -@@ -303,10 +303,11 @@ void LocalFrameClientImpl::DidInstallConditionalFeatures( +@@ -308,10 +308,11 @@ void LocalFrameClientImpl::DidInstallConditionalFeatures( } void LocalFrameClientImpl::WillReleaseScriptContext( diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index 512edb0faec3d..69e2cf47129c9 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -159,10 +159,10 @@ index 3bbd4e568ba99245622a96f0801d2b6cd203025f..1e0b7d16b33daed980961dd49c667a3b } content::WebContents* CreateCustomWebContents( diff --git a/components/embedder_support/android/delegate/web_contents_delegate_android.cc b/components/embedder_support/android/delegate/web_contents_delegate_android.cc -index 279f7501a197380dd63c8fe7827854b16d46e5f7..2b80f1970a067e91794a81fcc19e5be64b6b2944 100644 +index c7eaf8d34ea50ba356ed1997f2fe6477aee9bcb1..acb8b12f0b2796ef836069ce54539e1ac6b66dc5 100644 --- a/components/embedder_support/android/delegate/web_contents_delegate_android.cc +++ b/components/embedder_support/android/delegate/web_contents_delegate_android.cc -@@ -205,14 +205,13 @@ bool WebContentsDelegateAndroid::IsWebContentsCreationOverridden( +@@ -210,15 +210,14 @@ bool WebContentsDelegateAndroid::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -171,8 +171,9 @@ index 279f7501a197380dd63c8fe7827854b16d46e5f7..2b80f1970a067e91794a81fcc19e5be6 + const content::mojom::CreateNewWindowParams& params) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); - if (obj.is_null()) + if (obj.is_null()) { return false; + } ScopedJavaLocalRef<jobject> java_gurl = - url::GURLAndroid::FromNativeGURL(env, target_url); + url::GURLAndroid::FromNativeGURL(env, params.target_url.spec()); @@ -250,10 +251,10 @@ index df972f1ce594f2d4651202b650ff2d41fe19ecd0..a92305042eef86fbabeae6fe02b48668 } diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 38b61d04446736bcc44a412f633c01ed9aca5399..3c982afb1af048618506a36ca3532b15720d8869 100644 +index 98492cff13c97388d001fc33cc948261990edef1..88b4810d3b91df0dd6b932412edd4ff249bedde0 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h -@@ -368,8 +368,7 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -365,8 +365,7 @@ class CONTENT_EXPORT WebContentsDelegate { SiteInstance* source_site_instance, mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -384,7 +385,7 @@ index 756d4192271d6a65cfe8e1511737c565b543cb1f..5688f6f745056565c3c01947f741c4d1 int opener_render_process_id, int opener_render_frame_id, diff --git a/headless/lib/browser/headless_web_contents_impl.cc b/headless/lib/browser/headless_web_contents_impl.cc -index 617d6cbd13ad3ce5eb9626bb54162e4afdfd24bd..85281656a467262076c081eb974e35590c573dab 100644 +index d02d9468560eb451753fd56aa46bc4f191535e95..6e5c10f94a16039dc90cb2bdf90c4c854afc8a53 100644 --- a/headless/lib/browser/headless_web_contents_impl.cc +++ b/headless/lib/browser/headless_web_contents_impl.cc @@ -208,8 +208,7 @@ class HeadlessWebContentsImpl::Delegate : public content::WebContentsDelegate { diff --git a/patches/chromium/chore_restore_some_deprecated_wrapper_utility_in_gin.patch b/patches/chromium/chore_restore_some_deprecated_wrapper_utility_in_gin.patch index 770ef720c0037..de6c0e66761d8 100644 --- a/patches/chromium/chore_restore_some_deprecated_wrapper_utility_in_gin.patch +++ b/patches/chromium/chore_restore_some_deprecated_wrapper_utility_in_gin.patch @@ -91,7 +91,7 @@ index 9670f9f904c6c864e82409617ac4c7698c6fc3ef..d1014af4b63da244820ff865a8e824dd for (auto& observer : dispose_observers_) { observer.OnDisposed(); diff --git a/gin/per_isolate_data.h b/gin/per_isolate_data.h -index 82048c08a14d05e1f9bd6ad6cc16d16f0905f879..e38b0ca134e71a968805a547c1eccbc0cd6f6dda 100644 +index 9146df7ec5e65401771f452ed44c63369be1d31f..5ae71c795cc98a885090553177f57deccb8bc546 100644 --- a/gin/per_isolate_data.h +++ b/gin/per_isolate_data.h @@ -34,6 +34,10 @@ class GIN_EXPORT PerIsolateData { diff --git a/patches/chromium/disable_hidden.patch b/patches/chromium/disable_hidden.patch index 56b8901e177fa..6a5778486f411 100644 --- a/patches/chromium/disable_hidden.patch +++ b/patches/chromium/disable_hidden.patch @@ -6,7 +6,7 @@ Subject: disable_hidden.patch Electron uses this to disable background throttling for hidden windows. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 029e77eb851f46d8997890a9acc742aa371537ef..3a820b1b9c9aab336c724ef8c0d823eddb330e1e 100644 +index 16c3a86ec4543c95d37198cf7c90f8d2285d2337..1c74f5f7de96f5950b7eac3348528970aae7175c 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -841,6 +841,10 @@ void RenderWidgetHostImpl::WasHidden() { diff --git a/patches/chromium/feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch b/patches/chromium/feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch index 6e9871f05d9a2..8fa3633514bbc 100644 --- a/patches/chromium/feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch +++ b/patches/chromium/feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch @@ -56,7 +56,7 @@ index 05c899258143a958471f361b87324f7500d594c9..1943413560f23c212d98fa1b368204c6 + } // namespace gin diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h -index a4c766565bfcc47d1ef66570afa166b9c0c16312..02275338c070d4f48ac10d51e3a6d42368f52c9e 100644 +index 902ad13dad8df57325f6c74ee3da9ec3148751cb..d0de06b55937d36848664c3817d098182c67f570 100644 --- a/gin/public/isolate_holder.h +++ b/gin/public/isolate_holder.h @@ -133,6 +133,8 @@ class GIN_EXPORT IsolateHolder { diff --git a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch index 15f06540319a0..324d35cb29626 100644 --- a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch +++ b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch @@ -405,7 +405,7 @@ index 70a23343d5815db0722e2977d966219b824a83b1..85ac45c1868832c47460108f93d86a51 std::vector<std::string> extension_schemes; // Registers a URL scheme with a predefined default custom handler. diff --git a/url/url_util.cc b/url/url_util.cc -index 648d5e93231f077792552955dba16dde7c2d9833..19397c8344d185dac4e4e3c42db75890df491a14 100644 +index 5f45b59482b66aad4e8ab08cae9f3eef3f4e6fa7..88512b7dc2c04364af76182a42c414212a46cd58 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -136,6 +136,9 @@ struct SchemeRegistry { @@ -418,7 +418,7 @@ index 648d5e93231f077792552955dba16dde7c2d9833..19397c8344d185dac4e4e3c42db75890 // Schemes with a predefined default custom handler. std::vector<SchemeWithHandler> predefined_handler_schemes; -@@ -680,6 +683,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() { +@@ -679,6 +682,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() { return GetSchemeRegistry().empty_document_schemes; } diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index 031c106b64e4e..9004d0a266dea 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -20,7 +20,7 @@ making three primary changes to Blink: * Controls whether the CSS rule is available. diff --git a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom -index 3735887b8084d2044a27b7a93147ed1653d14384..6afb92d96f23b4baa46d41968a49d76bc6d80aa1 100644 +index 5e04647ae947613138ca3e803a5bac34acf9672f..edfdb10888b4c8efb63e6713f04858d35050112a 100644 --- a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom +++ b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom @@ -48,6 +48,7 @@ enum CSSSampleId { @@ -45,10 +45,10 @@ index e189d584f05f2ce6354c03a9b19f56985df8a15e..41b430e8f2416be098494f5c49fb97ca 'internal-forced-visited-'): internal_visited_order = 0 diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 -index a4bd2a77564418a1924a7bc6bf5accfb1e909035..a1eaef99c77d01bc59a46f8f58bb97cc3fa9b309 100644 +index 8ea9539c27b3c565efb05b8da39fcead8e4c2ee3..27346b484d7d6e78e3eea36bc9b1f819b98892cd 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5 -@@ -9036,6 +9036,26 @@ +@@ -9049,6 +9049,26 @@ property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], }, @@ -76,7 +76,7 @@ index a4bd2a77564418a1924a7bc6bf5accfb1e909035..a1eaef99c77d01bc59a46f8f58bb97cc { name: "-internal-visited-color", diff --git a/third_party/blink/renderer/core/css/css_property_equality.cc b/third_party/blink/renderer/core/css/css_property_equality.cc -index 0de4f52f5f047f5ec8f94ad9337f4c75a5fd364d..930a0c39390043faf8c326785a4214ab41b82603 100644 +index f4806d8ea97785e8450ba7d08da45108702c4217..71398ba97655c1a96633a8be2c0387604bfabf9d 100644 --- a/third_party/blink/renderer/core/css/css_property_equality.cc +++ b/third_party/blink/renderer/core/css/css_property_equality.cc @@ -354,6 +354,8 @@ bool CSSPropertyEquality::PropertiesEqual(const PropertyHandle& property, @@ -89,10 +89,10 @@ index 0de4f52f5f047f5ec8f94ad9337f4c75a5fd364d..930a0c39390043faf8c326785a4214ab return a.EmptyCells() == b.EmptyCells(); case CSSPropertyID::kFill: diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -index 47239aa9e6323b78430d8bd6c9474fb07f72a1a3..5b45a43c4337a0b06afa9b9d2aef4d6d51786ae5 100644 +index 56d4ea1c4c27062adb90754d75d3595a0fb71a9e..40b786c32a0c21ff31886a1fc8b6d7b2cfff2e91 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -@@ -12492,5 +12492,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( +@@ -12500,5 +12500,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( CSSValueID::kNone>(stream); } @@ -312,7 +312,7 @@ index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index 26bed8a2427716c38c8afd6f73c75caed1e3c51a..c2b659a49baaa835245fbcf0e73b7724565eb52d 100644 +index 1ce3037cb0f173c192707de4e36b92bd733a89c0..195d4430d824d815b7de7799842c6e53b6a997aa 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch b/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch index e518f43f3d998..10b251615959a 100644 --- a/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch +++ b/patches/chromium/feat_ensure_mas_builds_of_the_same_application_can_use_safestorage.patch @@ -11,10 +11,10 @@ We attempt to migrate the safe storage key from the old account, if that migrati Existing apps that aren't built for the app store should be unimpacted, there is one edge case where a user uses BOTH an AppStore and a darwin build of the same app only one will keep it's access to the safestorage key as during the migration we delete the old account. This is an acceptable edge case as no one should be actively using two versions of the same app. -diff --git a/components/os_crypt/sync/keychain_password_mac.mm b/components/os_crypt/sync/keychain_password_mac.mm -index 3bcbb33700b2b9349795c05c12e44b4fafcc0370..b55c72e236f05591d41b7146eab1662128d37eda 100644 ---- a/components/os_crypt/sync/keychain_password_mac.mm -+++ b/components/os_crypt/sync/keychain_password_mac.mm +diff --git a/components/os_crypt/common/keychain_password_mac.mm b/components/os_crypt/common/keychain_password_mac.mm +index f19628cc0cdba39b232f55935e8eee9786b02a77..036b50f53e78bc21ed1e1d6dd876b50ab1e8f05d 100644 +--- a/components/os_crypt/common/keychain_password_mac.mm ++++ b/components/os_crypt/common/keychain_password_mac.mm @@ -27,6 +27,12 @@ using KeychainNameContainerType = const base::NoDestructor<std::string>; #endif diff --git a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch index 9a8b3f344886c..1d02f796c12a0 100644 --- a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch +++ b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch @@ -28,10 +28,10 @@ The patch should be removed in favor of either: Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397. diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index 4553dfcd76b0a8bd7a0d1da781592768fdc90b64..d49a7f15c86643f76d9ba0f916700930daa49904 100644 +index 5f6fb36d9302e557ff56f770ff70b091ade0f53a..81e91f51d119b2e02f432c2e7ae81f6d118811b3 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc -@@ -11428,6 +11428,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { +@@ -11454,6 +11454,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { target_rph_id); } diff --git a/patches/chromium/fix_restore_original_resize_performance_on_macos.patch b/patches/chromium/fix_restore_original_resize_performance_on_macos.patch index 3b47008402712..e263ff13f990f 100644 --- a/patches/chromium/fix_restore_original_resize_performance_on_macos.patch +++ b/patches/chromium/fix_restore_original_resize_performance_on_macos.patch @@ -11,10 +11,10 @@ This patch should be upstreamed as a conditional revert of the logic in desktop vs mobile runtimes. i.e. restore the old logic only on desktop platforms diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 9a24c153e47b3f3878fa6ea92fb99d14c2cddd32..5b0f0b28c3f36315d5bb12ad7e35f21c91a1e8b6 100644 +index d197909a774d78aa33d6aa4b67ced27973d03331..4708741ea709c9dbdb1f88503562f0a4891b3465 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -2154,9 +2154,8 @@ RenderWidgetHostImpl::GetWidgetInputHandler() { +@@ -2156,9 +2156,8 @@ RenderWidgetHostImpl::GetWidgetInputHandler() { void RenderWidgetHostImpl::NotifyScreenInfoChanged() { // The resize message (which may not happen immediately) will carry with it // the screen info as well as the new size (if the screen has changed scale diff --git a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch index e779192a6ff4b..84ae6b49d2955 100644 --- a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch +++ b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch @@ -173,10 +173,10 @@ index 7c31a69ccd7a74d75e5df63d895b91239d243a92..1b435cb43592afba984fe203d1ccf2d9 } diff --git a/third_party/blink/renderer/core/frame/pausable_script_executor.h b/third_party/blink/renderer/core/frame/pausable_script_executor.h -index fa65331f40b90d812b71a489fd560e9359152d2b..390714d631dc88ef92d59ef9618a5706b4b52f22 100644 +index f2c94689450f0333a144ccf82cf147c194896e6b..1c2e9fe36c297f7d614d9ca290e4d13c83d11eb5 100644 --- a/third_party/blink/renderer/core/frame/pausable_script_executor.h +++ b/third_party/blink/renderer/core/frame/pausable_script_executor.h -@@ -48,7 +48,8 @@ class CORE_EXPORT PausableScriptExecutor final +@@ -47,7 +47,8 @@ class CORE_EXPORT PausableScriptExecutor final mojom::blink::LoadEventBlockingOption, mojom::blink::WantResultOption, mojom::blink::PromiseResultOption, @@ -186,7 +186,7 @@ index fa65331f40b90d812b71a489fd560e9359152d2b..390714d631dc88ef92d59ef9618a5706 class Executor : public GarbageCollected<Executor> { public: -@@ -65,6 +66,7 @@ class CORE_EXPORT PausableScriptExecutor final +@@ -64,6 +65,7 @@ class CORE_EXPORT PausableScriptExecutor final mojom::blink::WantResultOption, mojom::blink::PromiseResultOption, WebScriptExecutionCallback, @@ -194,7 +194,7 @@ index fa65331f40b90d812b71a489fd560e9359152d2b..390714d631dc88ef92d59ef9618a5706 Executor*); ~PausableScriptExecutor() override; -@@ -83,6 +85,7 @@ class CORE_EXPORT PausableScriptExecutor final +@@ -82,6 +84,7 @@ class CORE_EXPORT PausableScriptExecutor final Member<ScriptState> script_state_; WebScriptExecutionCallback callback_; diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index eb3a47f2c8968..384b5ae0878e9 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -6,10 +6,10 @@ Subject: frame_host_manager.patch Allows embedder to intercept site instances created by chromium. diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc -index 2300582c6dd1b9758066d3774338450baae54d81..9dd66581313d8b42bb81baea8821c3bc13db8b99 100644 +index b95cedc2e178a743830b395e9bb62ef7d3ddf8d2..1f08d28a7be70d4e730ef29e46c7d093d7f765fc 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc -@@ -4794,6 +4794,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -4806,6 +4806,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( request->ResetStateForSiteInstanceChange(); } @@ -20,7 +20,7 @@ index 2300582c6dd1b9758066d3774338450baae54d81..9dd66581313d8b42bb81baea8821c3bc } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 5ba465eec5408d020c0994969ac97d639f1d4c86..e19d7ae4a9f6cbeff126af5b18362a425ce35d48 100644 +index 86967a3df04e0ce4f464f399d547ca0252168af0..c5affc638d982da531e47037b7f4df08c2960fe1 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -340,6 +340,11 @@ class CONTENT_EXPORT ContentBrowserClient { diff --git a/patches/chromium/gin_enable_disable_v8_platform.patch b/patches/chromium/gin_enable_disable_v8_platform.patch index bde63695ee376..0e0b77efac675 100644 --- a/patches/chromium/gin_enable_disable_v8_platform.patch +++ b/patches/chromium/gin_enable_disable_v8_platform.patch @@ -27,7 +27,7 @@ index 456409c9e84c7a061d474470c8e42c5ddb5eb799..87187d05175a9da4fd7af03ba8a139a2 g_reference_table = reference_table; g_fatal_error_callback = fatal_error_callback; diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h -index 2c6eee95c8ddfbd08d934ac8ddd0b0edb0fa177a..45edc6c8930aede7a89cb1a3afbb9406f3c9158e 100644 +index 3909e70dc1425c2cb02624f4b3017784a2ae6c9d..a57b92f02085d6392e6d9d0cc037df6b972f3c31 100644 --- a/gin/public/isolate_holder.h +++ b/gin/public/isolate_holder.h @@ -120,7 +120,8 @@ class GIN_EXPORT IsolateHolder { diff --git a/patches/chromium/isolate_holder.patch b/patches/chromium/isolate_holder.patch index f0e628ed08c32..ac281b74a347f 100644 --- a/patches/chromium/isolate_holder.patch +++ b/patches/chromium/isolate_holder.patch @@ -58,7 +58,7 @@ index 87187d05175a9da4fd7af03ba8a139a2d9554551..05c899258143a958471f361b87324f75 isolate_, allocator, access_mode_, task_runner, std::move(user_visible_task_runner), std::move(best_effort_task_runner)); diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h -index 45edc6c8930aede7a89cb1a3afbb9406f3c9158e..a4c766565bfcc47d1ef66570afa166b9c0c16312 100644 +index a57b92f02085d6392e6d9d0cc037df6b972f3c31..902ad13dad8df57325f6c74ee3da9ec3148751cb 100644 --- a/gin/public/isolate_holder.h +++ b/gin/public/isolate_holder.h @@ -89,7 +89,8 @@ class GIN_EXPORT IsolateHolder { diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index 8e4d7562d3931..9e5e774e11154 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -35,7 +35,7 @@ system font by checking if it's kCTFontPriorityAttribute is set to system priority. diff --git a/base/BUILD.gn b/base/BUILD.gn -index 7a9290fb225feb033bc3baf5227fdc5dc14d8a60..7bb8cdf811bda8c7b57cc9576f1f23d0d334e351 100644 +index 2edc8252e3e83ab0238383091ebea5a21df3186f..3bbea6f7c13914e8f6e791cd77cab82b1eed51dd 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -1069,6 +1069,7 @@ component("base") { @@ -194,23 +194,10 @@ index e12c1d078147d956a1d9b1bc498c1b1d6fe7b974..233362259dc4e728ed37435e65041764 } } // namespace base -diff --git a/components/os_crypt/sync/BUILD.gn b/components/os_crypt/sync/BUILD.gn -index 20b4524c33b4477e12025a2334380d85eb9649cb..4b648046b325fe0df7f014b1718664222c8754af 100644 ---- a/components/os_crypt/sync/BUILD.gn -+++ b/components/os_crypt/sync/BUILD.gn -@@ -64,6 +64,8 @@ component("sync") { - "os_crypt_mac.mm", - ] - deps += [ "//crypto:mock_apple_keychain" ] -+ deps += ["//electron/build/config:generate_mas_config"] -+ - } else if (is_win) { - sources += [ "os_crypt_win.cc" ] - deps += [ "//components/version_info" ] -diff --git a/components/os_crypt/sync/keychain_password_mac.mm b/components/os_crypt/sync/keychain_password_mac.mm -index 1d4c16a300227e5e8269e2c2564cb5e87ec8ee65..3bcbb33700b2b9349795c05c12e44b4fafcc0370 100644 ---- a/components/os_crypt/sync/keychain_password_mac.mm -+++ b/components/os_crypt/sync/keychain_password_mac.mm +diff --git a/components/os_crypt/common/keychain_password_mac.mm b/components/os_crypt/common/keychain_password_mac.mm +index caa0e420956a31be1bd744319a0e40a0e50b46cf..f19628cc0cdba39b232f55935e8eee9786b02a77 100644 +--- a/components/os_crypt/common/keychain_password_mac.mm ++++ b/components/os_crypt/common/keychain_password_mac.mm @@ -16,6 +16,7 @@ #include "base/strings/string_view_util.h" #include "build/branding_buildflags.h" @@ -219,6 +206,18 @@ index 1d4c16a300227e5e8269e2c2564cb5e87ec8ee65..3bcbb33700b2b9349795c05c12e44b4f #include "third_party/abseil-cpp/absl/cleanup/cleanup.h" using crypto::apple::Keychain; +diff --git a/components/os_crypt/sync/BUILD.gn b/components/os_crypt/sync/BUILD.gn +index 2d155f49248a24b5551cb93e010ac1a0c0f94261..23aa391aaf380f87310fb295277809f8b105d6e8 100644 +--- a/components/os_crypt/sync/BUILD.gn ++++ b/components/os_crypt/sync/BUILD.gn +@@ -61,6 +61,7 @@ component("sync") { + deps += [ + "//components/os_crypt/common:keychain_password_mac", + "//crypto:mock_apple_keychain", ++ "//electron/build/config:generate_mas_config" + ] + } else if (is_win) { + sources += [ "os_crypt_win.cc" ] diff --git a/components/remote_cocoa/app_shim/BUILD.gn b/components/remote_cocoa/app_shim/BUILD.gn index ba813851fde2660c21f99248a124161d2ac2ca07..c34f920e4a592b6798f5307c726bc34ebedf3f88 100644 --- a/components/remote_cocoa/app_shim/BUILD.gn @@ -797,7 +796,7 @@ index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbe } // namespace content diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn -index f7b00799e71eaec7ab92747e94305fcb14b667e1..0d64ec4f4f9353c6ad0aeefde34219112b081997 100644 +index dfd3674692bc984821b52f1d410c1fa2ca56c42e..25dd06214e3aea73ebe556f9b8498ef8a63e42d6 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn @@ -703,6 +703,7 @@ static_library("test_support") { @@ -817,7 +816,7 @@ index f7b00799e71eaec7ab92747e94305fcb14b667e1..0d64ec4f4f9353c6ad0aeefde3421911 } mojom("content_test_mojo_bindings") { -@@ -2067,6 +2070,7 @@ test("content_browsertests") { +@@ -2068,6 +2071,7 @@ test("content_browsertests") { "//ui/shell_dialogs", "//ui/snapshot", "//ui/webui:test_support", @@ -825,7 +824,7 @@ index f7b00799e71eaec7ab92747e94305fcb14b667e1..0d64ec4f4f9353c6ad0aeefde3421911 ] if (!(is_chromeos && target_cpu == "arm64" && current_cpu == "arm")) { -@@ -3405,6 +3409,7 @@ test("content_unittests") { +@@ -3406,6 +3410,7 @@ test("content_unittests") { "//ui/shell_dialogs", "//ui/webui:test_support", "//url", @@ -1396,7 +1395,7 @@ index eb81a70e4d5d5cd3e6ae9b45f8cd1c795ea76c51..9921ccb10d3455600eddd85f77f10228 } // namespace sandbox diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn -index bf9258eeacb85f6b2e424ecd7bb6b9a653673f4b..5a3da145062137ba010cffd47bae475efb5743d0 100644 +index ac8db428b19dc3d442dc668b4e601d56f7b48c61..c6dfcdb6ac8ccc145eaad4087677add1afb217e1 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn @@ -428,6 +428,7 @@ component("core") { @@ -1408,10 +1407,10 @@ index bf9258eeacb85f6b2e424ecd7bb6b9a653673f4b..5a3da145062137ba010cffd47bae475e if (is_mac) { diff --git a/third_party/blink/renderer/core/editing/build.gni b/third_party/blink/renderer/core/editing/build.gni -index 0dfded158c60568d10486452c9d496a5759ac946..f8393cac3f954e2eb82610d3d70857ddfff77985 100644 +index c771cee7be34f36521de34ef893ee578b648a8c8..b0bd447b848bfdb7a9ff9cd98ba95574cb846cc2 100644 --- a/third_party/blink/renderer/core/editing/build.gni +++ b/third_party/blink/renderer/core/editing/build.gni -@@ -364,10 +364,14 @@ blink_core_sources_editing = [ +@@ -362,10 +362,14 @@ blink_core_sources_editing = [ if (is_mac) { blink_core_sources_editing += [ "commands/smart_replace_cf.cc", diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index 05e233f4783da..1eb94405eaaa2 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -113,7 +113,7 @@ index 2c9e6225d0085c67dc1ae51cca2614b2c74120a7..ad194578a06e74488a853cb8f3f042fd } diff --git a/content/browser/notifications/platform_notification_context_impl.h b/content/browser/notifications/platform_notification_context_impl.h -index 5be62a3fb27e37f3c1db6b811172f6dfebe18f61..34349f9832fe4b9a3d48db613a789afb87cb2a68 100644 +index 9bf238e64af483294ae3c3f18a4e9aed49a8658d..b9b2a4c8c387b8e8b4eb1f02fc0f891ceaa105a0 100644 --- a/content/browser/notifications/platform_notification_context_impl.h +++ b/content/browser/notifications/platform_notification_context_impl.h @@ -47,6 +47,7 @@ class PlatformNotificationServiceProxy; @@ -133,10 +133,10 @@ index 5be62a3fb27e37f3c1db6b811172f6dfebe18f61..34349f9832fe4b9a3d48db613a789afb const GURL& document_url, const WeakDocumentPtr& weak_document_ptr, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index d689ab09609595e9738a771d723f2923f629d6cb..ae46fafbb67668d3c0a147cb0d8cf8fda958409a 100644 +index 29a6786b54d38367745a04cc349ad018a379b724..9d2f7d1715eeb066789180684ef918e399dab9ae 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -2314,7 +2314,7 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2349,7 +2349,7 @@ void RenderProcessHostImpl::CreateNotificationService( case RenderProcessHost::NotificationServiceCreatorType::kSharedWorker: case RenderProcessHost::NotificationServiceCreatorType::kDedicatedWorker: { storage_partition_impl_->GetPlatformNotificationContext()->CreateService( @@ -145,7 +145,7 @@ index d689ab09609595e9738a771d723f2923f629d6cb..ae46fafbb67668d3c0a147cb0d8cf8fd creator_type, std::move(receiver)); break; } -@@ -2322,7 +2322,7 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2357,7 +2357,7 @@ void RenderProcessHostImpl::CreateNotificationService( CHECK(rfh); storage_partition_impl_->GetPlatformNotificationContext()->CreateService( diff --git a/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch b/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch index b6ebd4ffa54f6..eb8a2d9304f79 100644 --- a/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch +++ b/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch @@ -11,7 +11,7 @@ For resolving complex conflict please pin @reitowo For more reason please see: https://crrev.com/c/5465148 diff --git a/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc b/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc -index a45c24e28ca25f08603ce07e53c76c28e8c2e957..e01e5b4d52b3c698d68d5f4dca869570e3e15897 100644 +index 157a7e3a7cf9d07b41e386d56b85cf185a53957b..dfef68d807d39255996d475c5c55b67c1b6c4f8f 100644 --- a/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc +++ b/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc @@ -381,7 +381,8 @@ gfx::GpuMemoryBufferHandle D3DImageBackingFactory::CreateGpuMemoryBufferHandle( diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch index b80f61ff14769..5dfe58b2e529a 100644 --- a/patches/chromium/printing.patch +++ b/patches/chromium/printing.patch @@ -923,16 +923,16 @@ index 2f34f45aaf89e6f4600be1d2b8444c636b0cc83f..5bfd45c5efbf300a36e016af80e18fb9 virtual mojom::ResultCode OnError(); diff --git a/printing/printing_context_linux.cc b/printing/printing_context_linux.cc -index 1bf52330b555e14cf32c356321bef36442fab3d5..ee7ab77226a2aaf8f4250188a15af63dde70bce0 100644 +index e83735211e30a77ef1bc82b6a252da02a18626fc..b0c8fd3c5e3c5b3d2d64bee9df513e1b4829809c 100644 --- a/printing/printing_context_linux.cc +++ b/printing/printing_context_linux.cc -@@ -55,9 +55,8 @@ void PrintingContextLinux::AskUserForSettings(int max_pages, +@@ -54,9 +54,8 @@ void PrintingContextLinux::AskUserForSettings(int max_pages, bool is_scripted, PrintSettingsCallback callback) { if (!print_dialog_) { -- // Can only get here if the renderer is sending bad messages. -- // http://crbug.com/341777 -- NOTREACHED(); +- // Can only get here if the renderer is sending bad messages. Ignore. +- // https://crbug.com/41088489 +- return; + print_dialog_ = ui::LinuxUi::instance()->CreatePrintDialog(this); + print_dialog_->UseDefaultSettings(); } diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index af097e5930b30..8b415488e8c22 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -30,10 +30,10 @@ index 9a4195a3e53353342c75d6c4372ed4c27ef13fd3..bc1bfa1ac381ec94121a264d9dcbae9e // RenderWidgetHost on the primary main frame, and false otherwise. virtual bool IsWidgetForPrimaryMainFrame(RenderWidgetHostImpl*); diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 3a820b1b9c9aab336c724ef8c0d823eddb330e1e..9a24c153e47b3f3878fa6ea92fb99d14c2cddd32 100644 +index 1c74f5f7de96f5950b7eac3348528970aae7175c..d197909a774d78aa33d6aa4b67ced27973d03331 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -2073,6 +2073,9 @@ void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) { +@@ -2075,6 +2075,9 @@ void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) { if (view_) { view_->UpdateCursor(cursor); } diff --git a/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch b/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch index 93386b5312dc1..78c73f5b8eb84 100644 --- a/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch +++ b/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch @@ -7,10 +7,10 @@ Subject: refactor: expose HostImportModuleDynamically and This is so that Electron can blend Blink's and Node's implementations of these isolate handlers. diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -index 8499bf5bced44db827663b57a9af29d7dc731e76..a5e68f2554ee01d9a9e39900d350c64b1ceb7860 100644 +index 8f01e066661cfb4df9ad52a8f30782c1ed595fe4..0a74a57b7a0878a2edfa5bcd8b9f34620a2a5344 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -@@ -645,8 +645,9 @@ bool WasmCustomDescriptorsEnabledCallback(v8::Local<v8::Context> context) { +@@ -646,8 +646,9 @@ bool WasmCustomDescriptorsEnabledCallback(v8::Local<v8::Context> context) { return RuntimeEnabledFeatures::WebAssemblyCustomDescriptorsEnabled( execution_context); } @@ -21,7 +21,7 @@ index 8499bf5bced44db827663b57a9af29d7dc731e76..a5e68f2554ee01d9a9e39900d350c64b v8::Local<v8::Context> context, v8::Local<v8::Data> v8_host_defined_options, v8::Local<v8::Value> v8_referrer_resource_url, -@@ -724,20 +725,23 @@ v8::MaybeLocal<v8::Promise> HostImportModuleWithPhaseDynamically( +@@ -725,20 +726,23 @@ v8::MaybeLocal<v8::Promise> HostImportModuleWithPhaseDynamically( return resolver->Promise().V8Promise(); } @@ -47,7 +47,7 @@ index 8499bf5bced44db827663b57a9af29d7dc731e76..a5e68f2554ee01d9a9e39900d350c64b v8::Local<v8::Module> module, v8::Local<v8::Object> meta) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); -@@ -764,6 +768,7 @@ void HostGetImportMetaProperties(v8::Local<v8::Context> context, +@@ -765,6 +769,7 @@ void HostGetImportMetaProperties(v8::Local<v8::Context> context, meta->CreateDataProperty(context, resolve_key, resolve_value).ToChecked(); } @@ -55,7 +55,7 @@ index 8499bf5bced44db827663b57a9af29d7dc731e76..a5e68f2554ee01d9a9e39900d350c64b bool IsDOMExceptionWrapper(v8::Isolate* isolate, v8::Local<v8::Object> object) { return V8DOMException::HasInstance(isolate, object); } -@@ -794,7 +799,6 @@ void EmitDevToolsEvent(v8::Isolate* isolate) { +@@ -795,7 +800,6 @@ void EmitDevToolsEvent(v8::Isolate* isolate) { } // namespace @@ -63,7 +63,7 @@ index 8499bf5bced44db827663b57a9af29d7dc731e76..a5e68f2554ee01d9a9e39900d350c64b void V8Initializer::InitializeV8Common(v8::Isolate* isolate) { // Set up garbage collection before setting up anything else as V8 may trigger // GCs during Blink setup. -@@ -810,9 +814,9 @@ void V8Initializer::InitializeV8Common(v8::Isolate* isolate) { +@@ -811,9 +815,9 @@ void V8Initializer::InitializeV8Common(v8::Isolate* isolate) { SharedArrayBufferConstructorEnabledCallback); isolate->SetHostImportModuleDynamicallyCallback(HostImportModuleDynamically); isolate->SetHostImportModuleWithPhaseDynamicallyCallback( diff --git a/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch b/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch index b83845dbe2a3d..b670d92243c24 100644 --- a/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch +++ b/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch @@ -180,10 +180,10 @@ index bd0d77323277ee422ec4f75cee9f7d4e9bf198b3..d0ed451fe104b9671d6002ca72e8ca3a } // namespace diff --git a/chrome/browser/site_isolation/spellcheck_per_process_browsertest.cc b/chrome/browser/site_isolation/spellcheck_per_process_browsertest.cc -index 8aef94fbd6788d1216648d873cdea3136d8e51c0..1a18086f01c21b34e1ce5ecf750591456a8f3d32 100644 +index 081e422f9a29fc36eea19ed730b430ba5ceb2861..7817bc7a6f9f2c7fdeb08c9b185d2dd3c8cc61f7 100644 --- a/chrome/browser/site_isolation/spellcheck_per_process_browsertest.cc +++ b/chrome/browser/site_isolation/spellcheck_per_process_browsertest.cc -@@ -133,21 +133,26 @@ class MockSpellCheckHost : spellcheck::mojom::SpellCheckHost { +@@ -134,21 +134,26 @@ class MockSpellCheckHost : spellcheck::mojom::SpellCheckHost { #if BUILDFLAG(IS_WIN) void InitializeDictionaries( InitializeDictionariesCallback callback) override { @@ -222,9 +222,9 @@ index 8aef94fbd6788d1216648d873cdea3136d8e51c0..1a18086f01c21b34e1ce5ecf75059145 } void OnDictionariesInitialized() { -@@ -259,7 +264,17 @@ class ChromeSitePerProcessSpellCheckTest : public ChromeSitePerProcessTest { - public: - ChromeSitePerProcessSpellCheckTest() = default; +@@ -263,7 +268,17 @@ class ChromeSitePerProcessSpellCheckTest : public ChromeSitePerProcessTest { + blink::features::kRestrictSpellingAndGrammarHighlights); + } - void SetUp() override { ChromeSitePerProcessTest::SetUp(); } + void SetUp() override { @@ -241,7 +241,7 @@ index 8aef94fbd6788d1216648d873cdea3136d8e51c0..1a18086f01c21b34e1ce5ecf75059145 protected: // Tests that spelling in out-of-process subframes is checked. -@@ -366,3 +381,29 @@ IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessSpellCheckTest, +@@ -370,3 +385,29 @@ IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessSpellCheckTest, EXPECT_TRUE(host->SpellingPanelVisible()); } #endif // BUILDFLAG(HAS_SPELLCHECK_PANEL) diff --git a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch index 4d7e3f1e76187..d27426d90daff 100644 --- a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch +++ b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch @@ -254,10 +254,10 @@ index 17d6d7d935f93afefa9123f56ef9c138c3070f93..8dfa7501a6a2998e107bf9b51f5e5c3d } diff --git a/content/common/features.cc b/content/common/features.cc -index a79d4b37402c1982d7a4896c670e501d2055d618..8562333442891b7788d5ea37e67900f6da4810c8 100644 +index 444e54b49c5b9661dcce5563193484a4e0ea2836..b902bc814c15998f7678275326ee818e58d070a1 100644 --- a/content/common/features.cc +++ b/content/common/features.cc -@@ -313,6 +313,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); +@@ -311,6 +311,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kIOSurfaceCapturer, base::FEATURE_ENABLED_BY_DEFAULT); #endif @@ -273,7 +273,7 @@ index a79d4b37402c1982d7a4896c670e501d2055d618..8562333442891b7788d5ea37e67900f6 BASE_FEATURE(kKeepChildProcessAfterIPCReset, base::FEATURE_DISABLED_BY_DEFAULT); diff --git a/content/common/features.h b/content/common/features.h -index 026ae45de3356078c75bdef23453a1a1b2de7821..488d486021f4b62cc599a8166e8c93ed0fd04960 100644 +index b9bb81ea381fbd57c850546b72fd652644db3cb0..9fcab77a6255bb2c36cc01c027840f778c25bbdb 100644 --- a/content/common/features.h +++ b/content/common/features.h @@ -110,6 +110,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); diff --git a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch index b4c64f39f10ae..f49185647669c 100644 --- a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch +++ b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch @@ -39,7 +39,7 @@ index bc1bfa1ac381ec94121a264d9dcbae9e02ab5a81..c6fc03ae158b3ce87fd684d765a3f1b0 // event before sending it to the renderer. See enum for details on return // value. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 5b0f0b28c3f36315d5bb12ad7e35f21c91a1e8b6..08ca1a3fc2add9cf93b078b9136d9aa6d667b9f0 100644 +index 4708741ea709c9dbdb1f88503562f0a4891b3465..eb2f21c4ed5cdb570cca72afb884495c29d8d80c 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -1589,6 +1589,10 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( @@ -100,10 +100,10 @@ index a92305042eef86fbabeae6fe02b48668a349be99..5a50203f2df5724fe7bae5dc9ea211fd WebContents* source, const input::NativeWebKeyboardEvent& event) { diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 3c982afb1af048618506a36ca3532b15720d8869..5966331e9fa7413ce8d8321a04f829e75361ec59 100644 +index 88b4810d3b91df0dd6b932412edd4ff249bedde0..492efdb688af5af6691f3ef50de48103de29b138 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h -@@ -313,6 +313,13 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -311,6 +311,13 @@ class CONTENT_EXPORT WebContentsDelegate { virtual bool HandleContextMenu(RenderFrameHost& render_frame_host, const ContextMenuParams& params); diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index 37e90e93821fe..c7dc5709b9466 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index da0c8ef1c8addb2f06e944546e7f40c3a1262d0b..5a6ad8c4f316709ae5493f9f010d33a3da5b508a 100644 +index ce09656206496ee36294eb0d9b5a595d67411141..008ec5d958ee2105eb2de03b22c18734399e6435 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25357,6 +25357,21 @@ +@@ -25413,6 +25413,21 @@ ] } ], diff --git a/patches/chromium/support_mixed_sandbox_with_zygote.patch b/patches/chromium/support_mixed_sandbox_with_zygote.patch index bc0d2fa1e179d..b1474afdb45e0 100644 --- a/patches/chromium/support_mixed_sandbox_with_zygote.patch +++ b/patches/chromium/support_mixed_sandbox_with_zygote.patch @@ -22,10 +22,10 @@ However, the patch would need to be reviewed by the security team, as it does touch a security-sensitive class. diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index ae46fafbb67668d3c0a147cb0d8cf8fda958409a..3cda71f0b6c606b9df9b457e3f94ee7d3af051b6 100644 +index 9d2f7d1715eeb066789180684ef918e399dab9ae..3a6fef89877f2a6a58e9e03856d70a90b443c5d4 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -1905,6 +1905,10 @@ bool RenderProcessHostImpl::Init() { +@@ -1927,6 +1927,10 @@ bool RenderProcessHostImpl::Init() { std::unique_ptr<SandboxedProcessLauncherDelegate> sandbox_delegate = std::make_unique<RendererSandboxedProcessLauncherDelegateWin>( *cmd_line, IsPdf(), IsJitDisabled()); diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index 3d59188c4eb57..da9969901d9cf 100644 --- a/patches/chromium/web_contents.patch +++ b/patches/chromium/web_contents.patch @@ -35,7 +35,7 @@ index c6f031e408768a31198f7e875d03d59cacaef9a7..66c603cfa5916e377a5d978a5d8e0f0e CHECK(view_.get()); diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index ef60f27657953a92f720a0342c8bb08f24684b54..8d614d26117ec41dfe1ecffecbcfb2170c534c9a 100644 +index 221839a555727d62e5d6546377baa9aa08ef52bb..ab55df1817cb0c0213c3db7102c8c6d561dd1b87 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h @@ -130,11 +130,14 @@ class PrerenderHandle; diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index ae0bb2b492c5e..03547f12e1852 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,10 +15,10 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index db212382ebab56d46ea5d773bdce127e39f4b790..d58a056cefda8a2d1e1b8d85f8be7b4af401b4eb 100644 +index c50cceaf899308e126844e986abc4e01bc7497bb..e875bf555a92e4539aa0ea7e20eb369718b465cd 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -8953,6 +8953,17 @@ void RenderFrameHostImpl::EnterFullscreen( +@@ -8954,6 +8954,17 @@ void RenderFrameHostImpl::EnterFullscreen( } } diff --git a/patches/chromium/worker_context_will_destroy.patch b/patches/chromium/worker_context_will_destroy.patch index 19883c3c7a5d4..421adf8bb5c3f 100644 --- a/patches/chromium/worker_context_will_destroy.patch +++ b/patches/chromium/worker_context_will_destroy.patch @@ -10,7 +10,7 @@ An attempt to upstream this was made, but rejected: https://chromium-review.googlesource.com/c/chromium/src/+/1954347 diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index d794a461eedde1003c72f47af0517249ab20806d..6d2033d2023a7c4c936933a050d2372cf490eb44 100644 +index fbf4212b0aa58467a404ce146c59e8a7d2e55461..e27271000fdcb9f155467923db74b5da4df3e989 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h @@ -428,6 +428,11 @@ class CONTENT_EXPORT ContentRendererClient { diff --git a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch index 9e15fc37b4421..06376920f7cdf 100644 --- a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch +++ b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch @@ -19,7 +19,7 @@ that clearly establishes the worker script is ready for evaluation with the scop initialized. diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index 6d2033d2023a7c4c936933a050d2372cf490eb44..79d59c3f4d3d2d5ff39bd65ded489183247656a8 100644 +index e27271000fdcb9f155467923db74b5da4df3e989..1c5a9e693fd3b09213118fb32e4509e1d4a59364 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h @@ -428,6 +428,11 @@ class CONTENT_EXPORT ContentRendererClient { diff --git a/shell/browser/electron_browser_main_parts.cc b/shell/browser/electron_browser_main_parts.cc index e6b732c67e5ee..139237d3a0413 100644 --- a/shell/browser/electron_browser_main_parts.cc +++ b/shell/browser/electron_browser_main_parts.cc @@ -101,7 +101,7 @@ #endif #if BUILDFLAG(IS_MAC) -#include "components/os_crypt/sync/keychain_password_mac.h" +#include "components/os_crypt/common/keychain_password_mac.h" #include "shell/browser/ui/cocoa/views_delegate_mac.h" #else #include "shell/browser/ui/views/electron_views_delegate.h" diff --git a/spec/api-web-frame-main-spec.ts b/spec/api-web-frame-main-spec.ts index ccb109beec286..89397fcee840a 100644 --- a/spec/api-web-frame-main-spec.ts +++ b/spec/api-web-frame-main-spec.ts @@ -342,6 +342,8 @@ describe('webFrameMain module', () => { const crashEvent = once(w.webContents, 'render-process-gone'); w.webContents.forcefullyCrashRenderer(); await crashEvent; + // A short wait seems to be required to reproduce the crash. + await setTimeout(100); await w.webContents.loadURL(server.url); // Log just to keep mainFrame in scope. console.log('mainFrame.url', mainFrame.url); From 13d2b8f6ece566f8bf2204edb956b451a5d15ce9 Mon Sep 17 00:00:00 2001 From: "syntax.sculptor" <nilay2014@gmail.com> Date: Tue, 28 Oct 2025 20:48:47 +0530 Subject: [PATCH 182/268] fix: use correct signal variable in nan-spec-runner install check (#48639) The install process spawn was not capturing its own signal variable, causing the error check to incorrectly reference the build signal instead. This could lead to: - Install termination by signal going undetected - False positive errors when build was killed but install succeeded This commit ensures the install signal is properly captured and checked, matching the pattern used for the build process. --- script/nan-spec-runner.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/nan-spec-runner.js b/script/nan-spec-runner.js index 2c40c1e850f1f..b8259c7f753b3 100644 --- a/script/nan-spec-runner.js +++ b/script/nan-spec-runner.js @@ -118,16 +118,16 @@ async function main () { return process.exit(buildStatus !== 0 ? buildStatus : signal); } - const { status: installStatus } = cp.spawnSync(NPX_CMD, [`yarn@${YARN_VERSION}`, 'install'], { + const { status: installStatus, signal: installSignal } = cp.spawnSync(NPX_CMD, [`yarn@${YARN_VERSION}`, 'install'], { env, cwd: NAN_DIR, stdio: 'inherit', shell: process.platform === 'win32' }); - if (installStatus !== 0 || signal != null) { + if (installStatus !== 0 || installSignal != null) { console.error('Failed to install nan node_modules'); - return process.exit(installStatus !== 0 ? installStatus : signal); + return process.exit(installStatus !== 0 ? installStatus : installSignal); } const onlyTests = args.only?.split(','); From c32564d90ad4f8da740ff40f8f6f489c3cf88f2f Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Tue, 28 Oct 2025 16:20:55 +0100 Subject: [PATCH 183/268] fix: allow disabling all `NSMenuItems` (#48598) fix: allow disabling all NSMenuItems --- lib/browser/api/menu.ts | 21 +++- .../ui/cocoa/electron_menu_controller.mm | 111 ++++++++++-------- 2 files changed, 82 insertions(+), 50 deletions(-) diff --git a/lib/browser/api/menu.ts b/lib/browser/api/menu.ts index 10cad67f10c43..75a06afddca26 100644 --- a/lib/browser/api/menu.ts +++ b/lib/browser/api/menu.ts @@ -25,11 +25,30 @@ Menu.prototype._isCommandIdChecked = function (id) { }; Menu.prototype._isCommandIdEnabled = function (id) { - return this.commandsMap[id] ? this.commandsMap[id].enabled : false; + const item = this.commandsMap[id]; + if (!item) return false; + + const focusedWindow = BaseWindow.getFocusedWindow(); + + if (item.role === 'minimize' && focusedWindow) { + return focusedWindow.isMinimizable(); + } + + if (item.role === 'togglefullscreen' && focusedWindow) { + return focusedWindow.isFullScreenable(); + } + + if (item.role === 'close' && focusedWindow) { + return focusedWindow.isClosable(); + } + + return item.enabled; }; + Menu.prototype._shouldCommandIdWorkWhenHidden = function (id) { return this.commandsMap[id] ? !!this.commandsMap[id].acceleratorWorksWhenHidden : false; }; + Menu.prototype._isCommandIdVisible = function (id) { return this.commandsMap[id] ? this.commandsMap[id].visible : false; }; diff --git a/shell/browser/ui/cocoa/electron_menu_controller.mm b/shell/browser/ui/cocoa/electron_menu_controller.mm index 1e78e57f01dc1..789dd24f24fa4 100644 --- a/shell/browser/ui/cocoa/electron_menu_controller.mm +++ b/shell/browser/ui/cocoa/electron_menu_controller.mm @@ -90,6 +90,7 @@ bool MenuHasVisibleItems(const electron::ElectronMenuModel* model) { // "(empty)" into the submenu. Matches Windows behavior. NSMenu* MakeEmptySubmenu() { NSMenu* submenu = [[NSMenu alloc] initWithTitle:@""]; + submenu.autoenablesItems = NO; NSString* empty_menu_title = l10n_util::GetNSString(IDS_APP_MENU_EMPTY_SUBMENU); @@ -231,6 +232,9 @@ - (void)cancel { // be invoked recursively. - (NSMenu*)menuFromModel:(electron::ElectronMenuModel*)model { NSMenu* menu = [[NSMenu alloc] initWithTitle:@""]; + // We manually manage enabled/disabled/hidden state for every item, + // including Cocoa role-based selectors. + menu.autoenablesItems = NO; const int count = model->GetItemCount(); for (int index = 0; index < count; index++) { @@ -240,6 +244,7 @@ - (NSMenu*)menuFromModel:(electron::ElectronMenuModel*)model { [self addItemToMenu:menu atIndex:index fromModel:model]; } + menu.delegate = self; return menu; } @@ -294,9 +299,11 @@ - (NSMenu*)createShareMenuForItem:(const SharingItem&)item { if ([items count] == 0) return MakeEmptySubmenu(); NSMenu* menu = [[NSMenu alloc] init]; + menu.autoenablesItems = NO; NSArray* services = [NSSharingService sharingServicesForItems:items]; for (NSSharingService* service in services) [menu addItem:[self menuItemForService:service withItems:items]]; + [menu setDelegate:self]; return menu; } @@ -353,27 +360,22 @@ - (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index std::u16string title = u"Services"; NSString* sub_label = l10n_util::FixUpWindowsStyleLabel(title); - [item setTarget:nil]; - [item setAction:nil]; + item.target = nil; + item.action = nil; NSMenu* submenu = [[NSMenu alloc] initWithTitle:sub_label]; - [item setSubmenu:submenu]; + item.submenu = submenu; [NSApp setServicesMenu:submenu]; } else if (role == u"sharemenu") { SharingItem sharing_item; model->GetSharingItemAt(index, &sharing_item); - [item setTarget:nil]; - [item setAction:nil]; + item.target = nil; + item.action = nil; [item setSubmenu:[self createShareMenuForItem:sharing_item]]; } else if (type == electron::ElectronMenuModel::TYPE_SUBMENU && model->IsVisibleAt(index)) { - // We need to specifically check that the submenu top-level item has been - // enabled as it's not validated by validateUserInterfaceItem - if (!model->IsEnabledAt(index)) - [item setEnabled:NO]; - // Recursively build a submenu from the sub-model at this index. - [item setTarget:nil]; - [item setAction:nil]; + item.target = nil; + item.action = nil; electron::ElectronMenuModel* submenuModel = static_cast<electron::ElectronMenuModel*>( model->GetSubmenuModelAt(index)); @@ -388,8 +390,12 @@ - (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index } } - [submenu setTitle:[item title]]; - [item setSubmenu:submenu]; + submenu.title = item.title; + item.submenu = submenu; + item.tag = index; + item.representedObject = + [WeakPtrToElectronMenuModelAsNSObject weakPtrForModel:model]; + submenu.delegate = self; // Set submenu's role. if ((role == u"window" || role == u"windowmenu") && [submenu numberOfItems]) @@ -404,9 +410,9 @@ - (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index // the model so hierarchical menus check the correct index in the correct // model. Setting the target to |self| allows this class to participate // in validation of the menu items. - [item setTag:index]; - [item setRepresentedObject:[WeakPtrToElectronMenuModelAsNSObject - weakPtrForModel:model]]; + item.tag = index; + item.representedObject = + [WeakPtrToElectronMenuModelAsNSObject weakPtrForModel:model]; ui::Accelerator accelerator; if (model->GetAcceleratorAtWithParams(index, useDefaultAccelerator_, &accelerator)) { @@ -434,20 +440,20 @@ - (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index ui::MacKeyCodeForWindowsKeyCode(accelerator.key_code(), modifier_mask, nullptr, &character); } - [item setKeyEquivalent:[NSString stringWithFormat:@"%C", character]]; - [item setKeyEquivalentModifierMask:modifier_mask]; + item.keyEquivalent = [NSString stringWithFormat:@"%C", character]; + item.keyEquivalentModifierMask = modifier_mask; } [(id)item setAllowsKeyEquivalentWhenHidden:(model->WorksWhenHiddenAt(index))]; // Set menu item's role. - [item setTarget:self]; + item.target = self; if (!role.empty()) { for (const Role& pair : kRolesMap) { if (role == base::ASCIIToUTF16(pair.role)) { - [item setTarget:nil]; - [item setAction:pair.selector]; + item.target = nil; + item.action = pair.selector; break; } } @@ -457,6 +463,37 @@ - (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index return item; } +- (void)applyStateToMenuItem:(NSMenuItem*)item { + id represented = item.representedObject; + if (!represented) + return; + + electron::ElectronMenuModel* model = + [WeakPtrToElectronMenuModelAsNSObject getFrom:represented]; + if (!model) + return; + + NSInteger index = item.tag; + int count = model->GetItemCount(); + if (index < 0 || index >= count) + return; + + item.hidden = !model->IsVisibleAt(index); + item.enabled = model->IsEnabledAt(index); + item.state = model->IsItemCheckedAt(index) ? NSControlStateValueOn + : NSControlStateValueOff; +} + +// Recursively refreshes the menu tree starting from |menu|, applying the +// model state to each menu item. +- (void)refreshMenuTree:(NSMenu*)menu { + for (NSMenuItem* item in menu.itemArray) { + [self applyStateToMenuItem:item]; + if (item.submenu) + [self refreshMenuTree:item.submenu]; + } +} + // Adds an item or a hierarchical menu to the item at the |index|, // associated with the entry in the model identified by |modelIndex|. - (void)addItemToMenu:(NSMenu*)menu @@ -466,32 +503,6 @@ - (void)addItemToMenu:(NSMenu*)menu atIndex:index]; } -// Called before the menu is to be displayed to update the state (enabled, -// radio, etc) of each item in the menu. -- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { - SEL action = [item action]; - if (action == @selector(performShare:)) - return YES; - if (action != @selector(itemSelected:)) - return NO; - - NSInteger modelIndex = [item tag]; - electron::ElectronMenuModel* model = [WeakPtrToElectronMenuModelAsNSObject - getFrom:[(id)item representedObject]]; - DCHECK(model); - if (model) { - BOOL checked = model->IsItemCheckedAt(modelIndex); - DCHECK([(id)item isKindOfClass:[NSMenuItem class]]); - - [(id)item - setState:(checked ? NSControlStateValueOn : NSControlStateValueOff)]; - [(id)item setHidden:(!model->IsVisibleAt(modelIndex))]; - - return model->IsEnabledAt(modelIndex); - } - return NO; -} - // Called when the user chooses a particular menu item. |sender| is the menu // item chosen. - (void)itemSelected:(id)sender { @@ -526,10 +537,11 @@ - (NSMenu*)menu { menu_ = menu; } else { menu_ = [[NSMenu alloc] initWithTitle:@""]; + menu_.autoenablesItems = NO; if (model_) [self populateWithModel:model_.get()]; } - [menu_ setDelegate:self]; + menu_.delegate = self; return menu_; } @@ -539,6 +551,7 @@ - (BOOL)isMenuOpen { - (void)menuWillOpen:(NSMenu*)menu { isMenuOpen_ = YES; + [self refreshMenuTree:menu]; if (model_) model_->MenuWillShow(); } From 49a1fe6150e4adaaa4cd61dc10372499cb676ca7 Mon Sep 17 00:00:00 2001 From: byquanton <nilay2014@gmail.com> Date: Tue, 28 Oct 2025 20:39:12 +0100 Subject: [PATCH 184/268] docs: add caveats for Electron PipeWire implementation (#48242) --- docs/api/desktop-capturer.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/api/desktop-capturer.md b/docs/api/desktop-capturer.md index 822eabeac8751..63f647c474784 100644 --- a/docs/api/desktop-capturer.md +++ b/docs/api/desktop-capturer.md @@ -102,6 +102,10 @@ Returns `Promise<DesktopCapturerSource[]>` - Resolves with an array of [`Desktop ## Caveats +`desktopCapturer.getSources(options)` only returns a single source on Linux when using Pipewire. + +PipeWire supports a single capture for both screens and windows. If you request the window and screen type, the selected source will be returned as a window capture. + `navigator.mediaDevices.getUserMedia` does not work on macOS for audio capture due to a fundamental limitation whereby apps that want to access the system's audio require a [signed kernel extension](https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/KernelExtensions/KernelExtensions.html). Chromium, and by extension Electron, does not provide this. It is possible to circumvent this limitation by capturing system audio with another macOS app like Soundflower and passing it through a virtual audio input device. This virtual device can then be queried with `navigator.mediaDevices.getUserMedia`. From 6ea231d5cde033b451212a10820e549fd717daf8 Mon Sep 17 00:00:00 2001 From: Calvin <nilay2014@gmail.com> Date: Tue, 28 Oct 2025 13:40:00 -0600 Subject: [PATCH 185/268] docs: remove inaccurate EOL deprecation process (#48696) --- docs/tutorial/electron-timelines.md | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/docs/tutorial/electron-timelines.md b/docs/tutorial/electron-timelines.md index 4d530a608cf71..f164c2af5b41a 100644 --- a/docs/tutorial/electron-timelines.md +++ b/docs/tutorial/electron-timelines.md @@ -121,22 +121,3 @@ and that number is reduced to two in major version 10, the three-argument versio continue to work until, at minimum, major version 12. Past the minimum two-version threshold, we will attempt to support backwards compatibility beyond two versions until the maintainers feel the maintenance burden is too high to continue doing so. - -### End-of-life - -When a release branch reaches the end of its support cycle, the series -will be deprecated in NPM and a final end-of-support release will be -made. This release will add a warning to inform that an unsupported -version of Electron is in use. - -These steps are to help app developers learn when a branch they're -using becomes unsupported, but without being excessively intrusive -to end users. - -If an application has exceptional circumstances and needs to stay -on an unsupported series of Electron, developers can silence the -end-of-support warning by omitting the final release from the app's -`package.json` `devDependencies`. For example, since the 1-6-x series -ended with an end-of-support 1.6.18 release, developers could choose -to stay in the 1-6-x series without warnings with `devDependency` of -`"electron": 1.6.0 - 1.6.17`. From 023702c26b2b86f139deaebd9ff319f64da59910 Mon Sep 17 00:00:00 2001 From: Calvin <nilay2014@gmail.com> Date: Tue, 28 Oct 2025 13:42:59 -0600 Subject: [PATCH 186/268] docs: add release timeline for Electron 40 (#48663) --- docs/tutorial/electron-timelines.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/electron-timelines.md b/docs/tutorial/electron-timelines.md index f164c2af5b41a..a01fe78e21a8b 100644 --- a/docs/tutorial/electron-timelines.md +++ b/docs/tutorial/electron-timelines.md @@ -9,10 +9,11 @@ check out our [Electron Versioning](./electron-versioning.md) doc. | Electron | Alpha | Beta | Stable | EOL | Chrome | Node | Supported | | ------- | ----- | ------- | ------ | ------ | ---- | ---- | ---- | -| 39.0.0 | 2025-Sep-04 | 2025-Oct-01 | 2025-Oct-28 | 2026-May-05 | M142 | TBD | ✅ | +| 40.0.0 | 2025-Oct-30 | 2025-Dec-03 | 2025-Oct-28 | 2026-Jun-30 | M144 | TBD | ✅ | +| 39.0.0 | 2025-Sep-04 | 2025-Oct-01 | 2025-Oct-28 | 2026-May-05 | M142 | v22.20 | ✅ | | 38.0.0 | 2025-Jun-26 | 2025-Aug-06 | 2025-Sep-02 | 2026-Mar-10 | M140 | v22.18 | ✅ | | 37.0.0 | 2025-May-01 | 2025-May-28 | 2025-Jun-24 | 2026-Jan-13 | M138 | v22.16 | ✅ | -| 36.0.0 | 2025-Mar-06 | 2025-Apr-02 | 2025-Apr-29 | 2025-Oct-28 | M136 | v22.14 | ✅ | +| 36.0.0 | 2025-Mar-06 | 2025-Apr-02 | 2025-Apr-29 | 2025-Oct-28 | M136 | v22.14 | 🚫 | | 35.0.0 | 2025-Jan-16 | 2025-Feb-05 | 2025-Mar-04 | 2025-Sep-02 | M134 | v22.14 | 🚫 | | 34.0.0 | 2024-Oct-17 | 2024-Nov-13 | 2025-Jan-14 | 2025-Jun-24 | M132 | v20.18 | 🚫 | | 33.0.0 | 2024-Aug-22 | 2024-Sep-18 | 2024-Oct-15 | 2025-Apr-29 | M130 | v20.18 | 🚫 | From 38a7fbbc0e07f5e3426a69805de8bcd89e4b82fd Mon Sep 17 00:00:00 2001 From: Keeley Hammond <nilay2014@gmail.com> Date: Tue, 28 Oct 2025 15:02:26 -0700 Subject: [PATCH 187/268] build: bump NMV to 143 for Electron 40 (#48714) --- build/args/all.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/args/all.gn b/build/args/all.gn index e0e2e5af7a73d..b62e24774ded3 100644 --- a/build/args/all.gn +++ b/build/args/all.gn @@ -2,7 +2,7 @@ is_electron_build = true root_extra_deps = [ "//electron" ] # Registry of NMVs --> https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json -node_module_version = 140 +node_module_version = 143 v8_promise_internal_field_count = 1 v8_embedder_string = "-electron.0" From 80ed769356dc425788c395e7dad30c9244075a37 Mon Sep 17 00:00:00 2001 From: Erick Zhao <nilay2014@gmail.com> Date: Tue, 28 Oct 2025 15:24:31 -0700 Subject: [PATCH 188/268] docs: use relative link for `OffscreenSharedTexture` (#48717) --- docs/breaking-changes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/breaking-changes.md b/docs/breaking-changes.md index 745bd13c59aeb..11980098d5d92 100644 --- a/docs/breaking-changes.md +++ b/docs/breaking-changes.md @@ -41,7 +41,7 @@ webContents.setWindowOpenHandler((details) => { When using shared texture offscreen rendering feature, the `paint` event now emits a more structured object. It moves the `sharedTextureHandle`, `planes`, `modifier` into a unified `handle` property. -See [here](https://www.electronjs.org/docs/latest/api/structures/offscreen-shared-texture) for more details. +See the [OffscreenSharedTexture](./api/structures/offscreen-shared-texture.md) API structure for more details. ## Planned Breaking API Changes (38.0) From 075cedf6a75ebb649c4996beb5fcfd5c30a69883 Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Wed, 29 Oct 2025 12:32:33 +0100 Subject: [PATCH 189/268] chore: bump chromium to 143.0.7499.0 (main) (#48707) * chore: bump chromium in DEPS to 143.0.7499.0 * 7079895: Allow full screen reentry when full screen parameters changed https://chromium-review.googlesource.com/c/chromium/src/+/7079895 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> --- DEPS | 2 +- ...lectron_deps_to_license_credits_file.patch | 4 ++-- ..._depend_on_packed_resource_integrity.patch | 12 +++++----- patches/chromium/can_create_window.patch | 4 ++-- ...screationoverridden_with_full_params.patch | 8 +++---- ...xpose_setuseragent_on_networkcontext.patch | 8 +++---- ...t_allow_code_cache_in_custom_schemes.patch | 4 ++-- ...moothing_css_rule_and_blink_painting.patch | 18 +++++++------- ...screen_rendering_with_viz_compositor.patch | 2 +- ..._exclusive_access_for_electron_needs.patch | 24 ++++++++++--------- ...t_menu_item_when_opened_via_keyboard.patch | 4 ++-- patches/chromium/frame_host_manager.patch | 4 ++-- .../chromium/gritsettings_resource_ids.patch | 4 ++-- ..._avoid_private_macos_api_usage.patch.patch | 2 +- ...emote_certificate_verification_logic.patch | 10 ++++---- ...eature_windelayspellcheckserviceinit.patch | 4 ++-- ...ean_up_stale_macwebcontentsocclusion.patch | 2 +- ...windowtreehostwin_window_enlargement.patch | 4 ++-- patches/chromium/webview_fullscreen.patch | 6 ++--- 19 files changed, 64 insertions(+), 62 deletions(-) diff --git a/DEPS b/DEPS index e083bdd78b00b..9dab0e707a81f 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '143.0.7497.0', + '143.0.7499.0', 'node_version': 'v22.20.0', 'nan_version': diff --git a/patches/chromium/add_electron_deps_to_license_credits_file.patch b/patches/chromium/add_electron_deps_to_license_credits_file.patch index e47e7225699cc..b6bcbd01e8724 100644 --- a/patches/chromium/add_electron_deps_to_license_credits_file.patch +++ b/patches/chromium/add_electron_deps_to_license_credits_file.patch @@ -7,10 +7,10 @@ Ensure that licenses for the dependencies introduced by Electron are included in `LICENSES.chromium.html` diff --git a/tools/licenses/licenses.py b/tools/licenses/licenses.py -index 833a80f1387c64eec418b57d74373dd93130a9dc..a85714b903fc934593258192bc61d72cc557615b 100755 +index 514be069768cc1bbd39f2b261cefb1a9f267f89f..0a1ab64914cfaa087e4000fb81bfafd18aa1b98b 100755 --- a/tools/licenses/licenses.py +++ b/tools/licenses/licenses.py -@@ -356,6 +356,31 @@ SPECIAL_CASES = { +@@ -357,6 +357,31 @@ SPECIAL_CASES = { "License": "Apache 2.0", "License File": ["//third_party/sample3/the_license"], }, diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index 7a97b33222a67..f624ad3013aba 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -33,10 +33,10 @@ index c51468e6fdb46634b5458b387d1c78caf2dd083f..7236611d2a392008f43b1b83ae125e94 "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 03b7e243f304528ed12fcb0194f084bb4475d3a6..5ae8aaea4939b6a5500f487fa79c6352ffd6d173 100644 +index 848ddc7610d01dee15e0008e2095d4d0af056ac6..6bbacd81a079e54559989050e38e31b852102e15 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4823,7 +4823,7 @@ static_library("browser") { +@@ -4829,7 +4829,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index 03b7e243f304528ed12fcb0194f084bb4475d3a6..5ae8aaea4939b6a5500f487fa79c6352 # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 870557c8f7edb33c6373d59ffa9e87483262ca27..0e7ce248a0af7b9062ae258613474f859a3e153c 100644 +index c0fa565f990a956af43720850ac85451f3c25b8c..bf5e2c0f7e628befdee6e38a6a6dddefea8bce7a 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7583,9 +7583,12 @@ test("unit_tests") { +@@ -7585,9 +7585,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index 870557c8f7edb33c6373d59ffa9e87483262ca27..0e7ce248a0af7b9062ae258613474f85 "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8521,6 +8524,10 @@ test("unit_tests") { +@@ -8527,6 +8530,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index 870557c8f7edb33c6373d59ffa9e87483262ca27..0e7ce248a0af7b9062ae258613474f85 sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8577,7 +8584,6 @@ test("unit_tests") { +@@ -8583,7 +8590,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 8dd36fe894d83..dd50b491b78cf 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,10 +9,10 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index c6addeca2a539557c4b6bbb1c20e9904c64525f5..c50cceaf899308e126844e986abc4e01bc7497bb 100644 +index ce1e5c65773a1967bcaa31e5b2572d4e7fa8b148..9d54e7e7ccabad6dfcdc54214683df8b3b414208 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -9848,6 +9848,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -9953,6 +9953,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To<Referrer>(), params->frame_name, params->disposition, *params->features, diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index 69e2cf47129c9..6a1e4035aedeb 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -80,10 +80,10 @@ index 39fa45f0a0f9076bd7ac0be6f455dd540a276512..3d0381d463eed73470b28085830f2a23 content::WebContents* source, const content::OpenURLParams& params, diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index 7477bbc1a4e6ccb536d2c63ffe7c2b0982a5d298..5bfbf89e19e9c35c942b856276b35707a75fc0ef 100644 +index e550b21eba674396ba97b9ec21535964502d1b36..24e13b4f6ab01bdbefba791002edb0a4faf4811a 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc -@@ -2366,7 +2366,8 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2369,7 +2369,8 @@ bool Browser::IsWebContentsCreationOverridden( content::mojom::WindowContainerType window_container_type, const GURL& opener_url, const std::string& frame_name, @@ -93,7 +93,7 @@ index 7477bbc1a4e6ccb536d2c63ffe7c2b0982a5d298..5bfbf89e19e9c35c942b856276b35707 if (HasActorTask(profile(), opener)) { // If an ExecutionEngine is acting on the opener, prevent it from creating a // new WebContents. We'll instead force the navigation to happen in the same -@@ -2379,7 +2380,7 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2382,7 +2383,7 @@ bool Browser::IsWebContentsCreationOverridden( return (window_container_type == content::mojom::WindowContainerType::BACKGROUND && ShouldCreateBackgroundContents(source_site_instance, opener_url, @@ -103,7 +103,7 @@ index 7477bbc1a4e6ccb536d2c63ffe7c2b0982a5d298..5bfbf89e19e9c35c942b856276b35707 WebContents* Browser::CreateCustomWebContents( diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h -index 5eb967dec8c8ec8b8959b361438807a987011d04..784c2ad55d22bc82b5e629f364561d3f49c00887 100644 +index e0d63627518a5e0e1bdef510f3c0d849db4cc0d8..a052d78b6578a1e1fab88e1acafff77e5871c335 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -935,8 +935,7 @@ class Browser : public TabStripModelObserver, diff --git a/patches/chromium/expose_setuseragent_on_networkcontext.patch b/patches/chromium/expose_setuseragent_on_networkcontext.patch index 40d3fddf59c3f..c928703a00d2f 100644 --- a/patches/chromium/expose_setuseragent_on_networkcontext.patch +++ b/patches/chromium/expose_setuseragent_on_networkcontext.patch @@ -33,10 +33,10 @@ index 0ab8187b0db8ae6db46d81738f653a2bc4c566f6..de3d55e85c22317f7f9375eb94d0d5d4 } // namespace net diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index cf1cee2251d8ba88535acc1e41cf82986b62f259..27c1a38d0f1b06cbc0722f2067fe39a4f86f0903 100644 +index 3598823a6400c4e5045621950433d2688cfbba89..66379714141b83a2ded90f88ce8b89bf900ca5a6 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc -@@ -1910,6 +1910,13 @@ void NetworkContext::EnableDurableMessageCollector( +@@ -1911,6 +1911,13 @@ void NetworkContext::EnableDurableMessageCollector( it->second->AddReceiver(std::move(receiver)); } @@ -63,10 +63,10 @@ index 90cf1a70c068771ac98b2d5a283cba5e54c05ff4..0dc8de8d4e37e48cb28d8112c0233ac8 void SetEnableReferrers(bool enable_referrers) override; #if BUILDFLAG(IS_CT_SUPPORTED) diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index 00374e2ad12939733983fc6ea4643ff72134942a..ed149b049cb837adb17dfbd302f3ccc597c85fba 100644 +index 434cd63a228ddbdf2efffc0c6a17ab6376beb19d..75d2ad3ccdf4408a2c40c042be60ebd75c320b90 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -1353,6 +1353,9 @@ interface NetworkContext { +@@ -1357,6 +1357,9 @@ interface NetworkContext { mojo_base.mojom.UnguessableToken throttling_profile_id, pending_receiver<DurableMessageCollector> receiver); diff --git a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch index 324d35cb29626..a0eb4a81f5823 100644 --- a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch +++ b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch @@ -405,7 +405,7 @@ index 70a23343d5815db0722e2977d966219b824a83b1..85ac45c1868832c47460108f93d86a51 std::vector<std::string> extension_schemes; // Registers a URL scheme with a predefined default custom handler. diff --git a/url/url_util.cc b/url/url_util.cc -index 5f45b59482b66aad4e8ab08cae9f3eef3f4e6fa7..88512b7dc2c04364af76182a42c414212a46cd58 100644 +index 90c06884c9c7e91a706d58917b38c0919e546c1b..f3aa192ac229423fa0b9c8caa8f7b1df18cc45ec 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -136,6 +136,9 @@ struct SchemeRegistry { @@ -418,7 +418,7 @@ index 5f45b59482b66aad4e8ab08cae9f3eef3f4e6fa7..88512b7dc2c04364af76182a42c41421 // Schemes with a predefined default custom handler. std::vector<SchemeWithHandler> predefined_handler_schemes; -@@ -679,6 +682,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() { +@@ -677,6 +680,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() { return GetSchemeRegistry().empty_document_schemes; } diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index 9004d0a266dea..3da9175a20c39 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -20,7 +20,7 @@ making three primary changes to Blink: * Controls whether the CSS rule is available. diff --git a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom -index 5e04647ae947613138ca3e803a5bac34acf9672f..edfdb10888b4c8efb63e6713f04858d35050112a 100644 +index cd3f33a59c40705ee5aa0869c298dc11b3caac21..803212c1b7662f9b78f4e1f7a61acec129f54280 100644 --- a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom +++ b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom @@ -48,6 +48,7 @@ enum CSSSampleId { @@ -45,10 +45,10 @@ index e189d584f05f2ce6354c03a9b19f56985df8a15e..41b430e8f2416be098494f5c49fb97ca 'internal-forced-visited-'): internal_visited_order = 0 diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 -index 8ea9539c27b3c565efb05b8da39fcead8e4c2ee3..27346b484d7d6e78e3eea36bc9b1f819b98892cd 100644 +index bb84e7fb7845a64a336e95a20a47d32d7f74aa16..4849f6ac85715e816930ae35fdd9d2815165a133 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5 -@@ -9049,6 +9049,26 @@ +@@ -9074,6 +9074,26 @@ property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], }, @@ -76,7 +76,7 @@ index 8ea9539c27b3c565efb05b8da39fcead8e4c2ee3..27346b484d7d6e78e3eea36bc9b1f819 { name: "-internal-visited-color", diff --git a/third_party/blink/renderer/core/css/css_property_equality.cc b/third_party/blink/renderer/core/css/css_property_equality.cc -index f4806d8ea97785e8450ba7d08da45108702c4217..71398ba97655c1a96633a8be2c0387604bfabf9d 100644 +index 64a361128ec56be0382c72ef40db1bd01cb8d9a0..1dc51536f5860448dda9adc2b1129f53efbbd595 100644 --- a/third_party/blink/renderer/core/css/css_property_equality.cc +++ b/third_party/blink/renderer/core/css/css_property_equality.cc @@ -354,6 +354,8 @@ bool CSSPropertyEquality::PropertiesEqual(const PropertyHandle& property, @@ -89,10 +89,10 @@ index f4806d8ea97785e8450ba7d08da45108702c4217..71398ba97655c1a96633a8be2c038760 return a.EmptyCells() == b.EmptyCells(); case CSSPropertyID::kFill: diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -index 56d4ea1c4c27062adb90754d75d3595a0fb71a9e..40b786c32a0c21ff31886a1fc8b6d7b2cfff2e91 100644 +index c818580d191226b88dbac41d4eabbabf0b6035d9..c91591362e5b5fce9a383c07270f3c5e62771fe2 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -@@ -12500,5 +12500,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( +@@ -12521,5 +12521,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( CSSValueID::kNone>(stream); } @@ -130,10 +130,10 @@ index 56d4ea1c4c27062adb90754d75d3595a0fb71a9e..40b786c32a0c21ff31886a1fc8b6d7b2 } // namespace css_longhand } // namespace blink diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc -index b2cfcac17cac610bf2f686ded14e6cfe3b7023a9..81e98f83c0387a4c527e3d46361fcfe4c9791e9c 100644 +index 4c4a4ca1c5d0d9ebfc361323bf932b2c36de9c49..e350bb786146ade7991422fc8f8c640daa7ea2a8 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc -@@ -4122,6 +4122,15 @@ PositionTryFallback StyleBuilderConverter::ConvertSinglePositionTryFallback( +@@ -4119,6 +4119,15 @@ PositionTryFallback StyleBuilderConverter::ConvertSinglePositionTryFallback( return PositionTryFallback(scoped_name, tactic_list); } @@ -312,7 +312,7 @@ index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index 1ce3037cb0f173c192707de4e36b92bd733a89c0..195d4430d824d815b7de7799842c6e53b6a997aa 100644 +index 02815bb434a54acaacbd11e408fb26564bb5d0a6..e47d5eba72cd3e08675eea76927e4efd28b43a31 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch index 20a2f8b60ce36..82a5e49fffcc1 100644 --- a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch +++ b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch @@ -180,7 +180,7 @@ index 07502f4ff2afd53a43d8f0ab68d4c4c39f6c0737..20d51f86d5084edf0b05ce0ab11fcd12 HWND child_hwnd; auto device = CreateSoftwareOutputDeviceWin( diff --git a/components/viz/service/display_embedder/output_surface_provider_impl.h b/components/viz/service/display_embedder/output_surface_provider_impl.h -index e4b46a79560e7698a6400b2ab8a57f38205a8718..3cb2518c6644cf0618f625d981befd466a3dfb2c 100644 +index f49bbc5d568f0cb323a22997a949e2cae8f35d59..c0154ee828e67b197eb2ddb1abf04c0aede0d264 100644 --- a/components/viz/service/display_embedder/output_surface_provider_impl.h +++ b/components/viz/service/display_embedder/output_surface_provider_impl.h @@ -54,7 +54,8 @@ class VIZ_SERVICE_EXPORT OutputSurfaceProviderImpl diff --git a/patches/chromium/fix_adapt_exclusive_access_for_electron_needs.patch b/patches/chromium/fix_adapt_exclusive_access_for_electron_needs.patch index 01ae732adbc8b..0b5c0156dba90 100644 --- a/patches/chromium/fix_adapt_exclusive_access_for_electron_needs.patch +++ b/patches/chromium/fix_adapt_exclusive_access_for_electron_needs.patch @@ -16,7 +16,7 @@ Linux or Windows to un-fullscreen in some circumstances without this change. diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc -index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0669f2517 100644 +index 3d17e79f291e6d3925d29cf349c30b4f7c7a6f54..a7494e62a6a49a71e5aef2c8abb4ec29426a5d23 100644 --- a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc @@ -47,7 +47,7 @@ @@ -37,7 +37,7 @@ index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0 if (!popunder_preventer_) { popunder_preventer_ = std::make_unique<PopunderPreventer>(web_contents); } else { -@@ -317,12 +317,14 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) { +@@ -326,12 +326,14 @@ void FullscreenController::ExitFullscreenModeForTab(WebContents* web_contents) { void FullscreenController::FullscreenTabOpeningPopup( content::WebContents* opener, content::WebContents* popup) { @@ -52,7 +52,7 @@ index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0 } #endif // !BUILDFLAG(IS_ANDROID) -@@ -406,8 +408,7 @@ void FullscreenController::FullscreenTransitionCompleted() { +@@ -415,8 +417,7 @@ void FullscreenController::FullscreenTransitionCompleted() { #endif // DCHECK_IS_ON() tab_fullscreen_target_display_id_ = display::kInvalidDisplayId; started_fullscreen_transition_ = false; @@ -62,7 +62,7 @@ index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0 if (!IsTabFullscreen()) { // Activate any popup windows created while content fullscreen, after exit. popunder_preventer_.reset(); -@@ -543,18 +544,17 @@ void FullscreenController::EnterFullscreenModeInternal( +@@ -552,19 +553,18 @@ void FullscreenController::EnterFullscreenModeInternal( // Do not enter fullscreen mode if disallowed by pref. This prevents the user // from manually entering fullscreen mode and also disables kiosk mode on // desktop platforms. @@ -76,6 +76,7 @@ index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0 return; - } #endif + fullscreen_parameters_ = fullscreen_tab_params; started_fullscreen_transition_ = true; toggled_into_fullscreen_ = true; +#if 0 @@ -86,7 +87,7 @@ index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0 if (option == TAB) { origin = GetRequestingOrigin(); tab_fullscreen_ = true; -@@ -592,6 +592,7 @@ void FullscreenController::EnterFullscreenModeInternal( +@@ -602,6 +602,7 @@ void FullscreenController::EnterFullscreenModeInternal( origin = url::Origin::Create(extension_url_.value()); } } @@ -94,7 +95,7 @@ index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0 fullscreen_start_time_ = base::TimeTicks::Now(); if (option == BROWSER) { -@@ -613,6 +614,7 @@ void FullscreenController::ExitFullscreenModeInternal() { +@@ -623,6 +624,7 @@ void FullscreenController::ExitFullscreenModeInternal() { return; } @@ -102,12 +103,13 @@ index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0 // `fullscreen_start_time_` is null if a fullscreen tab moves to a new window. if (fullscreen_start_time_ && exclusive_access_tab()) { ukm::SourceId source_id = -@@ -624,18 +626,19 @@ void FullscreenController::ExitFullscreenModeInternal() { +@@ -634,19 +636,20 @@ void FullscreenController::ExitFullscreenModeInternal() { .Record(ukm::UkmRecorder::Get()); fullscreen_start_time_.reset(); } +#endif + fullscreen_parameters_.reset(); toggled_into_fullscreen_ = false; started_fullscreen_transition_ = true; -#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_ANDROID) @@ -126,12 +128,12 @@ index 9c29254d3400d4c52a71d7527b2db45858ce8cc2..5517cea76af4ea2b91c4a31fc359ebd0 extension_url_.reset(); exclusive_access_manager()->UpdateBubble(base::NullCallback()); diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.h b/chrome/browser/ui/exclusive_access/fullscreen_controller.h -index f9e3ec3c61e0c9f16b13e2ee5fd447e26b49a6da..e06b1fb4a0c256c0f51ff66d06663af46c9c88ae 100644 +index e80fa0ad07db3b670812b7b8b4fe09e1986933be..f86bd0cbfe79462617ed191b616cb5b6237c5ce8 100644 --- a/chrome/browser/ui/exclusive_access/fullscreen_controller.h +++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.h -@@ -256,7 +256,7 @@ class FullscreenController : public ExclusiveAccessControllerBase { - // Used in testing to set the state to tab fullscreen. - bool is_tab_fullscreen_for_testing_ = false; +@@ -261,7 +261,7 @@ class FullscreenController : public ExclusiveAccessControllerBase { + // Set of parameters used to enter fullscreen + std::optional<FullscreenTabParams> fullscreen_parameters_; -#if !BUILDFLAG(IS_ANDROID) +#if 0 diff --git a/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch b/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch index d0134997677d7..35d224ff449fc 100644 --- a/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch +++ b/patches/chromium/fix_select_the_first_menu_item_when_opened_via_keyboard.patch @@ -6,7 +6,7 @@ Subject: fix: select the first menu item when opened via keyboard This fixes an accessibility issue where the root view is 'focused' to the screen reader instead of the first menu item as with all other native menus. This patch will be upstreamed. diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc -index 2b537c6e6e3db1b7512bf41dbb0a44df752aeada..6b06366c31906c71d266966414d75534b10a875b 100644 +index 4fd9d4eb67842ac4232d1fe4cbb3da60c2d8c9bb..750e8886015692287bc7fa045b40c5a030cf886b 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc @@ -713,6 +713,16 @@ void MenuController::Run(Widget* parent, @@ -26,7 +26,7 @@ index 2b537c6e6e3db1b7512bf41dbb0a44df752aeada..6b06366c31906c71d266966414d75534 if (button_controller) { pressed_lock_ = button_controller->TakeLock( false, ui::LocatedEvent::FromIfValid(event)); -@@ -2475,18 +2485,15 @@ void MenuController::OpenMenuImpl(MenuItemView* item, bool show) { +@@ -2480,18 +2490,15 @@ void MenuController::OpenMenuImpl(MenuItemView* item, bool show) { } item->GetSubmenu()->ShowAt(params); diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index 384b5ae0878e9..1b2814a4baae1 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -6,10 +6,10 @@ Subject: frame_host_manager.patch Allows embedder to intercept site instances created by chromium. diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc -index b95cedc2e178a743830b395e9bb62ef7d3ddf8d2..1f08d28a7be70d4e730ef29e46c7d093d7f765fc 100644 +index 53bbf0174048d62b252b797b06695e6290273e80..4350b57ebf424e392c54dd2b54e62690527ca9b6 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc -@@ -4806,6 +4806,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -4809,6 +4809,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( request->ResetStateForSiteInstanceChange(); } diff --git a/patches/chromium/gritsettings_resource_ids.patch b/patches/chromium/gritsettings_resource_ids.patch index bd8ebe7640d37..b47c339c5ab10 100644 --- a/patches/chromium/gritsettings_resource_ids.patch +++ b/patches/chromium/gritsettings_resource_ids.patch @@ -6,10 +6,10 @@ Subject: gritsettings_resource_ids.patch Add electron resources file to the list of resource ids generation. diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec -index 647916bff39218a0a9711405f7b98eb9b4d6f821..0d3455c124c260cb0e7c313e1e923276598781db 100644 +index aeb9f8b8eaf68c076348278f6a8b394cae2ef827..edfddee6f923b86fae535dbde1ce886b61c5510f 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec -@@ -1595,6 +1595,11 @@ +@@ -1597,6 +1597,11 @@ "messages": [10120], }, diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index 9e5e774e11154..b0faed3c0b5b0 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -581,7 +581,7 @@ index e51fd827f7afc01a5189737f86a2414627a6546e..bb50f03ba5622c2bfb96bc75d145f471 return kAttributes; } diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index 9b0fea4c6ff8f43c695c437b5c295fcd41326d40..adf889c805e177d8d09700aa9d7f5ff2306b6826 100644 +index 548abd4a6857cc47691c276b4b11cb34eadedcdf..3a4ca077145fcd65fcb7ca1be85beabda0112e72 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn @@ -344,6 +344,7 @@ source_set("browser") { diff --git a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch index 2d9df1d6f2562..ddd26f5070c78 100644 --- a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch +++ b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch @@ -7,7 +7,7 @@ This adds a callback from the network service that's used to implement session.setCertificateVerifyCallback. diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index ecff85f3bdb1eb56f76bf71b2d365bba2c42a415..cf1cee2251d8ba88535acc1e41cf82986b62f259 100644 +index 71cef856b5d4311124bc8bf30bf6c0f73b990b13..3598823a6400c4e5045621950433d2688cfbba89 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc @@ -166,6 +166,11 @@ @@ -134,7 +134,7 @@ index ecff85f3bdb1eb56f76bf71b2d365bba2c42a415..cf1cee2251d8ba88535acc1e41cf8298 constexpr uint32_t NetworkContext::kMaxOutstandingRequestsPerProcess; NetworkContext::NetworkContextHttpAuthPreferences:: -@@ -1021,6 +1131,13 @@ void NetworkContext::SetClient( +@@ -1022,6 +1132,13 @@ void NetworkContext::SetClient( client_.Bind(std::move(client)); } @@ -148,7 +148,7 @@ index ecff85f3bdb1eb56f76bf71b2d365bba2c42a415..cf1cee2251d8ba88535acc1e41cf8298 void NetworkContext::CreateURLLoaderFactory( mojo::PendingReceiver<mojom::URLLoaderFactory> receiver, mojom::URLLoaderFactoryParamsPtr params) { -@@ -2688,6 +2805,10 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( +@@ -2689,6 +2806,10 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( cert_verifier = std::make_unique<net::CachingCertVerifier>( std::make_unique<net::CoalescingCertVerifier>( std::move(cert_verifier))); @@ -190,7 +190,7 @@ index 3795ce4def719c36e1dace911be53b0103aeafc5..90cf1a70c068771ac98b2d5a283cba5e std::unique_ptr<HostResolver> internal_host_resolver_; std::set<std::unique_ptr<HostResolver>, base::UniquePtrComparator> diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index 2d27a56d773140749469444af635b11d302793c1..00374e2ad12939733983fc6ea4643ff72134942a 100644 +index f6f90744b2faab08fd44f7b0ecc9c271abf62813..434cd63a228ddbdf2efffc0c6a17ab6376beb19d 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom @@ -316,6 +316,17 @@ struct SocketBrokerRemotes { @@ -211,7 +211,7 @@ index 2d27a56d773140749469444af635b11d302793c1..00374e2ad12939733983fc6ea4643ff7 // Parameters for constructing a network context. struct NetworkContextParams { // The user agent string. -@@ -1009,6 +1020,9 @@ interface NetworkContext { +@@ -1013,6 +1024,9 @@ interface NetworkContext { // Sets a client for this network context. SetClient(pending_remote<NetworkContextClient> client); diff --git a/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch b/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch index b670d92243c24..a6cf4773d4449 100644 --- a/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch +++ b/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch @@ -15,10 +15,10 @@ described in 97b353a (#34993): This patch can be removed when we fix that crash. diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc -index 9cb826530cf567e98baf91a60ca1f7496aca9431..2d0e92f9f373f8ef6ffa3c292811df957d457c95 100644 +index 2034b961d99225ebe9b606af915f5d90fdae913e..a7ee864ae4d14d36bdf5f7f4fb0ba86255dc9c6f 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc -@@ -1412,6 +1412,17 @@ void ChromeBrowserMainParts::PostProfileInit(Profile* profile, +@@ -1475,6 +1475,17 @@ void ChromeBrowserMainParts::PostProfileInit(Profile* profile, profile->GetPath())); } diff --git a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch index d27426d90daff..57ecf36a27857 100644 --- a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch +++ b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch @@ -254,7 +254,7 @@ index 17d6d7d935f93afefa9123f56ef9c138c3070f93..8dfa7501a6a2998e107bf9b51f5e5c3d } diff --git a/content/common/features.cc b/content/common/features.cc -index 444e54b49c5b9661dcce5563193484a4e0ea2836..b902bc814c15998f7678275326ee818e58d070a1 100644 +index f4c4f0cd75e8e8331d4a223d6faa6735401f0a86..5efe4e75273dec930534049e7e2a4935af0140c1 100644 --- a/content/common/features.cc +++ b/content/common/features.cc @@ -311,6 +311,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index c7dc5709b9466..56b9a37d98050 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index ce09656206496ee36294eb0d9b5a595d67411141..008ec5d958ee2105eb2de03b22c18734399e6435 100644 +index f8d61bc2e80c1f32aaae252d5897e6ac65935898..daf0bf82438ec022784ecbfa8e5e8869ec251359 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25413,6 +25413,21 @@ +@@ -25517,6 +25517,21 @@ ] } ], diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index 03547f12e1852..f3a0fcceef3db 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,10 +15,10 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index c50cceaf899308e126844e986abc4e01bc7497bb..e875bf555a92e4539aa0ea7e20eb369718b465cd 100644 +index 9d54e7e7ccabad6dfcdc54214683df8b3b414208..d5284c4a18f779b4a0fefa9e15ba4f8c023ca352 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -8954,6 +8954,17 @@ void RenderFrameHostImpl::EnterFullscreen( +@@ -9048,6 +9048,17 @@ void RenderFrameHostImpl::EnterFullscreen( } } @@ -34,7 +34,7 @@ index c50cceaf899308e126844e986abc4e01bc7497bb..e875bf555a92e4539aa0ea7e20eb3697 + } + // Focus the window if another frame may have delegated the capability. - if (had_fullscreen_token && !GetView()->HasFocus()) + if (had_fullscreen_token && !GetView()->HasFocus()) { GetView()->Focus(); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 66c603cfa5916e377a5d978a5d8e0f0e63ddb2a3..4a7c0480ad0e9d1f350909a14ef4e6d8d7b24581 100644 From a39fe86de5d84a2a1ebb03e4fbe75369d5d88df7 Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Wed, 29 Oct 2025 11:42:15 -0500 Subject: [PATCH 190/268] refactor: remove redundant map lookups in `browser/api/menu.ts` (#48706) perf: avoid double map lookup in Menu.prototype._shouldCommandIdWorkWhenHidden perf: avoid double map lookup in Menu.prototype._isCommandIdVisible perf: avoid double map lookup in Menu.prototype._shouldRegisterAcceleratorForCommandId perf: avoid double map lookup in Menu.prototype._getSharingItemForCommandId --- lib/browser/api/menu.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/browser/api/menu.ts b/lib/browser/api/menu.ts index 75a06afddca26..5f607b4ed3980 100644 --- a/lib/browser/api/menu.ts +++ b/lib/browser/api/menu.ts @@ -46,11 +46,11 @@ Menu.prototype._isCommandIdEnabled = function (id) { }; Menu.prototype._shouldCommandIdWorkWhenHidden = function (id) { - return this.commandsMap[id] ? !!this.commandsMap[id].acceleratorWorksWhenHidden : false; + return this.commandsMap[id]?.acceleratorWorksWhenHidden ?? false; }; Menu.prototype._isCommandIdVisible = function (id) { - return this.commandsMap[id] ? this.commandsMap[id].visible : false; + return this.commandsMap[id]?.visible ?? false; }; Menu.prototype._getAcceleratorForCommandId = function (id, useDefaultAccelerator) { @@ -61,12 +61,12 @@ Menu.prototype._getAcceleratorForCommandId = function (id, useDefaultAccelerator }; Menu.prototype._shouldRegisterAcceleratorForCommandId = function (id) { - return this.commandsMap[id] ? this.commandsMap[id].registerAccelerator : false; + return this.commandsMap[id]?.registerAccelerator ?? false; }; if (process.platform === 'darwin') { Menu.prototype._getSharingItemForCommandId = function (id) { - return this.commandsMap[id] ? this.commandsMap[id].sharingItem : null; + return this.commandsMap[id]?.sharingItem ?? null; }; } From f05505868a4a7719a22acfb7e0c783baa5d87c18 Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Thu, 30 Oct 2025 19:16:48 +0100 Subject: [PATCH 191/268] chore: upgrade Node.js to v24.10.0 (#48613) * chore: upgrade Node.js to v24.10.0 * chore: fixup crypto patch * chore: fixup crypto test patch * src: prepare for v8 sandboxing https://github.com/nodejs/node/pull/58376 * esm: fix module.exports export on CJS modules https://github.com/nodejs/node/pull/57366 * chore: fixup lazyload fs patch * esm: Source Phase Imports for WebAssembly https://github.com/nodejs/node/pull/56919 * module: remove --experimental-default-type https://github.com/nodejs/node/pull/56092 * lib,src: refactor assert to load error source from memory https://github.com/nodejs/node/pull/59751 * src: add source location to v8::TaskRunner https://github.com/nodejs/node/pull/54077 * src: remove dependency on wrapper-descriptor-based CppHeap https://github.com/nodejs/node/pull/54077 * src: do not use soon-to-be-deprecated V8 API https://github.com/nodejs/node/pull/53174 * src: stop using deprecated fields of v8::FastApiCallbackOptions https://github.com/nodejs/node/pull/54077 * test: update v8-stats test for V8 12.6 https://github.com/nodejs/node/pull/54077 * esm: unflag --experimental-wasm-modules https://github.com/nodejs/node/pull/57038 * test: adapt assert tests to stack trace changes https://github.com/nodejs/node/pull/58070 * src,test: unregister the isolate after disposal and before freeing https://github.com/nodejs/node/pull/58070 * src: use cppgc to manage ContextifyContext https://github.com/nodejs/node/pull/56522 * src: replace uses of FastApiTypedArray https://github.com/nodejs/node/pull/58070 * module: integrate TypeScript into compile cache https://github.com/nodejs/node/pull/56629 * deps: update ada to 3.2.7 https://github.com/nodejs/node/pull/59336 * src: make minor cleanups in encoding_binding.cc https://github.com/nodejs/node/pull/57448 * src: switch from `Get/SetPrototype` to `Get/SetPrototypeV2` https://github.com/nodejs/node/pull/55453 * src: use non-deprecated Get/SetPrototype methods https://github.com/nodejs/node/pull/59671 * src: simplify string_bytes with views https://github.com/nodejs/node/pull/54876 * src: improve utf8 string generation performance https://github.com/nodejs/node/pull/54873 * src: use non-deprecated Utf8LengthV2() method https://github.com/nodejs/node/pull/58070 * src: use non-deprecated WriteUtf8V2() method https://github.com/nodejs/node/pull/58070 * src: refactor WriteUCS2 and remove flags argument https://github.com/nodejs/node/pull/58163 * src: use String::WriteV2() in TwoByteValue https://github.com/nodejs/node/pull/58164 * node-api: use WriteV2 in napi_get_value_string_utf16 https://github.com/nodejs/node/pull/58165 * node-api: use WriteOneByteV2 in napi_get_value_string_latin1 https://github.com/nodejs/node/pull/58325 * src: migrate WriteOneByte to WriteOneByteV2 https://github.com/nodejs/node/pull/59634 * fs: introduce dirent\.parentPath https://github.com/nodejs/node/pull/50976 * src: avoid copy by using std::views::keys https://github.com/nodejs/node/pull/56080 * chore: fixup patch indices * fix: errant use of context->GetIsolate() * fix: tweak BoringSSL compat patch for new changes * fix: add back missing isolate dtor declaration * fixup! esm: fix module.exports export on CJS modules * cli: remove --no-experimental-fetch flag https://github.com/nodejs/node/pull/52611/files * esm: Source Phase Imports for WebAssembly https://github.com/nodejs/node/pull/56919 * fixup! src: prepare for v8 sandboxing * chore: bump @types/node to v24 * chore: fix const assignment in crypto test * fix: sandbox pointer patch issues * chore: rework source phase import patch * src: add percentage support to --max-old-space-size https://github.com/nodejs/node/pull/59082 * chore: fixup crypto tests * chore: HostImportModuleWithPhaseDynamically todo * fix: cjs esm failures * fix: v8::Object::Wrappable issues - https://github.com/v8/node/commit/b72a6157543d68218cc385fc17b81b7005567d0a - https://github.com/v8/node/commit/490bac24967c5bc2190c340611d4badba6af340e - https://github.com/v8/node/commit/4896a0dd693b604a80913b42c1fd9af0b5c4680c * chore: remove deleted specs * src: use v8::ExternalMemoryAccounter https://github.com/nodejs/node/pull/58070 * fs: port SonicBoom module to fs module as FastUtf8Stream https://github.com/nodejs/node/pull/58897 * chore: tweak sandboxed pr patch * test: disable parallel/test-os-checked-function * test: use WHATWG URL instead of url.parse * fix: OPENSSL_secure_zalloc doesn't work in BoringSSL * chore: fix accidental extra line * 7017517: [defer-import-eval] Parse import defer syntax https://chromium-review.googlesource.com/c/v8/v8/+/7017517 --- DEPS | 2 +- lib/browser/api/net-fetch.ts | 5 +- lib/browser/api/protocol.ts | 23 +- lib/browser/init.ts | 2 +- lib/node/asar-fs-wrapper.ts | 2 +- npm/package.json | 2 +- package.json | 2 +- patches/node/.patches | 33 +- ..._to_foreground_task_runner_signature.patch | 37 - .../api_remove_deprecated_getisolate.patch | 294 +++--- patches/node/build_add_gn_build_files.patch | 40 +- ...w_unbundling_of_node_js_dependencies.patch | 2 +- ...etraits_signatures_to_avoid_conflict.patch | 2 +- .../build_compile_with_c_20_support.patch | 33 - patches/node/build_enable_perfetto.patch | 16 +- ...compilation_fails_if_not_using_a_new.patch | 8 +- ...f_original-fs_and_custom_embedder_js.patch | 10 +- ...e_clang_as_default_compiler_on_macos.patch | 2 +- ...ternalizabletwobytestring_to_globals.patch | 21 - ...hore_add_missing_include_of_iterator.patch | 35 - ...de_entrypoint_to_be_a_builtin_module.patch | 4 +- ...de_folder_from_exit-time-destructors.patch | 4 +- ...e_expose_importmoduledynamically_and.patch | 53 +- ..._import_defer_as_ns_and_import_defer.patch | 48 + ...cli_move_--trace-atomics-wait_to_eol.patch | 305 ------ .../node/cli_remove_deprecated_v8_flag.patch | 59 -- ...enable_crashpad_linux_node_processes.patch | 8 +- .../expose_get_builtin_module_function.patch | 8 +- ...e_js_source_phase_imports_by_default.patch | 32 + ..._values_for_variables_in_common_gypi.patch | 2 +- ...d_source_location_for_v8_task_runner.patch | 101 -- ...ebidl_tests_for_enabled_float16array.patch | 23 +- ...tch_in_renderer_and_worker_processes.patch | 109 ++ ...g_fileexists_fn_to_legacymainresolve.patch | 14 +- ...ssert_module_in_the_renderer_process.patch | 67 -- ...eak_on_invalid_tls_protocol_versions.patch | 57 + .../node/fix_cppgc_initializing_twice.patch | 4 +- .../fix_crypto_tests_to_run_with_bssl.patch | 986 +++++++++++++++++- ..._do_not_resolve_electron_entrypoints.patch | 20 +- ...separent_bails_on_resource_path_exit.patch | 6 +- ...se_readfilesync_override_for_modules.patch | 30 +- ...n_electron_module_via_the_esm_loader.patch | 55 +- ...ingssl_and_openssl_incompatibilities.patch | 451 ++------ ...in_esm_loaders_to_apply_asar_patches.patch | 18 +- ...x_redefined_macos_sdk_header_symbols.patch | 4 +- ...ix_remove_deprecated_errno_constants.patch | 10 +- .../fix_remove_fastapitypedarray_usage.patch | 224 ---- ...emove_outdated_v8_flags_from_node_cc.patch | 41 - .../fix_replace_deprecated_setprototype.patch | 61 -- ...starvation_in_inspector_context_test.patch | 68 -- ...buffer_existence_in_fast-utf8-stream.patch | 46 + ...tev2_in_napi_get_value_string_latin1.patch | 60 -- ...itev2_in_napi_get_value_string_utf16.patch | 55 - .../pass_all_globals_through_require.patch | 6 +- ...dder_overriding_of_internal_fs_calls.patch | 4 +- ...ch_cppgc_heap_on_v8_isolate_creation.patch | 323 ++---- ...not_use_soon-to-be-deprecated_v8_api.patch | 127 --- ...e_utf8_string_generation_performance.patch | 166 --- ...grate_writeonebyte_to_writeonebytev2.patch | 276 ----- ..._writeucs2_and_remove_flags_argument.patch | 140 --- ..._on_wrapper-descriptor-based_cppheap.patch | 308 ------ ...src_simplify_string_bytes_with_views.patch | 150 --- ...ted_fields_of_fastapicallbackoptions.patch | 73 -- ...t_setprototype_to_get_setprototypev2.patch | 173 --- ...e_non-deprecated_utf8lengthv2_method.patch | 87 -- ...se_non-deprecated_writeutf8v2_method.patch | 138 --- ...c_use_string_writev2_in_twobytevalue.patch | 39 - .../node/support_v8_sandboxed_pointers.patch | 307 +++--- ...nable_stack_trace_change_in_snapshot.patch | 2 +- ...st_formally_mark_some_tests_as_flaky.patch | 8 +- ...explicit_resource_management_globals.patch | 21 - ...est_update_v8-stats_test_for_v8_12_6.patch | 20 - ...e_static_method_names_in_call_stacks.patch | 46 - script/node-disabled-tests.json | 5 +- shell/common/node_bindings.cc | 6 +- spec/api-context-bridge-spec.ts | 4 +- spec/api-ipc-spec.ts | 15 +- spec/chromium-spec.ts | 4 +- .../pages/window-opener-targetOrigin.html | 4 +- yarn.lock | 14 +- 80 files changed, 2002 insertions(+), 4068 deletions(-) delete mode 100644 patches/node/add_v8_taskpirority_to_foreground_task_runner_signature.patch delete mode 100644 patches/node/build_compile_with_c_20_support.patch delete mode 100644 patches/node/chore_add_createexternalizabletwobytestring_to_globals.patch delete mode 100644 patches/node/chore_add_missing_include_of_iterator.patch create mode 100644 patches/node/chore_handle_support_for_import_defer_as_ns_and_import_defer.patch delete mode 100644 patches/node/cli_move_--trace-atomics-wait_to_eol.patch delete mode 100644 patches/node/cli_remove_deprecated_v8_flag.patch create mode 100644 patches/node/feat_disable_js_source_phase_imports_by_default.patch delete mode 100644 patches/node/fix_add_source_location_for_v8_task_runner.patch create mode 100644 patches/node/fix_allow_disabling_fetch_in_renderer_and_worker_processes.patch delete mode 100644 patches/node/fix_assert_module_in_the_renderer_process.patch create mode 100644 patches/node/fix_avoid_external_memory_leak_on_invalid_tls_protocol_versions.patch delete mode 100644 patches/node/fix_remove_fastapitypedarray_usage.patch delete mode 100644 patches/node/fix_remove_outdated_v8_flags_from_node_cc.patch delete mode 100644 patches/node/fix_replace_deprecated_setprototype.patch delete mode 100644 patches/node/fix_task_starvation_in_inspector_context_test.patch create mode 100644 patches/node/lib_check_sharedarraybuffer_existence_in_fast-utf8-stream.patch delete mode 100644 patches/node/node-api_use_writeonebytev2_in_napi_get_value_string_latin1.patch delete mode 100644 patches/node/node-api_use_writev2_in_napi_get_value_string_utf16.patch delete mode 100644 patches/node/src_do_not_use_soon-to-be-deprecated_v8_api.patch delete mode 100644 patches/node/src_improve_utf8_string_generation_performance.patch delete mode 100644 patches/node/src_migrate_writeonebyte_to_writeonebytev2.patch delete mode 100644 patches/node/src_refactor_writeucs2_and_remove_flags_argument.patch delete mode 100644 patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch delete mode 100644 patches/node/src_simplify_string_bytes_with_views.patch delete mode 100644 patches/node/src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch delete mode 100644 patches/node/src_switch_from_get_setprototype_to_get_setprototypev2.patch delete mode 100644 patches/node/src_use_non-deprecated_utf8lengthv2_method.patch delete mode 100644 patches/node/src_use_non-deprecated_writeutf8v2_method.patch delete mode 100644 patches/node/src_use_string_writev2_in_twobytevalue.patch delete mode 100644 patches/node/test_handle_explicit_resource_management_globals.patch delete mode 100644 patches/node/test_update_v8-stats_test_for_v8_12_6.patch delete mode 100644 patches/node/test_use_static_method_names_in_call_stacks.patch diff --git a/DEPS b/DEPS index 9dab0e707a81f..7b11f64d40958 100644 --- a/DEPS +++ b/DEPS @@ -4,7 +4,7 @@ vars = { 'chromium_version': '143.0.7499.0', 'node_version': - 'v22.20.0', + 'v24.10.0', 'nan_version': '675cefebca42410733da8a454c8d9391fcebfbc2', 'squirrel.mac_version': diff --git a/lib/browser/api/net-fetch.ts b/lib/browser/api/net-fetch.ts index 54fdc788d6c6d..40e1a635fd362 100644 --- a/lib/browser/api/net-fetch.ts +++ b/lib/browser/api/net-fetch.ts @@ -119,7 +119,10 @@ export function fetchWithSession (input: RequestInfo, init: (RequestInit & {bypa p.reject(err); }); - if (!req.body?.pipeTo(Writable.toWeb(r as unknown as Writable)).then(() => r.end())) { r.end(); } + // pipeTo expects a WritableStream<Uint8Array>. Node.js' Writable.toWeb returns WritableStream<any>, + // which causes a TS structural mismatch. + const writable = Writable.toWeb(r as unknown as Writable) as unknown as WritableStream<Uint8Array>; + if (!req.body?.pipeTo(writable).then(() => r.end())) { r.end(); } return p.promise; } diff --git a/lib/browser/api/protocol.ts b/lib/browser/api/protocol.ts index cb6a1492eb227..9fd579b98681e 100644 --- a/lib/browser/api/protocol.ts +++ b/lib/browser/api/protocol.ts @@ -4,6 +4,8 @@ import { createReadStream } from 'fs'; import { Readable } from 'stream'; import { ReadableStream } from 'stream/web'; +import type { ReadableStreamDefaultReader } from 'stream/web'; + // Global protocol APIs. const { registerSchemesAsPrivileged, getStandardSchemes, Protocol } = process._linkedBinding('electron_browser_protocol'); @@ -12,7 +14,7 @@ const ERR_UNEXPECTED = -9; const isBuiltInScheme = (scheme: string) => ['http', 'https', 'file'].includes(scheme); -function makeStreamFromPipe (pipe: any): ReadableStream { +function makeStreamFromPipe (pipe: any): ReadableStream<Uint8Array> { const buf = new Uint8Array(1024 * 1024 /* 1 MB */); return new ReadableStream({ async pull (controller) { @@ -38,21 +40,26 @@ function makeStreamFromFileInfo ({ filePath: string; offset?: number; length?: number; -}): ReadableStream { +}): ReadableStream<Uint8Array> { + // Node's Readable.toWeb produces a WHATWG ReadableStream whose chunks are Uint8Array. return Readable.toWeb(createReadStream(filePath, { start: offset, end: length >= 0 ? offset + length : undefined - })); + })) as ReadableStream<Uint8Array>; } function convertToRequestBody (uploadData: ProtocolRequest['uploadData']): RequestInit['body'] { if (!uploadData) return null; // Optimization: skip creating a stream if the request is just a single buffer. - if (uploadData.length === 1 && (uploadData[0] as any).type === 'rawData') return uploadData[0].bytes; + if (uploadData.length === 1 && (uploadData[0] as any).type === 'rawData') { + return uploadData[0].bytes as any; + } - const chunks = [...uploadData] as any[]; // TODO: types are wrong - let current: ReadableStreamDefaultReader | null = null; - return new ReadableStream({ + const chunks = [...uploadData] as any[]; // TODO: refine ProtocolRequest types + // Use Node's web stream types explicitly to avoid DOM lib vs Node lib structural mismatches. + // Generic <Uint8Array> ensures reader.read() returns value?: Uint8Array consistent with enqueue. + let current: ReadableStreamDefaultReader<Uint8Array> | null = null; + return new ReadableStream<Uint8Array>({ async pull (controller) { if (current) { const { done, value } = await current.read(); @@ -67,7 +74,7 @@ function convertToRequestBody (uploadData: ProtocolRequest['uploadData']): Reque if (!chunks.length) { return controller.close(); } const chunk = chunks.shift()!; if (chunk.type === 'rawData') { - controller.enqueue(chunk.bytes); + controller.enqueue(chunk.bytes as Uint8Array); } else if (chunk.type === 'file') { current = makeStreamFromFileInfo(chunk).getReader(); return this.pull!(controller); diff --git a/lib/browser/init.ts b/lib/browser/init.ts index 35cf6f8325611..4a52cd0283157 100644 --- a/lib/browser/init.ts +++ b/lib/browser/init.ts @@ -40,7 +40,7 @@ process.on('uncaughtException', function (error) { // Emit 'exit' event on quit. const { app } = require('electron'); -app.on('quit', (_event, exitCode) => { +app.on('quit', (_event: any, exitCode: number) => { process.emit('exit', exitCode); }); diff --git a/lib/node/asar-fs-wrapper.ts b/lib/node/asar-fs-wrapper.ts index bee5e33025940..25eaf3a4a08f6 100644 --- a/lib/node/asar-fs-wrapper.ts +++ b/lib/node/asar-fs-wrapper.ts @@ -746,7 +746,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => { context.readdirResults.push(dirent); if (dirent!.isDirectory() || stat === 1) { - context.pathsQueue.push(path.join(dirent!.path, dirent!.name)); + context.pathsQueue.push(path.join(dirent!.parentPath, dirent!.name)); } } } diff --git a/npm/package.json b/npm/package.json index 96fd3c3ad0769..5f029ee4c7c0e 100644 --- a/npm/package.json +++ b/npm/package.json @@ -9,7 +9,7 @@ }, "dependencies": { "@electron/get": "^2.0.0", - "@types/node": "^22.7.7", + "@types/node": "^24.9.0", "extract-zip": "^2.0.1" }, "engines": { diff --git a/package.json b/package.json index 46faf05d9cc1c..cb568d0ea523f 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "@octokit/rest": "^20.1.2", "@primer/octicons": "^10.0.0", "@types/minimist": "^1.2.5", - "@types/node": "^22.7.7", + "@types/node": "^24.9.0", "@types/semver": "^7.5.8", "@types/stream-json": "^1.7.8", "@types/temp": "^0.9.4", diff --git a/patches/node/.patches b/patches/node/.patches index 523c726bd83d4..e080e149e485f 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -17,48 +17,25 @@ chore_expose_importmoduledynamically_and.patch test_formally_mark_some_tests_as_flaky.patch fix_do_not_resolve_electron_entrypoints.patch ci_ensure_node_tests_set_electron_run_as_node.patch -fix_assert_module_in_the_renderer_process.patch fix_allow_passing_fileexists_fn_to_legacymainresolve.patch fix_remove_deprecated_errno_constants.patch build_enable_perfetto.patch -fix_add_source_location_for_v8_task_runner.patch -src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch -test_update_v8-stats_test_for_v8_12_6.patch -src_do_not_use_soon-to-be-deprecated_v8_api.patch -src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch -build_compile_with_c_20_support.patch -add_v8_taskpirority_to_foreground_task_runner_signature.patch -cli_remove_deprecated_v8_flag.patch build_restore_clang_as_default_compiler_on_macos.patch -fix_remove_outdated_v8_flags_from_node_cc.patch chore_disable_deprecation_ftbfs_in_simdjson_header.patch build_allow_unbundling_of_node_js_dependencies.patch -test_use_static_method_names_in_call_stacks.patch -fix_remove_fastapitypedarray_usage.patch -test_handle_explicit_resource_management_globals.patch build_change_crdtp_protocoltypetraits_signatures_to_avoid_conflict.patch fix_adjust_wpt_and_webidl_tests_for_enabled_float16array.patch -chore_add_createexternalizabletwobytestring_to_globals.patch refactor_attach_cppgc_heap_on_v8_isolate_creation.patch fix_ensure_traverseparent_bails_on_resource_path_exit.patch -cli_move_--trace-atomics-wait_to_eol.patch fix_cppgc_initializing_twice.patch -fix_task_starvation_in_inspector_context_test.patch fix_expose_readfilesync_override_for_modules.patch fix_array_out-of-bounds_read_in_boyer-moore_search.patch -chore_add_missing_include_of_iterator.patch test_accomodate_v8_thenable_stack_trace_change_in_snapshot.patch chore_exclude_electron_node_folder_from_exit-time-destructors.patch api_remove_deprecated_getisolate.patch -src_switch_from_get_setprototype_to_get_setprototypev2.patch -fix_replace_deprecated_setprototype.patch fix_redefined_macos_sdk_header_symbols.patch -src_simplify_string_bytes_with_views.patch -src_improve_utf8_string_generation_performance.patch -src_use_non-deprecated_utf8lengthv2_method.patch -src_use_non-deprecated_writeutf8v2_method.patch -src_refactor_writeucs2_and_remove_flags_argument.patch -src_use_string_writev2_in_twobytevalue.patch -node-api_use_writev2_in_napi_get_value_string_utf16.patch -node-api_use_writeonebytev2_in_napi_get_value_string_latin1.patch -src_migrate_writeonebyte_to_writeonebytev2.patch +fix_allow_disabling_fetch_in_renderer_and_worker_processes.patch +feat_disable_js_source_phase_imports_by_default.patch +fix_avoid_external_memory_leak_on_invalid_tls_protocol_versions.patch +lib_check_sharedarraybuffer_existence_in_fast-utf8-stream.patch +chore_handle_support_for_import_defer_as_ns_and_import_defer.patch diff --git a/patches/node/add_v8_taskpirority_to_foreground_task_runner_signature.patch b/patches/node/add_v8_taskpirority_to_foreground_task_runner_signature.patch deleted file mode 100644 index 8d89edc40754d..0000000000000 --- a/patches/node/add_v8_taskpirority_to_foreground_task_runner_signature.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Calvin Watford <cwatford@slack-corp.com> -Date: Wed, 18 Sep 2024 16:25:05 -0600 -Subject: add v8::TaskPirority to foreground task runner signature - -For now, we ignore the priority parameter. We expect this will be fixed -naturally upstream, and we will be able to remove this patch in a future -Node.js upgrade. - -diff --git a/src/node_platform.cc b/src/node_platform.cc -index b24e170cb247261d4a16d77ad40df4dfd33709d9..5e31f984b5655ae2d1d7559b1bd550ba6dc90fb4 100644 ---- a/src/node_platform.cc -+++ b/src/node_platform.cc -@@ -688,8 +688,8 @@ bool NodePlatform::IdleTasksEnabled(Isolate* isolate) { - return ForIsolate(isolate)->IdleTasksEnabled(); - } - --std::shared_ptr<v8::TaskRunner> --NodePlatform::GetForegroundTaskRunner(Isolate* isolate) { -+std::shared_ptr<v8::TaskRunner> NodePlatform::GetForegroundTaskRunner( -+ Isolate* isolate, v8::TaskPriority priority) { - return ForIsolate(isolate)->GetForegroundTaskRunner(); - } - -diff --git a/src/node_platform.h b/src/node_platform.h -index a0222b4a1b074c6708e390d58d04221717069ac1..8015ca1801573c3a7c4a5db6d0f10b4016a9267c 100644 ---- a/src/node_platform.h -+++ b/src/node_platform.h -@@ -213,7 +213,7 @@ class NodePlatform : public MultiIsolatePlatform { - void (*callback)(void*), void* data) override; - - std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner( -- v8::Isolate* isolate) override; -+ v8::Isolate* isolate, v8::TaskPriority priority) override; - - Platform::StackTracePrinter GetStackTracePrinter() override; - v8::PageAllocator* GetPageAllocator() override; diff --git a/patches/node/api_remove_deprecated_getisolate.patch b/patches/node/api_remove_deprecated_getisolate.patch index 59d8f6a7fcba2..11c2fad5df2f7 100644 --- a/patches/node/api_remove_deprecated_getisolate.patch +++ b/patches/node/api_remove_deprecated_getisolate.patch @@ -6,10 +6,10 @@ Subject: Remove deprecated `GetIsolate` https://chromium-review.googlesource.com/c/v8/v8/+/6905244 diff --git a/src/api/environment.cc b/src/api/environment.cc -index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7c630fddf 100644 +index 072deb1fa70313e33397f6ff994e3f3548e86092..14be033113bfb13c64e5f99446afaf0cb2aa16a9 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -654,7 +654,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create( +@@ -669,7 +669,7 @@ std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create( MaybeLocal<Object> GetPerContextExports(Local<Context> context, IsolateData* isolate_data) { @@ -18,7 +18,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7 EscapableHandleScope handle_scope(isolate); Local<Object> global = context->Global(); -@@ -700,7 +700,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) { +@@ -715,7 +715,7 @@ void ProtoThrower(const FunctionCallbackInfo<Value>& info) { // This runs at runtime, regardless of whether the context // is created from a snapshot. Maybe<void> InitializeContextRuntime(Local<Context> context) { @@ -27,7 +27,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7 HandleScope handle_scope(isolate); // When `IsCodeGenerationFromStringsAllowed` is true, V8 takes the fast path -@@ -779,7 +779,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) { +@@ -794,7 +794,7 @@ Maybe<void> InitializeContextRuntime(Local<Context> context) { } Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) { @@ -36,7 +36,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7 HandleScope handle_scope(isolate); // Delete `Intl.v8BreakIterator` -@@ -804,7 +804,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) { +@@ -819,7 +819,7 @@ Maybe<void> InitializeBaseContextForSnapshot(Local<Context> context) { } Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) { @@ -45,7 +45,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7 HandleScope handle_scope(isolate); // Initialize the default values. -@@ -822,7 +822,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) { +@@ -837,7 +837,7 @@ Maybe<void> InitializeMainContextForSnapshot(Local<Context> context) { MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context, IsolateData* isolate_data) { CHECK(isolate_data); @@ -54,7 +54,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7 EscapableHandleScope scope(isolate); Context::Scope context_scope(context); -@@ -846,7 +846,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context, +@@ -861,7 +861,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context, MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context, IsolateData* isolate_data) { CHECK(isolate_data); @@ -63,7 +63,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7 EscapableHandleScope scope(isolate); Context::Scope context_scope(context); -@@ -872,7 +872,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context, +@@ -887,7 +887,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context, Maybe<void> InitializePrimordials(Local<Context> context, IsolateData* isolate_data) { // Run per-context JS files. @@ -73,7 +73,7 @@ index 8e227ddd1be50c046a8cf2895a31d607eb7d31de..82f53bba29613de212f64be440ca20d7 Local<Object> exports; diff --git a/src/base_object-inl.h b/src/base_object-inl.h -index 6f731b17fe0b84dd3d2c9bc9cfef1f8062a2c5f7..71a1072ed2decbee08d40eda7c47456be5093bc2 100644 +index cc60ddddb037e0279615bbe24821eb20fd8da677..37d83e41b618a07aca98118260abe9618f11256d 100644 --- a/src/base_object-inl.h +++ b/src/base_object-inl.h @@ -55,7 +55,6 @@ v8::Local<v8::Object> BaseObject::object() const { @@ -85,10 +85,10 @@ index 6f731b17fe0b84dd3d2c9bc9cfef1f8062a2c5f7..71a1072ed2decbee08d40eda7c47456b return handle; diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc -index a3d309d832c73ddc79564b9644d825bec7459e7f..580cbaf3858961f375ca2f53c48a07bcba82ef46 100644 +index 20d3c1d9d17fde18fc09b6ee219137831eb08a45..8fbf4f25a91b953f3d2868889c7ee06932ee3c5f 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc -@@ -967,7 +967,7 @@ bool ArrayOfStringsToX509s(Local<Context> context, +@@ -1022,7 +1022,7 @@ bool ArrayOfStringsToX509s(Local<Context> context, Local<Array> cert_array, std::vector<X509*>* certs) { ClearErrorOnReturn clear_error_on_return; @@ -98,11 +98,11 @@ index a3d309d832c73ddc79564b9644d825bec7459e7f..580cbaf3858961f375ca2f53c48a07bc uint32_t array_length = cert_array->Length(); diff --git a/src/crypto/crypto_x509.cc b/src/crypto/crypto_x509.cc -index eb6dad44a49d997097c8fb5009eeb60a7305da27..fd29d17de195017970856ce30d7a9c5785b0b8ee 100644 +index 4c5427596d1c90d3a413cdd9ff4f1151e657073d..70135a6be65e41fcb3564ddf6d1e8083a59ef8bb 100644 --- a/src/crypto/crypto_x509.cc +++ b/src/crypto/crypto_x509.cc -@@ -97,7 +97,7 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, BIOPointer&& bio) { - if (!bio) return {}; +@@ -107,7 +107,7 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, BIOPointer&& bio) { + return {}; BUF_MEM* mem = bio; Local<Value> ret; - if (!String::NewFromUtf8(context->GetIsolate(), @@ -110,32 +110,8 @@ index eb6dad44a49d997097c8fb5009eeb60a7305da27..fd29d17de195017970856ce30d7a9c57 mem->data, NewStringType::kNormal, mem->length) -@@ -121,7 +121,7 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, const ASN1_OBJECT* obj) { - } - - Local<Value> result; -- if (!String::NewFromUtf8(context->GetIsolate(), str).ToLocal(&result)) { -+ if (!String::NewFromUtf8(Isolate::GetCurrent(), str).ToLocal(&result)) { +@@ -121,7 +121,7 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, const BIOPointer& bio) { return {}; - } - return result; -@@ -136,12 +136,12 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, const ASN1_STRING* str) { - unsigned char* value_str; - int value_str_size = ASN1_STRING_to_UTF8(&value_str, str); - if (value_str_size < 0) { -- return Undefined(context->GetIsolate()); -+ return Undefined(Isolate::GetCurrent()); - } - DataPointer free_value_str(value_str, value_str_size); - - Local<Value> result; -- if (!String::NewFromUtf8(context->GetIsolate(), -+ if (!String::NewFromUtf8(Isolate::GetCurrent(), - reinterpret_cast<const char*>(value_str), - NewStringType::kNormal, - value_str_size) -@@ -155,7 +155,7 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, const BIOPointer& bio) { - if (!bio) return {}; BUF_MEM* mem = bio; Local<Value> ret; - if (!String::NewFromUtf8(context->GetIsolate(), @@ -144,23 +120,23 @@ index eb6dad44a49d997097c8fb5009eeb60a7305da27..fd29d17de195017970856ce30d7a9c57 NewStringType::kNormal, mem->length) diff --git a/src/encoding_binding.cc b/src/encoding_binding.cc -index 31ed995714bb99ab534f26ba9ebc6051c258a1c9..5ace688bb7ffc86eedf5aff11ab0ab487ad9440e 100644 +index 266f640fb1c6503a424e77cc41fc15bc658bb6a5..877ae8a18f6b8f2c7e3474dfba060d99db88e6b9 100644 --- a/src/encoding_binding.cc +++ b/src/encoding_binding.cc -@@ -73,7 +73,7 @@ void BindingData::Deserialize(Local<Context> context, +@@ -76,7 +76,7 @@ void BindingData::Deserialize(Local<Context> context, int index, InternalFieldInfoBase* info) { DCHECK_IS_SNAPSHOT_SLOT(index); -- v8::HandleScope scope(context->GetIsolate()); -+ v8::HandleScope scope(Isolate::GetCurrent()); +- HandleScope scope(context->GetIsolate()); ++ HandleScope scope(Isolate::GetCurrent()); Realm* realm = Realm::GetCurrent(context); // Recreate the buffer in the constructor. InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info); diff --git a/src/env.cc b/src/env.cc -index c6209cc7cf317de1bb9217e39dd760e5a83303e2..161d577e0ea6a251c83ba1903b1ec9a582a5317c 100644 +index a78817467518245c4a190e870e0eb30658eafcdb..13dcf0e9c2c86486d1e43763033f43ac4e6b6feb 100644 --- a/src/env.cc +++ b/src/env.cc -@@ -1748,10 +1748,10 @@ void AsyncHooks::Deserialize(Local<Context> context) { +@@ -1753,10 +1753,10 @@ void AsyncHooks::Deserialize(Local<Context> context) { context->GetDataFromSnapshotOnce<Array>( info_->js_execution_async_resources).ToLocalChecked(); } else { @@ -173,7 +149,7 @@ index c6209cc7cf317de1bb9217e39dd760e5a83303e2..161d577e0ea6a251c83ba1903b1ec9a5 // The native_execution_async_resources_ field requires v8::Local<> instances // for async calls whose resources were on the stack as JS objects when they -@@ -1791,7 +1791,7 @@ AsyncHooks::SerializeInfo AsyncHooks::Serialize(Local<Context> context, +@@ -1796,7 +1796,7 @@ AsyncHooks::SerializeInfo AsyncHooks::Serialize(Local<Context> context, info.async_id_fields = async_id_fields_.Serialize(context, creator); if (!js_execution_async_resources_.IsEmpty()) { info.js_execution_async_resources = creator->AddData( @@ -183,7 +159,7 @@ index c6209cc7cf317de1bb9217e39dd760e5a83303e2..161d577e0ea6a251c83ba1903b1ec9a5 } else { info.js_execution_async_resources = 0; diff --git a/src/inspector/network_agent.cc b/src/inspector/network_agent.cc -index 3b5d9615021101ad03d9dfef83e0c56b462b59ad..823e7b8d3d07eb2afa1cc62d3d9e2af20f4e2e89 100644 +index d136b72e598d07f3c2fcc9c2c8ba84f5ff1aaad7..649008aafc8d68cfecb02c28ad1e26a9b749f7bd 100644 --- a/src/inspector/network_agent.cc +++ b/src/inspector/network_agent.cc @@ -29,31 +29,31 @@ using v8::Value; @@ -296,6 +272,15 @@ index 3b5d9615021101ad03d9dfef83e0c56b462b59ad..823e7b8d3d07eb2afa1cc62d3d9e2af2 protocol::String url; if (!ObjectGetProtocolString(context, response, "url").To(&url)) { return {}; +@@ -210,7 +210,7 @@ std::unique_ptr<protocol::Network::Response> createResponseFromObject( + + std::unique_ptr<protocol::Network::WebSocketResponse> createWebSocketResponse( + v8::Local<v8::Context> context, Local<Object> response) { +- HandleScope handle_scope(context->GetIsolate()); ++ HandleScope handle_scope(v8::Isolate::GetCurrent()); + int status; + if (!ObjectGetInt(context, response, "status").To(&status)) { + return {}; diff --git a/src/js_native_api_v8.h b/src/js_native_api_v8.h index 27aeac589b19cd681923fb848ce5f36c66fc05e2..5f2900869763f40cac54e3cb3fe2e24eda615410 100644 --- a/src/js_native_api_v8.h @@ -310,10 +295,37 @@ index 27aeac589b19cd681923fb848ce5f36c66fc05e2..5f2900869763f40cac54e3cb3fe2e24e module_api_version(module_api_version) { napi_clear_last_error(this); diff --git a/src/module_wrap.cc b/src/module_wrap.cc -index cbb3e7f4df72f83cb8a1afc25a7429218792e964..ffccac5589bfe12eaf7861364cc6f2e403d26679 100644 +index 8fed194cbae9ce75bd0805b4df30b4de64fbbefa..a584e3a80adb69d2028dc79450349823ab973a58 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc -@@ -865,7 +865,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback( +@@ -99,7 +99,7 @@ ModuleCacheKey ModuleCacheKey::From(Local<Context> context, + Local<String> specifier, + Local<FixedArray> import_attributes) { + CHECK_EQ(import_attributes->Length() % elements_per_attribute, 0); +- Isolate* isolate = context->GetIsolate(); ++ Isolate* isolate = Isolate::GetCurrent(); + std::size_t h1 = specifier->GetIdentityHash(); + size_t num_attributes = import_attributes->Length() / elements_per_attribute; + ImportAttributeVector attributes; +@@ -1022,7 +1022,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback( + return {}; + } + DCHECK_NOT_NULL(resolved_module); +- return resolved_module->module_.Get(context->GetIsolate()); ++ return resolved_module->module_.Get(Isolate::GetCurrent()); + } + + // static +@@ -1046,7 +1046,7 @@ MaybeLocal<Object> ModuleWrap::ResolveSourceCallback( + Local<String> url = resolved_module->object() + ->GetInternalField(ModuleWrap::kURLSlot) + .As<String>(); +- THROW_ERR_SOURCE_PHASE_NOT_DEFINED(context->GetIsolate(), url); ++ THROW_ERR_SOURCE_PHASE_NOT_DEFINED(Isolate::GetCurrent(), url); + return {}; + } + CHECK(module_source_object->IsObject()); +@@ -1059,7 +1059,7 @@ Maybe<ModuleWrap*> ModuleWrap::ResolveModule( Local<String> specifier, Local<FixedArray> import_attributes, Local<Module> referrer) { @@ -322,16 +334,16 @@ index cbb3e7f4df72f83cb8a1afc25a7429218792e964..ffccac5589bfe12eaf7861364cc6f2e4 Environment* env = Environment::GetCurrent(context); if (env == nullptr) { THROW_ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE(isolate); -@@ -907,7 +907,7 @@ MaybeLocal<Promise> ImportModuleDynamically( - Local<Value> resource_name, +@@ -1104,7 +1104,7 @@ MaybeLocal<Promise> ImportModuleDynamicallyWithPhase( Local<String> specifier, + ModuleImportPhase phase, Local<FixedArray> import_attributes) { - Isolate* isolate = context->GetIsolate(); + Isolate* isolate = Isolate::GetCurrent(); Environment* env = Environment::GetCurrent(context); if (env == nullptr) { THROW_ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE(isolate); -@@ -1131,7 +1131,7 @@ MaybeLocal<Module> LinkRequireFacadeWithOriginal( +@@ -1346,7 +1346,7 @@ MaybeLocal<Module> LinkRequireFacadeWithOriginal( Local<FixedArray> import_attributes, Local<Module> referrer) { Environment* env = Environment::GetCurrent(context); @@ -341,10 +353,10 @@ index cbb3e7f4df72f83cb8a1afc25a7429218792e964..ffccac5589bfe12eaf7861364cc6f2e4 CHECK(!env->temporary_required_module_facade_original.IsEmpty()); return env->temporary_required_module_facade_original.Get(isolate); diff --git a/src/node.h b/src/node.h -index 16a0c71aef949b0ddd27def9dc843298f9a6b75f..28fa4cb3e7a621480a5ff11c48666c0de1363375 100644 +index 7fae281a6e0f3c1a9f0eb97536883bb26c16d94d..fb37310f44c8d06d1ab2697ed64a0b539776a411 100644 --- a/src/node.h +++ b/src/node.h -@@ -1050,7 +1050,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly", +@@ -1064,7 +1064,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly", #define NODE_DEFINE_CONSTANT(target, constant) \ do { \ @@ -353,7 +365,7 @@ index 16a0c71aef949b0ddd27def9dc843298f9a6b75f..28fa4cb3e7a621480a5ff11c48666c0d v8::Local<v8::Context> context = isolate->GetCurrentContext(); \ v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \ isolate, #constant, v8::NewStringType::kInternalized); \ -@@ -1066,7 +1066,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly", +@@ -1080,7 +1080,7 @@ NODE_DEPRECATED("Use v8::Date::ValueOf() directly", #define NODE_DEFINE_HIDDEN_CONSTANT(target, constant) \ do { \ @@ -363,7 +375,7 @@ index 16a0c71aef949b0ddd27def9dc843298f9a6b75f..28fa4cb3e7a621480a5ff11c48666c0d v8::Local<v8::String> constant_name = v8::String::NewFromUtf8Literal( \ isolate, #constant, v8::NewStringType::kInternalized); \ diff --git a/src/node_blob.cc b/src/node_blob.cc -index 9b9956f5ee3150a80f040cd0dbb9ef6589295600..14de0dad25fbf854ea23eb25abd6f9f2179e0dad 100644 +index d278a32c9934c15bc721da164efccca7bc7e7111..ab862bf93a411e6ae6da7c9f9706cee279a0ad70 100644 --- a/src/node_blob.cc +++ b/src/node_blob.cc @@ -554,7 +554,7 @@ void BlobBindingData::Deserialize(Local<Context> context, @@ -376,10 +388,10 @@ index 9b9956f5ee3150a80f040cd0dbb9ef6589295600..14de0dad25fbf854ea23eb25abd6f9f2 BlobBindingData* binding = realm->AddBindingData<BlobBindingData>(holder); CHECK_NOT_NULL(binding); diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index 4b288e0f89e0156cb5b0555c0259b2c1150770db..bc87057c8473d4731de55b909c58106217b32d1b 100644 +index e69eb280050cae0c0f394b2f956eef947e628904..9bb4576fcf4f07550e7d6f4ff2310cedc8093c5f 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc -@@ -275,7 +275,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal( +@@ -274,7 +274,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompileInternal( const char* id, LocalVector<String>* parameters, Realm* optional_realm) { @@ -388,7 +400,7 @@ index 4b288e0f89e0156cb5b0555c0259b2c1150770db..bc87057c8473d4731de55b909c581062 EscapableHandleScope scope(isolate); Local<String> source; -@@ -397,7 +397,7 @@ void BuiltinLoader::SaveCodeCache(const char* id, Local<Function> fun) { +@@ -396,7 +396,7 @@ void BuiltinLoader::SaveCodeCache(const char* id, Local<Function> fun) { MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context, const char* id, Realm* optional_realm) { @@ -397,7 +409,7 @@ index 4b288e0f89e0156cb5b0555c0259b2c1150770db..bc87057c8473d4731de55b909c581062 LocalVector<String> parameters(isolate); // Detects parameters of the scripts based on module ids. // internal/bootstrap/realm: process, getLinkedBinding, -@@ -451,7 +451,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context, +@@ -450,7 +450,7 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompile(Local<Context> context, MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context, const char* id, Realm* realm) { @@ -406,7 +418,7 @@ index 4b288e0f89e0156cb5b0555c0259b2c1150770db..bc87057c8473d4731de55b909c581062 // Detects parameters of the scripts based on module ids. // internal/bootstrap/realm: process, getLinkedBinding, // getInternalBinding, primordials -@@ -507,7 +507,7 @@ MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context, +@@ -506,7 +506,7 @@ MaybeLocal<Value> BuiltinLoader::CompileAndCall(Local<Context> context, if (!maybe_fn.ToLocal(&fn)) { return MaybeLocal<Value>(); } @@ -415,12 +427,12 @@ index 4b288e0f89e0156cb5b0555c0259b2c1150770db..bc87057c8473d4731de55b909c581062 return fn->Call(context, undefined, argc, argv); } -@@ -546,14 +546,14 @@ bool BuiltinLoader::CompileAllBuiltinsAndCopyCodeCache( +@@ -544,14 +544,14 @@ bool BuiltinLoader::CompileAllBuiltinsAndCopyCodeCache( to_eager_compile_.emplace(id); } -- v8::TryCatch bootstrapCatch(context->GetIsolate()); -+ v8::TryCatch bootstrapCatch(Isolate::GetCurrent()); +- TryCatch bootstrapCatch(context->GetIsolate()); ++ TryCatch bootstrapCatch(Isolate::GetCurrent()); auto fn = LookupAndCompile(context, id.data(), nullptr); if (bootstrapCatch.HasCaught()) { per_process::Debug(DebugCategory::CODE_CACHE, @@ -433,10 +445,10 @@ index 4b288e0f89e0156cb5b0555c0259b2c1150770db..bc87057c8473d4731de55b909c581062 // This is used by the snapshot builder, so save the code cache // unconditionally. diff --git a/src/node_constants.cc b/src/node_constants.cc -index cbcecfba33070b820aca0e2814982160a97a6378..b1ee513fc0873a51b4885f612dbf7b950b5cf2ca 100644 +index fea0426496978c0003fe1481afcf93fc9c23edca..c9588880d05435ab9f4e23fcff74c93309664270 100644 --- a/src/node_constants.cc +++ b/src/node_constants.cc -@@ -1264,7 +1264,7 @@ void CreatePerContextProperties(Local<Object> target, +@@ -1265,7 +1265,7 @@ void CreatePerContextProperties(Local<Object> target, Local<Value> unused, Local<Context> context, void* priv) { @@ -444,12 +456,12 @@ index cbcecfba33070b820aca0e2814982160a97a6378..b1ee513fc0873a51b4885f612dbf7b95 + Isolate* isolate = Isolate::GetCurrent(); Environment* env = Environment::GetCurrent(context); - CHECK(target->SetPrototype(env->context(), Null(env->isolate())).FromJust()); + CHECK( diff --git a/src/node_contextify.cc b/src/node_contextify.cc -index 21a08a738e5c3506d27e402762a4a267e9278588..475b5628f9b82a2b9b86343f25759c1e6814f816 100644 +index 3c234205e89be7e976dae5c3fcc73ca67953e034..e66d4fcb0c064f96cdb819c783027d864fe88d12 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc -@@ -111,7 +111,7 @@ namespace { +@@ -113,7 +113,7 @@ namespace { // Convert an int to a V8 Name (String or Symbol). MaybeLocal<String> Uint32ToName(Local<Context> context, uint32_t index) { @@ -458,7 +470,7 @@ index 21a08a738e5c3506d27e402762a4a267e9278588..475b5628f9b82a2b9b86343f25759c1e } } // anonymous namespace -@@ -682,7 +682,7 @@ Intercepted ContextifyContext::PropertyDefinerCallback( +@@ -677,7 +677,7 @@ Intercepted ContextifyContext::PropertyDefinerCallback( } Local<Context> context = ctx->context(); @@ -467,7 +479,7 @@ index 21a08a738e5c3506d27e402762a4a267e9278588..475b5628f9b82a2b9b86343f25759c1e PropertyAttribute attributes = PropertyAttribute::None; bool is_declared = -@@ -1657,7 +1657,7 @@ static MaybeLocal<Function> CompileFunctionForCJSLoader( +@@ -1666,7 +1666,7 @@ static MaybeLocal<Function> CompileFunctionForCJSLoader( bool* cache_rejected, bool is_cjs_scope, ScriptCompiler::CachedData* cached_data) { @@ -477,10 +489,10 @@ index 21a08a738e5c3506d27e402762a4a267e9278588..475b5628f9b82a2b9b86343f25759c1e Local<Symbol> symbol = env->vm_dynamic_import_default_internal(); diff --git a/src/node_env_var.cc b/src/node_env_var.cc -index 492d5f455f45a5c8a957ecdabed38709a633f640..48f9917113555c7ed87e37750c45d152fa4b68f8 100644 +index 6aad252eb5681bb9ab9890812602b43c418e7a7f..5f7ef8cc58f589ba30a44abaaaaaf1514458c3f0 100644 --- a/src/node_env_var.cc +++ b/src/node_env_var.cc -@@ -295,7 +295,7 @@ std::shared_ptr<KVStore> KVStore::CreateMapKVStore() { +@@ -311,7 +311,7 @@ std::shared_ptr<KVStore> KVStore::CreateMapKVStore() { Maybe<void> KVStore::AssignFromObject(Local<Context> context, Local<Object> entries) { @@ -490,7 +502,7 @@ index 492d5f455f45a5c8a957ecdabed38709a633f640..48f9917113555c7ed87e37750c45d152 Local<Array> keys; if (!entries->GetOwnPropertyNames(context).ToLocal(&keys)) diff --git a/src/node_errors.cc b/src/node_errors.cc -index befb642f1effa3c4139e4cd99ff64d9c5175fd72..9c068afd1c4c3fadeee4ba035e67ec4ae72c7f73 100644 +index 4386a1bc5678e351ce084cd2c47202561619b164..8d51201ad24999ed8f54e16c7878432d41841cf2 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -633,7 +633,7 @@ v8::ModifyCodeGenerationFromStringsResult ModifyCodeGenerationFromStrings( @@ -511,9 +523,9 @@ index befb642f1effa3c4139e4cd99ff64d9c5175fd72..9c068afd1c4c3fadeee4ba035e67ec4a switch (message->ErrorLevel()) { case Isolate::MessageErrorLevel::kMessageWarning: { Environment* env = Environment::GetCurrent(isolate); -@@ -1118,7 +1118,7 @@ void Initialize(Local<Object> target, +@@ -1161,7 +1161,7 @@ void Initialize(Local<Object> target, SetMethod( - context, target, "triggerUncaughtException", TriggerUncaughtException); + context, target, "getErrorSourcePositions", GetErrorSourcePositions); - Isolate* isolate = context->GetIsolate(); + Isolate* isolate = Isolate::GetCurrent(); @@ -521,10 +533,10 @@ index befb642f1effa3c4139e4cd99ff64d9c5175fd72..9c068afd1c4c3fadeee4ba035e67ec4a READONLY_PROPERTY(target, "exitCodes", exit_codes); diff --git a/src/node_file.cc b/src/node_file.cc -index d7009937b31729f33d9c45cbda7f5440fbdac2aa..e57a3140cd90d7e7852a0c6892091e50b850ae64 100644 +index d73dac2ee3f1cf1cac6845fae0f702c9fba8fcef..969e7d08086f8442bed476feaf15599b8c79db7c 100644 --- a/src/node_file.cc +++ b/src/node_file.cc -@@ -3753,7 +3753,7 @@ void BindingData::Deserialize(Local<Context> context, +@@ -3874,7 +3874,7 @@ void BindingData::Deserialize(Local<Context> context, int index, InternalFieldInfoBase* info) { DCHECK_IS_SNAPSHOT_SLOT(index); @@ -534,10 +546,10 @@ index d7009937b31729f33d9c45cbda7f5440fbdac2aa..e57a3140cd90d7e7852a0c6892091e50 InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info); BindingData* binding = diff --git a/src/node_messaging.cc b/src/node_messaging.cc -index 1eff9399ff87510164390a1dfea84158a8856b86..e912562d768308906286890b7015cf2c462bac49 100644 +index 57e068ae249d618c2658638f9f3b03e1fedb6524..8c51ae4e0a435971c6d0288af87810877dd31a49 100644 --- a/src/node_messaging.cc +++ b/src/node_messaging.cc -@@ -253,7 +253,7 @@ namespace { +@@ -254,7 +254,7 @@ namespace { MaybeLocal<Function> GetEmitMessageFunction(Local<Context> context, IsolateData* isolate_data) { @@ -546,7 +558,7 @@ index 1eff9399ff87510164390a1dfea84158a8856b86..e912562d768308906286890b7015cf2c Local<Object> per_context_bindings; Local<Value> emit_message_val; if (!GetPerContextExports(context, isolate_data) -@@ -268,7 +268,7 @@ MaybeLocal<Function> GetEmitMessageFunction(Local<Context> context, +@@ -269,7 +269,7 @@ MaybeLocal<Function> GetEmitMessageFunction(Local<Context> context, } MaybeLocal<Function> GetDOMException(Local<Context> context) { @@ -555,7 +567,7 @@ index 1eff9399ff87510164390a1dfea84158a8856b86..e912562d768308906286890b7015cf2c Local<Object> per_context_bindings; Local<Value> domexception_ctor_val; if (!GetPerContextExports(context).ToLocal(&per_context_bindings) || -@@ -283,7 +283,7 @@ MaybeLocal<Function> GetDOMException(Local<Context> context) { +@@ -284,7 +284,7 @@ MaybeLocal<Function> GetDOMException(Local<Context> context) { } void ThrowDataCloneException(Local<Context> context, Local<String> message) { @@ -564,7 +576,7 @@ index 1eff9399ff87510164390a1dfea84158a8856b86..e912562d768308906286890b7015cf2c Local<Value> argv[] = {message, FIXED_ONE_BYTE_STRING(isolate, "DataCloneError")}; Local<Value> exception; -@@ -1464,7 +1464,7 @@ BaseObjectPtr<BaseObject> JSTransferable::Data::Deserialize( +@@ -1477,7 +1477,7 @@ BaseObjectPtr<BaseObject> JSTransferable::Data::Deserialize( Maybe<bool> JSTransferable::Data::FinalizeTransferWrite( Local<Context> context, ValueSerializer* serializer) { @@ -574,10 +586,10 @@ index 1eff9399ff87510164390a1dfea84158a8856b86..e912562d768308906286890b7015cf2c data_.Reset(); return ret; diff --git a/src/node_modules.cc b/src/node_modules.cc -index 6204986dc97686a248d6ae483f3a413ee5c51e47..c0108310df81c9bd1756a6fb92466a7f84e53f7c 100644 +index bdbc511ef3f680bbac6770b89f47acaee95d56a2..d8477191efafba3c41c06d765f4b03bd00b8573c 100644 --- a/src/node_modules.cc +++ b/src/node_modules.cc -@@ -64,7 +64,7 @@ void BindingData::Deserialize(v8::Local<v8::Context> context, +@@ -69,7 +69,7 @@ void BindingData::Deserialize(v8::Local<v8::Context> context, int index, InternalFieldInfoBase* info) { DCHECK_IS_SNAPSHOT_SLOT(index); @@ -586,7 +598,7 @@ index 6204986dc97686a248d6ae483f3a413ee5c51e47..c0108310df81c9bd1756a6fb92466a7f Realm* realm = Realm::GetCurrent(context); BindingData* binding = realm->AddBindingData<BindingData>(holder); CHECK_NOT_NULL(binding); -@@ -706,7 +706,7 @@ void BindingData::CreatePerContextProperties(Local<Object> target, +@@ -735,7 +735,7 @@ void BindingData::CreatePerContextProperties(Local<Object> target, Realm* realm = Realm::GetCurrent(context); realm->AddBindingData<BindingData>(target); @@ -596,10 +608,10 @@ index 6204986dc97686a248d6ae483f3a413ee5c51e47..c0108310df81c9bd1756a6fb92466a7f #define V(status) \ diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc -index 1cb08b715865f8337e0292fc8e2a26488ba21694..2bd20fc173d4110282ee736e49b49ce0859088f3 100644 +index e453bacc3e5247493a3582c24174bfe6e590825d..fe4aad63bc877be105830a80aa6be10ce3f8fda4 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc -@@ -736,7 +736,7 @@ void BindingData::Deserialize(Local<Context> context, +@@ -737,7 +737,7 @@ void BindingData::Deserialize(Local<Context> context, int index, InternalFieldInfoBase* info) { DCHECK_IS_SNAPSHOT_SLOT(index); @@ -609,10 +621,10 @@ index 1cb08b715865f8337e0292fc8e2a26488ba21694..2bd20fc173d4110282ee736e49b49ce0 // Recreate the buffer in the constructor. InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info); diff --git a/src/node_realm.cc b/src/node_realm.cc -index cd2b4c0107594a8ba9bf671669e4c82326719908..d18945085ff1860bbe3796e0b47904210aafd941 100644 +index 2a5fe9fe501d1fd9356eeb7d044a872fa5a55f38..39f6f142044c42904d234da20a266315346c135a 100644 --- a/src/node_realm.cc +++ b/src/node_realm.cc -@@ -19,7 +19,7 @@ using v8::String; +@@ -22,7 +22,7 @@ using v8::String; using v8::Value; Realm::Realm(Environment* env, v8::Local<v8::Context> context, Kind kind) @@ -620,12 +632,12 @@ index cd2b4c0107594a8ba9bf671669e4c82326719908..d18945085ff1860bbe3796e0b4790421 + : env_(env), isolate_(v8::Isolate::GetCurrent()), kind_(kind) { context_.Reset(isolate_, context); env->AssignToContext(context, this, ContextInfo("")); - } + // The environment can also purge empty wrappers in the check callback, diff --git a/src/node_report.cc b/src/node_report.cc -index df73a8204bc0917073a70ca68d019ceab3159b08..d7bb94db78b3a729f25ceaf66d193032056b36ff 100644 +index c82c6bcc083ba60137e83b3c291130636db3162f..0d06f61d7fb2472a3d7a66854040dc493406b79e 100644 --- a/src/node_report.cc +++ b/src/node_report.cc -@@ -399,7 +399,7 @@ static void PrintJavaScriptErrorProperties(JSONWriter* writer, +@@ -400,7 +400,7 @@ static void PrintJavaScriptErrorProperties(JSONWriter* writer, if (!error.IsEmpty() && error->IsObject()) { TryCatch try_catch(isolate); Local<Object> error_obj = error.As<Object>(); @@ -635,10 +647,10 @@ index df73a8204bc0917073a70ca68d019ceab3159b08..d7bb94db78b3a729f25ceaf66d193032 if (!error_obj->GetOwnPropertyNames(context).ToLocal(&keys)) { return writer->json_objectend(); // the end of 'errorProperties' diff --git a/src/node_snapshotable.cc b/src/node_snapshotable.cc -index 69d8d15d8989ed31a19489e68588e730760c8ffb..d342a5ff91bbd9cb73c02c26ae3a36b9d0dc7b47 100644 +index c2e24b4645e7903e08c80aead1c18c7bcff1bd89..e34d24d51d5c090b560d06f727043f20924e6f46 100644 --- a/src/node_snapshotable.cc +++ b/src/node_snapshotable.cc -@@ -1613,7 +1613,7 @@ void BindingData::Deserialize(Local<Context> context, +@@ -1614,7 +1614,7 @@ void BindingData::Deserialize(Local<Context> context, int index, InternalFieldInfoBase* info) { DCHECK_IS_SNAPSHOT_SLOT(index); @@ -648,10 +660,10 @@ index 69d8d15d8989ed31a19489e68588e730760c8ffb..d342a5ff91bbd9cb73c02c26ae3a36b9 // Recreate the buffer in the constructor. InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info); diff --git a/src/node_sqlite.cc b/src/node_sqlite.cc -index 8b6fe36e1fece112269ebf193d6322a4d1dacc0a..96101167016573e80fff520256ebb78c71d83302 100644 +index 7bb4d4108c8326d69da5236c7ea7f00ddb68cea9..cf9ce6686cffca7e700a0e20cb9f776a5f0f7c4a 100644 --- a/src/node_sqlite.cc +++ b/src/node_sqlite.cc -@@ -1858,7 +1858,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) { +@@ -2020,7 +2020,7 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) { if (args[0]->IsObject() && !args[0]->IsArrayBufferView()) { Local<Object> obj = args[0].As<Object>(); @@ -661,7 +673,7 @@ index 8b6fe36e1fece112269ebf193d6322a4d1dacc0a..96101167016573e80fff520256ebb78c if (!obj->GetOwnPropertyNames(context).ToLocal(&keys)) { return false; diff --git a/src/node_task_queue.cc b/src/node_task_queue.cc -index c4257110d8b52017fccd8e1e746b557a0b7084df..6f00da0b515397d300e387f03f4a2bf71155cfe0 100644 +index d33ee3c26c111e53edf27e6368ca8f64ff30a349..f1c53c44f201b295888e7932c5e3e2b19cb9c319 100644 --- a/src/node_task_queue.cc +++ b/src/node_task_queue.cc @@ -48,7 +48,7 @@ void PromiseRejectCallback(PromiseRejectMessage message) { @@ -674,10 +686,10 @@ index c4257110d8b52017fccd8e1e746b557a0b7084df..6f00da0b515397d300e387f03f4a2bf7 Environment* env = Environment::GetCurrent(isolate); diff --git a/src/node_url.cc b/src/node_url.cc -index 09589e85e8bc131811204833d9a76f98c7b2a102..1154b452151b6b597aed67effbb3796c635d236b 100644 +index 9d1e8ec05161570db11f7b662395509774668d78..9b91f83d879ea02fd3d61913c8dfd35b3bf1ac31 100644 --- a/src/node_url.cc +++ b/src/node_url.cc -@@ -69,7 +69,7 @@ void BindingData::Deserialize(Local<Context> context, +@@ -70,7 +70,7 @@ void BindingData::Deserialize(Local<Context> context, int index, InternalFieldInfoBase* info) { DCHECK_IS_SNAPSHOT_SLOT(index); @@ -687,10 +699,10 @@ index 09589e85e8bc131811204833d9a76f98c7b2a102..1154b452151b6b597aed67effbb3796c BindingData* binding = realm->AddBindingData<BindingData>(holder); CHECK_NOT_NULL(binding); diff --git a/src/node_v8.cc b/src/node_v8.cc -index 430d5dd4f808af7b1790bd62f06d47b86100d4e9..08a741216d88c95d580e9281e174550001ff2b21 100644 +index 98e392f6d7118bee8a3d0bce4de1ded76a293001..152b030198c6b36efd2be6c06f5c6e8bbc7cfadb 100644 --- a/src/node_v8.cc +++ b/src/node_v8.cc -@@ -157,7 +157,7 @@ void BindingData::Deserialize(Local<Context> context, +@@ -158,7 +158,7 @@ void BindingData::Deserialize(Local<Context> context, int index, InternalFieldInfoBase* info) { DCHECK_IS_SNAPSHOT_SLOT(index); @@ -700,10 +712,10 @@ index 430d5dd4f808af7b1790bd62f06d47b86100d4e9..08a741216d88c95d580e9281e1745500 // Recreate the buffer in the constructor. InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info); diff --git a/src/node_wasi.cc b/src/node_wasi.cc -index 3f91b651b83a20e70d5b368e012f5ee4b9d16092..40c601acd752b559f7ffbc00c15728fbb5275ac5 100644 +index 370221d3cddc201180260ecb3a222bc831c91093..f5aff2f65fe6b9f48cf970ab3e7c57cfe4885f85 100644 --- a/src/node_wasi.cc +++ b/src/node_wasi.cc -@@ -49,7 +49,7 @@ using v8::WasmMemoryObject; +@@ -50,7 +50,7 @@ using v8::WasmMemoryObject; static MaybeLocal<Value> WASIException(Local<Context> context, int errorno, const char* syscall) { @@ -712,20 +724,22 @@ index 3f91b651b83a20e70d5b368e012f5ee4b9d16092..40c601acd752b559f7ffbc00c15728fb Environment* env = Environment::GetCurrent(context); CHECK_NOT_NULL(env); const char* err_name = uvwasi_embedder_err_code_to_string(errorno); -@@ -275,7 +275,7 @@ R WASI::WasiFunction<FT, F, R, Args...>::FastCallback( +@@ -275,8 +275,8 @@ R WASI::WasiFunction<FT, F, R, Args...>::FastCallback( return EinvalError<R>(); } -- v8::Isolate* isolate = receiver->GetIsolate(); -+ v8::Isolate* isolate = v8::Isolate::GetCurrent(); - v8::HandleScope handle_scope(isolate); +- Isolate* isolate = receiver->GetIsolate(); +- HandleScope scope(isolate); ++ Isolate* isolate = Isolate::GetCurrent(); ++ HandleScope handle_scope(isolate); if (wasi->memory_.IsEmpty()) { THROW_ERR_WASI_NOT_STARTED(isolate); + return EinvalError<R>(); diff --git a/src/node_webstorage.cc b/src/node_webstorage.cc -index 74ece724e207a69e2457598a199c12f1cebcfd4a..1705e430099c5a363e02010f83d729b0aa54f8e5 100644 +index cc90af827a3fbd14fb4cbfbfd39cc661f22cf6e1..5819d9bca845e0eed6d4d93564469d8f3c36200b 100644 --- a/src/node_webstorage.cc +++ b/src/node_webstorage.cc -@@ -58,7 +58,7 @@ using v8::Value; +@@ -57,7 +57,7 @@ using v8::Value; } while (0) static void ThrowQuotaExceededException(Local<Context> context) { @@ -734,7 +748,7 @@ index 74ece724e207a69e2457598a199c12f1cebcfd4a..1705e430099c5a363e02010f83d729b0 auto dom_exception_str = FIXED_ONE_BYTE_STRING(isolate, "DOMException"); auto err_name = FIXED_ONE_BYTE_STRING(isolate, "QuotaExceededError"); auto err_message = -@@ -434,7 +434,7 @@ Maybe<void> Storage::Store(Local<Name> key, Local<Value> value) { +@@ -433,7 +433,7 @@ Maybe<void> Storage::Store(Local<Name> key, Local<Value> value) { } static MaybeLocal<String> Uint32ToName(Local<Context> context, uint32_t index) { @@ -744,10 +758,10 @@ index 74ece724e207a69e2457598a199c12f1cebcfd4a..1705e430099c5a363e02010f83d729b0 static void Clear(const FunctionCallbackInfo<Value>& info) { diff --git a/src/node_worker.cc b/src/node_worker.cc -index 8555ab556b5b74a1cf9cf30747f1f417bfe4e4d9..1a2532337504444d59098304b87e0d65f16e838c 100644 +index 62c53368d1173edb7eb42e3337049c46fd7cdda9..7d08d8af7f6d99f7bd41cb7eb91063c630b3f87b 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc -@@ -1289,8 +1289,6 @@ void GetEnvMessagePort(const FunctionCallbackInfo<Value>& args) { +@@ -1466,8 +1466,6 @@ void GetEnvMessagePort(const FunctionCallbackInfo<Value>& args) { Local<Object> port = env->message_port(); CHECK_IMPLIES(!env->is_main_thread(), !port.IsEmpty()); if (!port.IsEmpty()) { @@ -757,10 +771,10 @@ index 8555ab556b5b74a1cf9cf30747f1f417bfe4e4d9..1a2532337504444d59098304b87e0d65 } } diff --git a/src/timers.cc b/src/timers.cc -index bf90e68479da141265f748775acacab513b8d437..5f0d07b4ac1d9b8df6c8bb059e5d07ac1a882b36 100644 +index da4206187f7c7d2becb8a101c1ff5346a10e13f4..03f0910926f3d403121e227cee32a546b2394e04 100644 --- a/src/timers.cc +++ b/src/timers.cc -@@ -117,7 +117,7 @@ void BindingData::Deserialize(Local<Context> context, +@@ -114,7 +114,7 @@ void BindingData::Deserialize(Local<Context> context, int index, InternalFieldInfoBase* info) { DCHECK_IS_SNAPSHOT_SLOT(index); @@ -770,10 +784,10 @@ index bf90e68479da141265f748775acacab513b8d437..5f0d07b4ac1d9b8df6c8bb059e5d07ac // Recreate the buffer in the constructor. BindingData* binding = realm->AddBindingData<BindingData>(holder); diff --git a/src/util-inl.h b/src/util-inl.h -index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330cb47c1a7 100644 +index 9d4db311024c5f526fc3c00764fff686af044026..da9268dcf2ff432ddeec7c0f61a147b73f3130e2 100644 --- a/src/util-inl.h +++ b/src/util-inl.h -@@ -326,14 +326,14 @@ v8::Maybe<void> FromV8Array(v8::Local<v8::Context> context, +@@ -336,14 +336,14 @@ v8::Maybe<void> FromV8Array(v8::Local<v8::Context> context, std::vector<v8::Global<v8::Value>>* out) { uint32_t count = js_array->Length(); out->reserve(count); @@ -790,7 +804,7 @@ index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330 if (str.size() >= static_cast<size_t>(v8::String::kMaxLength)) [[unlikely]] { // V8 only has a TODO comment about adding an exception when the maximum // string size is exceeded. -@@ -349,7 +349,7 @@ v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, +@@ -359,7 +359,7 @@ v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, v8_inspector::StringView str, v8::Isolate* isolate) { @@ -799,7 +813,7 @@ index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330 if (str.length() >= static_cast<size_t>(v8::String::kMaxLength)) [[unlikely]] { // V8 only has a TODO comment about adding an exception when the maximum -@@ -376,7 +376,7 @@ template <typename T> +@@ -386,7 +386,7 @@ template <typename T> v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, const std::vector<T>& vec, v8::Isolate* isolate) { @@ -808,7 +822,7 @@ index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330 v8::EscapableHandleScope handle_scope(isolate); MaybeStackBuffer<v8::Local<v8::Value>, 128> arr(vec.size()); -@@ -393,7 +393,7 @@ template <typename T> +@@ -403,7 +403,7 @@ template <typename T> v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, const std::set<T>& set, v8::Isolate* isolate) { @@ -817,7 +831,16 @@ index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330 v8::Local<v8::Set> set_js = v8::Set::New(isolate); v8::HandleScope handle_scope(isolate); -@@ -412,7 +412,7 @@ template <typename T, typename U> +@@ -422,7 +422,7 @@ template <typename T, std::size_t U> + v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, + const std::ranges::elements_view<T, U>& vec, + v8::Isolate* isolate) { +- if (isolate == nullptr) isolate = context->GetIsolate(); ++ if (isolate == nullptr) isolate = v8::Isolate::GetCurrent(); + v8::EscapableHandleScope handle_scope(isolate); + + MaybeStackBuffer<v8::Local<v8::Value>, 128> arr(vec.size()); +@@ -441,7 +441,7 @@ template <typename T, typename U> v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, const std::unordered_map<T, U>& map, v8::Isolate* isolate) { @@ -826,7 +849,7 @@ index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330 v8::EscapableHandleScope handle_scope(isolate); v8::Local<v8::Map> ret = v8::Map::New(isolate); -@@ -455,7 +455,7 @@ template <typename T, typename> +@@ -484,7 +484,7 @@ template <typename T, typename> v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, const T& number, v8::Isolate* isolate) { @@ -835,7 +858,7 @@ index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330 return ConvertNumberToV8Value(isolate, number); } -@@ -468,7 +468,7 @@ v8::Local<v8::Array> ToV8ValuePrimitiveArray(v8::Local<v8::Context> context, +@@ -497,7 +497,7 @@ v8::Local<v8::Array> ToV8ValuePrimitiveArray(v8::Local<v8::Context> context, std::is_floating_point_v<T>, "Only primitive types (bool, integral, floating-point) are supported."); @@ -844,11 +867,20 @@ index b21f7a8260ca6a4701f8904b9cb641428db80772..16fe55f3054fd20544babd63ff204330 v8::EscapableHandleScope handle_scope(isolate); v8::LocalVector<v8::Value> elements(isolate); +@@ -731,7 +731,7 @@ inline v8::MaybeLocal<v8::Object> NewDictionaryInstanceNullProto( + if (value.IsEmpty()) return v8::MaybeLocal<v8::Object>(); + } + v8::Local<v8::Object> obj = tmpl->NewInstance(context, property_values); +- if (obj->SetPrototypeV2(context, v8::Null(context->GetIsolate())) ++ if (obj->SetPrototypeV2(context, v8::Null(v8::Isolate::GetCurrent())) + .IsNothing()) { + return v8::MaybeLocal<v8::Object>(); + } diff --git a/src/util.cc b/src/util.cc -index 5ca32f026f9f001ddadc14965705fe005600eddd..1b38f22b930b77d80aa53f9b12299d3cc469a46d 100644 +index 660cfff6b8a0c583be843e555e7a06cd09e0d279..c4b39450c5b7f91c46f7027db367c30db34927bb 100644 --- a/src/util.cc +++ b/src/util.cc -@@ -393,7 +393,7 @@ void SetMethod(Local<v8::Context> context, +@@ -391,7 +391,7 @@ void SetMethod(Local<v8::Context> context, Local<v8::Object> that, const std::string_view name, v8::FunctionCallback callback) { @@ -857,7 +889,7 @@ index 5ca32f026f9f001ddadc14965705fe005600eddd..1b38f22b930b77d80aa53f9b12299d3c Local<v8::Function> function = NewFunctionTemplate(isolate, callback, -@@ -454,7 +454,7 @@ void SetFastMethod(Local<v8::Context> context, +@@ -452,7 +452,7 @@ void SetFastMethod(Local<v8::Context> context, const std::string_view name, v8::FunctionCallback slow_callback, const v8::CFunction* c_function) { @@ -866,7 +898,7 @@ index 5ca32f026f9f001ddadc14965705fe005600eddd..1b38f22b930b77d80aa53f9b12299d3c Local<v8::Function> function = NewFunctionTemplate(isolate, slow_callback, -@@ -476,7 +476,7 @@ void SetFastMethodNoSideEffect(Local<v8::Context> context, +@@ -474,7 +474,7 @@ void SetFastMethodNoSideEffect(Local<v8::Context> context, const std::string_view name, v8::FunctionCallback slow_callback, const v8::CFunction* c_function) { @@ -875,7 +907,7 @@ index 5ca32f026f9f001ddadc14965705fe005600eddd..1b38f22b930b77d80aa53f9b12299d3c Local<v8::Function> function = NewFunctionTemplate(isolate, slow_callback, -@@ -564,7 +564,7 @@ void SetMethodNoSideEffect(Local<v8::Context> context, +@@ -562,7 +562,7 @@ void SetMethodNoSideEffect(Local<v8::Context> context, Local<v8::Object> that, const std::string_view name, v8::FunctionCallback callback) { @@ -884,7 +916,7 @@ index 5ca32f026f9f001ddadc14965705fe005600eddd..1b38f22b930b77d80aa53f9b12299d3c Local<v8::Function> function = NewFunctionTemplate(isolate, callback, -@@ -665,7 +665,7 @@ void SetConstructorFunction(Local<v8::Context> context, +@@ -689,7 +689,7 @@ void SetConstructorFunction(Local<v8::Context> context, const char* name, Local<v8::FunctionTemplate> tmpl, SetConstructorFunctionFlag flag) { @@ -894,10 +926,10 @@ index 5ca32f026f9f001ddadc14965705fe005600eddd..1b38f22b930b77d80aa53f9b12299d3c context, that, OneByteString(isolate, name), tmpl, flag); } diff --git a/src/util.h b/src/util.h -index 7c98de621ca4d53cbaaa5bd4488aab20c7b033a7..329d2397c87ac37d157e3325e2ab62907d7286b4 100644 +index 2b351235cf7f32c9fad25367cc912d187466f1e0..6da57f95165bbdedb65dab6eaae8c39b815ee4e5 100644 --- a/src/util.h +++ b/src/util.h -@@ -756,7 +756,7 @@ inline v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context, +@@ -739,7 +739,7 @@ inline v8::MaybeLocal<v8::Value> ToV8Value( // Variation on NODE_DEFINE_CONSTANT that sets a String value. #define NODE_DEFINE_STRING_CONSTANT(target, name, constant) \ do { \ diff --git a/patches/node/build_add_gn_build_files.patch b/patches/node/build_add_gn_build_files.patch index 9176dfe6f4e3d..8524c800567e0 100644 --- a/patches/node/build_add_gn_build_files.patch +++ b/patches/node/build_add_gn_build_files.patch @@ -11,10 +11,10 @@ really in 20/21. We have to wait until 22 is released to be able to build with upstream GN files. diff --git a/configure.py b/configure.py -index 91283ca577f580dbf1e0c4e2dbf851a9ceaa38ed..e8eaff30ec947677db2d45425f9180759d0c55de 100755 +index 7f73f084ef1a8336089e6a16423c2eb310c0b9f2..96eedd5d9ae05ee6704724290973251059d5dd78 100755 --- a/configure.py +++ b/configure.py -@@ -1728,7 +1728,7 @@ def configure_v8(o, configs): +@@ -1730,7 +1730,7 @@ def configure_v8(o, configs): # Until we manage to get rid of all those, v8_enable_sandbox cannot be used. # Note that enabling pointer compression without enabling sandbox is unsupported by V8, # so this can be broken at any time. @@ -68,10 +68,10 @@ index d4438f7fd61598afac2c1e3184721a759d22b10c..e2407027ab05e59b2f0f1c213b98ea46 assert(!node_enable_inspector || node_use_openssl, diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index b83aa87c969fb4e71cb202816713af869bb76283..c54df6fee333ddfe59b9df7e0ddd2935b4dcb33f 100644 +index 581b9886ded52f294b7cc6b080b2269b7617c85e..e43e2559aaf48add88aad342b1c96fd34f26c87f 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc -@@ -789,6 +789,7 @@ void BuiltinLoader::RegisterExternalReferences( +@@ -774,6 +774,7 @@ void BuiltinLoader::RegisterExternalReferences( registry->Register(GetNatives); RegisterExternalReferencesForInternalizedBuiltinCode(registry); @@ -80,10 +80,10 @@ index b83aa87c969fb4e71cb202816713af869bb76283..c54df6fee333ddfe59b9df7e0ddd2935 } // namespace builtins diff --git a/src/node_builtins.h b/src/node_builtins.h -index f9426599f2d5dc6ad061407f0c4eb2c9203a4433..302030f610965f07dd6998d282275c1bdf738009 100644 +index 7a7b84337feb67960819472e43192dbdc151e299..bcdd50f635757f41287c87df1db9cd3b55c4b6b9 100644 --- a/src/node_builtins.h +++ b/src/node_builtins.h -@@ -74,6 +74,8 @@ using BuiltinCodeCacheMap = +@@ -75,6 +75,8 @@ using BuiltinCodeCacheMap = // Generated by tools/js2c.cc as node_javascript.cc void RegisterExternalReferencesForInternalizedBuiltinCode( ExternalReferenceRegistry* registry); @@ -92,26 +92,6 @@ index f9426599f2d5dc6ad061407f0c4eb2c9203a4433..302030f610965f07dd6998d282275c1b // Handles compilation and caching of built-in JavaScript modules and // bootstrap scripts, whose source are bundled into the binary as static data. -diff --git a/tools/install.py b/tools/install.py -index 8797b59e59c85a8877b977fa3281e50165e6f6b2..0af01e075616195f38fb242626dcab770ec1eb57 100755 ---- a/tools/install.py -+++ b/tools/install.py -@@ -222,6 +222,7 @@ def headers(options, action): - 'include/cppgc/internal/caged-heap-local-data.h', - 'include/cppgc/internal/caged-heap.h', - 'include/cppgc/internal/compiler-specific.h', -+ 'include/cppgc/internal/conditional-stack-allocated.h', - 'include/cppgc/internal/finalizer-trait.h', - 'include/cppgc/internal/gc-info.h', - 'include/cppgc/internal/logging.h', -@@ -301,6 +302,7 @@ def headers(options, action): - 'include/v8-promise.h', - 'include/v8-proxy.h', - 'include/v8-regexp.h', -+ 'include/v8-sandbox.h', - 'include/v8-script.h', - 'include/v8-snapshot.h', - 'include/v8-source-location.h', diff --git a/tools/js2c.cc b/tools/js2c.cc old mode 100644 new mode 100755 @@ -271,7 +251,7 @@ index 856878c33681a73d41016729dabe48b0a6a80589..91a11852d206b65485fe90fd037a0bd1 if sys.platform == 'win32': files = [ x.replace('\\', '/') for x in files ] diff --git a/unofficial.gni b/unofficial.gni -index 865a0d5ce9c6792e57f4216bcaa594ca6fc7b1c8..26ebc811272ef2990f8d090c54e7f5294aab9d37 100644 +index c742b62c484e9dd205eff63dcffad78c76828375..20d2483bb16e297ab5b12aab6f56948d6d25cb03 100644 --- a/unofficial.gni +++ b/unofficial.gni @@ -147,31 +147,41 @@ template("node_gn_build") { @@ -339,7 +319,7 @@ index 865a0d5ce9c6792e57f4216bcaa594ca6fc7b1c8..26ebc811272ef2990f8d090c54e7f529 executable(target_name) { forward_variables_from(invoker, "*") -@@ -297,6 +311,7 @@ template("node_gn_build") { +@@ -314,6 +328,7 @@ template("node_gn_build") { } executable("node_js2c") { @@ -347,7 +327,7 @@ index 865a0d5ce9c6792e57f4216bcaa594ca6fc7b1c8..26ebc811272ef2990f8d090c54e7f529 deps = [ "deps/uv", "$node_simdutf_path", -@@ -307,26 +322,75 @@ template("node_gn_build") { +@@ -324,26 +339,75 @@ template("node_gn_build") { "src/embedded_data.cc", "src/embedded_data.h", ] @@ -433,7 +413,7 @@ index 865a0d5ce9c6792e57f4216bcaa594ca6fc7b1c8..26ebc811272ef2990f8d090c54e7f529 outputs = [ "$target_gen_dir/node_javascript.cc" ] # Get the path to node_js2c executable of the host toolchain. -@@ -340,11 +404,11 @@ template("node_gn_build") { +@@ -357,11 +421,11 @@ template("node_gn_build") { get_label_info(":node_js2c($host_toolchain)", "name") + host_executable_suffix diff --git a/patches/node/build_allow_unbundling_of_node_js_dependencies.patch b/patches/node/build_allow_unbundling_of_node_js_dependencies.patch index 48d4362fb6792..1ce105ad3eb80 100644 --- a/patches/node/build_allow_unbundling_of_node_js_dependencies.patch +++ b/patches/node/build_allow_unbundling_of_node_js_dependencies.patch @@ -14,7 +14,7 @@ We don't need to do this for zlib, as the existing gn workflow uses the same Upstreamed at https://github.com/nodejs/node/pull/55903 diff --git a/unofficial.gni b/unofficial.gni -index 26ebc811272ef2990f8d090c54e7f5294aab9d37..8886f2a79ae77614789d6ae0defd4f18fc756456 100644 +index 20d2483bb16e297ab5b12aab6f56948d6d25cb03..253226009faf563f6db285d4b2908f308c1f96ea 100644 --- a/unofficial.gni +++ b/unofficial.gni @@ -160,7 +160,6 @@ template("node_gn_build") { diff --git a/patches/node/build_change_crdtp_protocoltypetraits_signatures_to_avoid_conflict.patch b/patches/node/build_change_crdtp_protocoltypetraits_signatures_to_avoid_conflict.patch index 7f669c5b0bd7d..927fd478912ad 100644 --- a/patches/node/build_change_crdtp_protocoltypetraits_signatures_to_avoid_conflict.patch +++ b/patches/node/build_change_crdtp_protocoltypetraits_signatures_to_avoid_conflict.patch @@ -14,7 +14,7 @@ error: duplicate symbol: crdtp::ProtocolTypeTraits<std::__Cr::basic_string<char, Some distinguishing change should be upstreamed to Node.js. diff --git a/src/inspector/node_string.cc b/src/inspector/node_string.cc -index 8521730bd03cdfce47e9b5d0f5d68a568bc3de8c..28f4598aa7ea0e93350f79566c06d0f08313be9f 100644 +index e2148e954217b9b999e9713e95f1a115ccf7d657..7ec7464cdc0ef00e6600fb897ae99e44ed0f4ad8 100644 --- a/src/inspector/node_string.cc +++ b/src/inspector/node_string.cc @@ -7,7 +7,8 @@ diff --git a/patches/node/build_compile_with_c_20_support.patch b/patches/node/build_compile_with_c_20_support.patch deleted file mode 100644 index c7faa4e0db275..0000000000000 --- a/patches/node/build_compile_with_c_20_support.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr <shelley.vohr@gmail.com> -Date: Wed, 4 Sep 2024 16:39:23 +0200 -Subject: build: compile with C++20 support - -Refs https://github.com/nodejs/node/pull/45427 - -V8 requires C++20 support as of https://chromium-review.googlesource.com/c/v8/v8/+/5587859. - -This can be removed when Electron upgrades to a version of Node.js containing the required V8 version. - -diff --git a/common.gypi b/common.gypi -index c28d6f5fe2c922f0b1e3f7e56289c78e7b91c294..95c56305926fc3e0e46e4cf99ec86d3d1b5576a7 100644 ---- a/common.gypi -+++ b/common.gypi -@@ -539,7 +539,7 @@ - '-fno-rtti', - '-fno-exceptions', - '-fno-strict-aliasing', -- '-std=gnu++17', -+ '-std=gnu++20', - ], - 'defines': [ '__STDC_FORMAT_MACROS' ], - 'ldflags': [ '-rdynamic' ], -@@ -719,7 +719,7 @@ - ['clang==1', { - 'xcode_settings': { - 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', -- 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++17', # -std=gnu++17 -+ 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++20', # -std=gnu++20 - 'CLANG_CXX_LIBRARY': 'libc++', - }, - }], diff --git a/patches/node/build_enable_perfetto.patch b/patches/node/build_enable_perfetto.patch index 5f481d544c8ed..34af611eae14d 100644 --- a/patches/node/build_enable_perfetto.patch +++ b/patches/node/build_enable_perfetto.patch @@ -33,10 +33,10 @@ index 8d7204f6cb48f783adc4d1c1eb2de0c83b7fffe2..a154559a56bf383d3c26af523c9bb07b // Non-alphabetic chars. diff --git a/lib/internal/http.js b/lib/internal/http.js -index 251f51ec454f9cba4023b8b6729241ee753aac13..1de8cac6e3953ce9cab9db03530da327199acfd5 100644 +index 9bf929f7f3360f13058d3f446c18a36cd15bea58..abf9a06d891488288bccd98c437746c1ce48bf83 100644 --- a/lib/internal/http.js +++ b/lib/internal/http.js -@@ -8,8 +8,8 @@ const { +@@ -11,8 +11,8 @@ const { const { setUnrefTimeout } = require('internal/timers'); const { getCategoryEnabledBuffer, trace } = internalBinding('trace_events'); const { @@ -46,8 +46,8 @@ index 251f51ec454f9cba4023b8b6729241ee753aac13..1de8cac6e3953ce9cab9db03530da327 + CHAR_UPPERCASE_E, } = require('internal/constants'); - let utcCache; -@@ -44,11 +44,13 @@ function isTraceHTTPEnabled() { + const { URL } = require('internal/url'); +@@ -51,11 +51,13 @@ function isTraceHTTPEnabled() { const traceEventCategory = 'node,node.http'; function traceBegin(...args) { @@ -62,12 +62,12 @@ index 251f51ec454f9cba4023b8b6729241ee753aac13..1de8cac6e3953ce9cab9db03530da327 + trace(CHAR_UPPERCASE_E, traceEventCategory, ...args); } - module.exports = { + function ipToInt(ip) { diff --git a/node.gyp b/node.gyp -index 0e0071b508f605bb9b7722f8304814dc176d907e..bcb9f371c4e4d8c665058115dc39eaa65125d679 100644 +index 420d57135f48df59b2cbd33497ef90b6148017e6..eefb1e0577b881da7a1570fd7ac465fe8b06747c 100644 --- a/node.gyp +++ b/node.gyp -@@ -174,7 +174,6 @@ +@@ -176,7 +176,6 @@ 'src/timers.cc', 'src/timer_wrap.cc', 'src/tracing/agent.cc', @@ -75,7 +75,7 @@ index 0e0071b508f605bb9b7722f8304814dc176d907e..bcb9f371c4e4d8c665058115dc39eaa6 'src/tracing/node_trace_writer.cc', 'src/tracing/trace_event.cc', 'src/tracing/traced_value.cc', -@@ -302,7 +301,6 @@ +@@ -308,7 +307,6 @@ 'src/tcp_wrap.h', 'src/timers.h', 'src/tracing/agent.h', diff --git a/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch b/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch index 6c6d33c0276de..f0ca785e2804c 100644 --- a/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch +++ b/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch @@ -7,7 +7,7 @@ Subject: build: ensure native module compilation fails if not using a new This should not be upstreamed, it is a quality-of-life patch for downstream module builders. diff --git a/common.gypi b/common.gypi -index 6b79de07be3f839af5b0644f19bfef9c33de590e..c28d6f5fe2c922f0b1e3f7e56289c78e7b91c294 100644 +index 29a912f58e7b522ae21fddac510946cbcbaaa4cc..aea3a882c338eb757bef9e85fabab3fc7e7495f7 100644 --- a/common.gypi +++ b/common.gypi @@ -89,6 +89,8 @@ @@ -42,10 +42,10 @@ index 6b79de07be3f839af5b0644f19bfef9c33de590e..c28d6f5fe2c922f0b1e3f7e56289c78e # list in v8/BUILD.gn. ['v8_enable_v8_checks == 1', { diff --git a/configure.py b/configure.py -index e8eaff30ec947677db2d45425f9180759d0c55de..dc2d9d80059e845b33444f8bdc29e82d0fe0e26b 100755 +index 96eedd5d9ae05ee6704724290973251059d5dd78..52060f9c6dc1bcec67a0fd4710e01e73a6cf276c 100755 --- a/configure.py +++ b/configure.py -@@ -1710,6 +1710,7 @@ def configure_library(lib, output, pkgname=None): +@@ -1711,6 +1711,7 @@ def configure_library(lib, output, pkgname=None): def configure_v8(o, configs): set_configuration_variable(configs, 'v8_enable_v8_checks', release=1, debug=0) @@ -54,7 +54,7 @@ index e8eaff30ec947677db2d45425f9180759d0c55de..dc2d9d80059e845b33444f8bdc29e82d o['variables']['v8_enable_javascript_promise_hooks'] = 1 o['variables']['v8_enable_lite_mode'] = 1 if options.v8_lite_mode else 0 diff --git a/src/node.h b/src/node.h -index a336f44dc1e785ea237865077216d41ab032c0af..96c599aa6448e2aa8e57e84f811564a5281c139a 100644 +index c5ade4bd30456cde33379c6202b65709650d3ec0..f7b3f90b0c2cfbeacc5bc50112dd711df8d3c364 100644 --- a/src/node.h +++ b/src/node.h @@ -22,6 +22,12 @@ diff --git a/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch b/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch index 27bb1db444b56..57afd30f2c38f 100644 --- a/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch +++ b/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch @@ -10,7 +10,7 @@ JS errors and ensures embedder JS is loaded via LoadEmbedderJavaScriptSource. That method is generated by our modifications to js2c.cc in the BUILD.gn patch diff --git a/lib/internal/fs/watchers.js b/lib/internal/fs/watchers.js -index 0244a214b187e67e0cb89f26cd019855963ec93a..b65a3be6bcb0e28f7f43367d0fa9da533db9d0d1 100644 +index 605dee28cace56f2366fec9d7f18894559044ae4..15dcabb3b1682438eb6d5a681363b7ea8602b9e7 100644 --- a/lib/internal/fs/watchers.js +++ b/lib/internal/fs/watchers.js @@ -299,12 +299,13 @@ function emitCloseNT(self) { @@ -34,10 +34,10 @@ index 0244a214b187e67e0cb89f26cd019855963ec93a..b65a3be6bcb0e28f7f43367d0fa9da53 let kResistStopPropagation; diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index c54df6fee333ddfe59b9df7e0ddd2935b4dcb33f..4b288e0f89e0156cb5b0555c0259b2c1150770db 100644 +index e43e2559aaf48add88aad342b1c96fd34f26c87f..e69eb280050cae0c0f394b2f956eef947e628904 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc -@@ -35,6 +35,7 @@ using v8::Value; +@@ -39,6 +39,7 @@ using v8::Value; BuiltinLoader::BuiltinLoader() : config_(GetConfig()), code_cache_(std::make_shared<BuiltinCodeCache>()) { LoadJavaScriptSource(); @@ -46,10 +46,10 @@ index c54df6fee333ddfe59b9df7e0ddd2935b4dcb33f..4b288e0f89e0156cb5b0555c0259b2c1 AddExternalizedBuiltin( "internal/deps/cjs-module-lexer/lexer", diff --git a/src/node_builtins.h b/src/node_builtins.h -index 302030f610965f07dd6998d282275c1bdf738009..35cb7766eeccc62dd2f0ce9484a2f1ec7beccc05 100644 +index bcdd50f635757f41287c87df1db9cd3b55c4b6b9..e908f3c0e314b90ff7b6c599940ea8f4e657c709 100644 --- a/src/node_builtins.h +++ b/src/node_builtins.h -@@ -138,6 +138,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { +@@ -141,6 +141,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { // Generated by tools/js2c.cc as node_javascript.cc void LoadJavaScriptSource(); // Loads data into source_ diff --git a/patches/node/build_restore_clang_as_default_compiler_on_macos.patch b/patches/node/build_restore_clang_as_default_compiler_on_macos.patch index 085cae86bc2a9..a1f987b2b7105 100644 --- a/patches/node/build_restore_clang_as_default_compiler_on_macos.patch +++ b/patches/node/build_restore_clang_as_default_compiler_on_macos.patch @@ -11,7 +11,7 @@ node-gyp will use the result of `process.config` that reflects the environment in which the binary got built. diff --git a/common.gypi b/common.gypi -index 95c56305926fc3e0e46e4cf99ec86d3d1b5576a7..45bb2c4ff94ceac377c9117da4497cdc5ac41171 100644 +index aea3a882c338eb757bef9e85fabab3fc7e7495f7..9303217fb05190c734e410a524a6921723d665d5 100644 --- a/common.gypi +++ b/common.gypi @@ -128,6 +128,7 @@ diff --git a/patches/node/chore_add_createexternalizabletwobytestring_to_globals.patch b/patches/node/chore_add_createexternalizabletwobytestring_to_globals.patch deleted file mode 100644 index d9578359a44e9..0000000000000 --- a/patches/node/chore_add_createexternalizabletwobytestring_to_globals.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: John Kleinschmidt <jkleinsc@electronjs.org> -Date: Fri, 28 Feb 2025 11:24:53 -0500 -Subject: chore: add createExternalizableTwoByteString to globals - -https://chromium-review.googlesource.com/c/v8/v8/+/6304942 added -createExternalizableTwoByteString, so make sure it is handled -as a global in the parallel/test-fs-write test. - -diff --git a/test/parallel/test-fs-write.js b/test/parallel/test-fs-write.js -index 82f3425de2aa162aa97047098806a08d0f8be4bd..31ab5b833db94fec6f2e976f53f650bc6318e794 100644 ---- a/test/parallel/test-fs-write.js -+++ b/test/parallel/test-fs-write.js -@@ -48,6 +48,7 @@ assert.notStrictEqual(isOneByteString, undefined); - // Account for extra globals exposed by --expose_externalize_string. - common.allowGlobals( - createExternalizableString, -+ createExternalizableTwoByteString, - externalizeString, - isOneByteString, - globalThis.x, diff --git a/patches/node/chore_add_missing_include_of_iterator.patch b/patches/node/chore_add_missing_include_of_iterator.patch deleted file mode 100644 index c04928baba59d..0000000000000 --- a/patches/node/chore_add_missing_include_of_iterator.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: David Sanders <dsanders11@ucsbalum.com> -Date: Mon, 21 Jul 2025 16:58:56 -0700 -Subject: chore: add missing include of <iterator> - -This has been upstreamed at https://github.com/ada-url/ada/pull/982 - -diff --git a/deps/ada/ada.cpp b/deps/ada/ada.cpp -index d7f9b3a92c5330dad1cbd9f6f0bdd96908a4ad13..68fe0701bced5db86834ebd8232d4fe5ae7ed308 100644 ---- a/deps/ada/ada.cpp -+++ b/deps/ada/ada.cpp -@@ -11217,6 +11217,7 @@ ada_warn_unused std::string to_string(ada::state state) { - - #include <numeric> - #include <algorithm> -+#include <iterator> - #include <string> - - namespace ada { -@@ -13067,6 +13068,7 @@ template url_aggregator parse_url<url_aggregator>( - /* end file src/parser.cpp */ - /* begin file src/url_components.cpp */ - -+#include <iterator> - #include <numeric> - #include <string> - -@@ -13192,6 +13194,7 @@ namespace ada { - /* end file src/url_components.cpp */ - /* begin file src/url_aggregator.cpp */ - -+#include <iterator> - #include <string> - #include <string_view> - diff --git a/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch b/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch index ca0d26b834e9c..2c56c247edae8 100644 --- a/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch +++ b/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch @@ -8,10 +8,10 @@ they use themselves as the entry point. We should try to upstream some form of this. diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js -index 98ed40e3076f6628b1771dade63ac51600e8e447..1eba13caf1e00a8b41b2cf8afc4168c8f98be69f 100644 +index c7f86098bdb00b6be84d547a0ac41919fa1bbb0f..35b43990c8f24f0888f89173f5662050a11b26ed 100644 --- a/lib/internal/process/pre_execution.js +++ b/lib/internal/process/pre_execution.js -@@ -245,12 +245,14 @@ function patchProcessObject(expandArgv1) { +@@ -243,12 +243,14 @@ function patchProcessObject(expandArgv1) { // the entry point. if (expandArgv1 && process.argv[1] && process.argv[1][0] !== '-') { // Expand process.argv[1] into a full path. diff --git a/patches/node/chore_exclude_electron_node_folder_from_exit-time-destructors.patch b/patches/node/chore_exclude_electron_node_folder_from_exit-time-destructors.patch index 098073d58bea1..b044a2d5f9df9 100644 --- a/patches/node/chore_exclude_electron_node_folder_from_exit-time-destructors.patch +++ b/patches/node/chore_exclude_electron_node_folder_from_exit-time-destructors.patch @@ -20,7 +20,7 @@ index ab7dc27de3e304f6d912d5834da47e3b4eb25495..b6c0fd4ceee989dac55c7d54e52fef18 } } diff --git a/unofficial.gni b/unofficial.gni -index 8886f2a79ae77614789d6ae0defd4f18fc756456..a64d2e4ac475abc049fff7ea62ec76de565a747d 100644 +index 253226009faf563f6db285d4b2908f308c1f96ea..dd686d2f7c8d2f6e8d6bd13a7bf2b4b140556ba9 100644 --- a/unofficial.gni +++ b/unofficial.gni @@ -143,7 +143,10 @@ template("node_gn_build") { @@ -35,7 +35,7 @@ index 8886f2a79ae77614789d6ae0defd4f18fc756456..a64d2e4ac475abc049fff7ea62ec76de public_configs = [ ":node_external_config", "deps/googletest:googletest_config", -@@ -345,6 +348,7 @@ template("node_gn_build") { +@@ -362,6 +365,7 @@ template("node_gn_build") { "src/embedded_data.h", ] include_dirs = [ "src", "tools" ] diff --git a/patches/node/chore_expose_importmoduledynamically_and.patch b/patches/node/chore_expose_importmoduledynamically_and.patch index 072c465e1185e..4a0b9dff2e174 100644 --- a/patches/node/chore_expose_importmoduledynamically_and.patch +++ b/patches/node/chore_expose_importmoduledynamically_and.patch @@ -11,10 +11,10 @@ its own blended handler between Node and Blink. Not upstreamable. diff --git a/lib/internal/modules/esm/utils.js b/lib/internal/modules/esm/utils.js -index 9b41db8b0714b7408f79cbd5b4c460d9bc08f239..35ecfb9bbaf2c8e7351e1c69da84c82a4a7cb049 100644 +index 4a4279459341e87784ee8efa832dc74371c4a708..88d84786e72cf8712e0b9bda16c418d4087fe549 100644 --- a/lib/internal/modules/esm/utils.js +++ b/lib/internal/modules/esm/utils.js -@@ -30,7 +30,7 @@ const { +@@ -34,7 +34,7 @@ const { ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING, ERR_INVALID_ARG_VALUE, } = require('internal/errors').codes; @@ -23,8 +23,8 @@ index 9b41db8b0714b7408f79cbd5b4c460d9bc08f239..35ecfb9bbaf2c8e7351e1c69da84c82a const { loadPreloadModules, initializeFrozenIntrinsics, -@@ -281,12 +281,13 @@ let _forceDefaultLoader = false; - * @param {boolean} [forceDefaultLoader=false] - A boolean indicating disabling custom loaders. +@@ -291,12 +291,13 @@ let _forceDefaultLoader = false; + * @param {boolean} [forceDefaultLoader] - A boolean indicating disabling custom loaders. */ function initializeESM(forceDefaultLoader = false) { + const shouldSetOnIsolate = !getEmbedderOptions().shouldNotRegisterESMLoader; @@ -40,19 +40,19 @@ index 9b41db8b0714b7408f79cbd5b4c460d9bc08f239..35ecfb9bbaf2c8e7351e1c69da84c82a /** diff --git a/src/module_wrap.cc b/src/module_wrap.cc -index c52e20d742942667f43ea3e151fc6702260b176b..cbb3e7f4df72f83cb8a1afc25a7429218792e964 100644 +index 5783728da2894270f902f47b210008df0e911bde..8fed194cbae9ce75bd0805b4df30b4de64fbbefa 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc -@@ -901,7 +901,7 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback( - return module->module_.Get(isolate); +@@ -1097,7 +1097,7 @@ Maybe<ModuleWrap*> ModuleWrap::ResolveModule( + return Just(module_wrap); } --static MaybeLocal<Promise> ImportModuleDynamically( -+MaybeLocal<Promise> ImportModuleDynamically( +-static MaybeLocal<Promise> ImportModuleDynamicallyWithPhase( ++MaybeLocal<Promise> ImportModuleDynamicallyWithPhase( Local<Context> context, Local<Data> host_defined_options, Local<Value> resource_name, -@@ -973,12 +973,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback( +@@ -1185,14 +1185,16 @@ void ModuleWrap::SetImportModuleDynamicallyCallback( Realm* realm = Realm::GetCurrent(args); HandleScope handle_scope(isolate); @@ -63,12 +63,16 @@ index c52e20d742942667f43ea3e151fc6702260b176b..cbb3e7f4df72f83cb8a1afc25a742921 realm->set_host_import_module_dynamically_callback(import_callback); - isolate->SetHostImportModuleDynamicallyCallback(ImportModuleDynamically); -+ if (args[1]->IsBoolean() && args[1]->BooleanValue(isolate)) +- isolate->SetHostImportModuleWithPhaseDynamicallyCallback( ++ if (args[1]->IsBoolean() && args[1]->BooleanValue(isolate)) { + isolate->SetHostImportModuleDynamicallyCallback(ImportModuleDynamically); ++ isolate->SetHostImportModuleWithPhaseDynamicallyCallback( + ImportModuleDynamicallyWithPhase); ++ } } void ModuleWrap::HostInitializeImportMetaObjectCallback( -@@ -1020,13 +1021,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback( +@@ -1234,13 +1236,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback( Realm* realm = Realm::GetCurrent(args); Isolate* isolate = realm->isolate(); @@ -87,7 +91,7 @@ index c52e20d742942667f43ea3e151fc6702260b176b..cbb3e7f4df72f83cb8a1afc25a742921 MaybeLocal<Value> ModuleWrap::SyntheticModuleEvaluationStepsCallback( diff --git a/src/module_wrap.h b/src/module_wrap.h -index 9363ce73e51cde3d3a94f9912f072d532d0f8560..c0e972ed293157726efc5fa76dfa62d3da51c22a 100644 +index 03cf8d0e91d795aad6db9b11956d296ff4999f7e..45264c2ad58e37a73fd62addac7fb671eed6d502 100644 --- a/src/module_wrap.h +++ b/src/module_wrap.h @@ -8,6 +8,7 @@ @@ -98,23 +102,24 @@ index 9363ce73e51cde3d3a94f9912f072d532d0f8560..c0e972ed293157726efc5fa76dfa62d3 #include "v8-script.h" namespace node { -@@ -33,7 +34,14 @@ enum HostDefinedOptions : int { - kLength = 9, +@@ -92,7 +93,15 @@ struct ModuleCacheKey : public MemoryRetainer { + hash(hash) {} }; -class ModuleWrap : public BaseObject { -+NODE_EXTERN v8::MaybeLocal<v8::Promise> ImportModuleDynamically( ++NODE_EXTERN v8::MaybeLocal<v8::Promise> ImportModuleDynamicallyWithPhase( + v8::Local<v8::Context> context, + v8::Local<v8::Data> host_defined_options, + v8::Local<v8::Value> resource_name, + v8::Local<v8::String> specifier, -+ v8::Local<v8::FixedArray> import_assertions); ++ v8::ModuleImportPhase phase, ++ v8::Local<v8::FixedArray> import_attributes); + +class NODE_EXTERN ModuleWrap : public BaseObject { - public: - enum InternalFields { - kModuleSlot = BaseObject::kInternalFieldCount, -@@ -92,6 +100,8 @@ class ModuleWrap : public BaseObject { + using ResolveCache = + std::unordered_map<ModuleCacheKey, uint32_t, ModuleCacheKey::Hash>; + +@@ -157,6 +166,8 @@ class ModuleWrap : public BaseObject { static void CreateRequiredModuleFacade( const v8::FunctionCallbackInfo<v8::Value>& args); @@ -123,11 +128,11 @@ index 9363ce73e51cde3d3a94f9912f072d532d0f8560..c0e972ed293157726efc5fa76dfa62d3 private: ModuleWrap(Realm* realm, v8::Local<v8::Object> object, -@@ -131,7 +141,6 @@ class ModuleWrap : public BaseObject { +@@ -205,7 +216,6 @@ class ModuleWrap : public BaseObject { v8::Local<v8::String> specifier, v8::Local<v8::FixedArray> import_attributes, v8::Local<v8::Module> referrer); - static ModuleWrap* GetFromModule(node::Environment*, v8::Local<v8::Module>); - v8::Global<v8::Module> module_; - std::unordered_map<std::string, v8::Global<v8::Object>> resolve_cache_; + // This method may throw a JavaScript exception, so the return type is + // wrapped in a Maybe. diff --git a/patches/node/chore_handle_support_for_import_defer_as_ns_and_import_defer.patch b/patches/node/chore_handle_support_for_import_defer_as_ns_and_import_defer.patch new file mode 100644 index 0000000000000..dffa0560f0f09 --- /dev/null +++ b/patches/node/chore_handle_support_for_import_defer_as_ns_and_import_defer.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr <shelley.vohr@gmail.com> +Date: Wed, 29 Oct 2025 11:45:23 +0000 +Subject: chore: handle support for `import defer * as ns` and `import.defer` + syntax + +V8 added support for the above syntax https://chromium-review.googlesource.com/c/v8/v8/+/7017517 +by adding a new `ModuleImportPhase::kDefer` phase. + +This patch can be removed when Electron updates to a version of Node.js containing +the above CL. + +diff --git a/src/module_wrap.cc b/src/module_wrap.cc +index a584e3a80adb69d2028dc79450349823ab973a58..6f010fa2e014b2d13b1f89a691d09e2ffdf690b6 100644 +--- a/src/module_wrap.cc ++++ b/src/module_wrap.cc +@@ -563,8 +563,10 @@ ModulePhase to_phase_constant(ModuleImportPhase phase) { + return kEvaluationPhase; + case ModuleImportPhase::kSource: + return kSourcePhase; ++ case ModuleImportPhase::kDefer: ++ default: ++ UNREACHABLE(); + } +- UNREACHABLE(); + } + + static Local<Object> createImportAttributesContainer( +@@ -1471,6 +1473,7 @@ void ModuleWrap::CreatePerContextProperties(Local<Object> target, + + V(ModulePhase, kEvaluationPhase); + V(ModulePhase, kSourcePhase); ++ V(ModulePhase, kDeferPhase); + #undef V + } + +diff --git a/src/module_wrap.h b/src/module_wrap.h +index 45264c2ad58e37a73fd62addac7fb671eed6d502..fb32fbc5c1cfa4aef4a7822dbc6195429299da3e 100644 +--- a/src/module_wrap.h ++++ b/src/module_wrap.h +@@ -37,6 +37,7 @@ enum HostDefinedOptions : int { + enum ModulePhase : int { + kSourcePhase = 1, + kEvaluationPhase = 2, ++ kDeferPhase = 3, + }; + + /** diff --git a/patches/node/cli_move_--trace-atomics-wait_to_eol.patch b/patches/node/cli_move_--trace-atomics-wait_to_eol.patch deleted file mode 100644 index 886a61ae99fc3..0000000000000 --- a/patches/node/cli_move_--trace-atomics-wait_to_eol.patch +++ /dev/null @@ -1,305 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Marco Ippolito <marcoippolito54@gmail.com> -Date: Wed, 1 May 2024 14:24:48 +0200 -Subject: cli: move --trace-atomics-wait to eol -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -PR-URL: https://github.com/nodejs/node/pull/52747 -Fixes: https://github.com/nodejs/node/issues/42982 -Reviewed-By: Matteo Collina <matteo.collina@gmail.com> -Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> -Reviewed-By: Michaël Zasso <targos@protonmail.com> -Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> -Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> - -diff --git a/doc/api/cli.md b/doc/api/cli.md -index 9a0e83b95a72486ab9751b3b8818f4beeb527041..1da7126b9d51238e9b89ee6bed602df3f5598a9e 100644 ---- a/doc/api/cli.md -+++ b/doc/api/cli.md -@@ -2727,39 +2727,6 @@ added: v12.0.0 - Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.3'. Use to disable support - for TLSv1.2, which is not as secure as TLSv1.3. - --### `--trace-atomics-wait` -- --<!-- YAML --added: v14.3.0 --deprecated: -- - v18.8.0 -- - v16.18.0 ----> -- --> Stability: 0 - Deprecated -- --Print short summaries of calls to [`Atomics.wait()`][] to stderr. --The output could look like this: -- --```text --(node:15701) [Thread 0] Atomics.wait(<address> + 0, 1, inf) started --(node:15701) [Thread 0] Atomics.wait(<address> + 0, 1, inf) did not wait because the values mismatched --(node:15701) [Thread 0] Atomics.wait(<address> + 0, 0, 10) started --(node:15701) [Thread 0] Atomics.wait(<address> + 0, 0, 10) timed out --(node:15701) [Thread 0] Atomics.wait(<address> + 4, 0, inf) started --(node:15701) [Thread 1] Atomics.wait(<address> + 4, -1, inf) started --(node:15701) [Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread --(node:15701) [Thread 1] Atomics.wait(<address> + 4, -1, inf) was woken up by another thread --``` -- --The fields here correspond to: -- --* The thread id as given by [`worker_threads.threadId`][] --* The base address of the `SharedArrayBuffer` in question, as well as the -- byte offset corresponding to the index passed to `Atomics.wait()` --* The expected value that was passed to `Atomics.wait()` --* The timeout passed to `Atomics.wait` -- - ### `--trace-deprecation` - - <!-- YAML -@@ -3445,7 +3412,6 @@ one is included in the list below. - * `--tls-min-v1.1` - * `--tls-min-v1.2` - * `--tls-min-v1.3` --* `--trace-atomics-wait` - * `--trace-deprecation` - * `--trace-env-js-stack` - * `--trace-env-native-stack` -diff --git a/doc/node.1 b/doc/node.1 -index e3b2c45af01b2e9b9522964da2572988edd2b9e9..64e975546285a1042dda6fdb54fdd502f338a929 100644 ---- a/doc/node.1 -+++ b/doc/node.1 -@@ -542,11 +542,6 @@ but the option is supported for compatibility with older Node.js versions. - Set default minVersion to 'TLSv1.3'. Use to disable support for TLSv1.2 in - favour of TLSv1.3, which is more secure. - . --.It Fl -trace-atomics-wait --Print short summaries of calls to --.Sy Atomics.wait() . --. --This flag is deprecated. - .It Fl -trace-deprecation - Print stack traces for deprecations. - . -diff --git a/src/node.cc b/src/node.cc -index 0725cc97510375bc616534ddf3de4b231bae6bf5..f21687ad9dfd69c829aaaf8f3ed66b6bf6713765 100644 ---- a/src/node.cc -+++ b/src/node.cc -@@ -232,44 +232,6 @@ void Environment::WaitForInspectorFrontendByOptions() { - } - #endif // HAVE_INSPECTOR - --#define ATOMIC_WAIT_EVENTS(V) \ -- V(kStartWait, "started") \ -- V(kWokenUp, "was woken up by another thread") \ -- V(kTimedOut, "timed out") \ -- V(kTerminatedExecution, "was stopped by terminated execution") \ -- V(kAPIStopped, "was stopped through the embedder API") \ -- V(kNotEqual, "did not wait because the values mismatched") \ -- --static void AtomicsWaitCallback(Isolate::AtomicsWaitEvent event, -- Local<v8::SharedArrayBuffer> array_buffer, -- size_t offset_in_bytes, int64_t value, -- double timeout_in_ms, -- Isolate::AtomicsWaitWakeHandle* stop_handle, -- void* data) { -- Environment* env = static_cast<Environment*>(data); -- -- const char* message = "(unknown event)"; -- switch (event) { --#define V(key, msg) \ -- case Isolate::AtomicsWaitEvent::key: \ -- message = msg; \ -- break; -- ATOMIC_WAIT_EVENTS(V) --#undef V -- } -- -- fprintf(stderr, -- "(node:%d) [Thread %" PRIu64 "] Atomics.wait(%p + %zx, %" PRId64 -- ", %.f) %s\n", -- static_cast<int>(uv_os_getpid()), -- env->thread_id(), -- array_buffer->Data(), -- offset_in_bytes, -- value, -- timeout_in_ms, -- message); --} -- - void Environment::InitializeDiagnostics() { - isolate_->GetHeapProfiler()->AddBuildEmbedderGraphCallback( - Environment::BuildEmbedderGraph, this); -@@ -278,17 +240,6 @@ void Environment::InitializeDiagnostics() { - } - if (options_->trace_uncaught) - isolate_->SetCaptureStackTraceForUncaughtExceptions(true); -- if (options_->trace_atomics_wait) { -- ProcessEmitDeprecationWarning( -- Environment::GetCurrent(isolate_), -- "The flag --trace-atomics-wait is deprecated.", -- "DEP0165"); -- isolate_->SetAtomicsWaitCallback(AtomicsWaitCallback, this); -- AddCleanupHook([](void* data) { -- Environment* env = static_cast<Environment*>(data); -- env->isolate()->SetAtomicsWaitCallback(nullptr, nullptr); -- }, this); -- } - if (options_->trace_promises) { - isolate_->SetPromiseHook(TracePromises); - } -diff --git a/src/node_options.cc b/src/node_options.cc -index e8424d7539db191a55edebb7d33a3c1dc37e2403..556776b79282d953fdc371d1901f21ca301bec1a 100644 ---- a/src/node_options.cc -+++ b/src/node_options.cc -@@ -773,10 +773,6 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { - "throw an exception on deprecations", - &EnvironmentOptions::throw_deprecation, - kAllowedInEnvvar); -- AddOption("--trace-atomics-wait", -- "(deprecated) trace Atomics.wait() operations", -- &EnvironmentOptions::trace_atomics_wait, -- kAllowedInEnvvar); - AddOption("--trace-deprecation", - "show stack traces on deprecations", - &EnvironmentOptions::trace_deprecation, -diff --git a/src/node_options.h b/src/node_options.h -index 418dee360f867c363f1576012b32213a51c4fdd0..7078d2493ed696bc5bd92df9c629b714c1a8fbfb 100644 ---- a/src/node_options.h -+++ b/src/node_options.h -@@ -205,7 +205,6 @@ class EnvironmentOptions : public Options { - std::vector<std::string> coverage_include_pattern; - std::vector<std::string> coverage_exclude_pattern; - bool throw_deprecation = false; -- bool trace_atomics_wait = false; - bool trace_deprecation = false; - bool trace_exit = false; - bool trace_sync_io = false; -diff --git a/test/parallel/test-trace-atomic-deprecation.js b/test/parallel/test-trace-atomic-deprecation.js -deleted file mode 100644 -index 8aeddb28e938d23e646d882cfe24b2e2311f9ab2..0000000000000000000000000000000000000000 ---- a/test/parallel/test-trace-atomic-deprecation.js -+++ /dev/null -@@ -1,14 +0,0 @@ --'use strict'; -- --const common = require('../common'); --const assert = require('node:assert'); --const { test } = require('node:test'); -- --test('should emit deprecation warning DEP0165', async () => { -- const { code, stdout, stderr } = await common.spawnPromisified( -- process.execPath, ['--trace-atomics-wait', '-e', '{}'] -- ); -- assert.match(stderr, /\[DEP0165\] DeprecationWarning:/); -- assert.strictEqual(stdout, ''); -- assert.strictEqual(code, 0); --}); -diff --git a/test/parallel/test-trace-atomics-wait.js b/test/parallel/test-trace-atomics-wait.js -deleted file mode 100644 -index 6449a2be2b47e0758090dc13d136877b1874c635..0000000000000000000000000000000000000000 ---- a/test/parallel/test-trace-atomics-wait.js -+++ /dev/null -@@ -1,101 +0,0 @@ --'use strict'; --require('../common'); --const assert = require('assert'); --const child_process = require('child_process'); --const { Worker } = require('worker_threads'); -- --if (process.argv[2] === 'child') { -- const i32arr = new Int32Array(new SharedArrayBuffer(8)); -- assert.strictEqual(Atomics.wait(i32arr, 0, 1), 'not-equal'); -- assert.strictEqual(Atomics.wait(i32arr, 0, 0, 10), 'timed-out'); -- -- new Worker(` -- const i32arr = require('worker_threads').workerData; -- Atomics.store(i32arr, 1, -1); -- Atomics.notify(i32arr, 1); -- Atomics.wait(i32arr, 1, -1); -- `, { eval: true, workerData: i32arr }); -- -- Atomics.wait(i32arr, 1, 0); -- assert.strictEqual(Atomics.load(i32arr, 1), -1); -- Atomics.store(i32arr, 1, 0); -- Atomics.notify(i32arr, 1); -- return; --} -- --const proc = child_process.spawnSync( -- process.execPath, -- [ '--disable-warning=DEP0165', '--trace-atomics-wait', __filename, 'child' ], -- { encoding: 'utf8', stdio: [ 'inherit', 'inherit', 'pipe' ] }); -- --if (proc.status !== 0) console.log(proc); --assert.strictEqual(proc.status, 0); -- --const SABAddress = proc.stderr.match(/Atomics\.wait\((?<SAB>.+) \+/).groups.SAB; --const actualTimeline = proc.stderr -- .replace(new RegExp(SABAddress, 'g'), '<address>') -- .replace(new RegExp(`\\(node:${proc.pid}\\) `, 'g'), '') -- .replace(/\binf(inity)?\b/gi, 'inf') -- .replace(/\r/g, '') -- .trim(); --console.log('+++ normalized stdout +++'); --console.log(actualTimeline); --console.log('--- normalized stdout ---'); -- --const begin = --`[Thread 0] Atomics.wait(<address> + 0, 1, inf) started --[Thread 0] Atomics.wait(<address> + 0, 1, inf) did not wait because the \ --values mismatched --[Thread 0] Atomics.wait(<address> + 0, 0, 10) started --[Thread 0] Atomics.wait(<address> + 0, 0, 10) timed out`; -- --const expectedTimelines = [ -- `${begin} --[Thread 0] Atomics.wait(<address> + 4, 0, inf) started --[Thread 1] Atomics.wait(<address> + 4, -1, inf) started --[Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread --[Thread 1] Atomics.wait(<address> + 4, -1, inf) was woken up by another thread`, -- `${begin} --[Thread 1] Atomics.wait(<address> + 4, 0, inf) started --[Thread 0] Atomics.wait(<address> + 4, -1, inf) started --[Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread --[Thread 1] Atomics.wait(<address> + 4, -1, inf) was woken up by another thread`, -- `${begin} --[Thread 0] Atomics.wait(<address> + 4, 0, inf) started --[Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread --[Thread 1] Atomics.wait(<address> + 4, -1, inf) started --[Thread 1] Atomics.wait(<address> + 4, -1, inf) was woken up by another thread`, -- `${begin} --[Thread 0] Atomics.wait(<address> + 4, 0, inf) started --[Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread --[Thread 1] Atomics.wait(<address> + 4, -1, inf) started --[Thread 1] Atomics.wait(<address> + 4, -1, inf) did not wait because the \ --values mismatched`, -- `${begin} --[Thread 0] Atomics.wait(<address> + 4, 0, inf) started --[Thread 1] Atomics.wait(<address> + 4, -1, inf) started --[Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread --[Thread 1] Atomics.wait(<address> + 4, -1, inf) did not wait because the \ --values mismatched`, -- `${begin} --[Thread 1] Atomics.wait(<address> + 4, 0, inf) started --[Thread 0] Atomics.wait(<address> + 4, -1, inf) started --[Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread --[Thread 1] Atomics.wait(<address> + 4, -1, inf) did not wait because the \ --values mismatched`, -- `${begin} --[Thread 0] Atomics.wait(<address> + 4, 0, inf) started --[Thread 0] Atomics.wait(<address> + 4, 0, inf) did not wait because the \ --values mismatched --[Thread 1] Atomics.wait(<address> + 4, -1, inf) started --[Thread 1] Atomics.wait(<address> + 4, -1, inf) did not wait because the \ --values mismatched`, -- `${begin} --[Thread 1] Atomics.wait(<address> + 4, -1, inf) started --[Thread 0] Atomics.wait(<address> + 4, 0, inf) started --[Thread 0] Atomics.wait(<address> + 4, 0, inf) did not wait because the \ --values mismatched --[Thread 1] Atomics.wait(<address> + 4, -1, inf) was woken up by another thread`, --]; -- --assert(expectedTimelines.includes(actualTimeline)); diff --git a/patches/node/cli_remove_deprecated_v8_flag.patch b/patches/node/cli_remove_deprecated_v8_flag.patch deleted file mode 100644 index 1d8b239e3aaff..0000000000000 --- a/patches/node/cli_remove_deprecated_v8_flag.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Omer Katz <omerkatz@chromium.org> -Date: Thu, 19 Sep 2024 10:50:09 +0200 -Subject: cli: remove deprecated V8 flag -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Remove the `--huge-max-old-generation-size` V8 flag from the -`NODE_OPTIONS` allowlist. That flag was recently deprecated (it -currently remains as nop, see crrev.com/c/5831467) and will soon be -completely removed. - -PR-URL: https://github.com/nodejs/node/pull/54761 -Reviewed-By: Richard Lau <rlau@redhat.com> -Reviewed-By: Luigi Pinca <luigipinca@gmail.com> -Reviewed-By: Michaël Zasso <targos@protonmail.com> -Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> - -diff --git a/doc/api/cli.md b/doc/api/cli.md -index b8f9fb49fcb45602828e79bd79902233b5987dda..9a0e83b95a72486ab9751b3b8818f4beeb527041 100644 ---- a/doc/api/cli.md -+++ b/doc/api/cli.md -@@ -3483,7 +3483,6 @@ V8 options that are allowed are: - * `--disallow-code-generation-from-strings` - * `--enable-etw-stack-walking` - * `--expose-gc` --* `--huge-max-old-generation-size` - * `--interpreted-frames-native-stack` - * `--jitless` - * `--max-old-space-size` -diff --git a/src/node_options.cc b/src/node_options.cc -index 8afded658c3f569de7b329ea9dddc11010748cf9..e8424d7539db191a55edebb7d33a3c1dc37e2403 100644 ---- a/src/node_options.cc -+++ b/src/node_options.cc -@@ -1001,11 +1001,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser( - "disallow eval and friends", - V8Option{}, - kAllowedInEnvvar); -- AddOption("--huge-max-old-generation-size", -- "increase default maximum heap size on machines with 16GB memory " -- "or more", -- V8Option{}, -- kAllowedInEnvvar); - AddOption("--jitless", - "disable runtime allocation of executable memory", - V8Option{}, -diff --git a/test/parallel/test-cli-node-options.js b/test/parallel/test-cli-node-options.js -index c5d74f40e7894980b45713c77cc36f836be73528..53bca572c3405c0357f868aae71fc2c82d973c04 100644 ---- a/test/parallel/test-cli-node-options.js -+++ b/test/parallel/test-cli-node-options.js -@@ -76,7 +76,6 @@ if (common.hasCrypto) { - expect('--abort_on-uncaught_exception', 'B\n'); - expect('--disallow-code-generation-from-strings', 'B\n'); - expect('--expose-gc', 'B\n'); --expect('--huge-max-old-generation-size', 'B\n'); - expect('--jitless', 'B\n'); - expect('--max-old-space-size=0', 'B\n'); - expect('--max-semi-space-size=0', 'B\n'); diff --git a/patches/node/enable_crashpad_linux_node_processes.patch b/patches/node/enable_crashpad_linux_node_processes.patch index 7defc4cc3c14f..f4cf91f463086 100644 --- a/patches/node/enable_crashpad_linux_node_processes.patch +++ b/patches/node/enable_crashpad_linux_node_processes.patch @@ -8,7 +8,7 @@ to child processes spawned with `ELECTRON_RUN_AS_NODE` which is used by the crashpad client to connect with the handler process. diff --git a/lib/child_process.js b/lib/child_process.js -index 960ecd25ebb5b2aba0b92b869a2332a3a69011e1..ced0a5d792c63662c577a41c88b52cae076e7d08 100644 +index 17c6b69c118a759f9fcf254a035f1a07fcc4059f..c8576fbf889d13f951a9ad2ffeb93389cfe2445b 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -62,6 +62,7 @@ let debug = require('internal/util/debuglog').debuglog( @@ -27,7 +27,7 @@ index 960ecd25ebb5b2aba0b92b869a2332a3a69011e1..ced0a5d792c63662c577a41c88b52cae args = [...execArgv, modulePath, ...args]; if (typeof options.stdio === 'string') { -@@ -637,6 +637,22 @@ function normalizeSpawnArguments(file, args, options) { +@@ -638,6 +638,22 @@ function normalizeSpawnArguments(file, args, options) { 'options.windowsVerbatimArguments'); } @@ -49,8 +49,8 @@ index 960ecd25ebb5b2aba0b92b869a2332a3a69011e1..ced0a5d792c63662c577a41c88b52cae + if (options.shell) { validateArgumentNullCheck(options.shell, 'options.shell'); - -@@ -671,8 +687,6 @@ function normalizeSpawnArguments(file, args, options) { + if (args.length > 0 && !emittedDEP0190Already) { +@@ -680,8 +696,6 @@ function normalizeSpawnArguments(file, args, options) { ArrayPrototypeUnshift(args, file); } diff --git a/patches/node/expose_get_builtin_module_function.patch b/patches/node/expose_get_builtin_module_function.patch index 8b95ccbe3290c..eb7db1059f544 100644 --- a/patches/node/expose_get_builtin_module_function.patch +++ b/patches/node/expose_get_builtin_module_function.patch @@ -9,10 +9,10 @@ modules to sandboxed renderers. TODO(codebytere): remove and replace with a public facing API. diff --git a/src/node_binding.cc b/src/node_binding.cc -index aa4213c3622eab077fa8d764775c1f95c6313e34..11f722d2d7c21079cbc65033429086231a786ca7 100644 +index 5bd07e5253ae64b02ae1874226ab70c1972cf9e0..768d81a63a42d9016a42b7cdce7b6be86c59afdf 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc -@@ -652,6 +652,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) { +@@ -655,6 +655,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) { args.GetReturnValue().Set(exports); } @@ -24,10 +24,10 @@ index aa4213c3622eab077fa8d764775c1f95c6313e34..11f722d2d7c21079cbc6503342908623 Environment* env = Environment::GetCurrent(args); diff --git a/src/node_binding.h b/src/node_binding.h -index 611f38ef5e21cc303127326d50c648fbb557b4da..3d95ad2733dc83d0b7d37d57c337732c8a0e83d7 100644 +index 813204dc473960e63896b6d3609a882b52ac59fa..2fe91a28460973b543f5dde7a78fdedb05ac98b3 100644 --- a/src/node_binding.h +++ b/src/node_binding.h -@@ -154,6 +154,8 @@ void GetInternalBinding(const v8::FunctionCallbackInfo<v8::Value>& args); +@@ -155,6 +155,8 @@ void GetInternalBinding(const v8::FunctionCallbackInfo<v8::Value>& args); void GetLinkedBinding(const v8::FunctionCallbackInfo<v8::Value>& args); void DLOpen(const v8::FunctionCallbackInfo<v8::Value>& args); diff --git a/patches/node/feat_disable_js_source_phase_imports_by_default.patch b/patches/node/feat_disable_js_source_phase_imports_by_default.patch new file mode 100644 index 0000000000000..a1de4431ef2df --- /dev/null +++ b/patches/node/feat_disable_js_source_phase_imports_by_default.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr <shelley.vohr@gmail.com> +Date: Wed, 22 Oct 2025 11:03:57 +0200 +Subject: feat: disable js source phase imports by default. + +Refs: +- https://chromium-review.googlesource.com/c/v8/v8/+/7003082 +- https://chromium-review.googlesource.com/c/chromium/src/+/6336964 +- https://github.com/nodejs/node/pull/56919 + +We need to disable source phase imports in renderer and worker processes - Chromium +disables them in content/renderer/render_process_impl.cc via and the process will +hard crash otherwise. + +They shouldn't be enabled by default in Node.js either as they are still not yet +Stage 3. + +Upstreamed in https://github.com/nodejs/node/pull/60364 + +diff --git a/src/node.cc b/src/node.cc +index 5713d49d859e1161e1d6703c0b6f3d717a5a9a34..829634c084cb91eb7f488dbdd48175a093dd6e12 100644 +--- a/src/node.cc ++++ b/src/node.cc +@@ -780,7 +780,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args, + env_opts->abort_on_uncaught_exception = true; + } + +- v8_args.emplace_back("--js-source-phase-imports"); ++ // v8_args.emplace_back("--js-source-phase-imports"); + + #ifdef __POSIX__ + // Block SIGPROF signals when sleeping in epoll_wait/kevent/etc. Avoids the diff --git a/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch b/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch index 077c811a595ca..37e9f425260c3 100644 --- a/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch +++ b/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch @@ -7,7 +7,7 @@ common.gypi is a file that's included in the node header bundle, despite the fact that we do not build node with gyp. diff --git a/common.gypi b/common.gypi -index ae31b372b96358a156761ec7e9c39c9530d1abd1..6b79de07be3f839af5b0644f19bfef9c33de590e 100644 +index 7727dfc4c62100cbd873ee4b34c6089ab4b638b1..29a912f58e7b522ae21fddac510946cbcbaaa4cc 100644 --- a/common.gypi +++ b/common.gypi @@ -91,6 +91,23 @@ diff --git a/patches/node/fix_add_source_location_for_v8_task_runner.patch b/patches/node/fix_add_source_location_for_v8_task_runner.patch deleted file mode 100644 index 2f60e1ea7fb76..0000000000000 --- a/patches/node/fix_add_source_location_for_v8_task_runner.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: VerteDinde <vertedinde@electronjs.org> -Date: Mon, 29 Apr 2024 02:56:27 -0700 -Subject: fix: add source location for v8::Task Runner - -This patch corresponds with an upstream change which adds -Post*TaskImpl variants of v8::TaskRunner::Post*Task methods, -which take a v8::SourceLocation argument, and makes Post*Task -methods non-virtual. In the original CL, embedders are asked -to override the Post*TaskImpl methods. - -This patch can be removed when node's upstream makes a -corresponding change. - -CL: https://chromium-review.googlesource.com/c/v8/v8/+/5300826 - -diff --git a/src/node_platform.cc b/src/node_platform.cc -index 0ffebd1dcb693dcddbedff5d259cf65c115f1dc2..b24e170cb247261d4a16d77ad40df4dfd33709d9 100644 ---- a/src/node_platform.cc -+++ b/src/node_platform.cc -@@ -308,11 +308,13 @@ void PerIsolatePlatformData::FlushTasks(uv_async_t* handle) { - platform_data->FlushForegroundTasksInternal(); - } - --void PerIsolatePlatformData::PostIdleTask(std::unique_ptr<v8::IdleTask> task) { -+void PerIsolatePlatformData::PostIdleTaskImpl(std::unique_ptr<v8::IdleTask> task, -+ const v8::SourceLocation& location) { - UNREACHABLE(); - } - --void PerIsolatePlatformData::PostTask(std::unique_ptr<Task> task) { -+void PerIsolatePlatformData::PostTaskImpl(std::unique_ptr<Task> task, -+ const v8::SourceLocation& location) { - // The task can be posted from any V8 background worker thread, even when - // the foreground task runner is being cleaned up by Shutdown(). In that - // case, make sure we wait until the shutdown is completed (which leads -@@ -331,8 +333,10 @@ void PerIsolatePlatformData::PostTask(std::unique_ptr<Task> task) { - uv_async_send(flush_tasks_); - } - --void PerIsolatePlatformData::PostDelayedTask( -- std::unique_ptr<Task> task, double delay_in_seconds) { -+void PerIsolatePlatformData::PostDelayedTaskImpl( -+ std::unique_ptr<Task> task, -+ double delay_in_seconds, -+ const v8::SourceLocation& location) { - if (debug_log_level_ != PlatformDebugLogLevel::kNone) { - fprintf(stderr, - "\nPerIsolatePlatformData::PostDelayedTaskImpl %p %f", -@@ -354,13 +358,15 @@ void PerIsolatePlatformData::PostDelayedTask( - uv_async_send(flush_tasks_); - } - --void PerIsolatePlatformData::PostNonNestableTask(std::unique_ptr<Task> task) { -+void PerIsolatePlatformData::PostNonNestableTaskImpl(std::unique_ptr<Task> task, -+ const v8::SourceLocation& location) { - PostTask(std::move(task)); - } - --void PerIsolatePlatformData::PostNonNestableDelayedTask( -+void PerIsolatePlatformData::PostNonNestableDelayedTaskImpl( - std::unique_ptr<Task> task, -- double delay_in_seconds) { -+ double delay_in_seconds, -+ const v8::SourceLocation& location) { - PostDelayedTask(std::move(task), delay_in_seconds); - } - -diff --git a/src/node_platform.h b/src/node_platform.h -index af30ebeb0c8629ab86d1a55fd63610165abfbabf..a0222b4a1b074c6708e390d58d04221717069ac1 100644 ---- a/src/node_platform.h -+++ b/src/node_platform.h -@@ -80,18 +80,21 @@ class PerIsolatePlatformData : - ~PerIsolatePlatformData() override; - - std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner() override; -- void PostTask(std::unique_ptr<v8::Task> task) override; -- void PostIdleTask(std::unique_ptr<v8::IdleTask> task) override; -- void PostDelayedTask(std::unique_ptr<v8::Task> task, -- double delay_in_seconds) override; -+ void PostTaskImpl(std::unique_ptr<v8::Task> task, const v8::SourceLocation&) override; -+ void PostIdleTaskImpl(std::unique_ptr<v8::IdleTask> task, const v8::SourceLocation&) override; -+ void PostDelayedTaskImpl(std::unique_ptr<v8::Task> task, -+ double delay_in_seconds, -+ const v8::SourceLocation&) override; - bool IdleTasksEnabled() override { return false; } - - // Non-nestable tasks are treated like regular tasks. - bool NonNestableTasksEnabled() const override { return true; } - bool NonNestableDelayedTasksEnabled() const override { return true; } -- void PostNonNestableTask(std::unique_ptr<v8::Task> task) override; -- void PostNonNestableDelayedTask(std::unique_ptr<v8::Task> task, -- double delay_in_seconds) override; -+ void PostNonNestableTaskImpl(std::unique_ptr<v8::Task> task, -+ const v8::SourceLocation&) override; -+ void PostNonNestableDelayedTaskImpl(std::unique_ptr<v8::Task> task, -+ double delay_in_seconds, -+ const v8::SourceLocation&) override; - - void AddShutdownCallback(void (*callback)(void*), void* data); - void Shutdown(); diff --git a/patches/node/fix_adjust_wpt_and_webidl_tests_for_enabled_float16array.patch b/patches/node/fix_adjust_wpt_and_webidl_tests_for_enabled_float16array.patch index c74ee34466051..a8c8f1b057183 100644 --- a/patches/node/fix_adjust_wpt_and_webidl_tests_for_enabled_float16array.patch +++ b/patches/node/fix_adjust_wpt_and_webidl_tests_for_enabled_float16array.patch @@ -11,31 +11,14 @@ Node.js upgrades to a version of V8 that has Float16Array enabled by default. diff --git a/test/common/globals.js b/test/common/globals.js -index 2c1dac019ba2aa0a23c2434997e2007dd2eacde8..152d9afa8f8ef6b76fceb0ac4481d1df719b872b 100644 +index 1641c4df36b92dbe29b06817d87130a94ae1b22f..34563b304f0e708ae066f8303a09e37b6bf123d6 100644 --- a/test/common/globals.js +++ b/test/common/globals.js -@@ -35,6 +35,7 @@ const intrinsics = new Set([ - 'Int16Array', +@@ -36,6 +36,7 @@ const intrinsics = new Set([ + 'Float16Array', 'Uint32Array', 'Int32Array', + 'Float16Array', 'Float32Array', 'Float64Array', 'Uint8ClampedArray', -diff --git a/test/wpt/status/encoding.json b/test/wpt/status/encoding.json -index f9378d7195a2a77eb89ae696ab26747fd8bf65b8..c258031e48556480d500a02925a8d9c29dfb2a18 100644 ---- a/test/wpt/status/encoding.json -+++ b/test/wpt/status/encoding.json -@@ -70,12 +70,6 @@ - "requires": ["full-icu"] - }, - "encodeInto.any.js": { -- "fail": { -- "expected": [ -- "Invalid encodeInto() destination: Float16Array, backed by: ArrayBuffer", -- "Invalid encodeInto() destination: Float16Array, backed by: SharedArrayBuffer" -- ] -- }, - "requires": ["small-icu"] - }, - "textdecoder-copy.any.js": { diff --git a/patches/node/fix_allow_disabling_fetch_in_renderer_and_worker_processes.patch b/patches/node/fix_allow_disabling_fetch_in_renderer_and_worker_processes.patch new file mode 100644 index 0000000000000..23e5b493cc36e --- /dev/null +++ b/patches/node/fix_allow_disabling_fetch_in_renderer_and_worker_processes.patch @@ -0,0 +1,109 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr <shelley.vohr@gmail.com> +Date: Tue, 21 Oct 2025 20:00:06 +0200 +Subject: fix: allow disabling fetch in renderer and worker processes + +We need to disable Node.js' fetch implementation to prevent +conflict with Blink's in renderer and worker processes. + +We should try to upstream some version of this. + +diff --git a/doc/api/cli.md b/doc/api/cli.md +index cc990c01704484cbaa314320b3b3b72acffb6940..6b985c9fce6ec607df0e04f93b3cd5b84233d0b9 100644 +--- a/doc/api/cli.md ++++ b/doc/api/cli.md +@@ -1767,6 +1767,14 @@ changes: + + Disable using [syntax detection][] to determine module type. + ++### `--no-experimental-fetch` ++ ++<!-- YAML ++added: v18.0.0 ++--> ++ ++Disable exposition of Fetch API on the global scope. ++ + ### `--no-experimental-global-navigator` + + <!-- YAML +@@ -3436,6 +3444,7 @@ one is included in the list below. + * `--no-addons` + * `--no-async-context-frame` + * `--no-deprecation` ++* `--no-experimental-fetch` + * `--no-experimental-global-navigator` + * `--no-experimental-repl-await` + * `--no-experimental-sqlite` +diff --git a/doc/node.1 b/doc/node.1 +index 6210cbf42b26d4673f67aac43874ea28c8955fd5..565068cc3aca0eb03642e1160b814b48cb0c3c45 100644 +--- a/doc/node.1 ++++ b/doc/node.1 +@@ -198,6 +198,9 @@ Enable transformation of TypeScript-only syntax into JavaScript code. + .It Fl -experimental-eventsource + Enable experimental support for the EventSource Web API. + . ++.It Fl -no-experimental-fetch ++Disable experimental support for the Fetch API. ++. + .It Fl -no-experimental-websocket + Disable experimental support for the WebSocket API. + . +diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js +index 35b43990c8f24f0888f89173f5662050a11b26ed..2c0d12c0fa9c85ac7ffb41dabda83760ed1ae3ee 100644 +--- a/lib/internal/process/pre_execution.js ++++ b/lib/internal/process/pre_execution.js +@@ -110,6 +110,7 @@ function prepareExecution(options) { + setupSQLite(); + setupQuic(); + setupWebStorage(); ++ setupFetch(); + setupWebsocket(); + setupEventsource(); + setupCodeCoverage(); +@@ -312,6 +313,16 @@ function setupWarningHandler() { + } + } + ++function setupFetch() { ++ if (getOptionValue('--no-experimental-fetch')) { ++ delete globalThis.fetch; ++ delete globalThis.FormData; ++ delete globalThis.Headers; ++ delete globalThis.Request; ++ delete globalThis.Response; ++ } ++} ++ + // https://websockets.spec.whatwg.org/ + function setupWebsocket() { + if (getOptionValue('--no-experimental-websocket')) { +diff --git a/src/node_options.cc b/src/node_options.cc +index 2a3ab5e73cdb98bde9df1465d5fb5e40ad7799f7..9317191d22f51fd75157e849eb67678d1ee6a2a1 100644 +--- a/src/node_options.cc ++++ b/src/node_options.cc +@@ -537,7 +537,11 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { + &EnvironmentOptions::experimental_eventsource, + kAllowedInEnvvar, + false); +- AddOption("--experimental-fetch", "", NoOp{}, kAllowedInEnvvar); ++ AddOption("--experimental-fetch", ++ "experimental Fetch API", ++ &EnvironmentOptions::experimental_fetch, ++ kAllowedInEnvvar, ++ true); + AddOption("--experimental-websocket", + "experimental WebSocket API", + &EnvironmentOptions::experimental_websocket, +diff --git a/test/parallel/test-process-env-allowed-flags-are-documented.js b/test/parallel/test-process-env-allowed-flags-are-documented.js +index f09bf0940dad2068f0aa5dce783dd422773d4bbb..ccf4ffcacf9bd9965978738656b8fe091fee4d6a 100644 +--- a/test/parallel/test-process-env-allowed-flags-are-documented.js ++++ b/test/parallel/test-process-env-allowed-flags-are-documented.js +@@ -122,7 +122,6 @@ const undocumented = difference(process.allowedNodeEnvironmentFlags, + assert(undocumented.delete('--debug-arraybuffer-allocations')); + assert(undocumented.delete('--no-debug-arraybuffer-allocations')); + assert(undocumented.delete('--es-module-specifier-resolution')); +-assert(undocumented.delete('--experimental-fetch')); + assert(undocumented.delete('--experimental-wasm-modules')); + assert(undocumented.delete('--experimental-global-customevent')); + assert(undocumented.delete('--experimental-global-webcrypto')); diff --git a/patches/node/fix_allow_passing_fileexists_fn_to_legacymainresolve.patch b/patches/node/fix_allow_passing_fileexists_fn_to_legacymainresolve.patch index b415690b0b764..5c4c34c59f50a 100644 --- a/patches/node/fix_allow_passing_fileexists_fn_to_legacymainresolve.patch +++ b/patches/node/fix_allow_passing_fileexists_fn_to_legacymainresolve.patch @@ -11,7 +11,7 @@ We can fix this by allowing the C++ implementation of legacyMainResolve to use a fileExists function that does take Asar into account. diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js -index e3afd30ba1f591d0298793bc42fd7166a4219bce..408dc96307d7f52f92db41004b358051a81c627c 100644 +index 72cc9444ca93ef7a1526e23314693aeaf5f173b0..79684dd7e8d1629b19be01ebf97e43e503dec581 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -28,14 +28,13 @@ const { BuiltinModule } = require('internal/bootstrap/realm'); @@ -53,10 +53,10 @@ index e3afd30ba1f591d0298793bc42fd7166a4219bce..408dc96307d7f52f92db41004b358051 const maybeMain = resolvedOption <= legacyMainResolveExtensionsIndexes.kResolvedByMainIndexNode ? packageConfig.main || './' : ''; diff --git a/src/node_file.cc b/src/node_file.cc -index e78326ed0de805a8bf4f621cad9158635eb44aa2..d7009937b31729f33d9c45cbda7f5440fbdac2aa 100644 +index 00f369e9691e184f9e5f226ce4216bd5b1d353ae..d73dac2ee3f1cf1cac6845fae0f702c9fba8fcef 100644 --- a/src/node_file.cc +++ b/src/node_file.cc -@@ -3502,13 +3502,25 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) { +@@ -3623,13 +3623,25 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) { } BindingData::FilePathIsFileReturnType BindingData::FilePathIsFile( @@ -83,7 +83,7 @@ index e78326ed0de805a8bf4f621cad9158635eb44aa2..d7009937b31729f33d9c45cbda7f5440 uv_fs_t req; int rc = uv_fs_stat(env->event_loop(), &req, file_path.c_str(), nullptr); -@@ -3566,6 +3578,11 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { +@@ -3687,6 +3699,11 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { std::optional<std::string> initial_file_path; std::string file_path; @@ -95,7 +95,7 @@ index e78326ed0de805a8bf4f621cad9158635eb44aa2..d7009937b31729f33d9c45cbda7f5440 if (args.Length() >= 2 && args[1]->IsString()) { auto package_config_main = Utf8Value(isolate, args[1]).ToString(); -@@ -3586,7 +3603,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { +@@ -3707,7 +3724,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { BufferValue buff_file_path(isolate, local_file_path); ToNamespacedPath(env, &buff_file_path); @@ -104,7 +104,7 @@ index e78326ed0de805a8bf4f621cad9158635eb44aa2..d7009937b31729f33d9c45cbda7f5440 case BindingData::FilePathIsFileReturnType::kIsFile: return args.GetReturnValue().Set(i); case BindingData::FilePathIsFileReturnType::kIsNotFile: -@@ -3623,7 +3640,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { +@@ -3744,7 +3761,7 @@ void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) { BufferValue buff_file_path(isolate, local_file_path); ToNamespacedPath(env, &buff_file_path); @@ -114,7 +114,7 @@ index e78326ed0de805a8bf4f621cad9158635eb44aa2..d7009937b31729f33d9c45cbda7f5440 return args.GetReturnValue().Set(i); case BindingData::FilePathIsFileReturnType::kIsNotFile: diff --git a/src/node_file.h b/src/node_file.h -index bdad1ae25f4892cbbfd8cc30c4d8b4a6f600edbc..099488319f53bc7718313d6e30df2237cad6771d 100644 +index 224fa6f7ade375cb673c8adcc95927fa04f9c248..343c6bec67e6cf70ffb91b87e7837dbaf6071cee 100644 --- a/src/node_file.h +++ b/src/node_file.h @@ -101,7 +101,8 @@ class BindingData : public SnapshotableObject { diff --git a/patches/node/fix_assert_module_in_the_renderer_process.patch b/patches/node/fix_assert_module_in_the_renderer_process.patch deleted file mode 100644 index bf7adcbd9a605..0000000000000 --- a/patches/node/fix_assert_module_in_the_renderer_process.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr <shelley.vohr@gmail.com> -Date: Wed, 16 Aug 2023 19:15:29 +0200 -Subject: fix: assert module in the renderer process - -When creating a Node.js Environment, embedders have the option to disable Node.js' -default overriding of Error.prepareStackTrace. However, the assert module depends on -a WeakMap that is populated with the error stacktraces in the overridden function. - -This adds handling to fall back to the default implementation if Error.prepareStackTrace -if the override has been disabled. - -This will be upstreamed. - -diff --git a/lib/internal/assert/utils.js b/lib/internal/assert/utils.js -index 13e41d67c635c27bd5e69eb4960eace34beaef0d..9a99c9ca93907630f9f3ba7ba24577a11465661c 100644 ---- a/lib/internal/assert/utils.js -+++ b/lib/internal/assert/utils.js -@@ -24,6 +24,7 @@ const AssertionError = require('internal/assert/assertion_error'); - const { openSync, closeSync, readSync } = require('fs'); - const { EOL } = require('internal/constants'); - const { BuiltinModule } = require('internal/bootstrap/realm'); -+const { getEmbedderOptions } = require('internal/options'); - const { isError } = require('internal/util'); - - const errorCache = new SafeMap(); -@@ -166,8 +167,16 @@ function getErrMessage(message, fn) { - ErrorCaptureStackTrace(err, fn); - if (errorStackTraceLimitIsWritable) Error.stackTraceLimit = tmpLimit; - -- overrideStackTrace.set(err, (_, stack) => stack); -- const call = err.stack[0]; -+ let call; -+ if (getEmbedderOptions().hasPrepareStackTraceCallback) { -+ overrideStackTrace.set(err, (_, stack) => stack); -+ call = err.stack[0]; -+ } else { -+ const tmpPrepare = Error.prepareStackTrace; -+ Error.prepareStackTrace = (_, stack) => stack; -+ call = err.stack[0]; -+ Error.prepareStackTrace = tmpPrepare; -+ } - - let filename = call.getFileName(); - const line = call.getLineNumber() - 1; -diff --git a/src/node_options.cc b/src/node_options.cc -index e3509abbc3bf84ac0edcd495eb3dde6219dbfc2d..8afded658c3f569de7b329ea9dddc11010748cf9 100644 ---- a/src/node_options.cc -+++ b/src/node_options.cc -@@ -1566,14 +1566,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) { - } - Isolate* isolate = args.GetIsolate(); - -- constexpr size_t kOptionsSize = 4; -+ constexpr size_t kOptionsSize = 5; - std::array<Local<Name>, kOptionsSize> names = { -+ FIXED_ONE_BYTE_STRING(env->isolate(), "hasPrepareStackTraceCallback"), - FIXED_ONE_BYTE_STRING(env->isolate(), "shouldNotRegisterESMLoader"), - FIXED_ONE_BYTE_STRING(env->isolate(), "noGlobalSearchPaths"), - FIXED_ONE_BYTE_STRING(env->isolate(), "noBrowserGlobals"), - FIXED_ONE_BYTE_STRING(env->isolate(), "hasEmbedderPreload")}; - - std::array<Local<Value>, kOptionsSize> values = { -+ Boolean::New(isolate, env->prepare_stack_trace_callback().IsEmpty()), - Boolean::New(isolate, env->should_not_register_esm_loader()), - Boolean::New(isolate, env->no_global_search_paths()), - Boolean::New(isolate, env->no_browser_globals()), diff --git a/patches/node/fix_avoid_external_memory_leak_on_invalid_tls_protocol_versions.patch b/patches/node/fix_avoid_external_memory_leak_on_invalid_tls_protocol_versions.patch new file mode 100644 index 0000000000000..d5cad3cb529b4 --- /dev/null +++ b/patches/node/fix_avoid_external_memory_leak_on_invalid_tls_protocol_versions.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr <shelley.vohr@gmail.com> +Date: Fri, 24 Oct 2025 15:32:50 +0200 +Subject: fix: avoid external memory leak on invalid TLS protocol versions + +Fixes a crash caused by unbalanced external memory accounting when +tls.createSecureContext() is called with invalid minVersion/maxVersion values: + +Prior to this change, _tls_common.js instantiated a native SecureContext +which incremented V8 external memory via +env->external_memory_accounter()->Increase(kExternalSize) in crypto_context.cc +before protocol version validation ran in toV(), so an early +ERR_TLS_INVALID_PROTOCOL_VERSION throw left the +1024 bytes un-decremented +and V8 asserted in ExternalMemoryAccounter::~ExternalMemoryAccounter +during Environment teardown. + +Fix this by reordering the constructor to validate minVersion/maxVersion first and +only allocate the native SecureContext on success. + +This should be upstreamed to Node.js. + +diff --git a/lib/_tls_common.js b/lib/_tls_common.js +index 66331d2d9999e93e59cbce9e153affb942b79946..0f7fd0747ea779f76a9e64ed37d195bd735ea2a8 100644 +--- a/lib/_tls_common.js ++++ b/lib/_tls_common.js +@@ -82,10 +82,11 @@ function SecureContext(secureProtocol, secureOptions, minVersion, maxVersion) { + throw new ERR_TLS_PROTOCOL_VERSION_CONFLICT(maxVersion, secureProtocol); + } + ++ const minV = toV('minimum', minVersion, tls.DEFAULT_MIN_VERSION); ++ const maxV = toV('maximum', maxVersion, tls.DEFAULT_MAX_VERSION); ++ + this.context = new NativeSecureContext(); +- this.context.init(secureProtocol, +- toV('minimum', minVersion, tls.DEFAULT_MIN_VERSION), +- toV('maximum', maxVersion, tls.DEFAULT_MAX_VERSION)); ++ this.context.init(secureProtocol, minV, maxV); + + if (secureOptions) { + validateInteger(secureOptions, 'secureOptions'); +diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc +index 8fbf4f25a91b953f3d2868889c7ee06932ee3c5f..96f6ea29525bc2c60297e7be5bc1d0b74cd568e1 100644 +--- a/src/crypto/crypto_context.cc ++++ b/src/crypto/crypto_context.cc +@@ -1355,10 +1355,8 @@ SecureContext::SecureContext(Environment* env, Local<Object> wrap) + } + + inline void SecureContext::Reset() { +- if (ctx_ != nullptr) { +- env()->external_memory_accounter()->Decrease(env()->isolate(), +- kExternalSize); +- } ++ env()->external_memory_accounter()->Decrease(env()->isolate(), ++ kExternalSize); + ctx_.reset(); + cert_.reset(); + issuer_.reset(); diff --git a/patches/node/fix_cppgc_initializing_twice.patch b/patches/node/fix_cppgc_initializing_twice.patch index 851b68cac311f..b3909737236af 100644 --- a/patches/node/fix_cppgc_initializing_twice.patch +++ b/patches/node/fix_cppgc_initializing_twice.patch @@ -12,10 +12,10 @@ This can be removed/refactored once Node.js upgrades to a version of V8 containing the above CL. diff --git a/src/node.cc b/src/node.cc -index f21687ad9dfd69c829aaaf8f3ed66b6bf6713765..17c29c759d4fa1a3b709c0844a80fbf509124d73 100644 +index c70bec82a28b166afa785d458d3f6c820d7b8565..5713d49d859e1161e1d6703c0b6f3d717a5a9a34 100644 --- a/src/node.cc +++ b/src/node.cc -@@ -1246,7 +1246,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, +@@ -1245,7 +1245,7 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, result->platform_ = per_process::v8_platform.Platform(); } diff --git a/patches/node/fix_crypto_tests_to_run_with_bssl.patch b/patches/node/fix_crypto_tests_to_run_with_bssl.patch index 72c38d7c08705..14871fd9456bb 100644 --- a/patches/node/fix_crypto_tests_to_run_with_bssl.patch +++ b/patches/node/fix_crypto_tests_to_run_with_bssl.patch @@ -10,8 +10,541 @@ This should be upstreamed in some form, though it may need to be tweaked before it's acceptable to upstream, as this patch comments out a couple of tests that upstream probably cares about. +diff --git a/test/fixtures/crypto/ecdsa.js b/test/fixtures/crypto/ecdsa.js +index b8827b24d41965b355c6e8bbf33ebc2c034a9035..c3545fb20ec7df3e6c3d8e7c3396030af85637c0 100644 +--- a/test/fixtures/crypto/ecdsa.js ++++ b/test/fixtures/crypto/ecdsa.js +@@ -72,18 +72,20 @@ module.exports = function() { + 'b6a0a14d7e4bc6dd2eda82c9234f174b670b60c8f7d101f68fdf5889e02373b025' + + 'dcbc4c82f2929b8e06c68535da98e38fe399c53a814b097935581ef21535eb', + 'hex'), +- 'SHA3-256': Buffer.from( +- 'f6a48eb5557f484ed0c3e4b5c78a3cf497cbd346db06a4165d429248aa2cc51a69' + +- '747d09f57af145469a8b607a9b8b9709629d74e8f5ca337c6ddc581b6f6103', +- 'hex'), +- 'SHA3-384': Buffer.from( +- '777785978eb59da32888554dc7fd62d1ba1a3033cddaa8c36b8f3dcea8f85e1c8e' + +- '6db26f509747bd144dfa9436784bf4abbcaa6abcf1ecc09cea3b921d46738c', +- 'hex'), +- 'SHA3-512': Buffer.from( +- '0f01c2083b5dd7fccb2784563f88cd9a815d570a1690695e426643ab725780760d' + +- 'e972e26e18d67f5557be89f17b4cd0065ce2937de299bdb2e972ebf7635084', +- 'hex') ++ ...(!process.features.openssl_is_boringssl ? { ++ 'SHA3-256': Buffer.from( ++ 'f6a48eb5557f484ed0c3e4b5c78a3cf497cbd346db06a4165d429248aa2cc51a69' + ++ '747d09f57af145469a8b607a9b8b9709629d74e8f5ca337c6ddc581b6f6103', ++ 'hex'), ++ 'SHA3-384': Buffer.from( ++ '777785978eb59da32888554dc7fd62d1ba1a3033cddaa8c36b8f3dcea8f85e1c8e' + ++ '6db26f509747bd144dfa9436784bf4abbcaa6abcf1ecc09cea3b921d46738c', ++ 'hex'), ++ 'SHA3-512': Buffer.from( ++ '0f01c2083b5dd7fccb2784563f88cd9a815d570a1690695e426643ab725780760d' + ++ 'e972e26e18d67f5557be89f17b4cd0065ce2937de299bdb2e972ebf7635084', ++ 'hex') ++ } : {}) + }, + 'P-384': { + 'SHA-1': Buffer.from( +@@ -102,18 +104,20 @@ module.exports = function() { + '72fbdb369fd34c1c54264d07f4facd69b02e4206f8a8bb259b882a305c56fde2d3' + + '5107e493c53cd6b4af0b31306f4d03fd43cfc762a1030e17a3d775453a1212b142' + + '9f7b3d93066a5f42a10b138cd177dc09616e827d598822d78d4627b754e6', 'hex'), +- 'SHA3-256': Buffer.from( +- '0b07c078be30fa5925a307d6fc559c5f398e63fb5d007d6b24a834847f2d3d18d5' + +- 'b5e840711c52a7bc6626c3ced93301e873c013a706f6b297c12cc6d47a71e0529e' + +- '719f43957de9995621d3cb0217469adaa6fd3135470771d0aa9d05d7a9c6', 'hex'), +- 'SHA3-384': Buffer.from( +- '2f36e8b04af46f68ef900c2720e3518b06f5440865d44072bbad5d62288c575042' + +- 'b183a372acd70328c738668dcecb9866801462d62df3c35450fdc6c95433103fcd' + +- 'c77999b640e3f92bd4e9be6e27ab129d1bc4f0b2a4c829388666920892d3', 'hex'), +- 'SHA3-512': Buffer.from( +- '32a951e886c33ac57a008efe9643bc92aa3ece9521d115e0c7240caecf124d1f7c' + +- 'dcba7fabb9ad5202e04f7aa591ab01ed3f060f04f493e4f24430fe8159200612f0' + +- '2849108b8be6edc8494c328097ad9265928efe5cb9d91be2f013ee17ee4e', 'hex') ++ ...(!process.features.openssl_is_boringssl ? { ++ 'SHA3-256': Buffer.from( ++ '0b07c078be30fa5925a307d6fc559c5f398e63fb5d007d6b24a834847f2d3d18d5' + ++ 'b5e840711c52a7bc6626c3ced93301e873c013a706f6b297c12cc6d47a71e0529e' + ++ '719f43957de9995621d3cb0217469adaa6fd3135470771d0aa9d05d7a9c6', 'hex'), ++ 'SHA3-384': Buffer.from( ++ '2f36e8b04af46f68ef900c2720e3518b06f5440865d44072bbad5d62288c575042' + ++ 'b183a372acd70328c738668dcecb9866801462d62df3c35450fdc6c95433103fcd' + ++ 'c77999b640e3f92bd4e9be6e27ab129d1bc4f0b2a4c829388666920892d3', 'hex'), ++ 'SHA3-512': Buffer.from( ++ '32a951e886c33ac57a008efe9643bc92aa3ece9521d115e0c7240caecf124d1f7c' + ++ 'dcba7fabb9ad5202e04f7aa591ab01ed3f060f04f493e4f24430fe8159200612f0' + ++ '2849108b8be6edc8494c328097ad9265928efe5cb9d91be2f013ee17ee4e', 'hex') ++ } : {}) + }, + 'P-521': { + 'SHA-1': Buffer.from( +@@ -140,29 +144,35 @@ module.exports = function() { + '01f0071e6a32867fa70f695cd39c4e87e142b9e4134d38740bd6fee354a575167e' + + '13524e94832637910fe11e53a85fb21b91adb81bb1779c4e2b8bc87c717dc35084', + 'hex'), +- 'SHA3-256': Buffer.from( +- '00463679f47a4c705e03447360dcf34d1743e0d4b2591cc66832a6bc80d92e538c' + +- '169a1fd330f98e7235ca7fec7e16ac44fb13095b8edf2c76b75c4845177d59e425' + +- '0127c4359f6a4c9ccb63e7a9ff8122c0b4a8b7408e28c96817ecc3baf8c559c413' + +- 'c3bb580447dec9f52139b2afde369cd51730f050bc94137556ae137f0509464219', +- 'hex'), +- 'SHA3-384': Buffer.from( +- '01969a4db0888bc067a68a31fe5d0fc97e0b701f570565f7b25cb27707c6f020ff' + +- '680f8553ec5c2d6885e9e91b39262ed1bde375525eb13fdf12089b7939c7689735' + +- '0101c8b8d1129a217e8e956bef78cf7b9a0458523b04ac8e0b84ce73d54326f7a8' + +- '704ee42fe183f3ef79d83e676f34dc5476e2342641a5b973d3d94e8503676fbbc5', +- 'hex'), +- 'SHA3-512': Buffer.from( +- '000f362e914ee0136663cf57bf4085c25604af6dc198b4818751e1195ee7e41a16' + +- '91be909dcbc2bae00b8917f6bb918eae3740ac1b76e0913137c2da1171d6400b55' + +- '01ec6e1dc5987a27fe16fc2ce5c8e954088f898a9bbefb176eaa8bbd9ccc264c4c' + +- 'cc38c83ac8b5a168f90228daf8405a2b9bf7829c263a646b4e1098e2ace38deec7', +- 'hex') ++ ...(!process.features.openssl_is_boringssl ? { ++ 'SHA3-256': Buffer.from( ++ '00463679f47a4c705e03447360dcf34d1743e0d4b2591cc66832a6bc80d92e538c' + ++ '169a1fd330f98e7235ca7fec7e16ac44fb13095b8edf2c76b75c4845177d59e425' + ++ '0127c4359f6a4c9ccb63e7a9ff8122c0b4a8b7408e28c96817ecc3baf8c559c413' + ++ 'c3bb580447dec9f52139b2afde369cd51730f050bc94137556ae137f0509464219', ++ 'hex'), ++ 'SHA3-384': Buffer.from( ++ '01969a4db0888bc067a68a31fe5d0fc97e0b701f570565f7b25cb27707c6f020ff' + ++ '680f8553ec5c2d6885e9e91b39262ed1bde375525eb13fdf12089b7939c7689735' + ++ '0101c8b8d1129a217e8e956bef78cf7b9a0458523b04ac8e0b84ce73d54326f7a8' + ++ '704ee42fe183f3ef79d83e676f34dc5476e2342641a5b973d3d94e8503676fbbc5', ++ 'hex'), ++ 'SHA3-512': Buffer.from( ++ '000f362e914ee0136663cf57bf4085c25604af6dc198b4818751e1195ee7e41a16' + ++ '91be909dcbc2bae00b8917f6bb918eae3740ac1b76e0913137c2da1171d6400b55' + ++ '01ec6e1dc5987a27fe16fc2ce5c8e954088f898a9bbefb176eaa8bbd9ccc264c4c' + ++ 'cc38c83ac8b5a168f90228daf8405a2b9bf7829c263a646b4e1098e2ace38deec7', ++ 'hex') ++ } : {}) + } + } + + const curves = ['P-256', 'P-384', 'P-521']; +- const hashes = ['SHA-1', 'SHA-256', 'SHA-384', 'SHA-512', 'SHA3-256', 'SHA3-384', 'SHA3-512']; ++ const hashes = ['SHA-1', 'SHA-256', 'SHA-384', 'SHA-512']; ++ ++ if (!process.features.openssl_is_boringssl) { ++ hashes.push('SHA3-256', 'SHA3-384', 'SHA3-512'); ++ } + + const vectors = []; + curves.forEach((namedCurve) => { +diff --git a/test/fixtures/crypto/hmac.js b/test/fixtures/crypto/hmac.js +index 6505c6e2ae55b55b2474f1b9c53f2da1e66c852e..acdf3229a4bc7cfc45c664718e7396f71025624a 100644 +--- a/test/fixtures/crypto/hmac.js ++++ b/test/fixtures/crypto/hmac.js +@@ -22,16 +22,18 @@ module.exports = function () { + '5dcc359443aaf652fa1375d6b3e61fdcf29bb4a28bd5d3dcfa40f82f906bb280' + + '0455db03b5d31fb972a15a6d0103a24e56d156a119c0e5a1e92a44c3c5657cf9', + 'hex'), +- 'SHA3-256': Buffer.from( +- 'e588ec0811463d767241df1074b47ae4071b51f2ce36537ba69ccdc3fdc2b7a8', +- 'hex'), +- 'SHA3-384': Buffer.from( +- '6b1da28eab1f582ad9718effe05e23d5fd2c9877a2d9443f90bec093bece2ea7' + +- 'd2354cd0bdc5e147d2e9009373494488', 'hex'), +- 'SHA3-512': Buffer.from( +- '5dcc359443aaf652fa1375d6b3e61fdcf29bb4a28bd5d3dcfa40f82f906bb280' + +- '0455db03b5d31fb972a15a6d0103a24e56d156a119c0e5a1e92a44c3c5657cf9', +- 'hex') ++ ...(!process.features.openssl_is_boringssl ? { ++ 'SHA3-256': Buffer.from( ++ 'e588ec0811463d767241df1074b47ae4071b51f2ce36537ba69ccdc3fdc2b7a8', ++ 'hex'), ++ 'SHA3-384': Buffer.from( ++ '6b1da28eab1f582ad9718effe05e23d5fd2c9877a2d9443f90bec093bece2ea7' + ++ 'd2354cd0bdc5e147d2e9009373494488', 'hex'), ++ 'SHA3-512': Buffer.from( ++ '5dcc359443aaf652fa1375d6b3e61fdcf29bb4a28bd5d3dcfa40f82f906bb280' + ++ '0455db03b5d31fb972a15a6d0103a24e56d156a119c0e5a1e92a44c3c5657cf9', ++ 'hex') ++ } : {}) + } + + const signatures = { +@@ -46,16 +48,18 @@ module.exports = function () { + '61fb278c3ffb0cce2bf1cf723ddfd8ef1f931c0c618c25907324605939e3f9a2' + + 'c6f4af690bda3407dc2f5770f6a0a44b954d64a332e3ee0821abf82b7f3e99c1', + 'hex'), +- 'SHA3-256': Buffer.from( +- 'c1ac5e11fcd50c48bf567f6e296632f5801c4eb07a8a47579b41dee971a3099b', +- 'hex'), +- 'SHA3-384': Buffer.from( +- 'ac8c97f6dd8d9e16101063077c16b23fe291a5e6d149653e9ac7002365159317' + +- 'adcfad511996578b0053a5c14b75f16c', 'hex'), +- 'SHA3-512': Buffer.from( +- '2162c2a8907e6b2f68599a69e81a464d8f076b5eeb555d98b4d20330034df3c7' + +- 'cf35b1fa958a074ca12f0d242df39f0da3d4f1dbfb3629057798fe1f883974ee', +- 'hex') ++ ...(!process.features.openssl_is_boringssl ? { ++ 'SHA3-256': Buffer.from( ++ 'c1ac5e11fcd50c48bf567f6e296632f5801c4eb07a8a47579b41dee971a3099b', ++ 'hex'), ++ 'SHA3-384': Buffer.from( ++ 'ac8c97f6dd8d9e16101063077c16b23fe291a5e6d149653e9ac7002365159317' + ++ 'adcfad511996578b0053a5c14b75f16c', 'hex'), ++ 'SHA3-512': Buffer.from( ++ '2162c2a8907e6b2f68599a69e81a464d8f076b5eeb555d98b4d20330034df3c7' + ++ 'cf35b1fa958a074ca12f0d242df39f0da3d4f1dbfb3629057798fe1f883974ee', ++ 'hex') ++ } : {}) + } + + const vectors = []; +diff --git a/test/fixtures/crypto/rsa_pkcs.js b/test/fixtures/crypto/rsa_pkcs.js +index 4630e4af9135800ad0fc604f99ac578d36984ca2..d54c44b6d820d83f997cc5e1b94fe5b5f151c013 100644 +--- a/test/fixtures/crypto/rsa_pkcs.js ++++ b/test/fixtures/crypto/rsa_pkcs.js +@@ -97,33 +97,35 @@ module.exports = function () { + '7a6335c70e193235dcda48add6858626bd96311e60f7e5ea4491b6c1e6248afe12b' + + 'bbd54f8869b043a5b0444562813f0a98b300356f306e6b783a29f3bec97ca40ea20' + + '062cab8926ec5d96aa387cc84821a6d72b8ea126e7d', 'hex'), +- 'sha3-256': Buffer.from( +- 'be1b476c1911a01d71710fd8a2f3158d6f7839e91443b01bed30dfdd04336d80c6b' + +- 'f692c06fad254877901c10a73853e8fb202a29cddefdf16c3adcda1fc123625897d' + +- '1b81b32a9dec38957e023be221d8f31e7470ad32e761edce9170eefa37ec19bd0c3' + +- 'e0b0ad2a244e98f54a08f873efb63c6fad14d7322b50eb05b6bae767305da92a90a' + +- '53cdae52b0d81e158a00003ec626e50423b7377a34a7b28cc7483b55bfde05bd431' + +- 'cfa436c38c285531e0d476ee13f151c8ae832ffd51ba00f2ab06f1844e73c0fe0f6' + +- 'ce17d966b1e07727af4161368aa0a74a594a6fdb782b46a9ae6098799c366fc0d71' + +- '1b2d965cf5eeeed9175b39b1d0bcefdd7df376e8ac9', 'hex'), +- 'sha3-384': Buffer.from( +- '002eaf5837443f1a33dc03729a308c503888d7a8cc013be424a91bce18105f7334a' + +- '499a5eddc5f4fab2fdf80f52988d53bf8bd5e78c3ce1a43abaf3b8146c260b6ce8b' + +- 'ffc9857f4b35c190cea85921c46d3ab573113744472d1afb637a0e9ab5021bcb355' + +- '7f5b52faf89fa864a7d3bf5799096c54ee53fa139e1bc13842a2a5bf0f1d85f041d' + +- 'a4e0e87425b421f22f0240ad62ef77ba6f090e0d48e17c07fd1e477c7e16a3196f5' + +- '0142d0f0c5e525a10325569e5a1f50cb4577e782a643972857cc918ae5409587d9e' + +- '44e1c1e89540e87deed7dda5005ac63ba609f522fdd92c81d95c1ffa383558a10f3' + +- '064f59ca0534bfad31acbf3e2807cb7d3147c59ee4d', 'hex'), +- 'sha3-512': Buffer.from( +- '561585b621c916453762285c8bb6ede3f303074ad6f2826ca15b3900e49c4d94c07' + +- 'aab0b875eaa79049ba2ed97e9a87c44fff9bffe638a1bf8c4db69c627b6adbe8fca' + +- '2b38cb8b4c2810a16286bef498327b9db4b53043ed5012c7c58f037edf669baf772' + +- '9b58e413e133ebb90a5fcb6dc3936f4f87971c0e85f362189b4279bbb2d9293a427' + +- '5653068c1bc8772cebc4733a5d1df0b454d4f628c645c22bb1c8cc601fbc92dc091' + +- 'db38fad4a36289ae9ed424c46643a8161a102ae511877d25f2eab7342dff6b92bf3' + +- '65951e76ee84c2bd84a595f63d7cc04d00e1589870956491e518b3ba245efc37a28' + +- 'ec018d8788a92ab93a90bb314f9ab0788a0b5b50489', 'hex') ++ ...(!process.features.openssl_is_boringssl ? { ++ 'sha3-256': Buffer.from( ++ 'be1b476c1911a01d71710fd8a2f3158d6f7839e91443b01bed30dfdd04336d80c6b' + ++ 'f692c06fad254877901c10a73853e8fb202a29cddefdf16c3adcda1fc123625897d' + ++ '1b81b32a9dec38957e023be221d8f31e7470ad32e761edce9170eefa37ec19bd0c3' + ++ 'e0b0ad2a244e98f54a08f873efb63c6fad14d7322b50eb05b6bae767305da92a90a' + ++ '53cdae52b0d81e158a00003ec626e50423b7377a34a7b28cc7483b55bfde05bd431' + ++ 'cfa436c38c285531e0d476ee13f151c8ae832ffd51ba00f2ab06f1844e73c0fe0f6' + ++ 'ce17d966b1e07727af4161368aa0a74a594a6fdb782b46a9ae6098799c366fc0d71' + ++ '1b2d965cf5eeeed9175b39b1d0bcefdd7df376e8ac9', 'hex'), ++ 'sha3-384': Buffer.from( ++ '002eaf5837443f1a33dc03729a308c503888d7a8cc013be424a91bce18105f7334a' + ++ '499a5eddc5f4fab2fdf80f52988d53bf8bd5e78c3ce1a43abaf3b8146c260b6ce8b' + ++ 'ffc9857f4b35c190cea85921c46d3ab573113744472d1afb637a0e9ab5021bcb355' + ++ '7f5b52faf89fa864a7d3bf5799096c54ee53fa139e1bc13842a2a5bf0f1d85f041d' + ++ 'a4e0e87425b421f22f0240ad62ef77ba6f090e0d48e17c07fd1e477c7e16a3196f5' + ++ '0142d0f0c5e525a10325569e5a1f50cb4577e782a643972857cc918ae5409587d9e' + ++ '44e1c1e89540e87deed7dda5005ac63ba609f522fdd92c81d95c1ffa383558a10f3' + ++ '064f59ca0534bfad31acbf3e2807cb7d3147c59ee4d', 'hex'), ++ 'sha3-512': Buffer.from( ++ '561585b621c916453762285c8bb6ede3f303074ad6f2826ca15b3900e49c4d94c07' + ++ 'aab0b875eaa79049ba2ed97e9a87c44fff9bffe638a1bf8c4db69c627b6adbe8fca' + ++ '2b38cb8b4c2810a16286bef498327b9db4b53043ed5012c7c58f037edf669baf772' + ++ '9b58e413e133ebb90a5fcb6dc3936f4f87971c0e85f362189b4279bbb2d9293a427' + ++ '5653068c1bc8772cebc4733a5d1df0b454d4f628c645c22bb1c8cc601fbc92dc091' + ++ 'db38fad4a36289ae9ed424c46643a8161a102ae511877d25f2eab7342dff6b92bf3' + ++ '65951e76ee84c2bd84a595f63d7cc04d00e1589870956491e518b3ba245efc37a28' + ++ 'ec018d8788a92ab93a90bb314f9ab0788a0b5b50489', 'hex') ++ } : {}) + } + + const vectors = [ +@@ -159,30 +161,32 @@ module.exports = function () { + plaintext, + signature: signatures['sha-512'] + }, +- { +- publicKeyBuffer: spki, +- privateKeyBuffer: pkcs8, +- algorithm: { name: 'RSASSA-PKCS1-v1_5' }, +- hash: 'SHA3-256', +- plaintext, +- signature: signatures['sha3-256'] +- }, +- { +- publicKeyBuffer: spki, +- privateKeyBuffer: pkcs8, +- algorithm: { name: 'RSASSA-PKCS1-v1_5' }, +- hash: 'SHA3-384', +- plaintext, +- signature: signatures['sha3-384'] +- }, +- { +- publicKeyBuffer: spki, +- privateKeyBuffer: pkcs8, +- algorithm: { name: 'RSASSA-PKCS1-v1_5' }, +- hash: 'SHA3-512', +- plaintext, +- signature: signatures['sha3-512'] +- }, ++ ...(!process.features.openssl_is_boringssl ? [ ++ { ++ publicKeyBuffer: spki, ++ privateKeyBuffer: pkcs8, ++ algorithm: { name: 'RSASSA-PKCS1-v1_5' }, ++ hash: 'SHA3-256', ++ plaintext, ++ signature: signatures['sha3-256'] ++ }, ++ { ++ publicKeyBuffer: spki, ++ privateKeyBuffer: pkcs8, ++ algorithm: { name: 'RSASSA-PKCS1-v1_5' }, ++ hash: 'SHA3-384', ++ plaintext, ++ signature: signatures['sha3-384'] ++ }, ++ { ++ publicKeyBuffer: spki, ++ privateKeyBuffer: pkcs8, ++ algorithm: { name: 'RSASSA-PKCS1-v1_5' }, ++ hash: 'SHA3-512', ++ plaintext, ++ signature: signatures['sha3-512'] ++ }, ++ ] : []), + ]; + + return vectors; +diff --git a/test/fixtures/crypto/rsa_pss.js b/test/fixtures/crypto/rsa_pss.js +index 101122b2ffe31c8dc903ff8852212d9f55c0badd..fa0bcceb5697486930a9530732f9a9ab6e1bb5b0 100644 +--- a/test/fixtures/crypto/rsa_pss.js ++++ b/test/fixtures/crypto/rsa_pss.js +@@ -1,6 +1,6 @@ + 'use strict'; + +-module.exports = function() { ++module.exports = function () { + const pkcs8 = Buffer.from( + '308204bf020100300d06092a864886f70d0101010500048204a9308204a5020100028' + + '2010100d3576092e62957364544e7e4233b7bdb293db2085122c479328546f9f0f712' + +@@ -150,42 +150,44 @@ module.exports = function() { + 'b68c04bfe452c3adc6c10066a915231b7b404727eb6201b4921eb96d9407de2b963' + + '3879ceb71d759d9828d7b4d062f6ef100757d8328187caf57dfb859d1555345207c' + + '1cce7905c3564c08fec78867a53d5a2cf84810e1ffa', 'hex'), +- 'sha3-512, no salt': Buffer.from( +- 'd2430dc87abeaa7d13f7cec8510f1a296e1c608f44b1696829c59a99e8eefe9b2ee' + +- '6ee8ad6fdc93c24fcba2f04d1da195924b6209717e1992c10ed9f4783478765fe34' + +- '3e761203bff9d326bb6dc2061b0a7554c8ce0814b29249136c20c8e30054df0c6bc' + +- '656509a82845149368896690e32ff5dd32ef01543686f01d6a69bb438b049e66a8b' + +- 'df485a13edcd7dc482da4cc57d0b740aca3e56f0da247794e600afd27b22b6da13b' + +- 'cc15dd2059b525f8cb6bcd07540aa843f0ae51d4b0eea27045485914b908bdd01d0' + +- 'a9d42379f9f7180f4ad162ff73df5fed0200eb02ad01473975d54a77c15a9c61a3c' + +- 'b5e27de5d1eecc363d45506f7123a5ddd115c5e4c9e', 'hex'), +- 'sha3-256, salted': Buffer.from( +- '59cb9cce6ae838eb20d38d6af4acb9b866b0753bb7df9e441037d788512c03279e8' + +- '3d9a9cf5c0921fe1c0b6e8e895a8c0ad24a18b123f809b34ef2a3a1f05974030320' + +- '435692ef5d378cef4368c3658c098a25371dfaf1c0b6910f653a4ec15f2c08956c1' + +- '405136c2aba7f25a808fa7dbf57a4cb2978bd91af710b27ee239d955c8cac7a76ae' + +- '9085cefeda2a585a99cc948f064b5da66a9c4aa4f3f767ac905a9f314b47038e05c' + +- '3608fbb7e67a278e4f009a62c3cd3fdf43692e759d9361be1217999a76a69d4d119' + +- 'f8791a90e207e46b3f6125721f56fd819292d06a3cdae2c62c9a1dc0d964a06036c' + +- '8c18661cc6c873532a3536ab51e1ce210926db299e2', 'hex'), +- 'sha3-384, salted': Buffer.from( +- '8d1f9297c8169f27f0c58827dba991d862de58c1155f612ad2995d2bf862d051c4a' + +- '91b48571849b0412384382e5b77990de6a3c84010046b35c4a504f175a3479483d9' + +- '5c58f86bb96d53a27e59d6f67fddaae295ce90610f5086acc711557c2c85aac32d3' + +- '24199cff2367ae44e1d91307a98c8cbfb085a8bce6b1c20714711bc15b0eddb7881' + +- '823227d4be477ffdad8093663a6a1fc62eb39c49c2c3a821c2b202cf7904b49ca92' + +- '3c83819602bb13931577354a80f99309030044935b1cd41f0513160e661db1959fb' + +- '1ec15f087f3d288e875d54cbf070ec860b0aeecc951ea65e97cd5460750d4b7de52' + +- '22cb9e7466b1f506ecf6a81fc399dfd8334160f9084', 'hex'), +- 'sha3-512, salted': Buffer.from( +- '7b6d7be418c5d37cc8070698b8b03d818ecd8b673d047d34921913f6d59c69cb496' + +- '172d6118207d9ff92b8e1246acf0e03a845d935a70f8a82c3d5d6db6a1a0e337269' + +- '4b904372413dcbaa7ac5486bc8ccaf70d7e9470be82b928a90017e272cf9761ed26' + +- 'c160fe874a2675a4fb2acad72c50fbfffdd70b5a6f2919553d7ea1829934670f8de' + +- 'f2a5c2816404b1aa153323c92c58400622f184b9b0463fa48d6b27091f68c287e3f' + +- '6d9ab9eb451711a5d984c547f3d56f14a686a89ddf36c47ce25092b8c6530904de9' + +- '5df7fc602fe9394315f1b1847aae304cb5ad71e2cb78acfbc997a87a9d62a6898bb' + +- '6d84a81bb89b50186265f4be171a93d837a4bf777c8', 'hex') ++ ...(!process.features.openssl_is_boringssl ? { ++ 'sha3-512, no salt': Buffer.from( ++ 'd2430dc87abeaa7d13f7cec8510f1a296e1c608f44b1696829c59a99e8eefe9b2ee' + ++ '6ee8ad6fdc93c24fcba2f04d1da195924b6209717e1992c10ed9f4783478765fe34' + ++ '3e761203bff9d326bb6dc2061b0a7554c8ce0814b29249136c20c8e30054df0c6bc' + ++ '656509a82845149368896690e32ff5dd32ef01543686f01d6a69bb438b049e66a8b' + ++ 'df485a13edcd7dc482da4cc57d0b740aca3e56f0da247794e600afd27b22b6da13b' + ++ 'cc15dd2059b525f8cb6bcd07540aa843f0ae51d4b0eea27045485914b908bdd01d0' + ++ 'a9d42379f9f7180f4ad162ff73df5fed0200eb02ad01473975d54a77c15a9c61a3c' + ++ 'b5e27de5d1eecc363d45506f7123a5ddd115c5e4c9e', 'hex'), ++ 'sha3-256, salted': Buffer.from( ++ '59cb9cce6ae838eb20d38d6af4acb9b866b0753bb7df9e441037d788512c03279e8' + ++ '3d9a9cf5c0921fe1c0b6e8e895a8c0ad24a18b123f809b34ef2a3a1f05974030320' + ++ '435692ef5d378cef4368c3658c098a25371dfaf1c0b6910f653a4ec15f2c08956c1' + ++ '405136c2aba7f25a808fa7dbf57a4cb2978bd91af710b27ee239d955c8cac7a76ae' + ++ '9085cefeda2a585a99cc948f064b5da66a9c4aa4f3f767ac905a9f314b47038e05c' + ++ '3608fbb7e67a278e4f009a62c3cd3fdf43692e759d9361be1217999a76a69d4d119' + ++ 'f8791a90e207e46b3f6125721f56fd819292d06a3cdae2c62c9a1dc0d964a06036c' + ++ '8c18661cc6c873532a3536ab51e1ce210926db299e2', 'hex'), ++ 'sha3-384, salted': Buffer.from( ++ '8d1f9297c8169f27f0c58827dba991d862de58c1155f612ad2995d2bf862d051c4a' + ++ '91b48571849b0412384382e5b77990de6a3c84010046b35c4a504f175a3479483d9' + ++ '5c58f86bb96d53a27e59d6f67fddaae295ce90610f5086acc711557c2c85aac32d3' + ++ '24199cff2367ae44e1d91307a98c8cbfb085a8bce6b1c20714711bc15b0eddb7881' + ++ '823227d4be477ffdad8093663a6a1fc62eb39c49c2c3a821c2b202cf7904b49ca92' + ++ '3c83819602bb13931577354a80f99309030044935b1cd41f0513160e661db1959fb' + ++ '1ec15f087f3d288e875d54cbf070ec860b0aeecc951ea65e97cd5460750d4b7de52' + ++ '22cb9e7466b1f506ecf6a81fc399dfd8334160f9084', 'hex'), ++ 'sha3-512, salted': Buffer.from( ++ '7b6d7be418c5d37cc8070698b8b03d818ecd8b673d047d34921913f6d59c69cb496' + ++ '172d6118207d9ff92b8e1246acf0e03a845d935a70f8a82c3d5d6db6a1a0e337269' + ++ '4b904372413dcbaa7ac5486bc8ccaf70d7e9470be82b928a90017e272cf9761ed26' + ++ 'c160fe874a2675a4fb2acad72c50fbfffdd70b5a6f2919553d7ea1829934670f8de' + ++ 'f2a5c2816404b1aa153323c92c58400622f184b9b0463fa48d6b27091f68c287e3f' + ++ '6d9ab9eb451711a5d984c547f3d56f14a686a89ddf36c47ce25092b8c6530904de9' + ++ '5df7fc602fe9394315f1b1847aae304cb5ad71e2cb78acfbc997a87a9d62a6898bb' + ++ '6d84a81bb89b50186265f4be171a93d837a4bf777c8', 'hex') ++ } : {}) + } + + const vectors = [ +@@ -253,54 +255,56 @@ module.exports = function() { + plaintext, + signature: signatures['sha-512, salted'] + }, +- { +- publicKeyBuffer: spki, +- privateKeyBuffer: pkcs8, +- algorithm: { name: 'RSA-PSS', saltLength: 0 }, +- hash: 'SHA3-256', +- plaintext, +- signature: signatures['sha3-256, no salt'] +- }, +- { +- publicKeyBuffer: spki, +- privateKeyBuffer: pkcs8, +- algorithm: { name: 'RSA-PSS', saltLength: 0 }, +- hash: 'SHA3-384', +- plaintext, +- signature: signatures['sha3-384, no salt'] +- }, +- { +- publicKeyBuffer: spki, +- privateKeyBuffer: pkcs8, +- algorithm: { name: 'RSA-PSS', saltLength: 0 }, +- hash: 'SHA3-512', +- plaintext, +- signature: signatures['sha3-512, no salt'] +- }, +- { +- publicKeyBuffer: spki, +- privateKeyBuffer: pkcs8, +- algorithm: { name: 'RSA-PSS', saltLength: 32 }, +- hash: 'SHA3-256', +- plaintext, +- signature: signatures['sha3-256, salted'] +- }, +- { +- publicKeyBuffer: spki, +- privateKeyBuffer: pkcs8, +- algorithm: { name: 'RSA-PSS', saltLength: 48 }, +- hash: 'SHA3-384', +- plaintext, +- signature: signatures['sha3-384, salted'] +- }, +- { +- publicKeyBuffer: spki, +- privateKeyBuffer: pkcs8, +- algorithm: { name: 'RSA-PSS', saltLength: 64 }, +- hash: 'SHA3-512', +- plaintext, +- signature: signatures['sha3-512, salted'] +- } ++ ...(!process.features.openssl_is_boringssl ? [ ++ { ++ publicKeyBuffer: spki, ++ privateKeyBuffer: pkcs8, ++ algorithm: { name: 'RSA-PSS', saltLength: 0 }, ++ hash: 'SHA3-256', ++ plaintext, ++ signature: signatures['sha3-256, no salt'] ++ }, ++ { ++ publicKeyBuffer: spki, ++ privateKeyBuffer: pkcs8, ++ algorithm: { name: 'RSA-PSS', saltLength: 0 }, ++ hash: 'SHA3-384', ++ plaintext, ++ signature: signatures['sha3-384, no salt'] ++ }, ++ { ++ publicKeyBuffer: spki, ++ privateKeyBuffer: pkcs8, ++ algorithm: { name: 'RSA-PSS', saltLength: 0 }, ++ hash: 'SHA3-512', ++ plaintext, ++ signature: signatures['sha3-512, no salt'] ++ }, ++ { ++ publicKeyBuffer: spki, ++ privateKeyBuffer: pkcs8, ++ algorithm: { name: 'RSA-PSS', saltLength: 32 }, ++ hash: 'SHA3-256', ++ plaintext, ++ signature: signatures['sha3-256, salted'] ++ }, ++ { ++ publicKeyBuffer: spki, ++ privateKeyBuffer: pkcs8, ++ algorithm: { name: 'RSA-PSS', saltLength: 48 }, ++ hash: 'SHA3-384', ++ plaintext, ++ signature: signatures['sha3-384, salted'] ++ }, ++ { ++ publicKeyBuffer: spki, ++ privateKeyBuffer: pkcs8, ++ algorithm: { name: 'RSA-PSS', saltLength: 64 }, ++ hash: 'SHA3-512', ++ plaintext, ++ signature: signatures['sha3-512, salted'] ++ } ++ ] : []), + ]; + + return vectors; +diff --git a/test/fixtures/webcrypto/supports-modern-algorithms.mjs b/test/fixtures/webcrypto/supports-modern-algorithms.mjs +index 337ed577b143062d41e378cc1f820945e76cea08..76d5e805cbc0e756aef0013373baec31bd320f44 100644 +--- a/test/fixtures/webcrypto/supports-modern-algorithms.mjs ++++ b/test/fixtures/webcrypto/supports-modern-algorithms.mjs +@@ -9,6 +9,7 @@ const shake256 = crypto.getHashes().includes('shake256'); + const chacha = crypto.getCiphers().includes('chacha20-poly1305'); + const ocb = hasOpenSSL(3); + const kmac = hasOpenSSL(3); ++const boringSSL = process.features.openssl_is_boringssl; + + const { subtle } = globalThis.crypto; + const X25519 = await subtle.generateKey('X25519', false, ['deriveBits', 'deriveKey']); +@@ -108,9 +109,9 @@ export const vectors = { + [true, 'RSA-PSS'], + [true, 'RSASSA-PKCS1-v1_5'], + [true, 'X25519'], +- [true, 'X448'], ++ [!boringSSL, 'X448'], + [true, 'Ed25519'], +- [true, 'Ed448'], ++ [!boringSSL, 'Ed448'], + [true, 'ECDH'], + [true, 'ECDSA'], + [pqc, 'ML-DSA-44'], diff --git a/test/parallel/test-crypto-async-sign-verify.js b/test/parallel/test-crypto-async-sign-verify.js -index 7a5e72b1e8e498fdfa8de12aa9b9672dc047248c..f326c52894f86ef9c82c685a8685245138f01ed5 100644 +index d385926e9943052bbe1793d4b1e39846e1a69562..dbf7b04afa77f132aaa466c9ee02c5ffad0296bc 100644 --- a/test/parallel/test-crypto-async-sign-verify.js +++ b/test/parallel/test-crypto-async-sign-verify.js @@ -89,6 +89,7 @@ test('rsa_public.pem', 'rsa_private.pem', 'sha256', false, @@ -30,20 +563,19 @@ index 7a5e72b1e8e498fdfa8de12aa9b9672dc047248c..f326c52894f86ef9c82c685a86852451 // Test Parallel Execution w/ KeyObject is threadsafe in openssl3 { -@@ -150,8 +152,10 @@ MCowBQYDK2VuAyEA6pwGRbadNQAI/tYN8+/p/0/hbsdHfOEGr1ADiLVk/Gc= +@@ -150,7 +152,10 @@ MCowBQYDK2VuAyEA6pwGRbadNQAI/tYN8+/p/0/hbsdHfOEGr1ADiLVk/Gc= const data = crypto.randomBytes(32); const signature = crypto.randomBytes(16); -- const expected = hasOpenSSL3 ? -- /operation not supported for this keytype/ : /no default digest/; -+ let expected = /no default digest/; +- const expected = hasOpenSSL3 ? /operation not supported for this keytype/ : /no default digest/; ++ let expected = hasOpenSSL3 ? /operation not supported for this keytype/ : /no default digest/; + if (hasOpenSSL3 || process.features.openssl_is_boringssl) { + expected = /operation[\s_]not[\s_]supported[\s_]for[\s_]this[\s_]keytype/i; + } crypto.verify(undefined, data, untrustedKey, signature, common.mustCall((err) => { assert.ok(err); -@@ -165,6 +169,6 @@ MCowBQYDK2VuAyEA6pwGRbadNQAI/tYN8+/p/0/hbsdHfOEGr1ADiLVk/Gc= +@@ -164,6 +169,6 @@ MCowBQYDK2VuAyEA6pwGRbadNQAI/tYN8+/p/0/hbsdHfOEGr1ADiLVk/Gc= }); crypto.sign('sha512', 'message', privateKey, common.mustCall((err) => { assert.ok(err); @@ -81,7 +613,7 @@ index 4a5f1f149fe6c739f7f1d2ee17df6e61a942d621..b3287f428ce6b3fde11d449c601a57ff { diff --git a/test/parallel/test-crypto-cipheriv-decipheriv.js b/test/parallel/test-crypto-cipheriv-decipheriv.js -index 88d07c3b957f57b85861542d174a0fd0ba8ceb66..1f430197579ff5f31322bfa0fa5e92e4c58588e2 100644 +index 6742722f9e90914b4dc8c079426d10040d476f72..8801ddfe7023fd0f7d5657b86a9164d75765322e 100644 --- a/test/parallel/test-crypto-cipheriv-decipheriv.js +++ b/test/parallel/test-crypto-cipheriv-decipheriv.js @@ -62,6 +62,10 @@ function testCipher2(key, iv) { @@ -222,6 +754,21 @@ index 929dd36c669239804f2cfc5168bd3bf6e15855e6..8ebe599bbd21ad30e5041e0eab1e5898 // Default outputLengths. assert.strictEqual(crypto.createHash('shake128').digest('hex'), '7f9c2ba4e88f827d616045507605853e'); +diff --git a/test/parallel/test-crypto-oneshot-hash-xof.js b/test/parallel/test-crypto-oneshot-hash-xof.js +index 75cb4800ff1bd51fedd7bc4e2d7e6af6f4f48346..b4363c31592763235116d970a5f45d4cf63de373 100644 +--- a/test/parallel/test-crypto-oneshot-hash-xof.js ++++ b/test/parallel/test-crypto-oneshot-hash-xof.js +@@ -7,6 +7,10 @@ if (!common.hasCrypto) common.skip('missing crypto'); + const assert = require('assert'); + const crypto = require('crypto'); + ++if (process.features.openssl_is_boringssl) { ++ common.skip('BoringSSL does not support XOF hash functions'); ++} ++ + // Test XOF hash functions and the outputLength option. + { + // Default outputLengths. diff --git a/test/parallel/test-crypto-padding.js b/test/parallel/test-crypto-padding.js index 48cd1ed4df61aaddeee8785cb90f83bdd9628187..d09e01712c617597833bb1320a32a967bcf1d318 100644 --- a/test/parallel/test-crypto-padding.js @@ -308,10 +855,10 @@ index 119bc3c2d20ea7d681f0b579f9d91ad46cdc3634..8d13b105fa426015a873c411ad1d7f64 // DSA signatures vary across runs so there is no static string to verify diff --git a/test/parallel/test-crypto-scrypt.js b/test/parallel/test-crypto-scrypt.js -index 03a18c7522531c7317f12705550117dc389a0245..2f0f46f2c6ddc62de89877cfa0ca80949a0f4c5e 100644 +index eafdfe392bde8eb1fde1dc7e7e9ae51682c74b87..2907e0175379266c90acb9df829d10283bd46652 100644 --- a/test/parallel/test-crypto-scrypt.js +++ b/test/parallel/test-crypto-scrypt.js -@@ -176,7 +176,7 @@ for (const options of bad) { +@@ -192,7 +192,7 @@ for (const options of incompatibleOptions) { for (const options of toobig) { const expected = { @@ -321,7 +868,7 @@ index 03a18c7522531c7317f12705550117dc389a0245..2f0f46f2c6ddc62de89877cfa0ca8094 }; assert.throws(() => crypto.scrypt('pass', 'salt', 1, options, () => {}), diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js -index 0589d60736e377f24dc8550f87a6b7624173fc44..113003826fc47a589cf2334f7345e33d3e189d0a 100644 +index a66f0a94efd7c952c1d2320fbc7a39fe3a88a8a1..dc5846db0e3dcf8f7cb5f7efcdbc81c1d767ab88 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js @@ -33,7 +33,7 @@ const keySize = 2048; @@ -336,7 +883,7 @@ index 0589d60736e377f24dc8550f87a6b7624173fc44..113003826fc47a589cf2334f7345e33d @@ -345,15 +345,15 @@ assert.throws( padding: crypto.constants.RSA_PKCS1_OAEP_PADDING }); - }, hasOpenSSL3 ? { + }, hasOpenSSL(3) ? { - code: 'ERR_OSSL_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE', - message: /illegal or unsupported padding mode/, + code: /^ERR_OSSL_(RSA|EVP)_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE$/, @@ -355,7 +902,7 @@ index 0589d60736e377f24dc8550f87a6b7624173fc44..113003826fc47a589cf2334f7345e33d }); } -@@ -423,10 +423,12 @@ assert.throws( +@@ -423,11 +423,13 @@ assert.throws( public: fixtures.readKey('ed25519_public.pem', 'ascii'), algo: null, sigLen: 64 }, @@ -363,12 +910,13 @@ index 0589d60736e377f24dc8550f87a6b7624173fc44..113003826fc47a589cf2334f7345e33d { private: fixtures.readKey('ed448_private.pem', 'ascii'), public: fixtures.readKey('ed448_public.pem', 'ascii'), algo: null, + supportsContext: true, sigLen: 114 }, + */ { private: fixtures.readKey('rsa_private_2048.pem', 'ascii'), public: fixtures.readKey('rsa_public_2048.pem', 'ascii'), algo: 'sha1', -@@ -497,7 +499,7 @@ assert.throws( +@@ -547,7 +549,7 @@ assert.throws( { const data = Buffer.from('Hello world'); @@ -474,11 +1022,387 @@ index 7bd42bbe721c4c9442410d524c5ca740078fc72c..de49dbdc2b75517f497af353a6b24b1b assert.strictEqual(err.function, 'ssl3_read_bytes'); assert.match(err.reason, expectedErrorReason); })); +diff --git a/test/parallel/test-webcrypto-derivebits-hkdf.js b/test/parallel/test-webcrypto-derivebits-hkdf.js +index 0629f85b0fb538cabf77479132f8c3e4ea958b19..2759223e76a0609d0ff98da73f8f6e67b325d8f3 100644 +--- a/test/parallel/test-webcrypto-derivebits-hkdf.js ++++ b/test/parallel/test-webcrypto-derivebits-hkdf.js +@@ -91,18 +91,20 @@ const kDerivations = { + empty: '9e4b719033742101e90f1ad61e2ff3b4' + + '256863667296d74389f1f02af2c4e6a6' + }, +- 'SHA3-256': { +- normal: '386b0693d7a58c4ddf01b49bfbbd2fa87c6f911991543995170ba20ed28df599', +- empty: 'd029bc828b6c6c8bb16ce3d25f5058f19c7d2517745e11c5d65c6d242e82e47f', +- }, +- 'SHA3-384': { +- normal: '8c3b72e659bad40bcd14bdc1f7c3836059d24253795ab046a272973fd0456508', +- empty: '3211ff4c676f761494c1ca2683d2d4662fe1d770ae5c58ebf6af6acb181c7d71', +- }, +- 'SHA3-512': { +- normal: '5588c5c70cb3dd2f95323da2e9d5f299ca99c301d920a499330c449d21c645cd', +- empty: '2c944b916c2751a71a1b5e57fcb487939c624335683995770b9f7cc7cbbb21f0', +- }, ++ ...(!process.features.openssl_is_boringssl ? { ++ 'SHA3-256': { ++ normal: '386b0693d7a58c4ddf01b49bfbbd2fa87c6f911991543995170ba20ed28df599', ++ empty: 'd029bc828b6c6c8bb16ce3d25f5058f19c7d2517745e11c5d65c6d242e82e47f', ++ }, ++ 'SHA3-384': { ++ normal: '8c3b72e659bad40bcd14bdc1f7c3836059d24253795ab046a272973fd0456508', ++ empty: '3211ff4c676f761494c1ca2683d2d4662fe1d770ae5c58ebf6af6acb181c7d71', ++ }, ++ 'SHA3-512': { ++ normal: '5588c5c70cb3dd2f95323da2e9d5f299ca99c301d920a499330c449d21c645cd', ++ empty: '2c944b916c2751a71a1b5e57fcb487939c624335683995770b9f7cc7cbbb21f0', ++ }, ++ } : {}), + }, + empty: { + 'SHA-384': { +@@ -129,18 +131,20 @@ const kDerivations = { + empty: 'c8e12774135305c9147f2cc4766e5ead' + + '25d8f457b9a1953d52677361ced558fb' + }, +- 'SHA3-256': { +- normal: '9befc557f5baf4075b5fb38c014b41b92ab7534150baf64201069e8807d0e83d', +- empty: '54d1fa1aa7cad99dab0622b772170e775c103756183bac36a228fd817a98a3f6', +- }, +- 'SHA3-384': { +- normal: '46b54c015e368677edf7ac16963bccd9d2ba8246eef0e8beb04d8d188774b91b', +- empty: '46eb0b2649bb0f605d70e4818ffc8176ee1be9782396e69fb4d0fd7cfe902b55', +- }, +- 'SHA3-512': { +- normal: 'aa4375c82b5d7a3cac88a0423250b3882f140c253e98e8e7a0f6055b0908e4c2', +- empty: '6613003f98602ddb53ac35f5aa256c9f5279d50ee65bb08fdf2ecf65cc5df27f', +- }, ++ ...(!process.features.openssl_is_boringssl ? { ++ 'SHA3-256': { ++ normal: '9befc557f5baf4075b5fb38c014b41b92ab7534150baf64201069e8807d0e83d', ++ empty: '54d1fa1aa7cad99dab0622b772170e775c103756183bac36a228fd817a98a3f6', ++ }, ++ 'SHA3-384': { ++ normal: '46b54c015e368677edf7ac16963bccd9d2ba8246eef0e8beb04d8d188774b91b', ++ empty: '46eb0b2649bb0f605d70e4818ffc8176ee1be9782396e69fb4d0fd7cfe902b55', ++ }, ++ 'SHA3-512': { ++ normal: 'aa4375c82b5d7a3cac88a0423250b3882f140c253e98e8e7a0f6055b0908e4c2', ++ empty: '6613003f98602ddb53ac35f5aa256c9f5279d50ee65bb08fdf2ecf65cc5df27f', ++ }, ++ } : {}), + } + }, + long: { +@@ -169,18 +173,20 @@ const kDerivations = { + empty: 'e579d1f9e7f08e6f990ffcfcce1ed201' + + 'c5e37e62cdf606f0ba4aca80427fbc44' + }, +- 'SHA3-256': { +- normal: '24f38fd1905554b7cbf8395cc3976292d11ce24a0b3131da0fd4b109832d27e3', +- empty: '33d0a5151c0f52e4bb7fb67cf7a17063127624dc3e685903f49ebb07872084d1', +- }, +- 'SHA3-384': { +- normal: '15777581a1ea81ad0baac8a97d954df4142f7260d9e8351aa7f6ef6de2d04632', +- empty: 'ada4da4e28dc971633a8760b265b3019db57baf17e7bf7e13cf78b1a676f6d44', +- }, +- 'SHA3-512': { +- normal: '621e4602b07fcba55ed6b976a8bef513b0f7c4ad0c546e0f852993051d887408', +- empty: 'f1292af65b05c86cf7146b739bc65785c707450316f3207ee54a3f596a7d0f7b', +- }, ++ ...(!process.features.openssl_is_boringssl ? { ++ 'SHA3-256': { ++ normal: '24f38fd1905554b7cbf8395cc3976292d11ce24a0b3131da0fd4b109832d27e3', ++ empty: '33d0a5151c0f52e4bb7fb67cf7a17063127624dc3e685903f49ebb07872084d1', ++ }, ++ 'SHA3-384': { ++ normal: '15777581a1ea81ad0baac8a97d954df4142f7260d9e8351aa7f6ef6de2d04632', ++ empty: 'ada4da4e28dc971633a8760b265b3019db57baf17e7bf7e13cf78b1a676f6d44', ++ }, ++ 'SHA3-512': { ++ normal: '621e4602b07fcba55ed6b976a8bef513b0f7c4ad0c546e0f852993051d887408', ++ empty: 'f1292af65b05c86cf7146b739bc65785c707450316f3207ee54a3f596a7d0f7b', ++ }, ++ } : {}), + }, + empty: { + 'SHA-384': { +@@ -207,18 +213,20 @@ const kDerivations = { + empty: 'b4f7e7557674d501cbfbc0148ad800c0' + + '750189fe295a2aca5e1bf4122c85edf9' + }, +- 'SHA3-256': { +- normal: 'fe32459f7339dd2e8df6c6fc874ed9e81e3b7aad669edad9b71196f53ed95b12', +- empty: '04519be1eb94079c91306cc5b21946b3de6a78ad35ec83d4f4a37bafbda678d7', +- }, +- 'SHA3-384': { +- normal: 'a474e8289cb4a0511e90b87eaf9ec29cadd74d4c1f2ee1fb8cb5f7d08f91a379', +- empty: '726c8c4b39083a7d5755604d3a67e9aa6139db00c08028ac9e69f7fb1525bf1d', +- }, +- 'SHA3-512': { +- normal: 'c7a7f5004d1d595c6896498c169642ac24b946e13296ff53e12b534962a88675', +- empty: '7b543480b5696932551abb3100d72e05c18f57fbb63aa44fe020bef1eec3555c', +- }, ++ ...(!process.features.openssl_is_boringssl ? { ++ 'SHA3-256': { ++ normal: 'fe32459f7339dd2e8df6c6fc874ed9e81e3b7aad669edad9b71196f53ed95b12', ++ empty: '04519be1eb94079c91306cc5b21946b3de6a78ad35ec83d4f4a37bafbda678d7', ++ }, ++ 'SHA3-384': { ++ normal: 'a474e8289cb4a0511e90b87eaf9ec29cadd74d4c1f2ee1fb8cb5f7d08f91a379', ++ empty: '726c8c4b39083a7d5755604d3a67e9aa6139db00c08028ac9e69f7fb1525bf1d', ++ }, ++ 'SHA3-512': { ++ normal: 'c7a7f5004d1d595c6896498c169642ac24b946e13296ff53e12b534962a88675', ++ empty: '7b543480b5696932551abb3100d72e05c18f57fbb63aa44fe020bef1eec3555c', ++ }, ++ } : {}), + } + }, + }; +diff --git a/test/parallel/test-webcrypto-derivekey.js b/test/parallel/test-webcrypto-derivekey.js +index 422384f4447bda80c3137ea8784c1bd70c3c285f..c7c6343194a29f14d80db44cf6574e4cd6f34786 100644 +--- a/test/parallel/test-webcrypto-derivekey.js ++++ b/test/parallel/test-webcrypto-derivekey.js +@@ -135,14 +135,21 @@ const { KeyObject } = require('crypto'); + '201509b012c9cd2fbe7ea938f0c509b36ecb140f38bf9130e96923f55f46756d'], + ['hello', 'there', 5, 'SHA-512', + '2e8d981741f98193e0af9c79870af0e985089341221edad9a130d297eae1984b'], +- ['hello', 'there', 5, 'SHA3-256', +- '0aed29b61b3ca3978aea34a9793276574ea997b69e8d03727438199f90571649'], +- ['hello', 'there', 5, 'SHA3-384', +- '7aa4a274aa19b4623c5d3091c4b06355de85ff6f25e53a83e3126cbb86ae68df'], +- ['hello', 'there', 5, 'SHA3-512', +- '4d909c47a81c625f866d1f9406248e6bc3c7ea89225fbccf1f08820254c9ef56'], + ]; + ++ if (!process.features.openssl_is_boringssl) { ++ kTests.push( ++ ['hello', 'there', 5, 'SHA3-256', ++ '0aed29b61b3ca3978aea34a9793276574ea997b69e8d03727438199f90571649'], ++ ['hello', 'there', 5, 'SHA3-384', ++ '7aa4a274aa19b4623c5d3091c4b06355de85ff6f25e53a83e3126cbb86ae68df'], ++ ['hello', 'there', 5, 'SHA3-512', ++ '4d909c47a81c625f866d1f9406248e6bc3c7ea89225fbccf1f08820254c9ef56'] ++ ); ++ } else { ++ common.printSkipMessage('Skipping unsupported SHA-3 test cases'); ++ } ++ + const tests = Promise.all(kTests.map((args) => test(...args))); + + tests.then(common.mustCall()); +@@ -158,16 +165,23 @@ const { KeyObject } = require('crypto'); + // Not long enough secret generated by ECDH + [{ name: 'HMAC', hash: 'SHA-384' }, 'sign', 1024], + [{ name: 'HMAC', hash: 'SHA-512' }, 'sign', 1024], +- [{ name: 'HMAC', hash: 'SHA3-256', length: 256 }, 'sign', 256], +- [{ name: 'HMAC', hash: 'SHA3-384', length: 384 }, 'sign', 384], +- [{ name: 'HMAC', hash: 'SHA3-512', length: 512 }, 'sign', 512], +- // This interaction is not defined for now. +- // https://github.com/WICG/webcrypto-modern-algos/issues/23 +- // [{ name: 'HMAC', hash: 'SHA3-256' }, 'sign', 256], +- // [{ name: 'HMAC', hash: 'SHA3-384' }, 'sign', 384], +- // [{ name: 'HMAC', hash: 'SHA3-512' }, 'sign', 512], + ]; + ++ if (!process.features.openssl_is_boringssl) { ++ vectors.push( ++ [{ name: 'HMAC', hash: 'SHA3-256', length: 256 }, 'sign', 256], ++ [{ name: 'HMAC', hash: 'SHA3-384', length: 384 }, 'sign', 384], ++ [{ name: 'HMAC', hash: 'SHA3-512', length: 512 }, 'sign', 512] ++ // This interaction is not defined for now. ++ // https://github.com/WICG/webcrypto-modern-algos/issues/23 ++ // [{ name: 'HMAC', hash: 'SHA3-256' }, 'sign', 256], ++ // [{ name: 'HMAC', hash: 'SHA3-384' }, 'sign', 384], ++ // [{ name: 'HMAC', hash: 'SHA3-512' }, 'sign', 512], ++ ); ++ } else { ++ common.printSkipMessage('Skipping unsupported SHA-3 test cases'); ++ } ++ + if (hasOpenSSL(3)) { + vectors.push( + ['KMAC128', 'sign', 128], +@@ -211,16 +225,23 @@ const { KeyObject } = require('crypto'); + [{ name: 'HMAC', hash: 'SHA-256' }, 'sign', 512], + [{ name: 'HMAC', hash: 'SHA-384' }, 'sign', 1024], + [{ name: 'HMAC', hash: 'SHA-512' }, 'sign', 1024], +- [{ name: 'HMAC', hash: 'SHA3-256', length: 256 }, 'sign', 256], +- [{ name: 'HMAC', hash: 'SHA3-384', length: 384 }, 'sign', 384], +- [{ name: 'HMAC', hash: 'SHA3-512', length: 512 }, 'sign', 512], +- // This interaction is not defined for now. +- // https://github.com/WICG/webcrypto-modern-algos/issues/23 +- // [{ name: 'HMAC', hash: 'SHA3-256' }, 'sign', 256], +- // [{ name: 'HMAC', hash: 'SHA3-384' }, 'sign', 384], +- // [{ name: 'HMAC', hash: 'SHA3-512' }, 'sign', 512], + ]; + ++ if (!process.features.openssl_is_boringssl) { ++ vectors.push( ++ [{ name: 'HMAC', hash: 'SHA3-256', length: 256 }, 'sign', 256], ++ [{ name: 'HMAC', hash: 'SHA3-384', length: 384 }, 'sign', 384], ++ [{ name: 'HMAC', hash: 'SHA3-512', length: 512 }, 'sign', 512], ++ // This interaction is not defined for now. ++ // https://github.com/WICG/webcrypto-modern-algos/issues/23 ++ // [{ name: 'HMAC', hash: 'SHA3-256' }, 'sign', 256], ++ // [{ name: 'HMAC', hash: 'SHA3-384' }, 'sign', 384], ++ // [{ name: 'HMAC', hash: 'SHA3-512' }, 'sign', 512], ++ ); ++ } else { ++ common.printSkipMessage('Skipping unsupported SHA-3 test cases'); ++ } ++ + if (hasOpenSSL(3)) { + vectors.push( + ['KMAC128', 'sign', 128], +diff --git a/test/parallel/test-webcrypto-digest.js b/test/parallel/test-webcrypto-digest.js +index 04507d77b59142be9c9fe81c746f1c0003429262..e91214047dea431913c1a3d47ed55dd573888daf 100644 +--- a/test/parallel/test-webcrypto-digest.js ++++ b/test/parallel/test-webcrypto-digest.js +@@ -148,65 +148,67 @@ const kDigestedData = { + '60b22aab8d36a4c2a3affdb71234f49276737c575ddf7' + + '4d14054cbd6fdb98fd0ddcbcb46f91ad76b6ee' + }, +- 'cshake128': { +- empty: '7f9c2ba4e88f827d616045507605853ed73b8093f6e' + +- 'fbc88eb1a6eacfa66ef26', +- short: 'dea62d73e6b59cf725d0320d660089a4475cbbd3b85' + +- '39e36691f150d47556794', +- medium: 'b1acd53a03e76a221e52ea578e042f686a68c3d1c9' + +- '832ab18285cf4f304ca32d', +- long: '3a5bf5676955e5dec87d430e526925558971ca14c370' + +- 'ee5d7cf572b94c7c63d7' +- }, +- 'cshake256': { +- empty: '46b9dd2b0ba88d13233b3feb743eeb243fcd52ea62b' + +- '81b82b50c27646ed5762fd75dc4ddd8c0f200cb0501' + +- '9d67b592f6fc821c49479ab48640292eacb3b7c4be', +- short: '1738113f5abb3ee5320ee18aa266c3617a7475dbd8e' + +- 'd9a985994fddd6112ad999ec8e2ebdfeafb96e76f6b' + +- 'b3a3adba43da60f00cd12496df5af3e28ae6d3de42', +- medium: '4146c13d86d9bc186b0b309ab6a124ee0c74ba26b8' + +- 'c60dcc7b3ed505969aa8d19028c6317999a085b1e6' + +- 'b6a785ce4ff632aeb27493227e44232fb7b3952141' + +- '7b', +- long: '0c42bfd1e282622fd8144aa29b072fd09fc2bae70885' + +- 'd5290933492f9d17411926a613dd0611668c2ac999e8' + +- 'c011aabaa9004323425fbad75b0f58ee6e777a94' +- }, +- 'sha3-256': { +- empty: 'a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a', +- short: '3059af7aa33b517084e8ad7bbc4fb208a44c28ef32b4698d103dd540e4f91aa1', +- medium: '1fa7cd1da74cd8046417508c8314e74a9a4a9d38f9f18e6cb215b8c891a0a80e', +- long: 'b2cfc61e0386cdaef5e10a2be189891f5ef52a7624bfcd8edc893acc64fec600' +- }, +- 'sha3-384': { +- empty: '0c63a75b845e4f7d01107d852e4c2485c51a50aaaa9' + +- '4fc61995e71bbee983a2ac3713831264adb47fb6bd1' + +- 'e058d5f004', +- short: '54b8f0e4cf4974de740098f66b3024479b01631315a' + +- '6773606c33eadc32556a6e778e08f0225ae79265aec' + +- '666cb2390b', +- medium: '437b7d8b68b250b5c1739ea4cc86db2033879dfb18' + +- 'de292c9c50d9c193a4c79a08a6cae3f4e483c2795e' + +- 'a5d1ef7e69d2', +- long: '3b39c4c97ad87613305d0ccc987181713e2d5e84b1f9' + +- '760011bcce0c297499005bdce8a3d2409b5ad0164f32' + +- 'bb8778d0' +- }, +- 'sha3-512': { +- empty: 'a69f73cca23a9ac5c8b567dc185a756e97c982164fe' + +- '25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9' + +- '402c3ac558f500199d95b6d3e301758586281dcd26', +- short: '2dd2e07a62e6ad0498ba84f313c4d4024cb46001f78' + +- 'f75db336b0d4d8bd2a9ec152c4ad20878735d82ba08' + +- '72ecf59608ef3ced2b2a8669427e7da31e362333d8', +- medium: 'e640a21909536640369e9b0a48931c5cb2efcbc91f' + +- 'ecf247306bc96a0e4ca33307cb8e1b9af367946dd01' + +- 'c243f3907508d04f1692a3161df1f898de8ee25febe', +- long: 'bd262cecf565c338032de5ba0138f0aacfe7dde83d27' + +- '2d0d37d952829ed25de1a1342d98659ef7d2fa4aca7c' + +- 'e2b1aa0784d8fc1dcbf81bcec7a7431a3da36bf7' +- } ++ ...(!process.features.openssl_is_boringssl ? { ++ 'cshake128': { ++ empty: '7f9c2ba4e88f827d616045507605853ed73b8093f6e' + ++ 'fbc88eb1a6eacfa66ef26', ++ short: 'dea62d73e6b59cf725d0320d660089a4475cbbd3b85' + ++ '39e36691f150d47556794', ++ medium: 'b1acd53a03e76a221e52ea578e042f686a68c3d1c9' + ++ '832ab18285cf4f304ca32d', ++ long: '3a5bf5676955e5dec87d430e526925558971ca14c370' + ++ 'ee5d7cf572b94c7c63d7' ++ }, ++ 'cshake256': { ++ empty: '46b9dd2b0ba88d13233b3feb743eeb243fcd52ea62b' + ++ '81b82b50c27646ed5762fd75dc4ddd8c0f200cb0501' + ++ '9d67b592f6fc821c49479ab48640292eacb3b7c4be', ++ short: '1738113f5abb3ee5320ee18aa266c3617a7475dbd8e' + ++ 'd9a985994fddd6112ad999ec8e2ebdfeafb96e76f6b' + ++ 'b3a3adba43da60f00cd12496df5af3e28ae6d3de42', ++ medium: '4146c13d86d9bc186b0b309ab6a124ee0c74ba26b8' + ++ 'c60dcc7b3ed505969aa8d19028c6317999a085b1e6' + ++ 'b6a785ce4ff632aeb27493227e44232fb7b3952141' + ++ '7b', ++ long: '0c42bfd1e282622fd8144aa29b072fd09fc2bae70885' + ++ 'd5290933492f9d17411926a613dd0611668c2ac999e8' + ++ 'c011aabaa9004323425fbad75b0f58ee6e777a94' ++ }, ++ 'sha3-256': { ++ empty: 'a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a', ++ short: '3059af7aa33b517084e8ad7bbc4fb208a44c28ef32b4698d103dd540e4f91aa1', ++ medium: '1fa7cd1da74cd8046417508c8314e74a9a4a9d38f9f18e6cb215b8c891a0a80e', ++ long: 'b2cfc61e0386cdaef5e10a2be189891f5ef52a7624bfcd8edc893acc64fec600' ++ }, ++ 'sha3-384': { ++ empty: '0c63a75b845e4f7d01107d852e4c2485c51a50aaaa9' + ++ '4fc61995e71bbee983a2ac3713831264adb47fb6bd1' + ++ 'e058d5f004', ++ short: '54b8f0e4cf4974de740098f66b3024479b01631315a' + ++ '6773606c33eadc32556a6e778e08f0225ae79265aec' + ++ '666cb2390b', ++ medium: '437b7d8b68b250b5c1739ea4cc86db2033879dfb18' + ++ 'de292c9c50d9c193a4c79a08a6cae3f4e483c2795e' + ++ 'a5d1ef7e69d2', ++ long: '3b39c4c97ad87613305d0ccc987181713e2d5e84b1f9' + ++ '760011bcce0c297499005bdce8a3d2409b5ad0164f32' + ++ 'bb8778d0' ++ }, ++ 'sha3-512': { ++ empty: 'a69f73cca23a9ac5c8b567dc185a756e97c982164fe' + ++ '25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9' + ++ '402c3ac558f500199d95b6d3e301758586281dcd26', ++ short: '2dd2e07a62e6ad0498ba84f313c4d4024cb46001f78' + ++ 'f75db336b0d4d8bd2a9ec152c4ad20878735d82ba08' + ++ '72ecf59608ef3ced2b2a8669427e7da31e362333d8', ++ medium: 'e640a21909536640369e9b0a48931c5cb2efcbc91f' + ++ 'ecf247306bc96a0e4ca33307cb8e1b9af367946dd01' + ++ 'c243f3907508d04f1692a3161df1f898de8ee25febe', ++ long: 'bd262cecf565c338032de5ba0138f0aacfe7dde83d27' + ++ '2d0d37d952829ed25de1a1342d98659ef7d2fa4aca7c' + ++ 'e2b1aa0784d8fc1dcbf81bcec7a7431a3da36bf7' ++ } ++ } : {}), + }; + + async function testDigest(size, alg) { +diff --git a/test/parallel/test-webcrypto-sign-verify-rsa.js b/test/parallel/test-webcrypto-sign-verify-rsa.js +index 7e90388cc4c270200ecfbda541828c5b237e0d69..ca99ad79fea59f583726f96a58271e86d5c7b5d7 100644 +--- a/test/parallel/test-webcrypto-sign-verify-rsa.js ++++ b/test/parallel/test-webcrypto-sign-verify-rsa.js +@@ -245,7 +245,7 @@ async function testSaltLength(keyLength, hash, hLen) { + ['SHA3-384', 48], + ['SHA3-512', 64], + ]) { +- if (hash.startsWith('SHA-3') && !process.features.openssl_is_boringssl) { ++ if (hash.startsWith('SHA3') && !process.features.openssl_is_boringssl) { + variations.push(testSaltLength(keyLength, hash, hLen)); + } + } diff --git a/test/parallel/test-webcrypto-wrap-unwrap.js b/test/parallel/test-webcrypto-wrap-unwrap.js -index d1ca571af4be713082d32093bfb8a65f2aef9800..57b8df2ce18df58ff54b2d828af67e3c2e082fe0 100644 +index bd788ec4ed88289d35798b8af8c9490a68e081a2..1a5477ba928bce93320f8056db02e1a7b8ddcdf3 100644 --- a/test/parallel/test-webcrypto-wrap-unwrap.js +++ b/test/parallel/test-webcrypto-wrap-unwrap.js -@@ -18,14 +18,15 @@ const kWrappingData = { +@@ -20,14 +20,15 @@ const kWrappingData = { wrap: { label: new Uint8Array(8) }, pair: true }, @@ -498,14 +1422,40 @@ index d1ca571af4be713082d32093bfb8a65f2aef9800..57b8df2ce18df58ff54b2d828af67e3c pair: false }, 'AES-GCM': { -@@ -42,6 +43,7 @@ const kWrappingData = { +@@ -46,30 +47,9 @@ if (!process.features.openssl_is_boringssl) { + generate: { length: 128 }, wrap: { }, pair: false - } +- }; +- kWrappingData['ChaCha20-Poly1305'] = { +- wrap: { +- iv: new Uint8Array(12), +- additionalData: new Uint8Array(16), +- tagLength: 128 +- }, +- pair: false +- }; +-} else { +- common.printSkipMessage('Skipping unsupported AES-KW test case'); +-} +- +-if (hasOpenSSL(3)) { +- kWrappingData['AES-OCB'] = { +- generate: { length: 128 }, +- wrap: { +- iv: new Uint8Array(15), +- additionalData: new Uint8Array(16), +- tagLength: 128 +- }, +- pair: false +- }; +-} ++ } + */ - }; ++}; function generateWrappingKeys() { + return Promise.all(Object.keys(kWrappingData).map(async (name) => { diff --git a/test/parallel/test-x509-escaping.js b/test/parallel/test-x509-escaping.js index b507af88e1f7f3424b7b5d6d683a295b9d208e5e..825ba4c8dce775f401080a0522565bb7a087bcc3 100644 --- a/test/parallel/test-x509-escaping.js diff --git a/patches/node/fix_do_not_resolve_electron_entrypoints.patch b/patches/node/fix_do_not_resolve_electron_entrypoints.patch index a69a82f520a37..03664584dcbdc 100644 --- a/patches/node/fix_do_not_resolve_electron_entrypoints.patch +++ b/patches/node/fix_do_not_resolve_electron_entrypoints.patch @@ -6,10 +6,10 @@ Subject: fix: do not resolve electron entrypoints This wastes fs cycles and can result in strange behavior if this path actually exists on disk diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index 2c33fd44b9a251682de78a8bcdad9ee5a0d3e5e8..ae3ef0e853ae19fca649704854d4bda84a5bd287 100644 +index 1f967df42128a05e49acfa6d409737c06a3372e3..c9b0dae3378f556c453f4fa31208eb6f57c433a9 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js -@@ -355,6 +355,10 @@ function cjsPreparseModuleExports(filename, source, format) { +@@ -408,6 +408,10 @@ function cjsPreparseModuleExports(filename, source, format) { return { module, exportNames: module[kModuleExportNames] }; } @@ -21,7 +21,7 @@ index 2c33fd44b9a251682de78a8bcdad9ee5a0d3e5e8..ae3ef0e853ae19fca649704854d4bda8 ({ source } = loadSourceForCJSWithHooks(module, filename, format)); } diff --git a/lib/internal/modules/run_main.js b/lib/internal/modules/run_main.js -index 02ba43adc2c8e92a78942bbb04023a16f5870ee9..bbf1ab69b884a9325bebdd07b2c4fd354eee946b 100644 +index 2a9ef56d1568080d19d4b6e68a14c752e48c3822..fb45f3dc66a49a554df1c06431197392c0a199b7 100644 --- a/lib/internal/modules/run_main.js +++ b/lib/internal/modules/run_main.js @@ -2,6 +2,7 @@ @@ -32,8 +32,8 @@ index 02ba43adc2c8e92a78942bbb04023a16f5870ee9..bbf1ab69b884a9325bebdd07b2c4fd35 globalThis, } = primordials; -@@ -26,6 +27,13 @@ const { - * @param {string} main - Entry point path +@@ -27,6 +28,13 @@ const { + * @returns {string|undefined} */ function resolveMainPath(main) { + // For built-in modules used as the main entry point we _never_ @@ -43,11 +43,11 @@ index 02ba43adc2c8e92a78942bbb04023a16f5870ee9..bbf1ab69b884a9325bebdd07b2c4fd35 + return main; + } + - const defaultType = getOptionValue('--experimental-default-type'); /** @type {string} */ let mainPath; -@@ -62,6 +70,13 @@ function resolveMainPath(main) { - * @param {string} mainPath - Absolute path to the main entry point + // Extension searching for the main entry point is supported for backward compatibility. +@@ -50,6 +58,13 @@ function resolveMainPath(main) { + * @returns {boolean} */ function shouldUseESMLoader(mainPath) { + // For built-in modules used as the main entry point we _never_ @@ -57,6 +57,6 @@ index 02ba43adc2c8e92a78942bbb04023a16f5870ee9..bbf1ab69b884a9325bebdd07b2c4fd35 + return false; + } + - if (getOptionValue('--experimental-default-type') === 'module') { return true; } - /** + * @type {string[]} userLoaders A list of custom loaders registered by the user + * (or an empty list when none have been registered). diff --git a/patches/node/fix_ensure_traverseparent_bails_on_resource_path_exit.patch b/patches/node/fix_ensure_traverseparent_bails_on_resource_path_exit.patch index 2a3a90362897e..d37e5b046d156 100644 --- a/patches/node/fix_ensure_traverseparent_bails_on_resource_path_exit.patch +++ b/patches/node/fix_ensure_traverseparent_bails_on_resource_path_exit.patch @@ -8,10 +8,10 @@ resource path. This commit ensures that the TraverseParent function bails out if the parent path is outside of the resource path. diff --git a/src/node_modules.cc b/src/node_modules.cc -index 55d628f0c5e7f330e548878807de26d51ef025b5..c06779dea471b6f6a8dd29d4657162ef0faec043 100644 +index 9eec93f52f0d0b2e45ae04ff357b4ced0770782f..b93ccedaf703f86ae2092c304785394c471d520c 100644 --- a/src/node_modules.cc +++ b/src/node_modules.cc -@@ -291,8 +291,41 @@ const BindingData::PackageConfig* BindingData::TraverseParent( +@@ -284,8 +284,41 @@ const BindingData::PackageConfig* BindingData::TraverseParent( Realm* realm, const std::filesystem::path& check_path) { std::filesystem::path current_path = check_path; auto env = realm->env(); @@ -53,7 +53,7 @@ index 55d628f0c5e7f330e548878807de26d51ef025b5..c06779dea471b6f6a8dd29d4657162ef do { current_path = current_path.parent_path(); -@@ -311,6 +344,12 @@ const BindingData::PackageConfig* BindingData::TraverseParent( +@@ -304,6 +337,12 @@ const BindingData::PackageConfig* BindingData::TraverseParent( return nullptr; } diff --git a/patches/node/fix_expose_readfilesync_override_for_modules.patch b/patches/node/fix_expose_readfilesync_override_for_modules.patch index 4a4f1fdaa6fc3..984a59d120fb8 100644 --- a/patches/node/fix_expose_readfilesync_override_for_modules.patch +++ b/patches/node/fix_expose_readfilesync_override_for_modules.patch @@ -8,10 +8,10 @@ an API override to replace the native `ReadFileSync` in the `modules` binding. diff --git a/src/env_properties.h b/src/env_properties.h -index 82225b0a53dd828750991a4e15a060b736b6ea2b..4b0d31356a2496a7fc67876a22da2453efc54f53 100644 +index 2884149d82d180e0d2ecfa7ac8fd92f201f1cb55..dded4bf3d7106d127efbad81087f0c375b2b2c95 100644 --- a/src/env_properties.h +++ b/src/env_properties.h -@@ -508,6 +508,7 @@ +@@ -490,6 +490,7 @@ V(maybe_cache_generated_source_map, v8::Function) \ V(messaging_deserialize_create_object, v8::Function) \ V(message_port, v8::Object) \ @@ -20,18 +20,18 @@ index 82225b0a53dd828750991a4e15a060b736b6ea2b..4b0d31356a2496a7fc67876a22da2453 V(performance_entry_callback, v8::Function) \ V(prepare_stack_trace_callback, v8::Function) \ diff --git a/src/node_modules.cc b/src/node_modules.cc -index c06779dea471b6f6a8dd29d4657162ef0faec043..6204986dc97686a248d6ae483f3a413ee5c51e47 100644 +index b93ccedaf703f86ae2092c304785394c471d520c..bdbc511ef3f680bbac6770b89f47acaee95d56a2 100644 --- a/src/node_modules.cc +++ b/src/node_modules.cc -@@ -21,6 +21,7 @@ namespace modules { - +@@ -23,6 +23,7 @@ namespace modules { using v8::Array; using v8::Context; + using v8::External; +using v8::Function; using v8::FunctionCallbackInfo; using v8::HandleScope; - using v8::Isolate; -@@ -89,6 +90,7 @@ Local<Array> BindingData::PackageConfig::Serialize(Realm* realm) const { + using v8::Integer; +@@ -94,6 +95,7 @@ Local<Array> BindingData::PackageConfig::Serialize(Realm* realm) const { const BindingData::PackageConfig* BindingData::GetPackageJSON( Realm* realm, std::string_view path, ErrorContext* error_context) { @@ -39,7 +39,7 @@ index c06779dea471b6f6a8dd29d4657162ef0faec043..6204986dc97686a248d6ae483f3a413e auto binding_data = realm->GetBindingData<BindingData>(); auto cache_entry = binding_data->package_configs_.find(path.data()); -@@ -98,8 +100,36 @@ const BindingData::PackageConfig* BindingData::GetPackageJSON( +@@ -103,8 +105,36 @@ const BindingData::PackageConfig* BindingData::GetPackageJSON( PackageConfig package_config{}; package_config.file_path = path; @@ -76,8 +76,8 @@ index c06779dea471b6f6a8dd29d4657162ef0faec043..6204986dc97686a248d6ae483f3a413e + if (read_err < 0) { return nullptr; } - // In some systems, std::string is annotated to generate an -@@ -249,6 +279,12 @@ const BindingData::PackageConfig* BindingData::GetPackageJSON( + simdjson::ondemand::document document; +@@ -242,6 +272,12 @@ const BindingData::PackageConfig* BindingData::GetPackageJSON( return &cached.first->second; } @@ -90,7 +90,7 @@ index c06779dea471b6f6a8dd29d4657162ef0faec043..6204986dc97686a248d6ae483f3a413e void BindingData::ReadPackageJSON(const FunctionCallbackInfo<Value>& args) { CHECK_GE(args.Length(), 1); // path, [is_esm, base, specifier] CHECK(args[0]->IsString()); // path -@@ -643,6 +679,8 @@ void InitImportMetaPathHelpers(const FunctionCallbackInfo<Value>& args) { +@@ -674,6 +710,8 @@ void SaveCompileCacheEntry(const FunctionCallbackInfo<Value>& args) { void BindingData::CreatePerIsolateProperties(IsolateData* isolate_data, Local<ObjectTemplate> target) { Isolate* isolate = isolate_data->isolate(); @@ -99,7 +99,7 @@ index c06779dea471b6f6a8dd29d4657162ef0faec043..6204986dc97686a248d6ae483f3a413e SetMethod(isolate, target, "readPackageJSON", ReadPackageJSON); SetMethod(isolate, target, -@@ -685,6 +723,8 @@ void BindingData::CreatePerContextProperties(Local<Object> target, +@@ -733,6 +771,8 @@ void BindingData::CreatePerContextProperties(Local<Object> target, void BindingData::RegisterExternalReferences( ExternalReferenceRegistry* registry) { @@ -107,9 +107,9 @@ index c06779dea471b6f6a8dd29d4657162ef0faec043..6204986dc97686a248d6ae483f3a413e + registry->Register(ReadPackageJSON); registry->Register(GetNearestParentPackageJSONType); - registry->Register(GetNearestParentPackageJSON); + registry->Register(GetPackageScopeConfig<false>); diff --git a/src/node_modules.h b/src/node_modules.h -index eb2900d8f8385238f89a6dcc972a28e5fcb1d288..e28f38d98f4f8749048af135f0dcbe55aa69c4fe 100644 +index e4ba6b75bc86d14deada835903ba68a4cb0eccc5..ae77f9ec81b358bd356993617cd07671d382e8ca 100644 --- a/src/node_modules.h +++ b/src/node_modules.h @@ -54,6 +54,8 @@ class BindingData : public SnapshotableObject { @@ -119,5 +119,5 @@ index eb2900d8f8385238f89a6dcc972a28e5fcb1d288..e28f38d98f4f8749048af135f0dcbe55 + static void OverrideReadFileSync( + const v8::FunctionCallbackInfo<v8::Value>& args); static void ReadPackageJSON(const v8::FunctionCallbackInfo<v8::Value>& args); - static void GetNearestParentPackageJSON( + static void GetNearestParentPackageJSONType( const v8::FunctionCallbackInfo<v8::Value>& args); diff --git a/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch b/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch index cc97575ed4c68..9abfc8d1c74b2 100644 --- a/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch +++ b/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch @@ -6,7 +6,7 @@ Subject: fix: expose the built-in electron module via the ESM loader This allows usage of `import { app } from 'electron'` and `import('electron')` natively in the browser + non-sandboxed renderer diff --git a/lib/internal/modules/esm/get_format.js b/lib/internal/modules/esm/get_format.js -index 9519f947b8dfdc69808839948c9cb8434a0acf0e..23ce72d479f638c33edffcea7c35f5da6cab7cae 100644 +index 01584983c16a2ab6eec2fbb01208504f2771148b..6afbbca6c95103f3ecad29485581c94735bac0d3 100644 --- a/lib/internal/modules/esm/get_format.js +++ b/lib/internal/modules/esm/get_format.js @@ -26,6 +26,7 @@ const protocolHandlers = { @@ -18,10 +18,10 @@ index 9519f947b8dfdc69808839948c9cb8434a0acf0e..23ce72d479f638c33edffcea7c35f5da /** diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js -index 307c35980551470b65128bebf5efe94df4e56892..3676a9852bcd42de0a3a380de117de58035f757b 100644 +index 8414d303c078d51a93c9127a1fd8d6f24961b104..e8a2326e158550786620439fa4039c2b449624cc 100644 --- a/lib/internal/modules/esm/load.js +++ b/lib/internal/modules/esm/load.js -@@ -81,7 +81,7 @@ function defaultLoad(url, context = kEmptyObject) { +@@ -77,7 +77,7 @@ function defaultLoad(url, context = kEmptyObject) { throwIfUnsupportedURLScheme(urlInstance); @@ -30,7 +30,7 @@ index 307c35980551470b65128bebf5efe94df4e56892..3676a9852bcd42de0a3a380de117de58 source = null; format ??= 'builtin'; } else if (format === 'addon') { -@@ -97,7 +97,7 @@ function defaultLoad(url, context = kEmptyObject) { +@@ -93,7 +93,7 @@ function defaultLoad(url, context = kEmptyObject) { // Now that we have the source for the module, run `defaultGetFormat` to detect its format. format = defaultGetFormat(urlInstance, context); @@ -39,7 +39,7 @@ index 307c35980551470b65128bebf5efe94df4e56892..3676a9852bcd42de0a3a380de117de58 // For backward compatibility reasons, we need to discard the source in // order for the CJS loader to re-fetch it. source = null; -@@ -145,7 +145,7 @@ function defaultLoadSync(url, context = kEmptyObject) { +@@ -141,7 +141,7 @@ function defaultLoadSync(url, context = kEmptyObject) { throwIfUnsupportedURLScheme(urlInstance, false); @@ -48,7 +48,7 @@ index 307c35980551470b65128bebf5efe94df4e56892..3676a9852bcd42de0a3a380de117de58 source = null; } else if (source == null) { ({ responseURL, source } = getSourceSync(urlInstance, context)); -@@ -178,12 +178,13 @@ function throwIfUnsupportedURLScheme(parsed) { +@@ -174,12 +174,13 @@ function throwIfUnsupportedURLScheme(parsed) { protocol !== 'file:' && protocol !== 'data:' && protocol !== 'node:' && @@ -64,10 +64,10 @@ index 307c35980551470b65128bebf5efe94df4e56892..3676a9852bcd42de0a3a380de117de58 } } diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js -index 78985575beb3df7722ba90968e8f085574b5afdf..e032c016efe227c26364e81804ad183cd2c0d17f 100644 +index 300da51afe6185f5f9799a88fc75ba3b8f0cf5fb..4c7e2dc8c00c7a38a27169d1cc08e27f89e74fbb 100644 --- a/lib/internal/modules/esm/loader.js +++ b/lib/internal/modules/esm/loader.js -@@ -504,7 +504,7 @@ class ModuleLoader { +@@ -522,7 +522,7 @@ class ModuleLoader { } const cjsModule = wrap[imported_cjs_symbol]; @@ -77,10 +77,10 @@ index 78985575beb3df7722ba90968e8f085574b5afdf..e032c016efe227c26364e81804ad183c // Check if the ESM initiating import CJS is being required by the same CJS module. if (cjsModule?.[kIsExecuting]) { diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js -index 859b6bfedac4bbee2df054f9ebca7cbaaed45f18..5aa946f66c71beff0b7a43c30638ab28a1a5dfc0 100644 +index c27ee4c6612c6a7ea0b6355f03563e8724fd0e40..5f03cf14e948d449d303b22ab6710b5508fb83b2 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js -@@ -750,6 +750,9 @@ function packageImportsResolve(name, base, conditions) { +@@ -751,6 +751,9 @@ function packageImportsResolve(name, base, conditions) { throw importNotDefined(name, packageJSONUrl, base); } @@ -90,7 +90,7 @@ index 859b6bfedac4bbee2df054f9ebca7cbaaed45f18..5aa946f66c71beff0b7a43c30638ab28 /** * Resolves a package specifier to a URL. -@@ -764,6 +767,11 @@ function packageResolve(specifier, base, conditions) { +@@ -765,6 +768,11 @@ function packageResolve(specifier, base, conditions) { return new URL('node:' + specifier); } @@ -103,30 +103,21 @@ index 859b6bfedac4bbee2df054f9ebca7cbaaed45f18..5aa946f66c71beff0b7a43c30638ab28 const packageConfig = packageJsonReader.read(packageJSONPath, { __proto__: null, specifier, base, isESM: true }); diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index 757f093becd112002f3422302f4c29bb464f1a6c..c8cea2117080930105b33e4e50586a2c88ef7352 100644 +index 147d96bda8098fe16e5d0053e36eab05fb489c22..3c82913ca381eba30596f22a734b49dcba9b6f5b 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js -@@ -188,7 +188,7 @@ function createCJSModuleWrap(url, source, isMain, format, loadCJS = loadCJSModul - +@@ -215,7 +215,9 @@ function createCJSModuleWrap(url, source, isMain, format, loadCJS = loadCJSModul const { exportNames, module } = cjsPreparseModuleExports(filename, source, format); cjsCache.set(url, module); -- const namesWithDefault = exportNames.has('default') ? -+ const namesWithDefault = filename === 'electron' ? ['default', ...Object.keys(module.exports)] : exportNames.has('default') ? - [...exportNames] : ['default', ...exportNames]; - if (isMain) { -@@ -210,8 +210,8 @@ function createCJSModuleWrap(url, source, isMain, format, loadCJS = loadCJSModul - ({ exports } = module); - } - for (const exportName of exportNames) { -- if (!ObjectPrototypeHasOwnProperty(exports, exportName) || -- exportName === 'default') { -+ if (exportName === 'default' || -+ !ObjectPrototypeHasOwnProperty(exports, exportName)) { - continue; - } - // We might trigger a getter -> dont fail. -@@ -286,6 +286,10 @@ translators.set('require-commonjs', (url, source, isMain) => { +- const wrapperNames = [...exportNames]; ++ const wrapperNames = filename === 'electron' ? ++ ['default', ...Object.keys(module.exports)] : ++ [...exportNames]; + if (!exportNames.has('default')) { + ArrayPrototypePush(wrapperNames, 'default'); + } +@@ -319,6 +321,10 @@ translators.set('require-commonjs', (url, source, isMain) => { return createCJSModuleWrap(url, source, isMain, 'commonjs'); }); @@ -138,10 +129,10 @@ index 757f093becd112002f3422302f4c29bb464f1a6c..c8cea2117080930105b33e4e50586a2c // This translator function must be sync, as `require` is sync. translators.set('require-commonjs-typescript', (url, source, isMain) => { diff --git a/lib/internal/url.js b/lib/internal/url.js -index d0c04be7c6ebc352d5958a987f3a4ba538e0d23a..00f9f3b73ed84c04ae712f6057b68737bd416333 100644 +index a1473fdac8aba3be541df3b6688a05c0dfbe403f..0a87d997856ea227f8f21393909ffc4634043f24 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js -@@ -1605,6 +1605,8 @@ function fileURLToPath(path, options = kEmptyObject) { +@@ -1609,6 +1609,8 @@ function fileURLToPath(path, options = kEmptyObject) { path = new URL(path); else if (!isURL(path)) throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path); diff --git a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch index 316767a8fed2a..aec3faa38e0ea 100644 --- a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch +++ b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch @@ -17,160 +17,82 @@ Upstreams: - https://github.com/nodejs/node/pull/39136 diff --git a/deps/ncrypto/ncrypto.cc b/deps/ncrypto/ncrypto.cc -index 6f9406eecacb7411a2e84a7b51e60b726d1961f3..a0cfb0bc3776dc3682cdb332ed418286d3243bd1 100644 +index e1c2da6969a1ce937d397735e844930f3234bba7..0bed152014949c22b6c610198df39a2522890279 100644 --- a/deps/ncrypto/ncrypto.cc +++ b/deps/ncrypto/ncrypto.cc -@@ -786,7 +786,7 @@ bool SafeX509SubjectAltNamePrint(const BIOPointer& out, X509_EXTENSION* ext) { - - bool ok = true; - -- for (int i = 0; i < sk_GENERAL_NAME_num(names); i++) { -+ for (size_t i = 0; i < sk_GENERAL_NAME_num(names); i++) { - GENERAL_NAME* gen = sk_GENERAL_NAME_value(names, i); - - if (i != 0) BIO_write(out.get(), ", ", 2); -@@ -810,7 +810,7 @@ bool SafeX509InfoAccessPrint(const BIOPointer& out, X509_EXTENSION* ext) { - - bool ok = true; - -- for (int i = 0; i < sk_ACCESS_DESCRIPTION_num(descs); i++) { -+ for (size_t i = 0; i < sk_ACCESS_DESCRIPTION_num(descs); i++) { - ACCESS_DESCRIPTION* desc = sk_ACCESS_DESCRIPTION_value(descs, i); - - if (i != 0) BIO_write(out.get(), "\n", 1); -@@ -952,13 +952,17 @@ BIOPointer X509View::getValidTo() const { - - int64_t X509View::getValidToTime() const { +@@ -11,6 +11,7 @@ + #include <array> + #include <cstring> + #include <string_view> ++#include <vector> + #if OPENSSL_VERSION_MAJOR >= 3 + #include <openssl/core_names.h> + #include <openssl/params.h> +@@ -1130,7 +1131,9 @@ int64_t X509View::getValidToTime() const { + return tp; + #else struct tm tp; - ASN1_TIME_to_tm(X509_get0_notAfter(cert_), &tp); +#ifndef OPENSSL_IS_BORINGSSL + ASN1_TIME_to_tm(X509_get0_notAfter(cert_), &tp); +#endif return PortableTimeGM(&tp); + #endif } - - int64_t X509View::getValidFromTime() const { +@@ -1142,7 +1145,9 @@ int64_t X509View::getValidFromTime() const { + return tp; + #else struct tm tp; +#ifndef OPENSSL_IS_BORINGSSL ASN1_TIME_to_tm(X509_get0_notBefore(cert_), &tp); +#endif return PortableTimeGM(&tp); + #endif } - -@@ -1233,7 +1237,11 @@ BIOPointer BIOPointer::NewMem() { - } - - BIOPointer BIOPointer::NewSecMem() { -- return BIOPointer(BIO_new(BIO_s_secmem())); -+#ifdef OPENSSL_IS_BORINGSSL -+ return BIOPointer(BIO_new(BIO_s_mem())); -+#else -+ return BIOPointer(BIO_new(BIO_s_secmem())); -+#endif - } - - BIOPointer BIOPointer::New(const BIO_METHOD* method) { -@@ -1303,8 +1311,10 @@ BignumPointer DHPointer::FindGroup(const std::string_view name, - #define V(n, p) \ - if (EqualNoCase(name, n)) return BignumPointer(p(nullptr)); - if (option != FindGroupOption::NO_SMALL_PRIMES) { -+#ifndef OPENSSL_IS_BORINGSSL - V("modp1", BN_get_rfc2409_prime_768); - V("modp2", BN_get_rfc2409_prime_1024); -+#endif - V("modp5", BN_get_rfc3526_prime_1536); - } - V("modp14", BN_get_rfc3526_prime_2048); -@@ -1380,11 +1390,13 @@ DHPointer::CheckPublicKeyResult DHPointer::checkPublicKey( - int codes = 0; - if (DH_check_pub_key(dh_.get(), pub_key.get(), &codes) != 1) - return DHPointer::CheckPublicKeyResult::CHECK_FAILED; -+#ifndef OPENSSL_IS_BORINGSSL - if (codes & DH_CHECK_PUBKEY_TOO_SMALL) { - return DHPointer::CheckPublicKeyResult::TOO_SMALL; - } else if (codes & DH_CHECK_PUBKEY_TOO_SMALL) { - return DHPointer::CheckPublicKeyResult::TOO_LARGE; -- } else if (codes != 0) { -+#endif -+ if (codes != 0) { - return DHPointer::CheckPublicKeyResult::INVALID; - } - return CheckPublicKeyResult::NONE; -@@ -2327,7 +2339,7 @@ const std::string_view SSLPointer::getClientHelloAlpn() const { - const unsigned char* buf; - size_t len; - size_t rem; +@@ -2886,10 +2891,6 @@ std::optional<uint32_t> SSLPointer::verifyPeerCertificate() const { + const char* SSLPointer::getClientHelloAlpn() const { + if (ssl_ == nullptr) return {}; + #ifndef OPENSSL_IS_BORINGSSL +- const unsigned char* buf; +- size_t len; +- size_t rem; - -+#ifndef OPENSSL_IS_BORINGSSL if (!SSL_client_hello_get0_ext( get(), TLSEXT_TYPE_application_layer_protocol_negotiation, -@@ -2340,6 +2352,8 @@ const std::string_view SSLPointer::getClientHelloAlpn() const { - len = (buf[0] << 8) | buf[1]; - if (len + 2 != rem) return {}; - return reinterpret_cast<const char*>(buf + 3); -+#endif -+ return {}; - } - - const std::string_view SSLPointer::getClientHelloServerName() const { -@@ -2347,7 +2361,7 @@ const std::string_view SSLPointer::getClientHelloServerName() const { - const unsigned char* buf; - size_t len; - size_t rem; -- +@@ -3090,9 +3091,11 @@ const Cipher Cipher::AES_256_GCM = Cipher::FromNid(NID_aes_256_gcm); + const Cipher Cipher::AES_128_KW = Cipher::FromNid(NID_id_aes128_wrap); + const Cipher Cipher::AES_192_KW = Cipher::FromNid(NID_id_aes192_wrap); + const Cipher Cipher::AES_256_KW = Cipher::FromNid(NID_id_aes256_wrap); +#ifndef OPENSSL_IS_BORINGSSL - if (!SSL_client_hello_get0_ext(get(), TLSEXT_TYPE_server_name, &buf, &rem) || - rem <= 2) { - return {}; -@@ -2363,6 +2377,8 @@ const std::string_view SSLPointer::getClientHelloServerName() const { - len = (*(buf + 3) << 8) | *(buf + 4); - if (len + 2 > rem) return {}; - return reinterpret_cast<const char*>(buf + 5); + const Cipher Cipher::AES_128_OCB = Cipher::FromNid(NID_aes_128_ocb); + const Cipher Cipher::AES_192_OCB = Cipher::FromNid(NID_aes_192_ocb); + const Cipher Cipher::AES_256_OCB = Cipher::FromNid(NID_aes_256_ocb); +#endif -+ return {}; - } + const Cipher Cipher::CHACHA20_POLY1305 = Cipher::FromNid(NID_chacha20_poly1305); - std::optional<const std::string_view> SSLPointer::GetServerName( -@@ -2396,8 +2412,11 @@ bool SSLPointer::isServer() const { - EVPKeyPointer SSLPointer::getPeerTempKey() const { - if (!ssl_) return {}; - EVP_PKEY* raw_key = nullptr; -+#ifndef OPENSSL_IS_BORINGSSL - if (!SSL_get_peer_tmp_key(get(), &raw_key)) return {}; - return EVPKeyPointer(raw_key); -+#endif -+ return {}; - } - - SSLCtxPointer::SSLCtxPointer(SSL_CTX* ctx) : ctx_(ctx) {} + bool Cipher::isGcmMode() const { diff --git a/deps/ncrypto/ncrypto.h b/deps/ncrypto/ncrypto.h -index e5bf2b529bf23914677e25d7468aad58a4684557..9a3c6029ff3319cce58c79782a7bd5d1fcd467f9 100644 +index 175ec8ba0f2a908ffad2ce48434aeed573b09c90..3218590ddce1e92c2a9d776f20f9fb016612061d 100644 --- a/deps/ncrypto/ncrypto.h +++ b/deps/ncrypto/ncrypto.h -@@ -623,17 +623,21 @@ class DHPointer final { - UNABLE_TO_CHECK_GENERATOR = DH_UNABLE_TO_CHECK_GENERATOR, - NOT_SUITABLE_GENERATOR = DH_NOT_SUITABLE_GENERATOR, - Q_NOT_PRIME = DH_CHECK_Q_NOT_PRIME, +@@ -306,9 +306,13 @@ class Cipher final { + #else + static constexpr size_t MAX_AUTH_TAG_LENGTH = 16; + #endif +- static_assert(EVP_GCM_TLS_TAG_LEN <= MAX_AUTH_TAG_LENGTH && +- EVP_CCM_TLS_TAG_LEN <= MAX_AUTH_TAG_LENGTH && +- EVP_CHACHAPOLY_TLS_TAG_LEN <= MAX_AUTH_TAG_LENGTH); ++ static_assert(EVP_GCM_TLS_TAG_LEN <= MAX_AUTH_TAG_LENGTH +#ifndef OPENSSL_IS_BORINGSSL - INVALID_Q = DH_CHECK_INVALID_Q_VALUE, - INVALID_J = DH_CHECK_INVALID_J_VALUE, ++ && EVP_CCM_TLS_TAG_LEN <= MAX_AUTH_TAG_LENGTH ++ && EVP_CHACHAPOLY_TLS_TAG_LEN <= MAX_AUTH_TAG_LENGTH); ++#else ++ ); +#endif - CHECK_FAILED = 512, - }; - CheckResult check(); - enum class CheckPublicKeyResult { - NONE, -+#ifndef OPENSSL_IS_BORINGSSL - TOO_SMALL = DH_R_CHECK_PUBKEY_TOO_SMALL, - TOO_LARGE = DH_R_CHECK_PUBKEY_TOO_LARGE, -- INVALID = DH_R_CHECK_PUBKEY_INVALID, -+#endif -+ INVALID = DH_R_INVALID_PUBKEY, - CHECK_FAILED = 512, - }; - // Check to see if the given public key is suitable for this DH instance. + Cipher() = default; + Cipher(const EVP_CIPHER* cipher) : cipher_(cipher) {} diff --git a/node.gni b/node.gni index e2407027ab05e59b2f0f1c213b98ea469db7a91b..c64761b730e61edcdc0e46a48699f2fd5bb1c0a6 100644 --- a/node.gni @@ -185,31 +107,32 @@ index e2407027ab05e59b2f0f1c213b98ea469db7a91b..c64761b730e61edcdc0e46a48699f2fd # The location of simdutf - use the one from node's deps by default. node_simdutf_path = "//third_party/simdutf" diff --git a/src/crypto/crypto_cipher.cc b/src/crypto/crypto_cipher.cc -index 2176fb6982484e2c42538478eeb4dd81c9d50ee1..c00d3616e08b00b1e0a3a29b2dbb5278e1e14fcc 100644 +index 5ed2f8b35a1e2f8348a0f3891f37944f49371256..bd453ae633b2833cc3c6e3e415b43792dc5bf2e5 100644 --- a/src/crypto/crypto_cipher.cc +++ b/src/crypto/crypto_cipher.cc -@@ -1027,7 +1027,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) { - if (EVP_PKEY_decrypt_init(ctx.get()) <= 0) { - return ThrowCryptoError(env, ERR_get_error()); +@@ -447,6 +447,7 @@ bool CipherBase::InitAuthenticated(const char* cipher_type, } -- + } else { + if (auth_tag_len == kNoAuthTagLength) { +#ifndef OPENSSL_IS_BORINGSSL - int rsa_pkcs1_implicit_rejection = - EVP_PKEY_CTX_ctrl_str(ctx.get(), "rsa_pkcs1_implicit_rejection", "1"); - // From the doc -2 means that the option is not supported. -@@ -1042,6 +1042,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) { - env, - "RSA_PKCS1_PADDING is no longer supported for private decryption"); - } + // We treat ChaCha20-Poly1305 specially. Like GCM, the authentication tag + // length defaults to 16 bytes when encrypting. Unlike GCM, the + // authentication tag length also defaults to 16 bytes when decrypting, +@@ -458,6 +459,9 @@ bool CipherBase::InitAuthenticated(const char* cipher_type, + env(), "authTagLength required for %s", cipher_type); + return false; + } ++#else ++ return false; +#endif - } + } - const EVP_MD* digest = nullptr; + // TODO(tniessen) Support CCM decryption in FIPS mode diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc -index d94f6e1c82c4a62547b3b395f375c86ce4deb5de..b81b9005365272217c77e2b9289bd9f877c0e77c 100644 +index d005bf0ffb93445fa6611a1beb1b465764271ede..01770687bd191c61af02e76d7de24bbac5c47b8f 100644 --- a/src/crypto/crypto_common.cc +++ b/src/crypto/crypto_common.cc -@@ -124,7 +124,7 @@ StackOfX509 CloneSSLCerts(X509Pointer&& cert, +@@ -90,7 +90,7 @@ StackOfX509 CloneSSLCerts(X509Pointer&& cert, if (!peer_certs) return StackOfX509(); if (cert && !sk_X509_push(peer_certs.get(), cert.release())) return StackOfX509(); @@ -218,7 +141,7 @@ index d94f6e1c82c4a62547b3b395f375c86ce4deb5de..b81b9005365272217c77e2b9289bd9f8 X509Pointer cert(X509_dup(sk_X509_value(ssl_certs, i))); if (!cert || !sk_X509_push(peer_certs.get(), cert.get())) return StackOfX509(); -@@ -140,7 +140,7 @@ MaybeLocal<Object> AddIssuerChainToObject(X509Pointer* cert, +@@ -106,7 +106,7 @@ MaybeLocal<Object> AddIssuerChainToObject(X509Pointer* cert, Environment* const env) { cert->reset(sk_X509_delete(peer_certs.get(), 0)); for (;;) { @@ -228,10 +151,10 @@ index d94f6e1c82c4a62547b3b395f375c86ce4deb5de..b81b9005365272217c77e2b9289bd9f8 X509View ca(sk_X509_value(peer_certs.get(), i)); if (!cert->view().isIssuedBy(ca)) continue; diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc -index c08dab17fa229d1d67d3ad5174c97192989b2bd0..a3d309d832c73ddc79564b9644d825bec7459e7f 100644 +index 6482bd58bb6a95cfa4074ea9535e1443aea66bb5..20d3c1d9d17fde18fc09b6ee219137831eb08a45 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc -@@ -141,7 +141,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx, +@@ -143,7 +143,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx, // the CA certificates. SSL_CTX_clear_extra_chain_certs(ctx); @@ -240,7 +163,7 @@ index c08dab17fa229d1d67d3ad5174c97192989b2bd0..a3d309d832c73ddc79564b9644d825be X509* ca = sk_X509_value(extra_certs, i); // NOTE: Increments reference count on `ca` -@@ -1773,11 +1773,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) { +@@ -1831,11 +1831,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) { // If the user specified "auto" for dhparams, the JavaScript layer will pass // true to this function instead of the original string. Any other string // value will be interpreted as custom DH parameters below. @@ -254,7 +177,7 @@ index c08dab17fa229d1d67d3ad5174c97192989b2bd0..a3d309d832c73ddc79564b9644d825be DHPointer dh; { BIOPointer bio(LoadBIO(env, args[0])); -@@ -2003,7 +2004,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) { +@@ -2061,7 +2062,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) { } // Add CA certs too @@ -264,71 +187,10 @@ index c08dab17fa229d1d67d3ad5174c97192989b2bd0..a3d309d832c73ddc79564b9644d825be X509_STORE_add_cert(sc->GetCertStoreOwnedByThisSecureContext(), ca); diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc -index c26a88b395abfc645da56231635b36fb23c8fa09..f23cedf4f2449d8edc9a8de1b70332e75d693cdd 100644 +index e35fda9ad2e8c52c75492d66566dc6e6c57dd2ae..46a7d1396dc1a175ae99f4e403721f1730fdd320 100644 --- a/src/crypto/crypto_dh.cc +++ b/src/crypto/crypto_dh.cc -@@ -7,7 +7,9 @@ - #include "memory_tracker-inl.h" - #include "ncrypto.h" - #include "node_errors.h" -+#ifndef OPENSSL_IS_BORINGSSL - #include "openssl/bnerr.h" -+#endif - #include "openssl/dh.h" - #include "threadpoolwork-inl.h" - #include "v8.h" -@@ -88,11 +90,7 @@ void New(const FunctionCallbackInfo<Value>& args) { - if (args[0]->IsInt32()) { - int32_t bits = args[0].As<Int32>()->Value(); - if (bits < 2) { --#if OPENSSL_VERSION_MAJOR >= 3 -- ERR_put_error(ERR_LIB_DH, 0, DH_R_MODULUS_TOO_SMALL, __FILE__, __LINE__); --#else -- ERR_put_error(ERR_LIB_BN, 0, BN_R_BITS_TOO_SMALL, __FILE__, __LINE__); --#endif -+ OPENSSL_PUT_ERROR(BN, BN_R_BITS_TOO_SMALL); - return ThrowCryptoError(env, ERR_get_error(), "Invalid prime length"); - } - -@@ -105,7 +103,7 @@ void New(const FunctionCallbackInfo<Value>& args) { - } - int32_t generator = args[1].As<Int32>()->Value(); - if (generator < 2) { -- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__); -+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR); - return ThrowCryptoError(env, ERR_get_error(), "Invalid generator"); - } - -@@ -134,12 +132,12 @@ void New(const FunctionCallbackInfo<Value>& args) { - if (args[1]->IsInt32()) { - int32_t generator = args[1].As<Int32>()->Value(); - if (generator < 2) { -- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__); -+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR); - return ThrowCryptoError(env, ERR_get_error(), "Invalid generator"); - } - bn_g = BignumPointer::New(); - if (!bn_g.setWord(generator)) { -- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__); -+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR); - return ThrowCryptoError(env, ERR_get_error(), "Invalid generator"); - } - } else { -@@ -148,11 +146,11 @@ void New(const FunctionCallbackInfo<Value>& args) { - return THROW_ERR_OUT_OF_RANGE(env, "generator is too big"); - bn_g = BignumPointer(reinterpret_cast<uint8_t*>(arg1.data()), arg1.size()); - if (!bn_g) { -- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__); -+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR); - return ThrowCryptoError(env, ERR_get_error(), "Invalid generator"); - } - if (bn_g.getWord() < 2) { -- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__); -+ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR); - return ThrowCryptoError(env, ERR_get_error(), "Invalid generator"); - } - } -@@ -260,15 +258,17 @@ void ComputeSecret(const FunctionCallbackInfo<Value>& args) { +@@ -309,15 +309,17 @@ void ComputeSecret(const FunctionCallbackInfo<Value>& args) { BignumPointer key(key_buf.data(), key_buf.size()); switch (dh.checkPublicKey(key)) { @@ -348,58 +210,24 @@ index c26a88b395abfc645da56231635b36fb23c8fa09..f23cedf4f2449d8edc9a8de1b70332e7 case DHPointer::CheckPublicKeyResult::NONE: break; } -@@ -400,9 +400,11 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { - key_params = EVPKeyPointer::New(); - CHECK(key_params); - CHECK_EQ(EVP_PKEY_assign_DH(key_params.get(), dh.release()), 1); -- } else if (int* prime_size = std::get_if<int>(¶ms->params.prime)) { -+ } else if (std::get_if<int>(¶ms->params.prime)) { - EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DH, nullptr)); - EVP_PKEY* raw_params = nullptr; -+#ifndef OPENSSL_IS_BORINGSSL -+ int* prime_size = std::get_if<int>(¶ms->params.prime); - if (!param_ctx || - EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 || - EVP_PKEY_CTX_set_dh_paramgen_prime_len( -@@ -416,6 +418,9 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { - } - - key_params = EVPKeyPointer(raw_params); -+#else -+ return EVPKeyCtxPointer(); -+#endif - } else { - UNREACHABLE(); - } -diff --git a/src/crypto/crypto_dsa.cc b/src/crypto/crypto_dsa.cc -index ca5edc8ebdf2550bb62b7969a5650733a2647f4f..198e18b58f31e361a9d2865cbe81e067e5f0b543 100644 ---- a/src/crypto/crypto_dsa.cc -+++ b/src/crypto/crypto_dsa.cc -@@ -43,7 +43,7 @@ namespace crypto { - EVPKeyCtxPointer DsaKeyGenTraits::Setup(DsaKeyPairGenConfig* params) { - EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DSA, nullptr)); - EVP_PKEY* raw_params = nullptr; -- -+#ifndef OPENSSL_IS_BORINGSSL - if (!param_ctx || - EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 || - EVP_PKEY_CTX_set_dsa_paramgen_bits( -@@ -58,7 +58,9 @@ EVPKeyCtxPointer DsaKeyGenTraits::Setup(DsaKeyPairGenConfig* params) { - return EVPKeyCtxPointer(); - } - } -- -+#else -+ return EVPKeyCtxPointer(); -+#endif - if (EVP_PKEY_paramgen(param_ctx.get(), &raw_params) <= 0) - return EVPKeyCtxPointer(); - +diff --git a/src/crypto/crypto_hash.cc b/src/crypto/crypto_hash.cc +index 33cde71b105c7cf22b559583d2e46bfb50016f6d..659910992dff7c05bb7e367e1cba14256b46dea4 100644 +--- a/src/crypto/crypto_hash.cc ++++ b/src/crypto/crypto_hash.cc +@@ -232,7 +232,7 @@ void Hash::OneShotDigest(const FunctionCallbackInfo<Value>& args) { + enum encoding output_enc = ParseEncoding(isolate, args[4], args[5], HEX); + + bool is_xof = (EVP_MD_flags(md) & EVP_MD_FLAG_XOF) != 0; +- int output_length = EVP_MD_size(md); ++ size_t output_length = EVP_MD_size(md); + + // This is to cause hash() to fail when an incorrect + // outputLength option was passed for a non-XOF hash function. diff --git a/src/crypto/crypto_keys.cc b/src/crypto/crypto_keys.cc -index 7238cda445fd663e6b45fa134f31d017bb267dfc..522655555cdb2ab2083797f736bf167d1f42c15e 100644 +index e805a984322c8348ceba950fe6f45e002ade10b3..bb9b1f8e1b3c6dd8479ee463e303088e3240d6be 100644 --- a/src/crypto/crypto_keys.cc +++ b/src/crypto/crypto_keys.cc -@@ -949,6 +949,7 @@ void KeyObjectHandle::GetAsymmetricKeyType( +@@ -1034,6 +1034,7 @@ void KeyObjectHandle::GetAsymmetricKeyType( } bool KeyObjectHandle::CheckEcKeyData() const { @@ -407,62 +235,21 @@ index 7238cda445fd663e6b45fa134f31d017bb267dfc..522655555cdb2ab2083797f736bf167d MarkPopErrorOnReturn mark_pop_error_on_return; const auto& key = data_.GetAsymmetricKey(); -@@ -965,6 +966,9 @@ bool KeyObjectHandle::CheckEcKeyData() const { - #else - return EVP_PKEY_public_check(ctx.get()) == 1; - #endif +@@ -1043,6 +1044,9 @@ bool KeyObjectHandle::CheckEcKeyData() const { + + return data_.GetKeyType() == kKeyTypePrivate ? ctx.privateCheck() + : ctx.publicCheck(); +#else + return true; +#endif } void KeyObjectHandle::CheckEcKeyData(const FunctionCallbackInfo<Value>& args) { -diff --git a/src/crypto/crypto_random.cc b/src/crypto/crypto_random.cc -index 78f2093d1d010be6f9c492662f4f582657ff6a13..b6aef7fd27cd974697bcee05955bfd9ccf4d5837 100644 ---- a/src/crypto/crypto_random.cc -+++ b/src/crypto/crypto_random.cc -@@ -143,7 +143,7 @@ Maybe<void> RandomPrimeTraits::AdditionalConfig( - - params->bits = bits; - params->safe = safe; -- params->prime = BignumPointer::NewSecure(); -+ params->prime = BignumPointer::New(); - if (!params->prime) { - THROW_ERR_CRYPTO_OPERATION_FAILED(env, "could not generate prime"); - return Nothing<void>(); -diff --git a/src/crypto/crypto_rsa.cc b/src/crypto/crypto_rsa.cc -index 05a3882c7e17d78e27aabb29891aa250789a47c0..1f2fccce6ed8f14525557644e0bdd130eedf3337 100644 ---- a/src/crypto/crypto_rsa.cc -+++ b/src/crypto/crypto_rsa.cc -@@ -612,10 +612,13 @@ Maybe<void> GetRsaKeyDetail(Environment* env, - } - - if (params->saltLength != nullptr) { -+#ifndef OPENSSL_IS_BORINGSSL -+ // TODO(codebytere): Upstream a shim to BoringSSL? - if (ASN1_INTEGER_get_int64(&salt_length, params->saltLength) != 1) { - ThrowCryptoError(env, ERR_get_error(), "ASN1_INTEGER_get_in64 error"); - return Nothing<void>(); - } -+#endif - } - - if (target diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index 7c548d32b40365343f0e208c3aa856a1c847f4c3..6346f8f7199cf7b7d3736c59571606fff102fbb6 100644 +index 205e248e0f20f019e189a6c69d3c011a616b3939..12b0d804c6f1d4998b85160b0aac8eb7a3b5576b 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc -@@ -207,7 +207,8 @@ void TestFipsCrypto(const v8::FunctionCallbackInfo<v8::Value>& args) { - - void GetOpenSSLSecLevelCrypto(const FunctionCallbackInfo<Value>& args) { - // for BoringSSL assume the same as the default -- int sec_level = OPENSSL_TLS_SECURITY_LEVEL; -+ // value of OPENSSL_TLS_SECURITY_LEVEL. -+ int sec_level = 1; - #ifndef OPENSSL_IS_BORINGSSL - Environment* env = Environment::GetCurrent(args); - -@@ -527,24 +528,15 @@ Maybe<void> Decorate(Environment* env, +@@ -533,24 +533,15 @@ Maybe<void> Decorate(Environment* env, V(BIO) \ V(PKCS7) \ V(X509V3) \ @@ -488,42 +275,11 @@ index 7c548d32b40365343f0e208c3aa856a1c847f4c3..6346f8f7199cf7b7d3736c59571606ff V(USER) \ #define V(name) case ERR_LIB_##name: lib = #name "_"; break; -@@ -686,7 +678,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) { - CHECK(args[0]->IsUint32()); - Environment* env = Environment::GetCurrent(args); - uint32_t len = args[0].As<Uint32>()->Value(); -- void* data = OPENSSL_secure_zalloc(len); -+ void* data = OPENSSL_malloc(len); - if (data == nullptr) { - // There's no memory available for the allocation. - // Return nothing. -@@ -697,7 +689,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) { - data, - len, - [](void* data, size_t len, void* deleter_data) { -- OPENSSL_secure_clear_free(data, len); -+ OPENSSL_clear_free(data, len); - }, - data); - Local<ArrayBuffer> buffer = ArrayBuffer::New(env->isolate(), store); -@@ -705,10 +697,12 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) { - } - - void SecureHeapUsed(const FunctionCallbackInfo<Value>& args) { -+#ifndef OPENSSL_IS_BORINGSSL - Environment* env = Environment::GetCurrent(args); - if (CRYPTO_secure_malloc_initialized()) - args.GetReturnValue().Set( - BigInt::New(env->isolate(), CRYPTO_secure_used())); -+#endif - } - } // namespace - diff --git a/src/env.h b/src/env.h -index 874e5f4d15a75307e45cf70c06fc104fed843a6a..35e16159a94bb97f19d17767e3ad4bb798660f44 100644 +index f3a2d221f4bb52987e1bdacdadf19aacfcf65ec3..d34aec43630b3cf53004d8180446d7136b59ceac 100644 --- a/src/env.h +++ b/src/env.h -@@ -51,7 +51,7 @@ +@@ -52,7 +52,7 @@ #include "v8-profiler.h" #include "v8.h" @@ -532,7 +288,7 @@ index 874e5f4d15a75307e45cf70c06fc104fed843a6a..35e16159a94bb97f19d17767e3ad4bb7 #include <openssl/evp.h> #endif -@@ -1077,7 +1077,7 @@ class Environment final : public MemoryRetainer { +@@ -1058,7 +1058,7 @@ class Environment final : public MemoryRetainer { kExitInfoFieldCount }; @@ -554,21 +310,8 @@ index d9c533f100d25aeab1fe8589932a8ddead431258..2acab8786a8a752b17961445edeb872c #include <openssl/crypto.h> #if NODE_OPENSSL_HAS_QUIC #include <openssl/quic.h> -diff --git a/src/node_options.cc b/src/node_options.cc -index ed85bf11f6f325823b59b3b0275908f9210c1b24..e3509abbc3bf84ac0edcd495eb3dde6219dbfc2d 100644 ---- a/src/node_options.cc -+++ b/src/node_options.cc -@@ -7,7 +7,7 @@ - #include "node_external_reference.h" - #include "node_internals.h" - #include "node_sea.h" --#if HAVE_OPENSSL -+#if HAVE_OPENSSL && !defined(OPENSSL_IS_BORINGSSL) - #include "openssl/opensslv.h" - #endif - diff --git a/src/node_options.h b/src/node_options.h -index cdbd9ca39e907ab22515293eac2c5512223f4ca2..418dee360f867c363f1576012b32213a51c4fdd0 100644 +index 3a1503a035e12b5dce75c77c327607c857a8a367..941ae4f15c42fb8016d03c786973fd4709ac1a0d 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -11,7 +11,7 @@ diff --git a/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch b/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch index 98867a20f98e2..bcd9a4b156e60 100644 --- a/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch +++ b/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch @@ -6,19 +6,19 @@ Subject: fix: lazyload fs in esm loaders to apply asar patches Changes { foo } from fs to just "fs.foo" so that our patching of fs is applied to esm loaders diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js -index 3676a9852bcd42de0a3a380de117de58035f757b..eaecfcfd8b922908957c3fefea65fb9deb445249 100644 +index e8a2326e158550786620439fa4039c2b449624cc..c17867136a07022a740d6bf957fe7a8138a48c11 100644 --- a/lib/internal/modules/esm/load.js +++ b/lib/internal/modules/esm/load.js -@@ -10,7 +10,7 @@ const { +@@ -9,7 +9,7 @@ const { + const { defaultGetFormat } = require('internal/modules/esm/get_format'); const { validateAttributes, emitImportAssertionWarning } = require('internal/modules/esm/assert'); - const { getOptionValue } = require('internal/options'); -const { readFileSync } = require('fs'); +const fs = require('fs'); - const defaultType = - getOptionValue('--experimental-default-type'); -@@ -38,7 +38,7 @@ function getSourceSync(url, context) { + const { Buffer: { from: BufferFrom } } = require('buffer'); + +@@ -34,7 +34,7 @@ function getSourceSync(url, context) { const responseURL = href; let source; if (protocol === 'file:') { @@ -28,7 +28,7 @@ index 3676a9852bcd42de0a3a380de117de58035f757b..eaecfcfd8b922908957c3fefea65fb9d const result = dataURLProcessor(url); if (result === 'failure') { diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js -index 5aa946f66c71beff0b7a43c30638ab28a1a5dfc0..e3afd30ba1f591d0298793bc42fd7166a4219bce 100644 +index 5f03cf14e948d449d303b22ab6710b5508fb83b2..72cc9444ca93ef7a1526e23314693aeaf5f173b0 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -25,7 +25,7 @@ const { @@ -50,7 +50,7 @@ index 5aa946f66c71beff0b7a43c30638ab28a1a5dfc0..e3afd30ba1f591d0298793bc42fd7166 }); const { search, hash } = resolved; diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index c8cea2117080930105b33e4e50586a2c88ef7352..2c33fd44b9a251682de78a8bcdad9ee5a0d3e5e8 100644 +index 3c82913ca381eba30596f22a734b49dcba9b6f5b..1f967df42128a05e49acfa6d409737c06a3372e3 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -24,7 +24,7 @@ const { @@ -62,7 +62,7 @@ index c8cea2117080930105b33e4e50586a2c88ef7352..2c33fd44b9a251682de78a8bcdad9ee5 const { dirname, extname } = require('path'); const { assertBufferSource, -@@ -315,7 +315,7 @@ translators.set('commonjs', function commonjsStrategy(url, source, isMain) { +@@ -350,7 +350,7 @@ translators.set('commonjs', function commonjsStrategy(url, source, isMain) { try { // We still need to read the FS to detect the exports. diff --git a/patches/node/fix_redefined_macos_sdk_header_symbols.patch b/patches/node/fix_redefined_macos_sdk_header_symbols.patch index 4e39d97cb8ae7..0b183cd513365 100644 --- a/patches/node/fix_redefined_macos_sdk_header_symbols.patch +++ b/patches/node/fix_redefined_macos_sdk_header_symbols.patch @@ -10,7 +10,7 @@ change, it seems to introduce an incompatibility when compiling using clang modules. Disabling them resolves the issue. diff --git a/unofficial.gni b/unofficial.gni -index a64d2e4ac475abc049fff7ea62ec76de565a747d..ab456452d102088005fc4bfcb394d2de5ec44889 100644 +index dd686d2f7c8d2f6e8d6bd13a7bf2b4b140556ba9..97e4bcfaa8aa42a5fc2b68ccdd8128eac8886532 100644 --- a/unofficial.gni +++ b/unofficial.gni @@ -195,6 +195,10 @@ template("node_gn_build") { @@ -24,7 +24,7 @@ index a64d2e4ac475abc049fff7ea62ec76de565a747d..ab456452d102088005fc4bfcb394d2de } if (is_posix) { configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] -@@ -350,6 +354,12 @@ template("node_gn_build") { +@@ -367,6 +371,12 @@ template("node_gn_build") { include_dirs = [ "src", "tools" ] configs += [ "//build/config/compiler:no_exit_time_destructors" ] diff --git a/patches/node/fix_remove_deprecated_errno_constants.patch b/patches/node/fix_remove_deprecated_errno_constants.patch index 3f6bf1ecbd32c..3722644054fef 100644 --- a/patches/node/fix_remove_deprecated_errno_constants.patch +++ b/patches/node/fix_remove_deprecated_errno_constants.patch @@ -45,10 +45,10 @@ index ac00778cfc59fb55e361b24fc81a965a5e8f97e7..f0c4d6dfc9f03bee59e656b2da9ac325 # define UV__EUNATCH UV__ERR(EUNATCH) #else diff --git a/src/node_constants.cc b/src/node_constants.cc -index 0ca643aa74d13f278685d2330b791182b55c15b4..cbcecfba33070b820aca0e2814982160a97a6378 100644 +index fd28e0904d05e24e8eeb74fa36abd9727699a649..fea0426496978c0003fe1481afcf93fc9c23edca 100644 --- a/src/node_constants.cc +++ b/src/node_constants.cc -@@ -241,10 +241,6 @@ void DefineErrnoConstants(Local<Object> target) { +@@ -242,10 +242,6 @@ void DefineErrnoConstants(Local<Object> target) { NODE_DEFINE_CONSTANT(target, ENOBUFS); #endif @@ -59,7 +59,7 @@ index 0ca643aa74d13f278685d2330b791182b55c15b4..cbcecfba33070b820aca0e2814982160 #ifdef ENODEV NODE_DEFINE_CONSTANT(target, ENODEV); #endif -@@ -281,14 +277,6 @@ void DefineErrnoConstants(Local<Object> target) { +@@ -282,14 +278,6 @@ void DefineErrnoConstants(Local<Object> target) { NODE_DEFINE_CONSTANT(target, ENOSPC); #endif @@ -74,7 +74,7 @@ index 0ca643aa74d13f278685d2330b791182b55c15b4..cbcecfba33070b820aca0e2814982160 #ifdef ENOSYS NODE_DEFINE_CONSTANT(target, ENOSYS); #endif -@@ -369,10 +357,6 @@ void DefineErrnoConstants(Local<Object> target) { +@@ -370,10 +358,6 @@ void DefineErrnoConstants(Local<Object> target) { NODE_DEFINE_CONSTANT(target, ESTALE); #endif @@ -86,7 +86,7 @@ index 0ca643aa74d13f278685d2330b791182b55c15b4..cbcecfba33070b820aca0e2814982160 NODE_DEFINE_CONSTANT(target, ETIMEDOUT); #endif diff --git a/src/node_errors.cc b/src/node_errors.cc -index 5f51add4cdf68a9487edfc9382f586cc94539571..befb642f1effa3c4139e4cd99ff64d9c5175fd72 100644 +index ae8553ee2022d60fea4572976b14ba9cd253aa45..4386a1bc5678e351ce084cd2c47202561619b164 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -862,10 +862,6 @@ const char* errno_string(int errorno) { diff --git a/patches/node/fix_remove_fastapitypedarray_usage.patch b/patches/node/fix_remove_fastapitypedarray_usage.patch deleted file mode 100644 index 9aef887c0f000..0000000000000 --- a/patches/node/fix_remove_fastapitypedarray_usage.patch +++ /dev/null @@ -1,224 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: deepak1556 <hop2deep@gmail.com> -Date: Sun, 29 Dec 2024 04:01:32 +0900 -Subject: fix: remove FastApiTypedArray usage - -Refs https://github.com/electron/electron/pull/45055#issuecomment-2559095439 -Can be removed when upstream adopts relevant V8 version. - -diff --git a/src/crypto/crypto_timing.cc b/src/crypto/crypto_timing.cc -index fe669d40c31a29334b047b9cfee3067f64ef0a7b..9e5de7bbe574add017cd12ee091304d01e6458d6 100644 ---- a/src/crypto/crypto_timing.cc -+++ b/src/crypto/crypto_timing.cc -@@ -12,7 +12,6 @@ namespace node { - - using v8::CFunction; - using v8::FastApiCallbackOptions; --using v8::FastApiTypedArray; - using v8::FunctionCallbackInfo; - using v8::Local; - using v8::Object; -@@ -51,14 +50,13 @@ void TimingSafeEqual(const FunctionCallbackInfo<Value>& args) { - } - - bool FastTimingSafeEqual(Local<Value> receiver, -- const FastApiTypedArray<uint8_t>& a, -- const FastApiTypedArray<uint8_t>& b, -+ Local<Value> a, -+ Local<Value> b, - // NOLINTNEXTLINE(runtime/references) - FastApiCallbackOptions& options) { -- uint8_t* data_a; -- uint8_t* data_b; -- if (a.length() != b.length() || !a.getStorageIfAligned(&data_a) || -- !b.getStorageIfAligned(&data_b)) { -+ FAST_SPREAD_BUFFER_ARG(a, a_buffer); -+ FAST_SPREAD_BUFFER_ARG(b, b_buffer); -+ if (a_buffer_length != b_buffer_length) { - TRACK_V8_FAST_API_CALL("crypto.timingSafeEqual.error"); - v8::HandleScope scope(options.isolate); - THROW_ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH(options.isolate); -@@ -66,7 +64,7 @@ bool FastTimingSafeEqual(Local<Value> receiver, - } - - TRACK_V8_FAST_API_CALL("crypto.timingSafeEqual.ok"); -- return CRYPTO_memcmp(data_a, data_b, a.length()) == 0; -+ return CRYPTO_memcmp(a_buffer_data, b_buffer_data, a_buffer_length) == 0; - } - - static CFunction fast_timing_safe_equal(CFunction::Make(FastTimingSafeEqual)); -diff --git a/src/node_buffer.cc b/src/node_buffer.cc -index e39852c8e0392e0a9ae5d4ea58be115416e19233..c94b14741c827a81d69a6f036426a344e563ad72 100644 ---- a/src/node_buffer.cc -+++ b/src/node_buffer.cc -@@ -44,6 +44,14 @@ - #define THROW_AND_RETURN_UNLESS_BUFFER(env, obj) \ - THROW_AND_RETURN_IF_NOT_BUFFER(env, obj, "argument") \ - -+#define THROW_AND_RETURN_VAL_UNLESS_BUFFER(isolate, val, prefix, retval) \ -+ do { \ -+ if (!Buffer::HasInstance(val)) { \ -+ node::THROW_ERR_INVALID_ARG_TYPE(isolate, prefix " must be a buffer"); \ -+ return retval; \ -+ } \ -+ } while (0) -+ - #define THROW_AND_RETURN_IF_OOB(r) \ - do { \ - Maybe<bool> m = (r); \ -@@ -60,7 +68,6 @@ using v8::ArrayBufferView; - using v8::BackingStore; - using v8::Context; - using v8::EscapableHandleScope; --using v8::FastApiTypedArray; - using v8::FunctionCallbackInfo; - using v8::Global; - using v8::HandleScope; -@@ -584,19 +591,24 @@ void SlowCopy(const FunctionCallbackInfo<Value>& args) { - - // Assume caller has properly validated args. - uint32_t FastCopy(Local<Value> receiver, -- const v8::FastApiTypedArray<uint8_t>& source, -- const v8::FastApiTypedArray<uint8_t>& target, -+ Local<Value> source_obj, -+ Local<Value> target_obj, - uint32_t target_start, - uint32_t source_start, -- uint32_t to_copy) { -- uint8_t* source_data; -- CHECK(source.getStorageIfAligned(&source_data)); -- -+ uint32_t to_copy, -+ v8::FastApiCallbackOptions& options) { -+ FAST_SPREAD_BUFFER_ARG(source_obj, source); - uint8_t* target_data; -- CHECK(target.getStorageIfAligned(&target_data)); -+ FAST_SPREAD_BUFFER_ARG(target_obj, target_buffer); -+ if (target_buffer_length <= kMaxSizeInHeap) { -+ HandleScope handle_scope(options.isolate); -+ SPREAD_BUFFER_ARG(target_obj, target_buffer); -+ target_data = reinterpret_cast<uint8_t*>(target_buffer_data); -+ } else { -+ target_data = target_buffer_data; -+ } - - memmove(target_data + target_start, source_data + source_start, to_copy); -- - return to_copy; - } - -@@ -865,19 +877,17 @@ void Compare(const FunctionCallbackInfo<Value> &args) { - } - - int32_t FastCompare(v8::Local<v8::Value>, -- const FastApiTypedArray<uint8_t>& a, -- const FastApiTypedArray<uint8_t>& b) { -- uint8_t* data_a; -- uint8_t* data_b; -- CHECK(a.getStorageIfAligned(&data_a)); -- CHECK(b.getStorageIfAligned(&data_b)); -+ v8::Local<v8::Value> a, -+ v8::Local<v8::Value> b) { -+ FAST_SPREAD_BUFFER_ARG(a, a_buffer); -+ FAST_SPREAD_BUFFER_ARG(b, b_buffer); - -- size_t cmp_length = std::min(a.length(), b.length()); -+ size_t cmp_length = std::min(a_buffer_length, b_buffer_length); - - return normalizeCompareVal( -- cmp_length > 0 ? memcmp(data_a, data_b, cmp_length) : 0, -- a.length(), -- b.length()); -+ cmp_length > 0 ? memcmp(a_buffer_data, b_buffer_data, cmp_length) : 0, -+ a_buffer_length, -+ b_buffer_length); - } - - static v8::CFunction fast_compare(v8::CFunction::Make(FastCompare)); -@@ -1149,14 +1159,13 @@ void SlowIndexOfNumber(const FunctionCallbackInfo<Value>& args) { - } - - int32_t FastIndexOfNumber(v8::Local<v8::Value>, -- const FastApiTypedArray<uint8_t>& buffer, -+ v8::Local<v8::Value> source_obj, - uint32_t needle, - int64_t offset_i64, - bool is_forward) { -- uint8_t* buffer_data; -- CHECK(buffer.getStorageIfAligned(&buffer_data)); -+ FAST_SPREAD_BUFFER_ARG(source_obj, buffer); - return IndexOfNumber( -- buffer_data, buffer.length(), needle, offset_i64, is_forward); -+ buffer_data, buffer_length, needle, offset_i64, is_forward); - } - - static v8::CFunction fast_index_of_number( -@@ -1496,21 +1505,31 @@ void SlowWriteString(const FunctionCallbackInfo<Value>& args) { - - template <encoding encoding> - uint32_t FastWriteString(Local<Value> receiver, -- const v8::FastApiTypedArray<uint8_t>& dst, -+ Local<v8::Value> dst, - const v8::FastOneByteString& src, - uint32_t offset, -- uint32_t max_length) { -- uint8_t* dst_data; -- CHECK(dst.getStorageIfAligned(&dst_data)); -- CHECK(offset <= dst.length()); -- CHECK(dst.length() - offset <= std::numeric_limits<uint32_t>::max()); -+ uint32_t max_length, -+ v8::FastApiCallbackOptions& options) { -+ THROW_AND_RETURN_VAL_UNLESS_BUFFER(options.isolate, dst, "dst", 0); -+ uint8_t* dst_buffer_data; -+ FAST_SPREAD_BUFFER_ARG(dst, dst_fast_buffer); -+ if (dst_fast_buffer_length <= kMaxSizeInHeap) { -+ HandleScope handle_scope(options.isolate); -+ SPREAD_BUFFER_ARG(dst, dst_slow_buffer); -+ dst_buffer_data = reinterpret_cast<uint8_t*>(dst_slow_buffer_data); -+ } else { -+ dst_buffer_data = dst_fast_buffer_data; -+ }; -+ -+ CHECK(dst_fast_buffer_length <= std::numeric_limits<uint32_t>::max()); -+ uint32_t dst_size = static_cast<uint32_t>(dst_fast_buffer_length); - TRACK_V8_FAST_API_CALL("buffer.writeString"); - - return WriteOneByteString<encoding>( - src.data, - src.length, -- reinterpret_cast<char*>(dst_data + offset), -- std::min<uint32_t>(dst.length() - offset, max_length)); -+ reinterpret_cast<char*>(dst_buffer_data + offset), -+ std::min<uint32_t>(dst_size - offset, max_length)); - } - - static const v8::CFunction fast_write_string_ascii( -diff --git a/src/util.h b/src/util.h -index dcd6548d41be786c42ce8328d89e532a8e9d43a2..7c98de621ca4d53cbaaa5bd4488aab20c7b033a7 100644 ---- a/src/util.h -+++ b/src/util.h -@@ -62,6 +62,7 @@ - namespace node { - - constexpr char kPathSeparator = std::filesystem::path::preferred_separator; -+static constexpr size_t kMaxSizeInHeap = 64; - - #ifdef _WIN32 - /* MAX_PATH is in characters, not bytes. Make sure we have enough headroom. */ -@@ -589,6 +590,16 @@ class BufferValue : public MaybeStackBuffer<char> { - static_cast<char*>(name->Buffer()->Data()) + name##_offset; \ - if (name##_length > 0) CHECK_NE(name##_data, nullptr); - -+#define FAST_SPREAD_BUFFER_ARG(val, name) \ -+ CHECK((val)->IsArrayBufferView()); \ -+ v8::Local<v8::ArrayBufferView> name = (val).As<v8::ArrayBufferView>(); \ -+ uint8_t name##_buffer[kMaxSizeInHeap]; \ -+ v8::MemorySpan<uint8_t> name##_storage(name##_buffer); \ -+ name##_storage = name->GetContents(name##_storage); \ -+ const size_t name##_length = name##_storage.size(); \ -+ uint8_t* name##_data = name##_storage.data(); \ -+ if (name##_length > 0) CHECK_NE(name##_data, nullptr); -+ - // Use this when a variable or parameter is unused in order to explicitly - // silence a compiler warning about that. - template <typename T> inline void USE(T&&) {} diff --git a/patches/node/fix_remove_outdated_v8_flags_from_node_cc.patch b/patches/node/fix_remove_outdated_v8_flags_from_node_cc.patch deleted file mode 100644 index 5251bd1cfc1d6..0000000000000 --- a/patches/node/fix_remove_outdated_v8_flags_from_node_cc.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr <shelley.vohr@gmail.com> -Date: Fri, 18 Oct 2024 17:01:06 +0200 -Subject: fix: remove outdated V8 flags from node.cc - -Refs https://chromium-review.googlesource.com/c/v8/v8/+/5507047 -Refs https://chromium-review.googlesource.com/c/v8/v8/+/6249026 -Refs https://chromium-review.googlesource.com/c/v8/v8/+/6948286 - -The above CLs remove the following flags from V8: -* --harmony-import-assertions -* --experimental-wasm-memory64 -* --experimental-wasm-imported-strings - -This patch can be removed when we upgrade to a V8 version that -contains the above CLs. - -diff --git a/src/node.cc b/src/node.cc -index 07684482f855363e26c3d7299a585a8a5654015e..5a7378890dc310bb3779974c79f387e7cdda15b0 100644 ---- a/src/node.cc -+++ b/src/node.cc -@@ -816,7 +816,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args, - } - // TODO(nicolo-ribaudo): remove this once V8 doesn't enable it by default - // anymore. -- v8_args.emplace_back("--no-harmony-import-assertions"); -+ // v8_args.emplace_back("--no-harmony-import-assertions"); - - auto env_opts = per_process::cli_options->per_isolate->per_env; - if (std::find(v8_args.begin(), v8_args.end(), -@@ -827,8 +827,8 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args, - } - - // Support stable Phase 5 WebAssembly proposals -- v8_args.emplace_back("--experimental-wasm-imported-strings"); -- v8_args.emplace_back("--experimental-wasm-memory64"); -+ // v8_args.emplace_back("--experimental-wasm-imported-strings"); -+ // v8_args.emplace_back("--experimental-wasm-memory64"); - v8_args.emplace_back("--experimental-wasm-exnref"); - - #ifdef __POSIX__ diff --git a/patches/node/fix_replace_deprecated_setprototype.patch b/patches/node/fix_replace_deprecated_setprototype.patch deleted file mode 100644 index 44e193cd56e79..0000000000000 --- a/patches/node/fix_replace_deprecated_setprototype.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samuel Maddock <smaddock@slack-corp.com> -Date: Mon, 6 Oct 2025 16:34:43 -0400 -Subject: fix: replace deprecated Get/SetPrototype - -https://chromium-review.googlesource.com/c/v8/v8/+/6983465 - -This is already applied in newer versions of Node so we can drop -this patch once we upgrade to v23. - -diff --git a/src/api/environment.cc b/src/api/environment.cc -index 0a358735c331767e8eb563a80e9aaccfb544c27b..d7d18d5fcbf008ac131db189a141315af4f6410b 100644 ---- a/src/api/environment.cc -+++ b/src/api/environment.cc -@@ -835,7 +835,7 @@ MaybeLocal<Object> InitializePrivateSymbols(Local<Context> context, - - Local<Object> private_symbols_object; - if (!private_symbols->NewInstance(context).ToLocal(&private_symbols_object) || -- private_symbols_object->SetPrototype(context, Null(isolate)) -+ private_symbols_object->SetPrototypeV2(context, Null(isolate)) - .IsNothing()) { - return MaybeLocal<Object>(); - } -@@ -861,7 +861,7 @@ MaybeLocal<Object> InitializePerIsolateSymbols(Local<Context> context, - Local<Object> per_isolate_symbols_object; - if (!per_isolate_symbols->NewInstance(context).ToLocal( - &per_isolate_symbols_object) || -- per_isolate_symbols_object->SetPrototype(context, Null(isolate)) -+ per_isolate_symbols_object->SetPrototypeV2(context, Null(isolate)) - .IsNothing()) { - return MaybeLocal<Object>(); - } -diff --git a/src/node_constants.cc b/src/node_constants.cc -index 2f23cc63f148a792f1302e1d2d88822730abaa33..42678e5d11e5ff9543bf12ec02fee7d3263d7629 100644 ---- a/src/node_constants.cc -+++ b/src/node_constants.cc -@@ -1307,7 +1307,7 @@ void CreatePerContextProperties(Local<Object> target, - .FromJust()); - - Local<Object> internal_constants = Object::New(isolate); -- CHECK(internal_constants->SetPrototype(env->context(), -+ CHECK(internal_constants->SetPrototypeV2(env->context(), - Null(env->isolate())).FromJust()); - - DefineErrnoConstants(err_constants); -diff --git a/src/node_sqlite.cc b/src/node_sqlite.cc -index 96101167016573e80fff520256ebb78c71d83302..a76a68e50d81bddd80c02fa8263b788c098c887d 100644 ---- a/src/node_sqlite.cc -+++ b/src/node_sqlite.cc -@@ -2106,9 +2106,9 @@ void StatementSync::Iterate(const FunctionCallbackInfo<Value>& args) { - StatementSyncIterator::Create(env, BaseObjectPtr<StatementSync>(stmt)); - - if (iter->object() -- ->GetPrototype() -+ ->GetPrototypeV2() - .As<Object>() -- ->SetPrototype(context, js_iterator_prototype) -+ ->SetPrototypeV2(context, js_iterator_prototype) - .IsNothing()) { - return; - } diff --git a/patches/node/fix_task_starvation_in_inspector_context_test.patch b/patches/node/fix_task_starvation_in_inspector_context_test.patch deleted file mode 100644 index 9e3438d72c40b..0000000000000 --- a/patches/node/fix_task_starvation_in_inspector_context_test.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Calvin Watford <cwatford@slack-corp.com> -Date: Thu, 3 Apr 2025 10:59:30 -0600 -Subject: Fix task starvation in inspector context test - -A V8 change makes these contexts get collected in a task that is posted -and run asynchronously. The tests were synchronously GC'ing in an -infinite loop, preventing the task loop from running the task that would -GC these contexts. - -This change should be upstreamed in some way. - -Ref: https://chromium-review.googlesource.com/c/v8/v8/+/4733273 - -diff --git a/test/parallel/test-inspector-contexts.js b/test/parallel/test-inspector-contexts.js -index e7bdc53f8cd5763572798cbd9ef07c902e3fc335..8b7a1f1aaf648efe10761af205ac561952a06980 100644 ---- a/test/parallel/test-inspector-contexts.js -+++ b/test/parallel/test-inspector-contexts.js -@@ -17,6 +17,13 @@ function notificationPromise(method) { - return new Promise((resolve) => session.once(method, resolve)); - } - -+function gcImmediate() { -+ return new Promise((resolve) => { -+ global.gc(); -+ setImmediate(resolve); -+ }); -+} -+ - async function testContextCreatedAndDestroyed() { - console.log('Testing context created/destroyed notifications'); - { -@@ -68,7 +75,7 @@ async function testContextCreatedAndDestroyed() { - // GC is unpredictable... - console.log('Checking/waiting for GC.'); - while (!contextDestroyed) -- global.gc(); -+ await gcImmediate(); - console.log('Context destroyed.'); - - assert.strictEqual(contextDestroyed.params.executionContextId, id, -@@ -100,7 +107,7 @@ async function testContextCreatedAndDestroyed() { - // GC is unpredictable... - console.log('Checking/waiting for GC again.'); - while (!contextDestroyed) -- global.gc(); -+ await gcImmediate(); - console.log('Other context destroyed.'); - } - -@@ -126,7 +133,7 @@ async function testContextCreatedAndDestroyed() { - // GC is unpredictable... - console.log('Checking/waiting for GC a third time.'); - while (!contextDestroyed) -- global.gc(); -+ await gcImmediate(); - console.log('Context destroyed once again.'); - } - -@@ -150,7 +157,7 @@ async function testContextCreatedAndDestroyed() { - // GC is unpredictable... - console.log('Checking/waiting for GC a fourth time.'); - while (!contextDestroyed) -- global.gc(); -+ await gcImmediate(); - console.log('Context destroyed a fourth time.'); - } - } diff --git a/patches/node/lib_check_sharedarraybuffer_existence_in_fast-utf8-stream.patch b/patches/node/lib_check_sharedarraybuffer_existence_in_fast-utf8-stream.patch new file mode 100644 index 0000000000000..6379c9643b511 --- /dev/null +++ b/patches/node/lib_check_sharedarraybuffer_existence_in_fast-utf8-stream.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr <shelley.vohr@gmail.com> +Date: Sat, 25 Oct 2025 11:06:10 +0200 +Subject: lib: check SharedArrayBuffer existence in fast-utf8-stream + +After https://github.com/nodejs/node/pull/58897 calling +Object.entries on fs will lazy-load fast-utf8-stream, which uses +SharedArrayBuffer without checking for its existence first. It +won't exist in the renderer process and will throw +'SharedArrayBuffer is not a constructor'. Refactor to check +for SharedArrayBuffer first. + +This should be upstreamed to Node.js + +diff --git a/lib/internal/streams/fast-utf8-stream.js b/lib/internal/streams/fast-utf8-stream.js +index 3bfcc494d17b5cc4c9f494fab4aff4f0d68d2287..241a6b05e84f8e79b8c9b93abfda5562c2e35e9e 100644 +--- a/lib/internal/streams/fast-utf8-stream.js ++++ b/lib/internal/streams/fast-utf8-stream.js +@@ -49,7 +49,8 @@ const { + const BUSY_WRITE_TIMEOUT = 100; + const kEmptyBuffer = Buffer.allocUnsafe(0); + +-const kNil = new Int32Array(new SharedArrayBuffer(4)); ++const haveSAB = typeof SharedArrayBuffer !== 'undefined'; ++const kNil = haveSAB ? new Int32Array(new SharedArrayBuffer(4)) : null; + + function sleep(ms) { + // Also filters out NaN, non-number types, including empty strings, but allows bigints +@@ -59,10 +60,14 @@ function sleep(ms) { + throw new ERR_INVALID_ARG_TYPE('ms', ['number', 'bigint'], ms); + } + throw new ERR_INVALID_ARG_VALUE.RangeError('ms', ms, +- 'must be a number greater than 0 and less than Infinity'); ++ 'must be a number greater than 0 and less than Infinity'); ++ } ++ if (haveSAB) { ++ AtomicsWait(kNil, 0, 0, Number(ms)); ++ } else { ++ const { sleep: _sleep } = internalBinding('util'); ++ _sleep(ms); + } +- +- AtomicsWait(kNil, 0, 0, Number(ms)); + } + + // 16 KB. Don't write more than docker buffer size. diff --git a/patches/node/node-api_use_writeonebytev2_in_napi_get_value_string_latin1.patch b/patches/node/node-api_use_writeonebytev2_in_napi_get_value_string_latin1.patch deleted file mode 100644 index 262e000823261..0000000000000 --- a/patches/node/node-api_use_writeonebytev2_in_napi_get_value_string_latin1.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Chengzhong Wu <cwu631@bloomberg.net> -Date: Fri, 16 May 2025 17:10:54 +0100 -Subject: node-api: use WriteOneByteV2 in napi_get_value_string_latin1 - -PR-URL: https://github.com/nodejs/node/pull/58325 -Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> -Reviewed-By: Michael Dawson <midawson@redhat.com> - -diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc -index cc2312bd2fd1ed194f927bbf33951ca0548d1a31..e4fd88f406be4d9117aa490ca2aa328c5ff0aab9 100644 ---- a/src/js_native_api_v8.cc -+++ b/src/js_native_api_v8.cc -@@ -2441,21 +2441,21 @@ napi_status NAPI_CDECL napi_get_value_string_latin1( - - v8::Local<v8::Value> val = v8impl::V8LocalValueFromJsValue(value); - RETURN_STATUS_IF_FALSE(env, val->IsString(), napi_string_expected); -+ v8::Local<v8::String> str = val.As<v8::String>(); - - if (!buf) { - CHECK_ARG(env, result); -- *result = val.As<v8::String>()->Length(); -+ *result = str->Length(); - } else if (bufsize != 0) { -- int copied = -- val.As<v8::String>()->WriteOneByte(env->isolate, -- reinterpret_cast<uint8_t*>(buf), -- 0, -- bufsize - 1, -- v8::String::NO_NULL_TERMINATION); -- -- buf[copied] = '\0'; -+ uint32_t length = static_cast<uint32_t>( -+ std::min(bufsize - 1, static_cast<size_t>(str->Length()))); -+ str->WriteOneByteV2(env->isolate, -+ 0, -+ length, -+ reinterpret_cast<uint8_t*>(buf), -+ v8::String::WriteFlags::kNullTerminate); - if (result != nullptr) { -- *result = copied; -+ *result = length; - } - } else if (result != nullptr) { - *result = 0; -@@ -2479,12 +2479,12 @@ napi_status NAPI_CDECL napi_get_value_string_utf8( - - v8::Local<v8::Value> val = v8impl::V8LocalValueFromJsValue(value); - RETURN_STATUS_IF_FALSE(env, val->IsString(), napi_string_expected); -+ v8::Local<v8::String> str = val.As<v8::String>(); - - if (!buf) { - CHECK_ARG(env, result); -- *result = val.As<v8::String>()->Utf8LengthV2(env->isolate); -+ *result = str->Utf8LengthV2(env->isolate); - } else if (bufsize != 0) { -- auto str = val.As<v8::String>(); - size_t copied = - str->WriteUtf8V2(env->isolate, - buf, diff --git a/patches/node/node-api_use_writev2_in_napi_get_value_string_utf16.patch b/patches/node/node-api_use_writev2_in_napi_get_value_string_utf16.patch deleted file mode 100644 index ecb6d83cf0624..0000000000000 --- a/patches/node/node-api_use_writev2_in_napi_get_value_string_utf16.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= <tniessen@tnie.de> -Date: Fri, 16 May 2025 17:10:45 +0100 -Subject: node-api: use WriteV2 in napi_get_value_string_utf16 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Since `String::Write()` is deprecated, use `String::Write2()` instead. -That requires us to compute the correct number of characters ahead of -time but removes the need for dealing with the return value. - -PR-URL: https://github.com/nodejs/node/pull/58165 -Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> -Reviewed-By: James M Snell <jasnell@gmail.com> -Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com> -Reviewed-By: Chengzhong Wu <legendecas@gmail.com> -Reviewed-By: Michael Dawson <midawson@redhat.com> - -diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc -index 8f97ca4d9cbb840efd36c77fed12d746a2793670..cc2312bd2fd1ed194f927bbf33951ca0548d1a31 100644 ---- a/src/js_native_api_v8.cc -+++ b/src/js_native_api_v8.cc -@@ -2520,21 +2520,23 @@ napi_status NAPI_CDECL napi_get_value_string_utf16(napi_env env, - - v8::Local<v8::Value> val = v8impl::V8LocalValueFromJsValue(value); - RETURN_STATUS_IF_FALSE(env, val->IsString(), napi_string_expected); -+ v8::Local<v8::String> str = val.As<v8::String>(); - - if (!buf) { - CHECK_ARG(env, result); - // V8 assumes UTF-16 length is the same as the number of characters. -- *result = val.As<v8::String>()->Length(); -+ *result = str->Length(); - } else if (bufsize != 0) { -- int copied = val.As<v8::String>()->Write(env->isolate, -- reinterpret_cast<uint16_t*>(buf), -- 0, -- bufsize - 1, -- v8::String::NO_NULL_TERMINATION); -+ uint32_t length = static_cast<uint32_t>( -+ std::min(bufsize - 1, static_cast<size_t>(str->Length()))); -+ str->WriteV2(env->isolate, -+ 0, -+ length, -+ reinterpret_cast<uint16_t*>(buf), -+ v8::String::WriteFlags::kNullTerminate); - -- buf[copied] = '\0'; - if (result != nullptr) { -- *result = copied; -+ *result = length; - } - } else if (result != nullptr) { - *result = 0; diff --git a/patches/node/pass_all_globals_through_require.patch b/patches/node/pass_all_globals_through_require.patch index cc4c2dbac1cac..c121874bbeeb1 100644 --- a/patches/node/pass_all_globals_through_require.patch +++ b/patches/node/pass_all_globals_through_require.patch @@ -6,10 +6,10 @@ Subject: Pass all globals through "require" (cherry picked from commit 7d015419cb7a0ecfe6728431a4ed2056cd411d62) diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index a7d8fa1139c82054ac37a4e11cfb68605dc21f31..589c239aa544e118b7d9b7fff86d7deefe903896 100644 +index 8a28cd0e497911550cb0fa889c4f2f780d86c24b..811a2961834b9648f5f6b51c3bda570541413818 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -202,6 +202,13 @@ const { +@@ -208,6 +208,13 @@ const { CHAR_FORWARD_SLASH, } = require('internal/constants'); @@ -23,7 +23,7 @@ index a7d8fa1139c82054ac37a4e11cfb68605dc21f31..589c239aa544e118b7d9b7fff86d7dee const { isProxy, } = require('internal/util/types'); -@@ -1701,10 +1708,12 @@ Module.prototype._compile = function(content, filename, format) { +@@ -1755,10 +1762,12 @@ Module.prototype._compile = function(content, filename, format) { if (this[kIsMainSymbol] && getOptionValue('--inspect-brk')) { const { callAndPauseOnStart } = internalBinding('inspector'); result = callAndPauseOnStart(compiledWrapper, thisValue, exports, diff --git a/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch b/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch index 2772afcbe43c9..a192468d4cf7e 100644 --- a/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch +++ b/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch @@ -7,10 +7,10 @@ We use this to allow node's 'fs' module to read from ASAR files as if they were a real filesystem. diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js -index 1a39b9f15e689e5c7ca1e3001b2ef6d854f8cc1e..9035311718c0a68e903e0ce748480bc78112c6ff 100644 +index 963fe2ab11927a6802d2b1c0f653b5b1032d4243..0a531f216bd64477b800a169e91d859844161f16 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js -@@ -132,6 +132,10 @@ process.domain = null; +@@ -129,6 +129,10 @@ process.domain = null; } process._exiting = false; diff --git a/patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch b/patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch index 32bfeaea784ce..734d31ac7bb2c 100644 --- a/patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch +++ b/patches/node/refactor_attach_cppgc_heap_on_v8_isolate_creation.patch @@ -18,10 +18,10 @@ This can be removed when Node.js upgrades to a version of V8 containing CLs from the above issue. diff --git a/src/api/environment.cc b/src/api/environment.cc -index cb37fa080fc8e8d524cfa2758c4a8c2c5652324d..8e227ddd1be50c046a8cf2895a31d607eb7d31de 100644 +index a869bc0a145009b57db3f37208e405d9356cc20f..072deb1fa70313e33397f6ff994e3f3548e86092 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -316,6 +316,10 @@ Isolate* NewIsolate(Isolate::CreateParams* params, +@@ -319,6 +319,10 @@ Isolate* NewIsolate(Isolate::CreateParams* params, MultiIsolatePlatform* platform, const SnapshotData* snapshot_data, const IsolateSettings& settings) { @@ -32,7 +32,7 @@ index cb37fa080fc8e8d524cfa2758c4a8c2c5652324d..8e227ddd1be50c046a8cf2895a31d607 Isolate* isolate = Isolate::Allocate(); if (isolate == nullptr) return nullptr; -@@ -359,9 +363,12 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator, +@@ -374,9 +378,12 @@ Isolate* NewIsolate(ArrayBufferAllocator* allocator, uv_loop_t* event_loop, MultiIsolatePlatform* platform, const EmbedderSnapshotData* snapshot_data, @@ -46,100 +46,66 @@ index cb37fa080fc8e8d524cfa2758c4a8c2c5652324d..8e227ddd1be50c046a8cf2895a31d607 return NewIsolate(¶ms, event_loop, platform, -diff --git a/src/env.cc b/src/env.cc -index 85641b68b1e6f6dd4149f33ba13f76bccc8bf47d..c6209cc7cf317de1bb9217e39dd760e5a83303e2 100644 ---- a/src/env.cc -+++ b/src/env.cc -@@ -578,14 +578,6 @@ IsolateData::IsolateData(Isolate* isolate, - // We do not care about overflow since we just want this to be different - // from the cppgc id. - uint16_t non_cppgc_id = cppgc_id + 1; -- if (cpp_heap == nullptr) { -- cpp_heap_ = CppHeap::Create(platform, v8::CppHeapCreateParams{{}}); -- // TODO(joyeecheung): pass it into v8::Isolate::CreateParams and let V8 -- // own it when we can keep the isolate registered/task runner discoverable -- // during isolate disposal. -- isolate->AttachCppHeap(cpp_heap_.get()); -- } -- - { - // GC could still be run after the IsolateData is destroyed, so we store - // the ids in a static map to ensure pointers to them are still valid -@@ -608,15 +600,6 @@ IsolateData::IsolateData(Isolate* isolate, - } +diff --git a/src/cppgc_helpers-inl.h b/src/cppgc_helpers-inl.h +index 745ecab746f7c7540733d31a94f52809dcddd5be..0e52bf5a6f4837d0f4bfed83987c6903796fda55 100644 +--- a/src/cppgc_helpers-inl.h ++++ b/src/cppgc_helpers-inl.h +@@ -15,11 +15,12 @@ void CppgcMixin::Wrap(T* ptr, Realm* realm, v8::Local<v8::Object> obj) { + v8::Isolate* isolate = realm->isolate(); + ptr->traced_reference_ = v8::TracedReference<v8::Object>(isolate, obj); + // Note that ptr must be of concrete type T in Wrap. +- v8::Object::Wrap<v8::CppHeapPointerTag::kDefaultTag>(isolate, obj, ptr); ++ auto* wrappable = static_cast<v8::Object::Wrappable*>(ptr); ++ v8::Object::Wrap<v8::CppHeapPointerTag::kDefaultTag>(isolate, obj, wrappable); + // Keep the layout consistent with BaseObjects. + obj->SetAlignedPointerInInternalField( +- kEmbedderType, realm->isolate_data()->embedder_id_for_cppgc()); +- obj->SetAlignedPointerInInternalField(kSlot, ptr); ++ kEmbedderType, realm->isolate_data()->embedder_id_for_cppgc(), 0); ++ obj->SetAlignedPointerInInternalField(kSlot, ptr, 0); + realm->TrackCppgcWrapper(ptr); } --IsolateData::~IsolateData() { -- if (cpp_heap_ != nullptr) { -- v8::Locker locker(isolate_); -- // The CppHeap must be detached before being terminated. -- isolate_->DetachCppHeap(); -- cpp_heap_->Terminate(); -- } --} -- - // Deprecated API, embedders should use v8::Object::Wrap() directly instead. - void SetCppgcReference(Isolate* isolate, - Local<Object> object, -diff --git a/src/env.h b/src/env.h -index 2d5fa8dbd75851bca30453548f6cbe0159509f26..c346e3a9c827993036438685d758a734f9ce8c05 100644 ---- a/src/env.h -+++ b/src/env.h -@@ -157,7 +157,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer { - ArrayBufferAllocator* node_allocator = nullptr, - const EmbedderSnapshotData* embedder_snapshot_data = nullptr, - std::shared_ptr<PerIsolateOptions> options = nullptr); -- ~IsolateData(); - - SET_MEMORY_INFO_NAME(IsolateData) - SET_SELF_SIZE(IsolateData) -@@ -260,7 +259,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer { - const SnapshotData* snapshot_data_; - std::optional<SnapshotConfig> snapshot_config_; - -- std::unique_ptr<v8::CppHeap> cpp_heap_; - std::shared_ptr<PerIsolateOptions> options_; - worker::Worker* worker_context_ = nullptr; - PerIsolateWrapperData* wrapper_data_; -diff --git a/src/node.cc b/src/node.cc -index 5a7378890dc310bb3779974c79f387e7cdda15b0..0725cc97510375bc616534ddf3de4b231bae6bf5 100644 ---- a/src/node.cc -+++ b/src/node.cc -@@ -1295,6 +1295,14 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, - result->platform_ = per_process::v8_platform.Platform(); +@@ -40,7 +41,7 @@ T* CppgcMixin::Unwrap(v8::Local<v8::Object> obj) { + if (obj->InternalFieldCount() != T::kInternalFieldCount) { + return nullptr; } +- T* ptr = static_cast<T*>(obj->GetAlignedPointerFromInternalField(T::kSlot)); ++ T* ptr = static_cast<T*>(obj->GetAlignedPointerFromInternalField(T::kSlot, 0)); + return ptr; + } -+ if (!(flags & ProcessInitializationFlags::kNoInitializeCppgc)) { -+ v8::PageAllocator* allocator = nullptr; -+ if (result->platform_ != nullptr) { -+ allocator = result->platform_->GetPageAllocator(); -+ } -+ cppgc::InitializeProcess(allocator); -+ } -+ - if (!(flags & ProcessInitializationFlags::kNoInitializeV8)) { - V8::Initialize(); +diff --git a/src/cppgc_helpers.h b/src/cppgc_helpers.h +index fb2af584a4ae777022c9ef8c20ada1edcbbbefdc..fe6300a5d5d2d6602a84cbd33736c2133041d1b0 100644 +--- a/src/cppgc_helpers.h ++++ b/src/cppgc_helpers.h +@@ -155,7 +155,7 @@ class CppgcMixin : public cppgc::GarbageCollectedMixin, public MemoryRetainer { + */ + #define CPPGC_MIXIN(Klass) \ + public /* NOLINT(whitespace/indent) */ \ +- cppgc::GarbageCollected<Klass>, public cppgc::NameProvider, public CppgcMixin ++ v8::Object::Wrappable, public CppgcMixin -@@ -1304,14 +1312,6 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args, - absl::SetMutexDeadlockDetectionMode(absl::OnDeadlockCycle::kIgnore); - } + #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -- if (!(flags & ProcessInitializationFlags::kNoInitializeCppgc)) { -- v8::PageAllocator* allocator = nullptr; -- if (result->platform_ != nullptr) { -- allocator = result->platform_->GetPageAllocator(); -- } -- cppgc::InitializeProcess(allocator); -- } -- - #if NODE_USE_V8_WASM_TRAP_HANDLER - bool use_wasm_trap_handler = - !per_process::cli_options->disable_wasm_trap_handler; +diff --git a/src/env.cc b/src/env.cc +index 53f0bf7fc1e5c85fa9a5a323e998f04310f4f75e..a78817467518245c4a190e870e0eb30658eafcdb 100644 +--- a/src/env.cc ++++ b/src/env.cc +@@ -611,7 +611,7 @@ IsolateData::~IsolateData() {} + // Deprecated API, embedders should use v8::Object::Wrap() directly instead. + void SetCppgcReference(Isolate* isolate, + Local<Object> object, +- void* wrappable) { ++ v8::Object::Wrappable* wrappable) { + v8::Object::Wrap<v8::CppHeapPointerTag::kDefaultTag>( + isolate, object, wrappable); + } diff --git a/src/node.h b/src/node.h -index d3a965661d068db359bb1bb4b14e59c28bb615f9..16a0c71aef949b0ddd27def9dc843298f9a6b75f 100644 +index f7b3f90b0c2cfbeacc5bc50112dd711df8d3c364..7fae281a6e0f3c1a9f0eb97536883bb26c16d94d 100644 --- a/src/node.h +++ b/src/node.h -@@ -590,7 +590,8 @@ NODE_EXTERN v8::Isolate* NewIsolate( +@@ -604,7 +604,8 @@ NODE_EXTERN v8::Isolate* NewIsolate( struct uv_loop_s* event_loop, MultiIsolatePlatform* platform, const EmbedderSnapshotData* snapshot_data = nullptr, @@ -149,8 +115,22 @@ index d3a965661d068db359bb1bb4b14e59c28bb615f9..16a0c71aef949b0ddd27def9dc843298 NODE_EXTERN v8::Isolate* NewIsolate( std::shared_ptr<ArrayBufferAllocator> allocator, struct uv_loop_s* event_loop, +@@ -1617,9 +1618,10 @@ void RegisterSignalHandler(int signal, + // work with only Node.js versions with v8::Object::Wrap() should use that + // instead. + NODE_DEPRECATED("Use v8::Object::Wrap()", +- NODE_EXTERN void SetCppgcReference(v8::Isolate* isolate, +- v8::Local<v8::Object> object, +- void* wrappable)); ++ NODE_EXTERN void SetCppgcReference( ++ v8::Isolate* isolate, ++ v8::Local<v8::Object> object, ++ v8::Object::Wrappable* wrappable)); + + } // namespace node + diff --git a/src/node_main_instance.cc b/src/node_main_instance.cc -index 4119ac1b002681d39711eac810ca2fcc2702ffc7..790347056cde949ffe6cf8498a7eca0c4864c997 100644 +index dd6ecd1f9d82f6661b2480c0195e33515633429f..334d5cb7df7a763e0929468392dad83421cad606 100644 --- a/src/node_main_instance.cc +++ b/src/node_main_instance.cc @@ -44,6 +44,8 @@ NodeMainInstance::NodeMainInstance(const SnapshotData* snapshot_data, @@ -162,22 +142,11 @@ index 4119ac1b002681d39711eac810ca2fcc2702ffc7..790347056cde949ffe6cf8498a7eca0c isolate_ = NewIsolate(isolate_params_.get(), event_loop, platform, snapshot_data); -@@ -81,9 +83,9 @@ NodeMainInstance::~NodeMainInstance() { - // This should only be done on a main instance that owns its isolate. - // IsolateData must be freed before UnregisterIsolate() is called. - isolate_data_.reset(); -- platform_->UnregisterIsolate(isolate_); - } - isolate_->Dispose(); -+ platform_->UnregisterIsolate(isolate_); - } - - ExitCode NodeMainInstance::Run() { diff --git a/src/node_worker.cc b/src/node_worker.cc -index 29c4b1de42b3127a98871d200c80197bf974b31f..8555ab556b5b74a1cf9cf30747f1f417bfe4e4d9 100644 +index 7bae29747d8cd8e83973d105099f9111fc185fe1..62c53368d1173edb7eb42e3337049c46fd7cdda9 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc -@@ -177,6 +177,9 @@ class WorkerThreadData { +@@ -181,6 +181,9 @@ class WorkerThreadData { SetIsolateCreateParamsForNode(¶ms); w->UpdateResourceConstraints(¶ms.constraints); params.array_buffer_allocator_shared = allocator; @@ -187,153 +156,3 @@ index 29c4b1de42b3127a98871d200c80197bf974b31f..8555ab556b5b74a1cf9cf30747f1f417 Isolate* isolate = NewIsolate(¶ms, &loop_, w->platform_, w->snapshot_data()); if (isolate == nullptr) { -@@ -245,13 +248,8 @@ class WorkerThreadData { - *static_cast<bool*>(data) = true; - }, &platform_finished); - -- // The order of these calls is important; if the Isolate is first disposed -- // and then unregistered, there is a race condition window in which no -- // new Isolate at the same address can successfully be registered with -- // the platform. -- // (Refs: https://github.com/nodejs/node/issues/30846) -- w_->platform_->UnregisterIsolate(isolate); - isolate->Dispose(); -+ w_->platform_->UnregisterIsolate(isolate); - - // Wait until the platform has cleaned up all relevant resources. - while (!platform_finished) { -diff --git a/src/util.cc b/src/util.cc -index 0c01d338b9d1ced7f173ac862239315f91326791..5ca32f026f9f001ddadc14965705fe005600eddd 100644 ---- a/src/util.cc -+++ b/src/util.cc -@@ -726,8 +726,8 @@ RAIIIsolateWithoutEntering::RAIIIsolateWithoutEntering(const SnapshotData* data) - } - - RAIIIsolateWithoutEntering::~RAIIIsolateWithoutEntering() { -- per_process::v8_platform.Platform()->UnregisterIsolate(isolate_); - isolate_->Dispose(); -+ per_process::v8_platform.Platform()->UnregisterIsolate(isolate_); - } - - RAIIIsolate::RAIIIsolate(const SnapshotData* data) -diff --git a/test/cctest/node_test_fixture.h b/test/cctest/node_test_fixture.h -index 3414c0be8ad777f0b9836323150071b688831a38..82013ffe7667d53248bd616efb79b294e4ae47dd 100644 ---- a/test/cctest/node_test_fixture.h -+++ b/test/cctest/node_test_fixture.h -@@ -123,8 +123,8 @@ class NodeTestFixture : public NodeZeroIsolateTestFixture { - void TearDown() override { - platform->DrainTasks(isolate_); - isolate_->Exit(); -- platform->UnregisterIsolate(isolate_); - isolate_->Dispose(); -+ platform->UnregisterIsolate(isolate_); - isolate_ = nullptr; - NodeZeroIsolateTestFixture::TearDown(); - } -diff --git a/test/cctest/test_cppgc.cc b/test/cctest/test_cppgc.cc -index edd413ae9b956b2e59e8166785adef6a8ff06d51..d1c1549efcb0320bc0f7d354db2101acc0930005 100644 ---- a/test/cctest/test_cppgc.cc -+++ b/test/cctest/test_cppgc.cc -@@ -46,18 +46,15 @@ int CppGCed::kDestructCount = 0; - int CppGCed::kTraceCount = 0; - - TEST_F(NodeZeroIsolateTestFixture, ExistingCppHeapTest) { -- v8::Isolate* isolate = -- node::NewIsolate(allocator.get(), ¤t_loop, platform.get()); - - // Create and attach the CppHeap before we set up the IsolateData so that - // it recognizes the existing heap. - std::unique_ptr<v8::CppHeap> cpp_heap = - v8::CppHeap::Create(platform.get(), v8::CppHeapCreateParams{{}}); - -- // TODO(joyeecheung): pass it into v8::Isolate::CreateParams and let V8 -- // own it when we can keep the isolate registered/task runner discoverable -- // during isolate disposal. -- isolate->AttachCppHeap(cpp_heap.get()); -+ v8::Isolate* isolate = -+ node::NewIsolate(allocator.get(), ¤t_loop, platform.get(), -+ nullptr, {}, std::move(cpp_heap)); - - // Try creating Context + IsolateData + Environment. - { -@@ -102,13 +99,11 @@ TEST_F(NodeZeroIsolateTestFixture, ExistingCppHeapTest) { - platform->DrainTasks(isolate); - - // Cleanup. -- isolate->DetachCppHeap(); -- cpp_heap->Terminate(); - platform->DrainTasks(isolate); - } - -- platform->UnregisterIsolate(isolate); - isolate->Dispose(); -+ platform->UnregisterIsolate(isolate); - - // Check that all the objects are created and destroyed properly. - EXPECT_EQ(CppGCed::kConstructCount, 100); -diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc -index 008cda77b650dc2d904ae00e7629b5ad05d297ad..103931516cea9beb7f25c53526928e67b3c90d2d 100644 ---- a/test/cctest/test_environment.cc -+++ b/test/cctest/test_environment.cc -@@ -625,6 +625,9 @@ TEST_F(NodeZeroIsolateTestFixture, CtrlCWithOnlySafeTerminationTest) { - // Allocate and initialize Isolate. - v8::Isolate::CreateParams create_params; - create_params.array_buffer_allocator = allocator.get(); -+ create_params.cpp_heap = -+ v8::CppHeap::Create(platform.get(), v8::CppHeapCreateParams{{}}) -+ .release(); - v8::Isolate* isolate = v8::Isolate::Allocate(); - CHECK_NOT_NULL(isolate); - platform->RegisterIsolate(isolate, ¤t_loop); -@@ -675,8 +678,8 @@ TEST_F(NodeZeroIsolateTestFixture, CtrlCWithOnlySafeTerminationTest) { - } - - // Cleanup. -- platform->UnregisterIsolate(isolate); - isolate->Dispose(); -+ platform->UnregisterIsolate(isolate); - } - #endif // _WIN32 - -diff --git a/test/cctest/test_platform.cc b/test/cctest/test_platform.cc -index 53644accf29749bf8fc18b641ae1eaef93cd6f98..7e5b143fb4b633e18a4b2d7440cba7e077c50950 100644 ---- a/test/cctest/test_platform.cc -+++ b/test/cctest/test_platform.cc -@@ -102,8 +102,8 @@ TEST_F(NodeZeroIsolateTestFixture, IsolatePlatformDelegateTest) { - - // Graceful shutdown - delegate->Shutdown(); -- platform->UnregisterIsolate(isolate); - isolate->Dispose(); -+ platform->UnregisterIsolate(isolate); - } - - TEST_F(PlatformTest, TracingControllerNullptr) { -diff --git a/test/fuzzers/fuzz_env.cc b/test/fuzzers/fuzz_env.cc -index bace3051f8cecd5050d4707f2431973752a22188..5ca295848a974c70ff1a9094eb288ef7e658d8e5 100644 ---- a/test/fuzzers/fuzz_env.cc -+++ b/test/fuzzers/fuzz_env.cc -@@ -65,8 +65,8 @@ public: - void Teardown() { - platform->DrainTasks(isolate_); - isolate_->Exit(); -- platform->UnregisterIsolate(isolate_); - isolate_->Dispose(); -+ platform->UnregisterIsolate(isolate_); - isolate_ = nullptr; - } - }; -diff --git a/test/fuzzers/fuzz_strings.cc b/test/fuzzers/fuzz_strings.cc -index 8f5e1a473e3148e0bcdcc3c2fd582685665ce461..936876cdae20d29618d3789a5ab46a1b3101a79d 100644 ---- a/test/fuzzers/fuzz_strings.cc -+++ b/test/fuzzers/fuzz_strings.cc -@@ -72,8 +72,8 @@ public: - void Teardown() { - platform->DrainTasks(isolate_); - isolate_->Exit(); -- platform->UnregisterIsolate(isolate_); - isolate_->Dispose(); -+ platform->UnregisterIsolate(isolate_); - isolate_ = nullptr; - } - }; diff --git a/patches/node/src_do_not_use_soon-to-be-deprecated_v8_api.patch b/patches/node/src_do_not_use_soon-to-be-deprecated_v8_api.patch deleted file mode 100644 index 15650a4479567..0000000000000 --- a/patches/node/src_do_not_use_soon-to-be-deprecated_v8_api.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Igor Sheludko <ishell@chromium.org> -Date: Fri, 19 Apr 2024 12:29:53 +0200 -Subject: src: do not use soon-to-be-deprecated V8 API - -V8 announced deprecation of the following methods: - - v8::Object::SetAccessor(...) in favor of - v8::Object::SetNativeDataProperty(...), - - v8::ObjectTemplate::SetNativeDataProperty(...) with AccessControl - parameter in favor of - v8::ObjectTemplate::SetNativeDataProperty(...) without AccessControl - parameter. - -See https://crrev.com/c/5006387. - -This slightly changes behavior of the following properties: - - process.debugPort (for worker processes), - - process.title (for worker processes), - - process.ppid. - -The difference is that they will now behave like a regular writable -JavaScript data properties - in case setter callback is not provided -they will be be reconfigured from a native data property (the one -that calls C++ callbacks upon get/set operations) to a real data -property (so subsequent reads will no longer trigger C++ getter -callbacks). - -PR-URL: https://github.com/nodejs/node/pull/53174 -Reviewed-By: Michael Dawson <midawson@redhat.com> -Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> -Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> -Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> -Reviewed-By: James M Snell <jasnell@gmail.com> - -diff --git a/src/node_process_object.cc b/src/node_process_object.cc -index 2e0d180d249c6925c761cb673a4a396905cc971c..5bf854723040859f841608f40ac43ea3d4a44b1e 100644 ---- a/src/node_process_object.cc -+++ b/src/node_process_object.cc -@@ -13,7 +13,6 @@ - - namespace node { - using v8::Context; --using v8::DEFAULT; - using v8::EscapableHandleScope; - using v8::Function; - using v8::FunctionCallbackInfo; -@@ -168,13 +167,12 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) { - - // process.title - CHECK(process -- ->SetAccessor( -+ ->SetNativeDataProperty( - context, - FIXED_ONE_BYTE_STRING(isolate, "title"), - ProcessTitleGetter, - env->owns_process_state() ? ProcessTitleSetter : nullptr, - Local<Value>(), -- DEFAULT, - None, - SideEffectType::kHasNoSideEffect) - .FromJust()); -@@ -193,9 +191,15 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) { - READONLY_PROPERTY(process, "pid", - Integer::New(isolate, uv_os_getpid())); - -- CHECK(process->SetAccessor(context, -- FIXED_ONE_BYTE_STRING(isolate, "ppid"), -- GetParentProcessId).FromJust()); -+ CHECK(process -+ ->SetNativeDataProperty(context, -+ FIXED_ONE_BYTE_STRING(isolate, "ppid"), -+ GetParentProcessId, -+ nullptr, -+ Local<Value>(), -+ None, -+ SideEffectType::kHasNoSideEffect) -+ .FromJust()); - - // --security-revert flags - #define V(code, _, __) \ -@@ -220,12 +224,15 @@ void PatchProcessObject(const FunctionCallbackInfo<Value>& args) { - - // process.debugPort - CHECK(process -- ->SetAccessor(context, -- FIXED_ONE_BYTE_STRING(isolate, "debugPort"), -- DebugPortGetter, -- env->owns_process_state() ? DebugPortSetter : nullptr, -- Local<Value>()) -- .FromJust()); -+ ->SetNativeDataProperty( -+ context, -+ FIXED_ONE_BYTE_STRING(isolate, "debugPort"), -+ DebugPortGetter, -+ env->owns_process_state() ? DebugPortSetter : nullptr, -+ Local<Value>(), -+ None, -+ SideEffectType::kHasNoSideEffect) -+ .FromJust()); - - // process.versions - Local<Object> versions = Object::New(isolate); -diff --git a/test/parallel/test-worker-unsupported-things.js b/test/parallel/test-worker-unsupported-things.js -index 18c1617c3cde5ef12f9c97828840c39e0be3dc2c..95d93d24dec9f1944091a97574f01c94d617cc49 100644 ---- a/test/parallel/test-worker-unsupported-things.js -+++ b/test/parallel/test-worker-unsupported-things.js -@@ -14,14 +14,16 @@ if (!process.env.HAS_STARTED_WORKER) { - } else { - { - const before = process.title; -- process.title += ' in worker'; -- assert.strictEqual(process.title, before); -+ const after = before + ' in worker'; -+ process.title = after; -+ assert.strictEqual(process.title, after); - } - - { - const before = process.debugPort; -- process.debugPort++; -- assert.strictEqual(process.debugPort, before); -+ const after = before + 1; -+ process.debugPort = after; -+ assert.strictEqual(process.debugPort, after); - } - - { diff --git a/patches/node/src_improve_utf8_string_generation_performance.patch b/patches/node/src_improve_utf8_string_generation_performance.patch deleted file mode 100644 index 9fba676aef4fb..0000000000000 --- a/patches/node/src_improve_utf8_string_generation_performance.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Yagiz Nizipli <yagiz@nizipli.com> -Date: Mon, 16 Sep 2024 20:19:46 -0400 -Subject: src: improve utf8 string generation performance - -PR-URL: https://github.com/nodejs/node/pull/54873 -Reviewed-By: Daniel Lemire <daniel@lemire.me> -Reviewed-By: Matteo Collina <matteo.collina@gmail.com> -Reviewed-By: James M Snell <jasnell@gmail.com> -Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> - -diff --git a/src/string_bytes.cc b/src/string_bytes.cc -index f0fbf496dcfdec2c522508c61ae24fb20b1eb081..4324ed52d7cd6af5202512858a62346c3ab6c302 100644 ---- a/src/string_bytes.cc -+++ b/src/string_bytes.cc -@@ -386,21 +386,21 @@ Maybe<size_t> StringBytes::StorageSize(Isolate* isolate, - Local<Value> val, - enum encoding encoding) { - HandleScope scope(isolate); -- size_t data_size = 0; -- bool is_buffer = Buffer::HasInstance(val); - -- if (is_buffer && (encoding == BUFFER || encoding == LATIN1)) { -+ if (Buffer::HasInstance(val) && (encoding == BUFFER || encoding == LATIN1)) { - return Just(Buffer::Length(val)); - } - - Local<String> str; - if (!val->ToString(isolate->GetCurrentContext()).ToLocal(&str)) - return Nothing<size_t>(); -+ String::ValueView view(isolate, str); -+ size_t data_size = 0; - - switch (encoding) { - case ASCII: - case LATIN1: -- data_size = str->Length(); -+ data_size = view.length(); - break; - - case BUFFER: -@@ -408,25 +408,25 @@ Maybe<size_t> StringBytes::StorageSize(Isolate* isolate, - // A single UCS2 codepoint never takes up more than 3 utf8 bytes. - // It is an exercise for the caller to decide when a string is - // long enough to justify calling Size() instead of StorageSize() -- data_size = 3 * str->Length(); -+ data_size = 3 * view.length(); - break; - - case UCS2: -- data_size = str->Length() * sizeof(uint16_t); -+ data_size = view.length() * sizeof(uint16_t); - break; - - case BASE64URL: -- data_size = simdutf::base64_length_from_binary(str->Length(), -+ data_size = simdutf::base64_length_from_binary(view.length(), - simdutf::base64_url); - break; - - case BASE64: -- data_size = simdutf::base64_length_from_binary(str->Length()); -+ data_size = simdutf::base64_length_from_binary(view.length()); - break; - - case HEX: -- CHECK(str->Length() % 2 == 0 && "invalid hex string length"); -- data_size = str->Length() / 2; -+ CHECK(view.length() % 2 == 0 && "invalid hex string length"); -+ data_size = view.length() / 2; - break; - - default: -@@ -447,32 +447,36 @@ Maybe<size_t> StringBytes::Size(Isolate* isolate, - Local<String> str; - if (!val->ToString(isolate->GetCurrentContext()).ToLocal(&str)) - return Nothing<size_t>(); -+ String::ValueView view(isolate, str); - - switch (encoding) { - case ASCII: - case LATIN1: -- return Just<size_t>(str->Length()); -+ return Just<size_t>(view.length()); - - case BUFFER: - case UTF8: -- return Just<size_t>(str->Utf8Length(isolate)); -+ if (view.is_one_byte()) { -+ return Just<size_t>(simdutf::utf8_length_from_latin1( -+ reinterpret_cast<const char*>(view.data8()), view.length())); -+ } -+ return Just<size_t>(simdutf::utf8_length_from_utf16( -+ reinterpret_cast<const char16_t*>(view.data16()), view.length())); - - case UCS2: -- return Just(str->Length() * sizeof(uint16_t)); -+ return Just(view.length() * sizeof(uint16_t)); - - case BASE64URL: { -- String::Value value(isolate, str); -- return Just(simdutf::base64_length_from_binary(value.length(), -+ return Just(simdutf::base64_length_from_binary(view.length(), - simdutf::base64_url)); - } - - case BASE64: { -- String::Value value(isolate, str); -- return Just(simdutf::base64_length_from_binary(value.length())); -+ return Just(simdutf::base64_length_from_binary(view.length())); - } - - case HEX: -- return Just<size_t>(str->Length() / 2); -+ return Just<size_t>(view.length() / 2); - } - - UNREACHABLE(); -diff --git a/src/util.cc b/src/util.cc -index 1b38f22b930b77d80aa53f9b12299d3cc469a46d..03c4794314c1c228f95536d2d20a440061cf3a80 100644 ---- a/src/util.cc -+++ b/src/util.cc -@@ -48,6 +48,8 @@ - #include <sys/types.h> - #endif - -+#include <simdutf.h> -+ - #include <atomic> - #include <cstdio> - #include <cstring> -@@ -100,11 +102,31 @@ static void MakeUtf8String(Isolate* isolate, - MaybeStackBuffer<T>* target) { - Local<String> string; - if (!value->ToString(isolate->GetCurrentContext()).ToLocal(&string)) return; -+ String::ValueView value_view(isolate, string); -+ -+ auto value_length = value_view.length(); -+ -+ if (value_view.is_one_byte()) { -+ auto const_char = reinterpret_cast<const char*>(value_view.data8()); -+ auto expected_length = -+ target->capacity() < (static_cast<size_t>(value_length) * 2 + 1) -+ ? simdutf::utf8_length_from_latin1(const_char, value_length) -+ : value_length * 2; -+ -+ // Add +1 for null termination. -+ target->AllocateSufficientStorage(expected_length + 1); -+ const auto actual_length = simdutf::convert_latin1_to_utf8( -+ const_char, value_length, target->out()); -+ target->SetLengthAndZeroTerminate(actual_length); -+ return; -+ } - -- size_t storage; -- if (!StringBytes::StorageSize(isolate, string, UTF8).To(&storage)) return; -- storage += 1; -+ // Add +1 for null termination. -+ size_t storage = (3 * value_length) + 1; - target->AllocateSufficientStorage(storage); -+ -+ // TODO(@anonrig): Use simdutf to speed up non-one-byte strings once it's -+ // implemented - const int flags = - String::NO_NULL_TERMINATION | String::REPLACE_INVALID_UTF8; - const int length = diff --git a/patches/node/src_migrate_writeonebyte_to_writeonebytev2.patch b/patches/node/src_migrate_writeonebyte_to_writeonebytev2.patch deleted file mode 100644 index b0267d9a85302..0000000000000 --- a/patches/node/src_migrate_writeonebyte_to_writeonebytev2.patch +++ /dev/null @@ -1,276 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Chengzhong Wu <cwu631@bloomberg.net> -Date: Fri, 29 Aug 2025 23:41:00 +0100 -Subject: src: migrate WriteOneByte to WriteOneByteV2 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -PR-URL: https://github.com/nodejs/node/pull/59634 -Fixes: https://github.com/nodejs/node/issues/59555 -Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> -Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> -Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> -Reviewed-By: Darshan Sen <raisinten@gmail.com> -Reviewed-By: Matteo Collina <matteo.collina@gmail.com> - -diff --git a/src/node_buffer.cc b/src/node_buffer.cc -index ae73e6743879f32f08b4f6f8c546c587de71d2f3..be93e60f851c6c144fdd19f810e0a44cf3845bce 100644 ---- a/src/node_buffer.cc -+++ b/src/node_buffer.cc -@@ -1033,8 +1033,11 @@ void IndexOfString(const FunctionCallbackInfo<Value>& args) { - if (needle_data == nullptr) { - return args.GetReturnValue().Set(-1); - } -- needle->WriteOneByte( -- isolate, needle_data, 0, needle_length, String::NO_NULL_TERMINATION); -+ StringBytes::Write(isolate, -+ reinterpret_cast<char*>(needle_data), -+ needle_length, -+ needle, -+ enc); - - result = nbytes::SearchString(reinterpret_cast<const uint8_t*>(haystack), - haystack_length, -@@ -1288,11 +1291,7 @@ static void Btoa(const FunctionCallbackInfo<Value>& args) { - simdutf::binary_to_base64(ext->data(), ext->length(), buffer.out()); - } else if (input->IsOneByte()) { - MaybeStackBuffer<uint8_t> stack_buf(input->Length()); -- input->WriteOneByte(env->isolate(), -- stack_buf.out(), -- 0, -- input->Length(), -- String::NO_NULL_TERMINATION); -+ input->WriteOneByteV2(env->isolate(), 0, input->Length(), stack_buf.out()); - - size_t expected_length = - simdutf::base64_length_from_binary(input->Length()); -@@ -1348,11 +1347,8 @@ static void Atob(const FunctionCallbackInfo<Value>& args) { - ext->data(), ext->length(), buffer.out(), simdutf::base64_default); - } else if (input->IsOneByte()) { - MaybeStackBuffer<uint8_t> stack_buf(input->Length()); -- input->WriteOneByte(args.GetIsolate(), -- stack_buf.out(), -- 0, -- input->Length(), -- String::NO_NULL_TERMINATION); -+ input->WriteOneByteV2( -+ args.GetIsolate(), 0, input->Length(), stack_buf.out()); - const char* data = reinterpret_cast<const char*>(*stack_buf); - size_t expected_length = - simdutf::maximal_binary_length_from_base64(data, input->Length()); -diff --git a/src/node_http2.cc b/src/node_http2.cc -index 8237c9b7d325dd925ae8798d7795fcd94eeb13d0..27a0db87e1f7f75336ecaa044e7cd66a9a5e87a4 100644 ---- a/src/node_http2.cc -+++ b/src/node_http2.cc -@@ -485,13 +485,10 @@ Origins::Origins( - - CHECK_LE(origin_contents + origin_string_len, - static_cast<char*>(bs_->Data()) + bs_->ByteLength()); -- CHECK_EQ(origin_string->WriteOneByte( -- env->isolate(), -- reinterpret_cast<uint8_t*>(origin_contents), -- 0, -- origin_string_len, -- String::NO_NULL_TERMINATION), -- origin_string_len); -+ origin_string->WriteOneByteV2(env->isolate(), -+ 0, -+ origin_string_len, -+ reinterpret_cast<uint8_t*>(origin_contents)); - - size_t n = 0; - char* p; -@@ -3183,8 +3180,8 @@ void Http2Session::AltSvc(const FunctionCallbackInfo<Value>& args) { - if (origin_str.IsEmpty() || value_str.IsEmpty()) - return; - -- size_t origin_len = origin_str->Length(); -- size_t value_len = value_str->Length(); -+ int origin_len = origin_str->Length(); -+ int value_len = value_str->Length(); - - CHECK_LE(origin_len + value_len, 16382); // Max permitted for ALTSVC - // Verify that origin len != 0 if stream id == 0, or -@@ -3193,8 +3190,13 @@ void Http2Session::AltSvc(const FunctionCallbackInfo<Value>& args) { - - MaybeStackBuffer<uint8_t> origin(origin_len); - MaybeStackBuffer<uint8_t> value(value_len); -- origin_str->WriteOneByte(env->isolate(), *origin); -- value_str->WriteOneByte(env->isolate(), *value); -+ origin_str->WriteOneByteV2(env->isolate(), -+ 0, -+ origin_len, -+ *origin, -+ String::WriteFlags::kNullTerminate); -+ value_str->WriteOneByteV2( -+ env->isolate(), 0, value_len, *value, String::WriteFlags::kNullTerminate); - - session->AltSvc(id, *origin, origin_len, *value, value_len); - } -diff --git a/src/node_http_common-inl.h b/src/node_http_common-inl.h -index dba1a5e051b3e03c435ba3885b3fe2d04ea8ca9e..46984dba907fffb836d62b9c6e6b325a0ba504dd 100644 ---- a/src/node_http_common-inl.h -+++ b/src/node_http_common-inl.h -@@ -2,9 +2,11 @@ - #define SRC_NODE_HTTP_COMMON_INL_H_ - - #include "node_http_common.h" -+ -+#include "env-inl.h" - #include "node.h" - #include "node_mem-inl.h" --#include "env-inl.h" -+#include "string_bytes.h" - #include "v8.h" - - #include <algorithm> -@@ -37,13 +39,12 @@ NgHeaders<T>::NgHeaders(Environment* env, v8::Local<v8::Array> headers) { - nv_t* const nva = reinterpret_cast<nv_t*>(start); - - CHECK_LE(header_contents + header_string_len, *buf_ + buf_.length()); -- CHECK_EQ(header_string.As<v8::String>()->WriteOneByte( -- env->isolate(), -- reinterpret_cast<uint8_t*>(header_contents), -- 0, -- header_string_len, -- v8::String::NO_NULL_TERMINATION), -- header_string_len); -+ CHECK_EQ(StringBytes::Write(env->isolate(), -+ header_contents, -+ header_string_len, -+ header_string.As<v8::String>(), -+ LATIN1), -+ static_cast<size_t>(header_string_len)); - - size_t n = 0; - char* p; -diff --git a/src/string_bytes.cc b/src/string_bytes.cc -index b02e9c5d14c2438d30b16f977c4e8a76bb23479d..71381f8fdc341cf2bac34028eb10df30fd9306b9 100644 ---- a/src/string_bytes.cc -+++ b/src/string_bytes.cc -@@ -249,11 +249,13 @@ size_t StringBytes::Write(Isolate* isolate, - nbytes = std::min(buflen, static_cast<size_t>(input_view.length())); - memcpy(buf, input_view.data8(), nbytes); - } else { -- uint8_t* const dst = reinterpret_cast<uint8_t*>(buf); -- const int flags = String::HINT_MANY_WRITES_EXPECTED | -- String::NO_NULL_TERMINATION | -- String::REPLACE_INVALID_UTF8; -- nbytes = str->WriteOneByte(isolate, dst, 0, buflen, flags); -+ nbytes = std::min(buflen, static_cast<size_t>(input_view.length())); -+ // Do not use v8::String::WriteOneByteV2 as it asserts the string to be -+ // a one byte string. For compatibility, convert the uint16_t to uint8_t -+ // even though this may loose accuracy. -+ for (size_t i = 0; i < nbytes; i++) { -+ buf[i] = static_cast<uint8_t>(input_view.data16()[i]); -+ } - } - break; - -diff --git a/test/cctest/test_string_bytes.cc b/test/cctest/test_string_bytes.cc -new file mode 100644 -index 0000000000000000000000000000000000000000..bc308918680bb153dbbda8b18dcb24d129f14833 ---- /dev/null -+++ b/test/cctest/test_string_bytes.cc -@@ -0,0 +1,100 @@ -+#include "gtest/gtest.h" -+#include "node.h" -+#include "node_test_fixture.h" -+#include "string_bytes.h" -+#include "util-inl.h" -+ -+using node::MaybeStackBuffer; -+using node::StringBytes; -+using v8::HandleScope; -+using v8::Local; -+using v8::Maybe; -+using v8::String; -+ -+class StringBytesTest : public EnvironmentTestFixture {}; -+ -+// Data "Hello, ÆÊÎÖÿ" -+static const char latin1_data[] = "Hello, \xC6\xCA\xCE\xD6\xFF"; -+static const char utf8_data[] = "Hello, ÆÊÎÖÿ"; -+ -+TEST_F(StringBytesTest, WriteLatin1WithOneByteString) { -+ const HandleScope handle_scope(isolate_); -+ const Argv argv; -+ Env env_{handle_scope, argv}; -+ -+ Local<String> one_byte_str = -+ String::NewFromOneByte(isolate_, -+ reinterpret_cast<const uint8_t*>(latin1_data)) -+ .ToLocalChecked(); -+ -+ Maybe<size_t> size_maybe = -+ StringBytes::StorageSize(isolate_, one_byte_str, node::LATIN1); -+ -+ ASSERT_TRUE(size_maybe.IsJust()); -+ size_t size = size_maybe.FromJust(); -+ ASSERT_EQ(size, 12u); -+ -+ MaybeStackBuffer<char> buf; -+ size_t written = StringBytes::Write( -+ isolate_, buf.out(), buf.capacity(), one_byte_str, node::LATIN1); -+ ASSERT_EQ(written, 12u); -+ -+ // Null-terminate the buffer and compare the contents. -+ buf.SetLength(13); -+ buf[12] = '\0'; -+ ASSERT_STREQ(latin1_data, buf.out()); -+} -+ -+TEST_F(StringBytesTest, WriteLatin1WithUtf8String) { -+ const HandleScope handle_scope(isolate_); -+ const Argv argv; -+ Env env_{handle_scope, argv}; -+ -+ Local<String> utf8_str = -+ String::NewFromUtf8(isolate_, utf8_data).ToLocalChecked(); -+ -+ Maybe<size_t> size_maybe = -+ StringBytes::StorageSize(isolate_, utf8_str, node::LATIN1); -+ -+ ASSERT_TRUE(size_maybe.IsJust()); -+ size_t size = size_maybe.FromJust(); -+ ASSERT_EQ(size, 12u); -+ -+ MaybeStackBuffer<char> buf; -+ size_t written = StringBytes::Write( -+ isolate_, buf.out(), buf.capacity(), utf8_str, node::LATIN1); -+ ASSERT_EQ(written, 12u); -+ -+ // Null-terminate the buffer and compare the contents. -+ buf.SetLength(13); -+ buf[12] = '\0'; -+ ASSERT_STREQ(latin1_data, buf.out()); -+} -+ -+// Verify that StringBytes::Write converts two-byte characters to one-byte -+// characters, even if there is no valid one-byte representation. -+TEST_F(StringBytesTest, WriteLatin1WithInvalidChar) { -+ const HandleScope handle_scope(isolate_); -+ const Argv argv; -+ Env env_{handle_scope, argv}; -+ -+ Local<String> utf8_str = -+ String::NewFromUtf8(isolate_, "Hello, 世界").ToLocalChecked(); -+ -+ Maybe<size_t> size_maybe = -+ StringBytes::StorageSize(isolate_, utf8_str, node::LATIN1); -+ -+ ASSERT_TRUE(size_maybe.IsJust()); -+ size_t size = size_maybe.FromJust(); -+ ASSERT_EQ(size, 9u); -+ -+ MaybeStackBuffer<char> buf; -+ size_t written = StringBytes::Write( -+ isolate_, buf.out(), buf.capacity(), utf8_str, node::LATIN1); -+ ASSERT_EQ(written, 9u); -+ -+ // Null-terminate the buffer and compare the contents. -+ buf.SetLength(10); -+ buf[9] = '\0'; -+ ASSERT_STREQ("Hello, \x16\x4C", buf.out()); -+} diff --git a/patches/node/src_refactor_writeucs2_and_remove_flags_argument.patch b/patches/node/src_refactor_writeucs2_and_remove_flags_argument.patch deleted file mode 100644 index 28eee21c9094f..0000000000000 --- a/patches/node/src_refactor_writeucs2_and_remove_flags_argument.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= <tniessen@tnie.de> -Date: Thu, 8 May 2025 13:55:26 +0100 -Subject: src: refactor WriteUCS2 and remove flags argument -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This change refactors `StringBytes::WriteUCS2()` in multiple ways. - -The `flags` argument being passed to `WriteUCS2()` is not useful: the -only really relevant flag is `NO_NULL_TERMINATION` since V8 ignores -`REPLACE_INVALID_UTF8`, `HINT_MANY_WRITES_EXPECTED`, and -`PRESERVE_ONE_BYTE_NULL` for UTF-16 strings. However, `WriteUCS2()` -might not null-terminate the result correctly regardless of whether -`NO_NULL_TERMINATION` is set because it makes multiple calls to -`String::Write()` internally. For these reasons, this patch removes the -`flags` argument entirely and always assumes `NO_NULL_TERMINATION`. - -Next, this patch replaces the calls to the deprecated function -`String::Write()` with calls to the new function `String::WriteV2()`, -which always succeeds and always writes a predictable number of -characters, removing the need to deal with a return value here. - -Lastly, this patch simplifies the implementation of `WriteUCS2()` and -computes the exact number of characters `nchars` from the beginning, -removing the need to later check again if the number of characters is -zero. - -PR-URL: https://github.com/nodejs/node/pull/58163 -Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> -Reviewed-By: James M Snell <jasnell@gmail.com> - -diff --git a/src/string_bytes.cc b/src/string_bytes.cc -index 0eb9b1967f1f185a140239924809468394297d58..b02e9c5d14c2438d30b16f977c4e8a76bb23479d 100644 ---- a/src/string_bytes.cc -+++ b/src/string_bytes.cc -@@ -198,40 +198,34 @@ MaybeLocal<Value> ExternTwoByteString::NewSimpleFromCopy(Isolate* isolate, - - } // anonymous namespace - --size_t StringBytes::WriteUCS2( -- Isolate* isolate, char* buf, size_t buflen, Local<String> str, int flags) { -+size_t StringBytes::WriteUCS2(Isolate* isolate, -+ char* buf, -+ size_t buflen, -+ Local<String> str) { - uint16_t* const dst = reinterpret_cast<uint16_t*>(buf); - -- size_t max_chars = buflen / sizeof(*dst); -- if (max_chars == 0) { -+ const size_t max_chars = buflen / sizeof(*dst); -+ const size_t nchars = std::min(max_chars, static_cast<size_t>(str->Length())); -+ if (nchars == 0) { - return 0; - } - - uint16_t* const aligned_dst = nbytes::AlignUp(dst, sizeof(*dst)); -- size_t nchars; -+ CHECK_EQ(reinterpret_cast<uintptr_t>(aligned_dst) % sizeof(*dst), 0); - if (aligned_dst == dst) { -- nchars = str->Write(isolate, dst, 0, max_chars, flags); -- return nchars * sizeof(*dst); -- } -+ str->WriteV2(isolate, 0, nchars, dst); -+ } else { -+ // Write all but the last char. -+ str->WriteV2(isolate, 0, nchars - 1, aligned_dst); - -- CHECK_EQ(reinterpret_cast<uintptr_t>(aligned_dst) % sizeof(*dst), 0); -+ // Shift everything to unaligned-left. -+ memmove(dst, aligned_dst, (nchars - 1) * sizeof(*dst)); - -- // Write all but the last char -- max_chars = std::min(max_chars, static_cast<size_t>(str->Length())); -- if (max_chars == 0) { -- return 0; -+ // One more char to be written. -+ uint16_t last; -+ str->WriteV2(isolate, nchars - 1, 1, &last); -+ memcpy(dst + nchars - 1, &last, sizeof(last)); - } -- nchars = str->Write(isolate, aligned_dst, 0, max_chars - 1, flags); -- CHECK_EQ(nchars, max_chars - 1); -- -- // Shift everything to unaligned-left -- memmove(dst, aligned_dst, nchars * sizeof(*dst)); -- -- // One more char to be written -- uint16_t last; -- CHECK_EQ(str->Write(isolate, &last, nchars, 1, flags), 1); -- memcpy(buf + nchars * sizeof(*dst), &last, sizeof(last)); -- nchars++; - - return nchars * sizeof(*dst); - } -@@ -248,10 +242,6 @@ size_t StringBytes::Write(Isolate* isolate, - Local<String> str = val.As<String>(); - String::ValueView input_view(isolate, str); - -- int flags = String::HINT_MANY_WRITES_EXPECTED | -- String::NO_NULL_TERMINATION | -- String::REPLACE_INVALID_UTF8; -- - switch (encoding) { - case ASCII: - case LATIN1: -@@ -260,6 +250,9 @@ size_t StringBytes::Write(Isolate* isolate, - memcpy(buf, input_view.data8(), nbytes); - } else { - uint8_t* const dst = reinterpret_cast<uint8_t*>(buf); -+ const int flags = String::HINT_MANY_WRITES_EXPECTED | -+ String::NO_NULL_TERMINATION | -+ String::REPLACE_INVALID_UTF8; - nbytes = str->WriteOneByte(isolate, dst, 0, buflen, flags); - } - break; -@@ -271,7 +264,7 @@ size_t StringBytes::Write(Isolate* isolate, - break; - - case UCS2: { -- nbytes = WriteUCS2(isolate, buf, buflen, str, flags); -+ nbytes = WriteUCS2(isolate, buf, buflen, str); - - // Node's "ucs2" encoding wants LE character data stored in - // the Buffer, so we need to reorder on BE platforms. See -diff --git a/src/string_bytes.h b/src/string_bytes.h -index 53bc003fbda43663d6b8619672b23803fc88deb6..2a916b1c6a03b53c15e96e050dfa5711caaa07e2 100644 ---- a/src/string_bytes.h -+++ b/src/string_bytes.h -@@ -102,8 +102,7 @@ class StringBytes { - static size_t WriteUCS2(v8::Isolate* isolate, - char* buf, - size_t buflen, -- v8::Local<v8::String> str, -- int flags); -+ v8::Local<v8::String> str); - }; - - } // namespace node diff --git a/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch b/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch deleted file mode 100644 index 36cc33e7effed..0000000000000 --- a/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch +++ /dev/null @@ -1,308 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Joyee Cheung <joyeec9h3@gmail.com> -Date: Wed, 29 May 2024 19:59:19 +0200 -Subject: src: remove dependency on wrapper-descriptor-based CppHeap - -As V8 has moved away from wrapper-descriptor-based CppHeap, this -patch: - -1. Create the CppHeap without using wrapper descirptors. -2. Deprecates node::SetCppgcReference() in favor of - v8::Object::Wrap() since the wrapper descriptor is no longer - relevant. It is still kept as a compatibility layer for addons - that need to also work on Node.js versions without - v8::Object::Wrap(). - -(cherry picked from commit 30329d06235a9f9733b1d4da479b403462d1b326) - -diff --git a/src/env-inl.h b/src/env-inl.h -index 67b4cc2037b8e02f6382cd12a7abb157d0dbac65..4906c6c4c0ab5260d6e6387d0ed8e0687f982a38 100644 ---- a/src/env-inl.h -+++ b/src/env-inl.h -@@ -62,31 +62,6 @@ inline uv_loop_t* IsolateData::event_loop() const { - return event_loop_; - } - --inline void IsolateData::SetCppgcReference(v8::Isolate* isolate, -- v8::Local<v8::Object> object, -- void* wrappable) { -- v8::CppHeap* heap = isolate->GetCppHeap(); -- CHECK_NOT_NULL(heap); -- v8::WrapperDescriptor descriptor = heap->wrapper_descriptor(); -- uint16_t required_size = std::max(descriptor.wrappable_instance_index, -- descriptor.wrappable_type_index); -- CHECK_GT(object->InternalFieldCount(), required_size); -- -- uint16_t* id_ptr = nullptr; -- { -- Mutex::ScopedLock lock(isolate_data_mutex_); -- auto it = -- wrapper_data_map_.find(descriptor.embedder_id_for_garbage_collected); -- CHECK_NE(it, wrapper_data_map_.end()); -- id_ptr = &(it->second->cppgc_id); -- } -- -- object->SetAlignedPointerInInternalField(descriptor.wrappable_type_index, -- id_ptr); -- object->SetAlignedPointerInInternalField(descriptor.wrappable_instance_index, -- wrappable); --} -- - inline uint16_t* IsolateData::embedder_id_for_cppgc() const { - return &(wrapper_data_->cppgc_id); - } -diff --git a/src/env.cc b/src/env.cc -index 926645dc647fe7ca01165462f08eac1ade71ac4e..85641b68b1e6f6dd4149f33ba13f76bccc8bf47d 100644 ---- a/src/env.cc -+++ b/src/env.cc -@@ -23,6 +23,7 @@ - #include "util-inl.h" - #include "v8-cppgc.h" - #include "v8-profiler.h" -+#include "v8-sandbox.h" // v8::Object::Wrap(), v8::Object::Unwrap() - - #include <algorithm> - #include <atomic> -@@ -72,7 +73,6 @@ using v8::TryCatch; - using v8::Uint32; - using v8::Undefined; - using v8::Value; --using v8::WrapperDescriptor; - using worker::Worker; - - int const ContextEmbedderTag::kNodeContextTag = 0x6e6f64; -@@ -530,6 +530,14 @@ void IsolateData::CreateProperties() { - CreateEnvProxyTemplate(this); - } - -+// Previously, the general convention of the wrappable layout for cppgc in -+// the ecosystem is: -+// [ 0 ] -> embedder id -+// [ 1 ] -> wrappable instance -+// Now V8 has deprecated this layout-based tracing enablement, embedders -+// should simply use v8::Object::Wrap() and v8::Object::Unwrap(). We preserve -+// this layout only to distinguish internally how the memory of a Node.js -+// wrapper is managed or whether a wrapper is managed by Node.js. - constexpr uint16_t kDefaultCppGCEmbedderID = 0x90de; - Mutex IsolateData::isolate_data_mutex_; - std::unordered_map<uint16_t, std::unique_ptr<PerIsolateWrapperData>> -@@ -567,36 +575,16 @@ IsolateData::IsolateData(Isolate* isolate, - v8::CppHeap* cpp_heap = isolate->GetCppHeap(); - - uint16_t cppgc_id = kDefaultCppGCEmbedderID; -- if (cpp_heap != nullptr) { -- // The general convention of the wrappable layout for cppgc in the -- // ecosystem is: -- // [ 0 ] -> embedder id -- // [ 1 ] -> wrappable instance -- // If the Isolate includes a CppHeap attached by another embedder, -- // And if they also use the field 0 for the ID, we DCHECK that -- // the layout matches our layout, and record the embedder ID for cppgc -- // to avoid accidentally enabling cppgc on non-cppgc-managed wrappers . -- v8::WrapperDescriptor descriptor = cpp_heap->wrapper_descriptor(); -- if (descriptor.wrappable_type_index == BaseObject::kEmbedderType) { -- cppgc_id = descriptor.embedder_id_for_garbage_collected; -- DCHECK_EQ(descriptor.wrappable_instance_index, BaseObject::kSlot); -- } -- // If the CppHeap uses the slot we use to put non-cppgc-traced BaseObject -- // for embedder ID, V8 could accidentally enable cppgc on them. So -- // safe guard against this. -- DCHECK_NE(descriptor.wrappable_type_index, BaseObject::kSlot); -- } else { -- cpp_heap_ = CppHeap::Create( -- platform, -- CppHeapCreateParams{ -- {}, -- WrapperDescriptor( -- BaseObject::kEmbedderType, BaseObject::kSlot, cppgc_id)}); -- isolate->AttachCppHeap(cpp_heap_.get()); -- } - // We do not care about overflow since we just want this to be different - // from the cppgc id. - uint16_t non_cppgc_id = cppgc_id + 1; -+ if (cpp_heap == nullptr) { -+ cpp_heap_ = CppHeap::Create(platform, v8::CppHeapCreateParams{{}}); -+ // TODO(joyeecheung): pass it into v8::Isolate::CreateParams and let V8 -+ // own it when we can keep the isolate registered/task runner discoverable -+ // during isolate disposal. -+ isolate->AttachCppHeap(cpp_heap_.get()); -+ } - - { - // GC could still be run after the IsolateData is destroyed, so we store -@@ -629,11 +617,12 @@ IsolateData::~IsolateData() { - } - } - --// Public API -+// Deprecated API, embedders should use v8::Object::Wrap() directly instead. - void SetCppgcReference(Isolate* isolate, - Local<Object> object, - void* wrappable) { -- IsolateData::SetCppgcReference(isolate, object, wrappable); -+ v8::Object::Wrap<v8::CppHeapPointerTag::kDefaultTag>( -+ isolate, object, static_cast<v8::Object::Wrappable*>(wrappable)); - } - - void IsolateData::MemoryInfo(MemoryTracker* tracker) const { -diff --git a/src/env.h b/src/env.h -index 35e16159a94bb97f19d17767e3ad4bb798660f44..2d5fa8dbd75851bca30453548f6cbe0159509f26 100644 ---- a/src/env.h -+++ b/src/env.h -@@ -177,10 +177,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer { - uint16_t* embedder_id_for_cppgc() const; - uint16_t* embedder_id_for_non_cppgc() const; - -- static inline void SetCppgcReference(v8::Isolate* isolate, -- v8::Local<v8::Object> object, -- void* wrappable); -- - inline uv_loop_t* event_loop() const; - inline MultiIsolatePlatform* platform() const; - inline const SnapshotData* snapshot_data() const; -diff --git a/src/node.h b/src/node.h -index 96c599aa6448e2aa8e57e84f811564a5281c139a..d3a965661d068db359bb1bb4b14e59c28bb615f9 100644 ---- a/src/node.h -+++ b/src/node.h -@@ -1576,24 +1576,14 @@ void RegisterSignalHandler(int signal, - bool reset_handler = false); - #endif // _WIN32 - --// Configure the layout of the JavaScript object with a cppgc::GarbageCollected --// instance so that when the JavaScript object is reachable, the garbage --// collected instance would have its Trace() method invoked per the cppgc --// contract. To make it work, the process must have called --// cppgc::InitializeProcess() before, which is usually the case for addons --// loaded by the stand-alone Node.js executable. Embedders of Node.js can use --// either need to call it themselves or make sure that --// ProcessInitializationFlags::kNoInitializeCppgc is *not* set for cppgc to --// work. --// If the CppHeap is owned by Node.js, which is usually the case for addon, --// the object must be created with at least two internal fields available, --// and the first two internal fields would be configured by Node.js. --// This may be superseded by a V8 API in the future, see --// https://bugs.chromium.org/p/v8/issues/detail?id=13960. Until then this --// serves as a helper for Node.js isolates. --NODE_EXTERN void SetCppgcReference(v8::Isolate* isolate, -- v8::Local<v8::Object> object, -- void* wrappable); -+// This is kept as a compatibility layer for addons to wrap cppgc-managed -+// objects on Node.js versions without v8::Object::Wrap(). Addons created to -+// work with only Node.js versions with v8::Object::Wrap() should use that -+// instead. -+NODE_DEPRECATED("Use v8::Object::Wrap()", -+ NODE_EXTERN void SetCppgcReference(v8::Isolate* isolate, -+ v8::Local<v8::Object> object, -+ void* wrappable)); - - } // namespace node - -diff --git a/test/addons/cppgc-object/binding.cc b/test/addons/cppgc-object/binding.cc -index 1b70ff11dc561abdc5ac794f6280557d5c428239..7fc16a87b843ce0626ee137a07c3ccb7f4cc6493 100644 ---- a/test/addons/cppgc-object/binding.cc -+++ b/test/addons/cppgc-object/binding.cc -@@ -1,8 +1,10 @@ -+#include <assert.h> - #include <cppgc/allocation.h> - #include <cppgc/garbage-collected.h> - #include <cppgc/heap.h> - #include <node.h> - #include <v8-cppgc.h> -+#include <v8-sandbox.h> - #include <v8.h> - #include <algorithm> - -@@ -15,8 +17,10 @@ class CppGCed : public cppgc::GarbageCollected<CppGCed> { - static void New(const v8::FunctionCallbackInfo<v8::Value>& args) { - v8::Isolate* isolate = args.GetIsolate(); - v8::Local<v8::Object> js_object = args.This(); -- CppGCed* gc_object = cppgc::MakeGarbageCollected<CppGCed>( -- isolate->GetCppHeap()->GetAllocationHandle()); -+ auto* heap = isolate->GetCppHeap(); -+ assert(heap != nullptr); -+ CppGCed* gc_object = -+ cppgc::MakeGarbageCollected<CppGCed>(heap->GetAllocationHandle()); - node::SetCppgcReference(isolate, js_object, gc_object); - args.GetReturnValue().Set(js_object); - } -@@ -24,12 +28,6 @@ class CppGCed : public cppgc::GarbageCollected<CppGCed> { - static v8::Local<v8::Function> GetConstructor( - v8::Local<v8::Context> context) { - auto ft = v8::FunctionTemplate::New(context->GetIsolate(), New); -- auto ot = ft->InstanceTemplate(); -- v8::WrapperDescriptor descriptor = -- context->GetIsolate()->GetCppHeap()->wrapper_descriptor(); -- uint16_t required_size = std::max(descriptor.wrappable_instance_index, -- descriptor.wrappable_type_index); -- ot->SetInternalFieldCount(required_size + 1); - return ft->GetFunction(context).ToLocalChecked(); - } - -diff --git a/test/cctest/test_cppgc.cc b/test/cctest/test_cppgc.cc -index 49665174615870b4f70529b1d548e593846140a1..edd413ae9b956b2e59e8166785adef6a8ff06d51 100644 ---- a/test/cctest/test_cppgc.cc -+++ b/test/cctest/test_cppgc.cc -@@ -3,16 +3,12 @@ - #include <cppgc/heap.h> - #include <node.h> - #include <v8-cppgc.h> -+#include <v8-sandbox.h> - #include <v8.h> - #include "node_test_fixture.h" - - // This tests that Node.js can work with an existing CppHeap. - --// Mimic the Blink layout. --static int kWrappableTypeIndex = 0; --static int kWrappableInstanceIndex = 1; --static uint16_t kEmbedderID = 0x1; -- - // Mimic a class that does not know about Node.js. - class CppGCed : public cppgc::GarbageCollected<CppGCed> { - public: -@@ -23,12 +19,11 @@ class CppGCed : public cppgc::GarbageCollected<CppGCed> { - static void New(const v8::FunctionCallbackInfo<v8::Value>& args) { - v8::Isolate* isolate = args.GetIsolate(); - v8::Local<v8::Object> js_object = args.This(); -- CppGCed* gc_object = cppgc::MakeGarbageCollected<CppGCed>( -- isolate->GetCppHeap()->GetAllocationHandle()); -- js_object->SetAlignedPointerInInternalField(kWrappableTypeIndex, -- &kEmbedderID); -- js_object->SetAlignedPointerInInternalField(kWrappableInstanceIndex, -- gc_object); -+ auto* heap = isolate->GetCppHeap(); -+ CHECK_NOT_NULL(heap); -+ CppGCed* gc_object = -+ cppgc::MakeGarbageCollected<CppGCed>(heap->GetAllocationHandle()); -+ node::SetCppgcReference(isolate, js_object, gc_object); - kConstructCount++; - args.GetReturnValue().Set(js_object); - } -@@ -36,8 +31,6 @@ class CppGCed : public cppgc::GarbageCollected<CppGCed> { - static v8::Local<v8::Function> GetConstructor( - v8::Local<v8::Context> context) { - auto ft = v8::FunctionTemplate::New(context->GetIsolate(), New); -- auto ot = ft->InstanceTemplate(); -- ot->SetInternalFieldCount(2); - return ft->GetFunction(context).ToLocalChecked(); - } - -@@ -58,12 +51,12 @@ TEST_F(NodeZeroIsolateTestFixture, ExistingCppHeapTest) { - - // Create and attach the CppHeap before we set up the IsolateData so that - // it recognizes the existing heap. -- std::unique_ptr<v8::CppHeap> cpp_heap = v8::CppHeap::Create( -- platform.get(), -- v8::CppHeapCreateParams( -- {}, -- v8::WrapperDescriptor( -- kWrappableTypeIndex, kWrappableInstanceIndex, kEmbedderID))); -+ std::unique_ptr<v8::CppHeap> cpp_heap = -+ v8::CppHeap::Create(platform.get(), v8::CppHeapCreateParams{{}}); -+ -+ // TODO(joyeecheung): pass it into v8::Isolate::CreateParams and let V8 -+ // own it when we can keep the isolate registered/task runner discoverable -+ // during isolate disposal. - isolate->AttachCppHeap(cpp_heap.get()); - - // Try creating Context + IsolateData + Environment. diff --git a/patches/node/src_simplify_string_bytes_with_views.patch b/patches/node/src_simplify_string_bytes_with_views.patch deleted file mode 100644 index 0e326633751e1..0000000000000 --- a/patches/node/src_simplify_string_bytes_with_views.patch +++ /dev/null @@ -1,150 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Daniel Lemire <daniel@lemire.me> -Date: Thu, 12 Sep 2024 12:07:08 -0400 -Subject: src: simplify string_bytes with views - -PR-URL: https://github.com/nodejs/node/pull/54876 -Reviewed-By: James M Snell <jasnell@gmail.com> -Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> -Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> - -diff --git a/src/string_bytes.cc b/src/string_bytes.cc -index addb7e21ba6a3bbabf3ff5f32240a5e428d176ee..f0fbf496dcfdec2c522508c61ae24fb20b1eb081 100644 ---- a/src/string_bytes.cc -+++ b/src/string_bytes.cc -@@ -246,6 +246,7 @@ size_t StringBytes::Write(Isolate* isolate, - - CHECK(val->IsString() == true); - Local<String> str = val.As<String>(); -+ String::ValueView input_view(isolate, str); - - int flags = String::HINT_MANY_WRITES_EXPECTED | - String::NO_NULL_TERMINATION | -@@ -254,10 +255,9 @@ size_t StringBytes::Write(Isolate* isolate, - switch (encoding) { - case ASCII: - case LATIN1: -- if (str->IsExternalOneByte()) { -- auto ext = str->GetExternalOneByteStringResource(); -- nbytes = std::min(buflen, ext->length()); -- memcpy(buf, ext->data(), nbytes); -+ if (input_view.is_one_byte()) { -+ nbytes = std::min(buflen, static_cast<size_t>(input_view.length())); -+ memcpy(buf, input_view.data8(), nbytes); - } else { - uint8_t* const dst = reinterpret_cast<uint8_t*>(buf); - nbytes = str->WriteOneByte(isolate, dst, 0, buflen, flags); -@@ -282,31 +282,11 @@ size_t StringBytes::Write(Isolate* isolate, - } - - case BASE64URL: -- if (str->IsExternalOneByte()) { // 8-bit case -- auto ext = str->GetExternalOneByteStringResource(); -+ if (input_view.is_one_byte()) { // 8-bit case - size_t written_len = buflen; - auto result = simdutf::base64_to_binary_safe( -- ext->data(), ext->length(), buf, written_len, simdutf::base64_url); -- if (result.error == simdutf::error_code::SUCCESS) { -- nbytes = written_len; -- } else { -- // The input does not follow the WHATWG forgiving-base64 specification -- // adapted for base64url -- // https://infra.spec.whatwg.org/#forgiving-base64-decode -- nbytes = -- nbytes::Base64Decode(buf, buflen, ext->data(), ext->length()); -- } -- } else if (str->IsOneByte()) { -- MaybeStackBuffer<uint8_t> stack_buf(str->Length()); -- str->WriteOneByte(isolate, -- stack_buf.out(), -- 0, -- str->Length(), -- String::NO_NULL_TERMINATION); -- size_t written_len = buflen; -- auto result = simdutf::base64_to_binary_safe( -- reinterpret_cast<const char*>(*stack_buf), -- stack_buf.length(), -+ reinterpret_cast<const char*>(input_view.data8()), -+ input_view.length(), - buf, - written_len, - simdutf::base64_url); -@@ -316,8 +296,11 @@ size_t StringBytes::Write(Isolate* isolate, - // The input does not follow the WHATWG forgiving-base64 specification - // (adapted for base64url with + and / replaced by - and _). - // https://infra.spec.whatwg.org/#forgiving-base64-decode -- nbytes = -- nbytes::Base64Decode(buf, buflen, *stack_buf, stack_buf.length()); -+ nbytes = nbytes::Base64Decode( -+ buf, -+ buflen, -+ reinterpret_cast<const char*>(input_view.data8()), -+ input_view.length()); - } - } else { - String::Value value(isolate, str); -@@ -340,40 +323,23 @@ size_t StringBytes::Write(Isolate* isolate, - break; - - case BASE64: { -- if (str->IsExternalOneByte()) { // 8-bit case -- auto ext = str->GetExternalOneByteStringResource(); -+ if (input_view.is_one_byte()) { // 8-bit case - size_t written_len = buflen; - auto result = simdutf::base64_to_binary_safe( -- ext->data(), ext->length(), buf, written_len); -- if (result.error == simdutf::error_code::SUCCESS) { -- nbytes = written_len; -- } else { -- // The input does not follow the WHATWG forgiving-base64 specification -- // https://infra.spec.whatwg.org/#forgiving-base64-decode -- nbytes = -- nbytes::Base64Decode(buf, buflen, ext->data(), ext->length()); -- } -- } else if (str->IsOneByte()) { -- MaybeStackBuffer<uint8_t> stack_buf(str->Length()); -- str->WriteOneByte(isolate, -- stack_buf.out(), -- 0, -- str->Length(), -- String::NO_NULL_TERMINATION); -- size_t written_len = buflen; -- auto result = simdutf::base64_to_binary_safe( -- reinterpret_cast<const char*>(*stack_buf), -- stack_buf.length(), -+ reinterpret_cast<const char*>(input_view.data8()), -+ input_view.length(), - buf, - written_len); - if (result.error == simdutf::error_code::SUCCESS) { - nbytes = written_len; - } else { - // The input does not follow the WHATWG forgiving-base64 specification -- // (adapted for base64url with + and / replaced by - and _). - // https://infra.spec.whatwg.org/#forgiving-base64-decode -- nbytes = -- nbytes::Base64Decode(buf, buflen, *stack_buf, stack_buf.length()); -+ nbytes = nbytes::Base64Decode( -+ buf, -+ buflen, -+ reinterpret_cast<const char*>(input_view.data8()), -+ input_view.length()); - } - } else { - String::Value value(isolate, str); -@@ -394,9 +360,12 @@ size_t StringBytes::Write(Isolate* isolate, - break; - } - case HEX: -- if (str->IsExternalOneByte()) { -- auto ext = str->GetExternalOneByteStringResource(); -- nbytes = nbytes::HexDecode(buf, buflen, ext->data(), ext->length()); -+ if (input_view.is_one_byte()) { -+ nbytes = -+ nbytes::HexDecode(buf, -+ buflen, -+ reinterpret_cast<const char*>(input_view.data8()), -+ input_view.length()); - } else { - String::Value value(isolate, str); - nbytes = nbytes::HexDecode(buf, buflen, *value, value.length()); diff --git a/patches/node/src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch b/patches/node/src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch deleted file mode 100644 index b798ee11d432d..0000000000000 --- a/patches/node/src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Andreas Haas <ahaas@chromium.org> -Date: Sun, 28 Jul 2024 09:20:12 +0200 -Subject: src: stop using deprecated fields of `v8::FastApiCallbackOptions` - -Two fields on the `v8::FastApiCallbackOptions` struct were deprecated -recently: `fallback` and `wasm_memory`. This PR removes uses of these -two fields in node.js. - -(This is a subset of upstream commit d0000b118 from the `canary-base` -branch of Node.js. This patch can be removed when Electron upgrades to -a stable Node release that contains the change. -- Charles) - -diff --git a/src/crypto/crypto_timing.cc b/src/crypto/crypto_timing.cc -index dbc46400501b61814d5be0ec1cb01b0dcd94e1d0..fe669d40c31a29334b047b9cfee3067f64ef0a7b 100644 ---- a/src/crypto/crypto_timing.cc -+++ b/src/crypto/crypto_timing.cc -@@ -60,7 +60,8 @@ bool FastTimingSafeEqual(Local<Value> receiver, - if (a.length() != b.length() || !a.getStorageIfAligned(&data_a) || - !b.getStorageIfAligned(&data_b)) { - TRACK_V8_FAST_API_CALL("crypto.timingSafeEqual.error"); -- options.fallback = true; -+ v8::HandleScope scope(options.isolate); -+ THROW_ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH(options.isolate); - return false; - } - -diff --git a/src/histogram.cc b/src/histogram.cc -index b655808e43d7c700ddeab7690e287bdbc9bfa50a..b0f7ae4e3af652c6dfe09f66d88485c5783f4037 100644 ---- a/src/histogram.cc -+++ b/src/histogram.cc -@@ -187,7 +187,8 @@ void HistogramBase::FastRecord(Local<Value> unused, - const int64_t value, - FastApiCallbackOptions& options) { - if (value < 1) { -- options.fallback = true; -+ Environment* env = Environment::GetCurrent(options.isolate); -+ THROW_ERR_OUT_OF_RANGE(env, "value is out of range"); - return; - } - HistogramBase* histogram; -diff --git a/src/node_wasi.cc b/src/node_wasi.cc -index 090866960beb8f1759c99e95536924b8b61fb723..3f91b651b83a20e70d5b368e012f5ee4b9d16092 100644 ---- a/src/node_wasi.cc -+++ b/src/node_wasi.cc -@@ -275,17 +275,19 @@ R WASI::WasiFunction<FT, F, R, Args...>::FastCallback( - return EinvalError<R>(); - } - -- if (options.wasm_memory == nullptr || wasi->memory_.IsEmpty()) [[unlikely]] { -- // fallback to slow path which to throw an error about missing memory. -- options.fallback = true; -+ v8::Isolate* isolate = receiver->GetIsolate(); -+ v8::HandleScope handle_scope(isolate); -+ if (wasi->memory_.IsEmpty()) { -+ THROW_ERR_WASI_NOT_STARTED(isolate); - return EinvalError<R>(); - } -- uint8_t* memory = nullptr; -- CHECK(options.wasm_memory->getStorageIfAligned(&memory)); - -- return F(*wasi, -- {reinterpret_cast<char*>(memory), options.wasm_memory->length()}, -- args...); -+ Local<ArrayBuffer> ab = wasi->memory_.Get(isolate)->Buffer(); -+ size_t mem_size = ab->ByteLength(); -+ char* mem_data = static_cast<char*>(ab->Data()); -+ CHECK_NOT_NULL(mem_data); -+ -+ return F(*wasi, {mem_data, mem_size}, args...); - } - - namespace { diff --git a/patches/node/src_switch_from_get_setprototype_to_get_setprototypev2.patch b/patches/node/src_switch_from_get_setprototype_to_get_setprototypev2.patch deleted file mode 100644 index 79190df99fd44..0000000000000 --- a/patches/node/src_switch_from_get_setprototype_to_get_setprototypev2.patch +++ /dev/null @@ -1,173 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aviv Keller <redyetidev@gmail.com> -Date: Tue, 22 Oct 2024 01:05:19 -0400 -Subject: src: switch from `Get/SetPrototype` to `Get/SetPrototypeV2` - -PR-URL: https://github.com/nodejs/node/pull/55453 -Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com> -Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> -Reviewed-By: Moshe Atlow <moshe@atlow.co.il> -Reviewed-By: James M Snell <jasnell@gmail.com> - -diff --git a/src/api/environment.cc b/src/api/environment.cc -index 82f53bba29613de212f64be440ca20d7c630fddf..0a358735c331767e8eb563a80e9aaccfb544c27b 100644 ---- a/src/api/environment.cc -+++ b/src/api/environment.cc -@@ -886,7 +886,7 @@ Maybe<void> InitializePrimordials(Local<Context> context, - CHECK(!exports->Has(context, primordials_string).FromJust()); - - Local<Object> primordials = Object::New(isolate); -- if (primordials->SetPrototype(context, Null(isolate)).IsNothing() || -+ if (primordials->SetPrototypeV2(context, Null(isolate)).IsNothing() || - exports->Set(context, primordials_string, primordials).IsNothing()) { - return Nothing<void>(); - } -diff --git a/src/internal_only_v8.cc b/src/internal_only_v8.cc -index 487b8b7adfd35646d20fdb15be5fd6f2bee9315b..6a3c4e6952a8f3250bf1b57652a1622e9f63ec52 100644 ---- a/src/internal_only_v8.cc -+++ b/src/internal_only_v8.cc -@@ -33,8 +33,8 @@ class PrototypeChainHas : public v8::QueryObjectPredicate { - if (creation_context != context_) { - return false; - } -- for (Local<Value> proto = object->GetPrototype(); proto->IsObject(); -- proto = proto.As<Object>()->GetPrototype()) { -+ for (Local<Value> proto = object->GetPrototypeV2(); proto->IsObject(); -+ proto = proto.As<Object>()->GetPrototypeV2()) { - if (search_ == proto) return true; - } - return false; -diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc -index de3d1f2f1832740b24480267f8c573794179859c..6e1680a74e21240ab99be86dcf23e60a05174888 100644 ---- a/src/js_native_api_v8.cc -+++ b/src/js_native_api_v8.cc -@@ -1577,7 +1577,7 @@ napi_status NAPI_CDECL napi_get_prototype(napi_env env, - CHECK_TO_OBJECT(env, context, obj, object); - - // This doesn't invokes Proxy's [[GetPrototypeOf]] handler. -- v8::Local<v8::Value> val = obj->GetPrototype(); -+ v8::Local<v8::Value> val = obj->GetPrototypeV2(); - *result = v8impl::JsValueFromV8LocalValue(val); - return GET_RETURN_STATUS(env); - } -diff --git a/src/node_buffer.cc b/src/node_buffer.cc -index c94b14741c827a81d69a6f036426a344e563ad72..15129e4455fdc8792f21511a04d534ba3a4ebb5f 100644 ---- a/src/node_buffer.cc -+++ b/src/node_buffer.cc -@@ -284,8 +284,9 @@ MaybeLocal<Uint8Array> New(Environment* env, - size_t length) { - CHECK(!env->buffer_prototype_object().IsEmpty()); - Local<Uint8Array> ui = Uint8Array::New(ab, byte_offset, length); -- if (ui->SetPrototype(env->context(), env->buffer_prototype_object()) -- .IsNothing()) { -+ Maybe<bool> mb = -+ ui->SetPrototypeV2(env->context(), env->buffer_prototype_object()); -+ if (mb.IsNothing()) { - return MaybeLocal<Uint8Array>(); - } - return ui; -diff --git a/src/node_constants.cc b/src/node_constants.cc -index b1ee513fc0873a51b4885f612dbf7b950b5cf2ca..2f23cc63f148a792f1302e1d2d88822730abaa33 100644 ---- a/src/node_constants.cc -+++ b/src/node_constants.cc -@@ -1267,43 +1267,44 @@ void CreatePerContextProperties(Local<Object> target, - Isolate* isolate = Isolate::GetCurrent(); - Environment* env = Environment::GetCurrent(context); - -- CHECK(target->SetPrototype(env->context(), Null(env->isolate())).FromJust()); -+ CHECK( -+ target->SetPrototypeV2(env->context(), Null(env->isolate())).FromJust()); - - Local<Object> os_constants = Object::New(isolate); -- CHECK(os_constants->SetPrototype(env->context(), -- Null(env->isolate())).FromJust()); -+ CHECK(os_constants->SetPrototypeV2(env->context(), Null(env->isolate())) -+ .FromJust()); - - Local<Object> err_constants = Object::New(isolate); -- CHECK(err_constants->SetPrototype(env->context(), -- Null(env->isolate())).FromJust()); -+ CHECK(err_constants->SetPrototypeV2(env->context(), Null(env->isolate())) -+ .FromJust()); - - Local<Object> sig_constants = Object::New(isolate); -- CHECK(sig_constants->SetPrototype(env->context(), -- Null(env->isolate())).FromJust()); -+ CHECK(sig_constants->SetPrototypeV2(env->context(), Null(env->isolate())) -+ .FromJust()); - - Local<Object> priority_constants = Object::New(isolate); -- CHECK(priority_constants->SetPrototype(env->context(), -- Null(env->isolate())).FromJust()); -+ CHECK(priority_constants->SetPrototypeV2(env->context(), Null(env->isolate())) -+ .FromJust()); - - Local<Object> fs_constants = Object::New(isolate); -- CHECK(fs_constants->SetPrototype(env->context(), -- Null(env->isolate())).FromJust()); -+ CHECK(fs_constants->SetPrototypeV2(env->context(), Null(env->isolate())) -+ .FromJust()); - - Local<Object> crypto_constants = Object::New(isolate); -- CHECK(crypto_constants->SetPrototype(env->context(), -- Null(env->isolate())).FromJust()); -+ CHECK(crypto_constants->SetPrototypeV2(env->context(), Null(env->isolate())) -+ .FromJust()); - - Local<Object> zlib_constants = Object::New(isolate); -- CHECK(zlib_constants->SetPrototype(env->context(), -- Null(env->isolate())).FromJust()); -+ CHECK(zlib_constants->SetPrototypeV2(env->context(), Null(env->isolate())) -+ .FromJust()); - - Local<Object> dlopen_constants = Object::New(isolate); -- CHECK(dlopen_constants->SetPrototype(env->context(), -- Null(env->isolate())).FromJust()); -+ CHECK(dlopen_constants->SetPrototypeV2(env->context(), Null(env->isolate())) -+ .FromJust()); - - Local<Object> trace_constants = Object::New(isolate); -- CHECK(trace_constants->SetPrototype(env->context(), -- Null(env->isolate())).FromJust()); -+ CHECK(trace_constants->SetPrototypeV2(env->context(), Null(env->isolate())) -+ .FromJust()); - - Local<Object> internal_constants = Object::New(isolate); - CHECK(internal_constants->SetPrototype(env->context(), -diff --git a/src/node_options.cc b/src/node_options.cc -index 556776b79282d953fdc371d1901f21ca301bec1a..b33193c4d017b35aec5e73c1ead04cfb3ba50d55 100644 ---- a/src/node_options.cc -+++ b/src/node_options.cc -@@ -1493,7 +1493,8 @@ void GetCLIOptionsInfo(const FunctionCallbackInfo<Value>& args) { - - Local<Map> options = Map::New(isolate); - if (options -- ->SetPrototype(context, env->primordials_safe_map_prototype_object()) -+ ->SetPrototypeV2(context, -+ env->primordials_safe_map_prototype_object()) - .IsNothing()) { - return; - } -@@ -1533,7 +1534,8 @@ void GetCLIOptionsInfo(const FunctionCallbackInfo<Value>& args) { - if (!ToV8Value(context, _ppop_instance.aliases_).ToLocal(&aliases)) return; - - if (aliases.As<Object>() -- ->SetPrototype(context, env->primordials_safe_map_prototype_object()) -+ ->SetPrototypeV2(context, -+ env->primordials_safe_map_prototype_object()) - .IsNothing()) { - return; - } -diff --git a/src/node_webstorage.cc b/src/node_webstorage.cc -index 1705e430099c5a363e02010f83d729b0aa54f8e5..0577777723747327dc57830ace316aebc0cfd891 100644 ---- a/src/node_webstorage.cc -+++ b/src/node_webstorage.cc -@@ -532,7 +532,7 @@ template <typename T> - static bool ShouldIntercept(Local<Name> property, - const PropertyCallbackInfo<T>& info) { - Environment* env = Environment::GetCurrent(info); -- Local<Value> proto = info.This()->GetPrototype(); -+ Local<Value> proto = info.This()->GetPrototypeV2(); - - if (proto->IsObject()) { - bool has_prop; diff --git a/patches/node/src_use_non-deprecated_utf8lengthv2_method.patch b/patches/node/src_use_non-deprecated_utf8lengthv2_method.patch deleted file mode 100644 index 1a6455865e2a1..0000000000000 --- a/patches/node/src_use_non-deprecated_utf8lengthv2_method.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Yagiz Nizipli <yagiz@nizipli.com> -Date: Thu, 17 Apr 2025 10:57:40 -0400 -Subject: src: use non-deprecated Utf8LengthV2() method - -PR-URL: https://github.com/nodejs/node/pull/58070 -Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> -Reviewed-By: Darshan Sen <raisinten@gmail.com> -Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> -Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> - -diff --git a/benchmark/napi/function_args/binding.cc b/benchmark/napi/function_args/binding.cc -index 078fe0ee3ea767616e7b938fe4a2fb8d6a2b8d6e..e7c3cb40586ce9f99a57f3d26944e03738bdbabd 100644 ---- a/benchmark/napi/function_args/binding.cc -+++ b/benchmark/napi/function_args/binding.cc -@@ -21,7 +21,7 @@ void CallWithString(const FunctionCallbackInfo<Value>& args) { - assert(args.Length() == 1 && args[0]->IsString()); - if (args.Length() == 1 && args[0]->IsString()) { - Local<String> str = args[0].As<String>(); -- const int32_t length = str->Utf8Length(args.GetIsolate()) + 1; -+ const size_t length = str->Utf8LengthV2(args.GetIsolate()) + 1; - char* buf = new char[length]; - str->WriteUtf8(args.GetIsolate(), buf, length); - delete[] buf; -diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index 7eea2eaefcad5780663a6b87985925ae5d70a5f9..b9a7710ef3cc516ff89aee0da0a8f142507605e3 100644 ---- a/src/crypto/crypto_util.cc -+++ b/src/crypto/crypto_util.cc -@@ -445,7 +445,7 @@ ByteSource ByteSource::FromStringOrBuffer(Environment* env, - ByteSource ByteSource::FromString(Environment* env, Local<String> str, - bool ntc) { - CHECK(str->IsString()); -- size_t size = str->Utf8Length(env->isolate()); -+ size_t size = str->Utf8LengthV2(env->isolate()); - size_t alloc_size = ntc ? size + 1 : size; - ByteSource::Builder out(alloc_size); - int opts = String::NO_OPTIONS; -diff --git a/src/encoding_binding.cc b/src/encoding_binding.cc -index 5ace688bb7ffc86eedf5aff11ab0ab487ad9440e..2d45bbe60f413121b3fd0f01802aeb4368f0c301 100644 ---- a/src/encoding_binding.cc -+++ b/src/encoding_binding.cc -@@ -119,7 +119,7 @@ void BindingData::EncodeUtf8String(const FunctionCallbackInfo<Value>& args) { - CHECK(args[0]->IsString()); - - Local<String> str = args[0].As<String>(); -- size_t length = str->Utf8Length(isolate); -+ size_t length = str->Utf8LengthV2(isolate); - - Local<ArrayBuffer> ab; - { -diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc -index 6e1680a74e21240ab99be86dcf23e60a05174888..a84fdae795dc1cb367a2e446264575c550ce07ee 100644 ---- a/src/js_native_api_v8.cc -+++ b/src/js_native_api_v8.cc -@@ -2482,7 +2482,7 @@ napi_status NAPI_CDECL napi_get_value_string_utf8( - - if (!buf) { - CHECK_ARG(env, result); -- *result = val.As<v8::String>()->Utf8Length(env->isolate); -+ *result = val.As<v8::String>()->Utf8LengthV2(env->isolate); - } else if (bufsize != 0) { - int copied = val.As<v8::String>()->WriteUtf8( - env->isolate, -diff --git a/src/node_buffer.cc b/src/node_buffer.cc -index 15129e4455fdc8792f21511a04d534ba3a4ebb5f..ae73e6743879f32f08b4f6f8c546c587de71d2f3 100644 ---- a/src/node_buffer.cc -+++ b/src/node_buffer.cc -@@ -662,7 +662,7 @@ void Fill(const FunctionCallbackInfo<Value>& args) { - // Can't use StringBytes::Write() in all cases. For example if attempting - // to write a two byte character into a one byte Buffer. - if (enc == UTF8) { -- str_length = str_obj->Utf8Length(env->isolate()); -+ str_length = str_obj->Utf8LengthV2(env->isolate()); - node::Utf8Value str(env->isolate(), args[1]); - memcpy(ts_obj_data + start, *str, std::min(str_length, fill_length)); - -@@ -750,8 +750,8 @@ void SlowByteLengthUtf8(const FunctionCallbackInfo<Value>& args) { - CHECK(args[0]->IsString()); - - // Fast case: avoid StringBytes on UTF8 string. Jump to v8. -- args.GetReturnValue().Set( -- args[0].As<String>()->Utf8Length(args.GetIsolate())); -+ size_t result = args[0].As<String>()->Utf8LengthV2(args.GetIsolate()); -+ args.GetReturnValue().Set(static_cast<uint64_t>(result)); - } - - uint32_t FastByteLengthUtf8(Local<Value> receiver, diff --git a/patches/node/src_use_non-deprecated_writeutf8v2_method.patch b/patches/node/src_use_non-deprecated_writeutf8v2_method.patch deleted file mode 100644 index 0dd5b3e13d1d4..0000000000000 --- a/patches/node/src_use_non-deprecated_writeutf8v2_method.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Yagiz Nizipli <yagiz@nizipli.com> -Date: Thu, 17 Apr 2025 11:36:25 -0400 -Subject: src: use non-deprecated WriteUtf8V2() method - -PR-URL: https://github.com/nodejs/node/pull/58070 -Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> -Reviewed-By: Darshan Sen <raisinten@gmail.com> -Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> -Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> - -diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index b9a7710ef3cc516ff89aee0da0a8f142507605e3..73bfa6ac5e6e2b837b1bbc4a6d5f337fc0b79913 100644 ---- a/src/crypto/crypto_util.cc -+++ b/src/crypto/crypto_util.cc -@@ -29,6 +29,7 @@ namespace node { - using ncrypto::BignumPointer; - using ncrypto::BIOPointer; - using ncrypto::CryptoErrorList; -+using ncrypto::DataPointer; - #ifndef OPENSSL_NO_ENGINE - using ncrypto::EnginePointer; - #endif // !OPENSSL_NO_ENGINE -@@ -447,11 +448,12 @@ ByteSource ByteSource::FromString(Environment* env, Local<String> str, - CHECK(str->IsString()); - size_t size = str->Utf8LengthV2(env->isolate()); - size_t alloc_size = ntc ? size + 1 : size; -- ByteSource::Builder out(alloc_size); -- int opts = String::NO_OPTIONS; -- if (!ntc) opts |= String::NO_NULL_TERMINATION; -- str->WriteUtf8(env->isolate(), out.data<char>(), alloc_size, nullptr, opts); -- return std::move(out).release(); -+ auto out = DataPointer::Alloc(alloc_size); -+ int flags = String::WriteFlags::kNone; -+ if (ntc) flags |= String::WriteFlags::kNullTerminate; -+ str->WriteUtf8V2( -+ env->isolate(), static_cast<char*>(out.get()), alloc_size, flags); -+ return ByteSource::Allocated(out.release()); - } - - ByteSource ByteSource::FromBuffer(Local<Value> buffer, bool ntc) { -diff --git a/src/encoding_binding.cc b/src/encoding_binding.cc -index 2d45bbe60f413121b3fd0f01802aeb4368f0c301..2af83e27f77f9afe2f725338b04061efbf0960a1 100644 ---- a/src/encoding_binding.cc -+++ b/src/encoding_binding.cc -@@ -98,13 +98,12 @@ void BindingData::EncodeInto(const FunctionCallbackInfo<Value>& args) { - char* write_result = static_cast<char*>(buf->Data()) + dest->ByteOffset(); - size_t dest_length = dest->ByteLength(); - -- int nchars; -- int written = source->WriteUtf8( -- isolate, -- write_result, -- dest_length, -- &nchars, -- String::NO_NULL_TERMINATION | String::REPLACE_INVALID_UTF8); -+ size_t nchars; -+ size_t written = source->WriteUtf8V2(isolate, -+ write_result, -+ dest_length, -+ String::WriteFlags::kReplaceInvalidUtf8, -+ &nchars); - - binding_data->encode_into_results_buffer_[0] = nchars; - binding_data->encode_into_results_buffer_[1] = written; -@@ -129,11 +128,11 @@ void BindingData::EncodeUtf8String(const FunctionCallbackInfo<Value>& args) { - - CHECK(bs); - -- str->WriteUtf8(isolate, -- static_cast<char*>(bs->Data()), -- -1, // We are certain that `data` is sufficiently large -- nullptr, -- String::NO_NULL_TERMINATION | String::REPLACE_INVALID_UTF8); -+ // We are certain that `data` is sufficiently large -+ str->WriteUtf8V2(isolate, -+ static_cast<char*>(bs->Data()), -+ bs->MaxByteLength(), -+ String::WriteFlags::kReplaceInvalidUtf8); - - ab = ArrayBuffer::New(isolate, std::move(bs)); - } -diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc -index a84fdae795dc1cb367a2e446264575c550ce07ee..8f97ca4d9cbb840efd36c77fed12d746a2793670 100644 ---- a/src/js_native_api_v8.cc -+++ b/src/js_native_api_v8.cc -@@ -2484,12 +2484,12 @@ napi_status NAPI_CDECL napi_get_value_string_utf8( - CHECK_ARG(env, result); - *result = val.As<v8::String>()->Utf8LengthV2(env->isolate); - } else if (bufsize != 0) { -- int copied = val.As<v8::String>()->WriteUtf8( -- env->isolate, -- buf, -- bufsize - 1, -- nullptr, -- v8::String::REPLACE_INVALID_UTF8 | v8::String::NO_NULL_TERMINATION); -+ auto str = val.As<v8::String>(); -+ size_t copied = -+ str->WriteUtf8V2(env->isolate, -+ buf, -+ bufsize - 1, -+ v8::String::WriteFlags::kReplaceInvalidUtf8); - - buf[copied] = '\0'; - if (result != nullptr) { -diff --git a/src/string_bytes.cc b/src/string_bytes.cc -index 4324ed52d7cd6af5202512858a62346c3ab6c302..0eb9b1967f1f185a140239924809468394297d58 100644 ---- a/src/string_bytes.cc -+++ b/src/string_bytes.cc -@@ -266,7 +266,8 @@ size_t StringBytes::Write(Isolate* isolate, - - case BUFFER: - case UTF8: -- nbytes = str->WriteUtf8(isolate, buf, buflen, nullptr, flags); -+ nbytes = str->WriteUtf8V2( -+ isolate, buf, buflen, String::WriteFlags::kReplaceInvalidUtf8); - break; - - case UCS2: { -diff --git a/src/util.cc b/src/util.cc -index 03c4794314c1c228f95536d2d20a440061cf3a80..e616e11107555f0613cb631e3b4320fc281441fa 100644 ---- a/src/util.cc -+++ b/src/util.cc -@@ -125,12 +125,8 @@ static void MakeUtf8String(Isolate* isolate, - size_t storage = (3 * value_length) + 1; - target->AllocateSufficientStorage(storage); - -- // TODO(@anonrig): Use simdutf to speed up non-one-byte strings once it's -- // implemented -- const int flags = -- String::NO_NULL_TERMINATION | String::REPLACE_INVALID_UTF8; -- const int length = -- string->WriteUtf8(isolate, target->out(), storage, nullptr, flags); -+ size_t length = string->WriteUtf8V2( -+ isolate, target->out(), storage, String::WriteFlags::kReplaceInvalidUtf8); - target->SetLengthAndZeroTerminate(length); - } - diff --git a/patches/node/src_use_string_writev2_in_twobytevalue.patch b/patches/node/src_use_string_writev2_in_twobytevalue.patch deleted file mode 100644 index 1f466dffbc585..0000000000000 --- a/patches/node/src_use_string_writev2_in_twobytevalue.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= <tniessen@tnie.de> -Date: Fri, 9 May 2025 04:15:47 +0100 -Subject: src: use String::WriteV2() in TwoByteValue -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Since `String::Write()` is deprecated, use `String::WriteV2()` instead. - -PR-URL: https://github.com/nodejs/node/pull/58164 -Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> -Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> -Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> -Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> -Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> -Reviewed-By: James M Snell <jasnell@gmail.com> - -diff --git a/src/util.cc b/src/util.cc -index e616e11107555f0613cb631e3b4320fc281441fa..c5c2b89dc3fc008114b2492d1e16928428f097b4 100644 ---- a/src/util.cc -+++ b/src/util.cc -@@ -146,12 +146,10 @@ TwoByteValue::TwoByteValue(Isolate* isolate, Local<Value> value) { - Local<String> string; - if (!value->ToString(isolate->GetCurrentContext()).ToLocal(&string)) return; - -- // Allocate enough space to include the null terminator -- const size_t storage = string->Length() + 1; -- AllocateSufficientStorage(storage); -- -- const int flags = String::NO_NULL_TERMINATION; -- const int length = string->Write(isolate, out(), 0, storage, flags); -+ // Allocate enough space to include the null terminator. -+ const size_t length = string->Length(); -+ AllocateSufficientStorage(length + 1); -+ string->WriteV2(isolate, 0, length, out()); - SetLengthAndZeroTerminate(length); - } - diff --git a/patches/node/support_v8_sandboxed_pointers.patch b/patches/node/support_v8_sandboxed_pointers.patch index d46ef48236169..b035c26d399b2 100644 --- a/patches/node/support_v8_sandboxed_pointers.patch +++ b/patches/node/support_v8_sandboxed_pointers.patch @@ -7,10 +7,10 @@ This refactors several allocators to allocate within the V8 memory cage, allowing them to be compatible with the V8_SANDBOXED_POINTERS feature. diff --git a/src/api/environment.cc b/src/api/environment.cc -index fd71ceac65ccef1d2832b45b0b5612877cee22c1..cb37fa080fc8e8d524cfa2758c4a8c2c5652324d 100644 +index d10f861c96931d06fb50dcdb66f2e79b0dee55a7..a869bc0a145009b57db3f37208e405d9356cc20f 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -106,6 +106,14 @@ MaybeLocal<Value> PrepareStackTraceCallback(Local<Context> context, +@@ -109,6 +109,14 @@ MaybeLocal<Value> PrepareStackTraceCallback(Local<Context> context, return result; } @@ -25,17 +25,39 @@ index fd71ceac65ccef1d2832b45b0b5612877cee22c1..cb37fa080fc8e8d524cfa2758c4a8c2c void* NodeArrayBufferAllocator::Allocate(size_t size) { void* ret; if (zero_fill_field_ || per_process::cli_options->zero_fill_all_buffers) +@@ -324,6 +332,12 @@ Isolate* NewIsolate(Isolate::CreateParams* params, + // but also otherwise just doesn't work, and the only real alternative + // is disabling shared-readonly-heap mode altogether. + static Isolate::CreateParams first_params = *params; ++ // Clear allocator pointers to prevent use-after-free during static ++ // destruction. The static first_params can outlive V8's internal ++ // allocator systems, causing crashes when its destructor tries to ++ // free resources after V8 has shut down. ++ first_params.array_buffer_allocator = nullptr; ++ first_params.array_buffer_allocator_shared.reset(); + params->snapshot_blob = first_params.snapshot_blob; + params->external_references = first_params.external_references; + } diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc -index f23cedf4f2449d8edc9a8de1b70332e75d693cdd..976653dd1e9363e046788fc3419a9b649ceb2ea4 100644 +index 46a7d1396dc1a175ae99f4e403721f1730fdd320..bbb0abb3b9563074d350578e0f5a8fa211046b17 100644 --- a/src/crypto/crypto_dh.cc +++ b/src/crypto/crypto_dh.cc -@@ -55,13 +55,32 @@ void DiffieHellman::MemoryInfo(MemoryTracker* tracker) const { - - namespace { - MaybeLocal<Value> DataPointerToBuffer(Environment* env, DataPointer&& data) { -+#if defined(V8_ENABLE_SANDBOX) +@@ -61,17 +61,22 @@ MaybeLocal<Value> DataPointerToBuffer(Environment* env, DataPointer&& data) { + bool secure; + }; + #ifdef V8_ENABLE_SANDBOX +- auto backing = ArrayBuffer::NewBackingStore( +- env->isolate(), +- data.size(), +- BackingStoreInitializationMode::kUninitialized, +- BackingStoreOnFailureMode::kReturnNull); +- if (!backing) { +- THROW_ERR_MEMORY_ALLOCATION_FAILED(env); +- return MaybeLocal<Value>(); +- } + std::unique_ptr<v8::BackingStore> backing; -+ if (data.size() > 0) { + if (data.size() > 0) { +- memcpy(backing->Data(), data.get(), data.size()); + std::unique_ptr<ArrayBuffer::Allocator> allocator(ArrayBuffer::Allocator::NewDefaultAllocator()); + void* v8_data = allocator->Allocate(data.size()); + CHECK(v8_data); @@ -50,32 +72,24 @@ index f23cedf4f2449d8edc9a8de1b70332e75d693cdd..976653dd1e9363e046788fc3419a9b64 + } else { + NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); + backing = v8::ArrayBuffer::NewBackingStore(env->isolate(), data.size()); -+ } -+#else + } + #else auto backing = ArrayBuffer::NewBackingStore( - data.get(), - data.size(), - [](void* data, size_t len, void* ptr) { DataPointer free_me(data, len); }, - nullptr); - data.release(); -- -+#endif - auto ab = ArrayBuffer::New(env->isolate(), std::move(backing)); - return Buffer::New(env, ab, 0, ab->ByteLength()).FromMaybe(Local<Value>()); - } diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index 6346f8f7199cf7b7d3736c59571606fff102fbb6..7eea2eaefcad5780663a6b87985925ae5d70a5f9 100644 +index 12b0d804c6f1d4998b85160b0aac8eb7a3b5576b..27bd93769233dc65a064710db4095d9cdc3a8b1a 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc -@@ -359,10 +359,35 @@ ByteSource& ByteSource::operator=(ByteSource&& other) noexcept { - return *this; - } - --std::unique_ptr<BackingStore> ByteSource::ReleaseToBackingStore() { -+std::unique_ptr<BackingStore> ByteSource::ReleaseToBackingStore(Environment* env) { +@@ -346,24 +346,30 @@ std::unique_ptr<BackingStore> ByteSource::ReleaseToBackingStore( // It's ok for allocated_data_ to be nullptr but // only if size_ is zero. CHECK_IMPLIES(size_ > 0, allocated_data_ != nullptr); +-#ifdef V8_ENABLE_SANDBOX +- // If the v8 sandbox is enabled, then all array buffers must be allocated +- // via the isolate. External buffers are not allowed. So, instead of wrapping +- // the allocated data we'll copy it instead. +- +- // TODO(@jasnell): It would be nice to use an abstracted utility to do this +- // branch instead of duplicating the V8_ENABLE_SANDBOX check each time. +#if defined(V8_ENABLE_SANDBOX) + // When V8 sandboxed pointers are enabled, we have to copy into the memory + // cage. We still want to ensure we erase the data on free though, so @@ -87,9 +101,18 @@ index 6346f8f7199cf7b7d3736c59571606fff102fbb6..7eea2eaefcad5780663a6b87985925ae + CHECK(v8_data); + memcpy(v8_data, allocated_data_, size()); + OPENSSL_clear_free(allocated_data_, size()); -+ std::unique_ptr<BackingStore> ptr = ArrayBuffer::NewBackingStore( + std::unique_ptr<BackingStore> ptr = ArrayBuffer::NewBackingStore( +- env->isolate(), + v8_data, -+ size(), + size(), +- BackingStoreInitializationMode::kUninitialized, +- BackingStoreOnFailureMode::kReturnNull); +- if (!ptr) { +- THROW_ERR_MEMORY_ALLOCATION_FAILED(env); +- return nullptr; +- } +- memcpy(ptr->Data(), allocated_data_, size()); +- OPENSSL_clear_free(allocated_data_, size_); + [](void* data, size_t length, void*) { + OPENSSL_cleanse(data, length); + std::unique_ptr<ArrayBuffer::Allocator> allocator(ArrayBuffer::Allocator::NewDefaultAllocator()); @@ -100,108 +123,131 @@ index 6346f8f7199cf7b7d3736c59571606fff102fbb6..7eea2eaefcad5780663a6b87985925ae + data_ = nullptr; + size_ = 0; + return ptr; -+#else + #else std::unique_ptr<BackingStore> ptr = ArrayBuffer::NewBackingStore( allocated_data_, - size(), -@@ -374,10 +399,11 @@ std::unique_ptr<BackingStore> ByteSource::ReleaseToBackingStore() { - data_ = nullptr; - size_ = 0; - return ptr; -+#endif // defined(V8_ENABLE_SANDBOX) - } - - Local<ArrayBuffer> ByteSource::ToArrayBuffer(Environment* env) { -- std::unique_ptr<BackingStore> store = ReleaseToBackingStore(); -+ std::unique_ptr<BackingStore> store = ReleaseToBackingStore(env); - return ArrayBuffer::New(env->isolate(), std::move(store)); - } - -@@ -674,6 +700,16 @@ namespace { - // in which case this has the same semantics as +@@ -662,23 +668,16 @@ namespace { // using OPENSSL_malloc. However, if the secure heap is // initialized, SecureBuffer will automatically use it. -+#if defined(V8_ENABLE_SANDBOX) -+// When V8 sandboxed pointers are enabled, the secure heap cannot be used as -+// all ArrayBuffers must be allocated inside the V8 memory cage. -+void SecureBuffer(const FunctionCallbackInfo<Value>& args) { -+ CHECK(args[0]->IsUint32()); -+ uint32_t len = args[0].As<Uint32>()->Value(); -+ Local<ArrayBuffer> buffer = ArrayBuffer::New(args.GetIsolate(), len); -+ args.GetReturnValue().Set(Uint8Array::New(buffer, 0, len)); -+} -+#else void SecureBuffer(const FunctionCallbackInfo<Value>& args) { - CHECK(args[0]->IsUint32()); - Environment* env = Environment::GetCurrent(args); -@@ -695,6 +731,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) { - Local<ArrayBuffer> buffer = ArrayBuffer::New(env->isolate(), store); - args.GetReturnValue().Set(Uint8Array::New(buffer, 0, len)); - } -+#endif // defined(V8_ENABLE_SANDBOX) - - void SecureHeapUsed(const FunctionCallbackInfo<Value>& args) { - #ifndef OPENSSL_IS_BORINGSSL -diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h -index ebc7fddeccf04a92c610849b626b33f900d63493..ed7d202d1b041f8a6cd43ae767d696fb29ab9cd9 100644 ---- a/src/crypto/crypto_util.h -+++ b/src/crypto/crypto_util.h -@@ -243,7 +243,7 @@ class ByteSource { - // Creates a v8::BackingStore that takes over responsibility for - // any allocated data. The ByteSource will be reset with size = 0 - // after being called. -- std::unique_ptr<v8::BackingStore> ReleaseToBackingStore(); -+ std::unique_ptr<v8::BackingStore> ReleaseToBackingStore(Environment* env); - - v8::Local<v8::ArrayBuffer> ToArrayBuffer(Environment* env); +- Environment* env = Environment::GetCurrent(args); ++ CHECK(args[0]->IsUint32()); + #ifdef V8_ENABLE_SANDBOX +- // The v8 sandbox is enabled, so we cannot use the secure heap because +- // the sandbox requires that all array buffers be allocated via the isolate. +- // That is fundamentally incompatible with the secure heap which allocates +- // in openssl's secure heap area. Instead we'll just throw an error here. +- // +- // That said, we really shouldn't get here in the first place since the +- // option to enable the secure heap is only available when the sandbox +- // is disabled. +- UNREACHABLE(); ++ uint32_t len = args[0].As<Uint32>()->Value(); ++ Local<ArrayBuffer> buffer = ArrayBuffer::New(args.GetIsolate(), len); ++ args.GetReturnValue().Set(Uint8Array::New(buffer, 0, len)); + #else +- CHECK(args[0]->IsUint32()); ++ Environment* env = Environment::GetCurrent(args); + uint32_t len = args[0].As<Uint32>()->Value(); + auto data = DataPointer::SecureAlloc(len); +- CHECK(data.isSecure()); + if (!data) { + return THROW_ERR_OPERATION_FAILED(env, "Allocation failed"); + } diff --git a/src/crypto/crypto_x509.cc b/src/crypto/crypto_x509.cc -index f616223cfb0f6e10f7cf57ada9704316bde2797e..eb6dad44a49d997097c8fb5009eeb60a7305da27 100644 +index b30297eac08ad9587642b723f91d7e3b954294d4..4c5427596d1c90d3a413cdd9ff4f1151e657073d 100644 --- a/src/crypto/crypto_x509.cc +++ b/src/crypto/crypto_x509.cc -@@ -167,6 +167,19 @@ MaybeLocal<Value> ToV8Value(Local<Context> context, const BIOPointer& bio) { - MaybeLocal<Value> ToBuffer(Environment* env, BIOPointer* bio) { - if (bio == nullptr || !*bio) return {}; +@@ -135,19 +135,17 @@ MaybeLocal<Value> ToBuffer(Environment* env, BIOPointer* bio) { + return {}; BUF_MEM* mem = *bio; -+#if defined(V8_ENABLE_SANDBOX) + #ifdef V8_ENABLE_SANDBOX +- // If the v8 sandbox is enabled, then all array buffers must be allocated +- // via the isolate. External buffers are not allowed. So, instead of wrapping +- // the BIOPointer we'll copy it instead. +- auto backing = ArrayBuffer::NewBackingStore( +- env->isolate(), + std::unique_ptr<ArrayBuffer::Allocator> allocator(ArrayBuffer::Allocator::NewDefaultAllocator()); + void* v8_data = allocator->Allocate(mem->length); + CHECK(v8_data); + memcpy(v8_data, mem->data, mem->length); + std::unique_ptr<v8::BackingStore> backing = ArrayBuffer::NewBackingStore( + v8_data, -+ mem->length, + mem->length, +- BackingStoreInitializationMode::kUninitialized, +- BackingStoreOnFailureMode::kReturnNull); +- if (!backing) { +- THROW_ERR_MEMORY_ALLOCATION_FAILED(env); +- return MaybeLocal<Value>(); +- } +- memcpy(backing->Data(), mem->data, mem->length); + [](void* data, size_t length, void*) { + std::unique_ptr<ArrayBuffer::Allocator> allocator(ArrayBuffer::Allocator::NewDefaultAllocator()); + allocator->Free(data, length); + }, nullptr); -+#else + #else auto backing = ArrayBuffer::NewBackingStore( mem->data, - mem->length, -@@ -174,6 +187,8 @@ MaybeLocal<Value> ToBuffer(Environment* env, BIOPointer* bio) { - BIOPointer free_me(static_cast<BIO*>(data)); - }, - bio->release()); -+#endif +diff --git a/src/env-inl.h b/src/env-inl.h +index 97c43afb487b58c0c77bd59b4a6b6d7a13690053..5dfbd564d5bbd22ebf3b529a07b73e85cbe51986 100644 +--- a/src/env-inl.h ++++ b/src/env-inl.h +@@ -44,6 +44,16 @@ + + namespace node { + ++NoArrayBufferZeroFillScope::NoArrayBufferZeroFillScope( ++ IsolateData* isolate_data) ++ : node_allocator_(isolate_data->node_allocator()) { ++ if (node_allocator_ != nullptr) node_allocator_->zero_fill_field()[0] = 0; ++} + - auto ab = ArrayBuffer::New(env->isolate(), std::move(backing)); - Local<Value> ret; - if (!Buffer::New(env, ab, 0, ab->ByteLength()).ToLocal(&ret)) return {}; ++NoArrayBufferZeroFillScope::~NoArrayBufferZeroFillScope() { ++ if (node_allocator_ != nullptr) node_allocator_->zero_fill_field()[0] = 1; ++} ++ + inline v8::Isolate* IsolateData::isolate() const { + return isolate_; + } +diff --git a/src/env.h b/src/env.h +index d34aec43630b3cf53004d8180446d7136b59ceac..b30314d7773742e2332ff47f84bc326151563690 100644 +--- a/src/env.h ++++ b/src/env.h +@@ -111,6 +111,19 @@ class ModuleWrap; + class Environment; + class Realm; + ++// Disables zero-filling for ArrayBuffer allocations in this scope. This is ++// similar to how we implement Buffer.allocUnsafe() in JS land. ++class NoArrayBufferZeroFillScope { ++ public: ++ inline explicit NoArrayBufferZeroFillScope(IsolateData* isolate_data); ++ inline ~NoArrayBufferZeroFillScope(); ++ ++ private: ++ NodeArrayBufferAllocator* node_allocator_; ++ ++ friend class Environment; ++}; ++ + struct IsolateDataSerializeInfo { + std::vector<SnapshotIndex> primitive_values; + std::vector<PropInfo> template_values; diff --git a/src/node_i18n.cc b/src/node_i18n.cc -index 61b6ecd240c9500f21f683065a2f920af3afb502..ad2b1c76325cb5c8f18a618c5a85ae87b6a7bbe7 100644 +index 3c4f419aa29470b3280174b58680b9421b0340b5..3b24ad2a2316f89d98b067e2c13988f87a9a00d2 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc -@@ -104,7 +104,7 @@ namespace { - +@@ -105,7 +105,7 @@ namespace { template <typename T> MaybeLocal<Object> ToBufferEndian(Environment* env, MaybeStackBuffer<T>* buf) { -- MaybeLocal<Object> ret = Buffer::New(env, buf); -+ MaybeLocal<Object> ret = Buffer::Copy(env, reinterpret_cast<char*>(buf->out()), buf->length() * sizeof(T)); - if (ret.IsEmpty()) - return ret; + Local<Object> ret; +- if (!Buffer::New(env, buf).ToLocal(&ret)) { ++ if (!Buffer::Copy(env, reinterpret_cast<char*>(buf->out()), buf->length() * sizeof(T)).ToLocal(&ret)) { + return {}; + } -@@ -181,7 +181,7 @@ MaybeLocal<Object> TranscodeLatin1ToUcs2(Environment* env, +@@ -182,7 +182,7 @@ MaybeLocal<Object> TranscodeLatin1ToUcs2(Environment* env, return {}; } @@ -210,7 +256,7 @@ index 61b6ecd240c9500f21f683065a2f920af3afb502..ad2b1c76325cb5c8f18a618c5a85ae87 } MaybeLocal<Object> TranscodeFromUcs2(Environment* env, -@@ -226,7 +226,7 @@ MaybeLocal<Object> TranscodeUcs2FromUtf8(Environment* env, +@@ -227,7 +227,7 @@ MaybeLocal<Object> TranscodeUcs2FromUtf8(Environment* env, return {}; } @@ -219,7 +265,7 @@ index 61b6ecd240c9500f21f683065a2f920af3afb502..ad2b1c76325cb5c8f18a618c5a85ae87 } MaybeLocal<Object> TranscodeUtf8FromUcs2(Environment* env, -@@ -250,7 +250,7 @@ MaybeLocal<Object> TranscodeUtf8FromUcs2(Environment* env, +@@ -251,7 +251,7 @@ MaybeLocal<Object> TranscodeUtf8FromUcs2(Environment* env, return {}; } @@ -253,7 +299,7 @@ index 12ea72b61b0a5e194207bb369dfed4b8667107cb..64442215714a98f648971e517ddd9c77 // Delegate to V8's allocator for compatibility with the V8 memory cage. diff --git a/src/node_serdes.cc b/src/node_serdes.cc -index c55a2e28066147ae5ca5def10ec76ccc03c634b4..c54183c72944989219b6437c9e571a3f7f3f8dd5 100644 +index 00fcd4b6afccce47ff21c4447d9cd60f25c11835..5f96ee2051e5339456185efddb149c4d43093f31 100644 --- a/src/node_serdes.cc +++ b/src/node_serdes.cc @@ -29,6 +29,26 @@ using v8::ValueSerializer; @@ -307,8 +353,8 @@ index c55a2e28066147ae5ca5def10ec76ccc03c634b4..c54183c72944989219b6437c9e571a3f }; class DeserializerContext : public BaseObject, -@@ -144,6 +170,24 @@ Maybe<uint32_t> SerializerContext::GetSharedArrayBufferId( - return id.ToLocalChecked()->Uint32Value(env()->context()); +@@ -145,6 +171,24 @@ Maybe<uint32_t> SerializerContext::GetSharedArrayBufferId( + return id->Uint32Value(env()->context()); } +void* SerializerContext::ReallocateBufferMemory(void* old_buffer, @@ -331,14 +377,15 @@ index c55a2e28066147ae5ca5def10ec76ccc03c634b4..c54183c72944989219b6437c9e571a3f + Maybe<bool> SerializerContext::WriteHostObject(Isolate* isolate, Local<Object> input) { - MaybeLocal<Value> ret; -@@ -209,9 +253,14 @@ void SerializerContext::ReleaseBuffer(const FunctionCallbackInfo<Value>& args) { + Local<Value> args[1] = { input }; +@@ -211,10 +255,17 @@ void SerializerContext::ReleaseBuffer(const FunctionCallbackInfo<Value>& args) { // Note: Both ValueSerializer and this Buffer::New() variant use malloc() // as the underlying allocator. std::pair<uint8_t*, size_t> ret = ctx->serializer_.Release(); -- auto buf = Buffer::New(ctx->env(), -- reinterpret_cast<char*>(ret.first), -- ret.second); +- Local<Object> buf; +- if (Buffer::New(ctx->env(), reinterpret_cast<char*>(ret.first), ret.second) +- .ToLocal(&buf)) { +- args.GetReturnValue().Set(buf); + std::unique_ptr<v8::BackingStore> bs = + v8::ArrayBuffer::NewBackingStore(reinterpret_cast<char*>(ret.first), ret.second, + [](void* data, size_t length, void* deleter_data) { @@ -347,14 +394,17 @@ index c55a2e28066147ae5ca5def10ec76ccc03c634b4..c54183c72944989219b6437c9e571a3f + Local<ArrayBuffer> ab = v8::ArrayBuffer::New(ctx->env()->isolate(), std::move(bs)); + + auto buf = Buffer::New(ctx->env(), ab, 0, ret.second); ++ ++ if (!buf.IsEmpty()) { ++ args.GetReturnValue().Set(buf.ToLocalChecked()); + } + } - if (!buf.IsEmpty()) { - args.GetReturnValue().Set(buf.ToLocalChecked()); diff --git a/src/node_trace_events.cc b/src/node_trace_events.cc -index 9787b14352753c5e0f8dc2b90093680e7cd10f1a..31af9e62396368af1b81f8841a705fd313df2b9f 100644 +index ef659f1c39f7ee958879bf395377bc99911fc346..225b1465b7c97d972a38968faf6d685017a80bf0 100644 --- a/src/node_trace_events.cc +++ b/src/node_trace_events.cc -@@ -132,12 +132,28 @@ static void GetCategoryEnabledBuffer(const FunctionCallbackInfo<Value>& args) { +@@ -129,12 +129,28 @@ static void GetCategoryEnabledBuffer(const FunctionCallbackInfo<Value>& args) { const uint8_t* enabled_pointer = TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_name.out()); uint8_t* enabled_pointer_cast = const_cast<uint8_t*>(enabled_pointer); @@ -384,3 +434,26 @@ index 9787b14352753c5e0f8dc2b90093680e7cd10f1a..31af9e62396368af1b81f8841a705fd3 auto ab = ArrayBuffer::New(isolate, std::move(bs)); v8::Local<Uint8Array> u8 = v8::Uint8Array::New(ab, 0, 1); +diff --git a/test/parallel/test-process-env-allowed-flags-are-documented.js b/test/parallel/test-process-env-allowed-flags-are-documented.js +index 07e38748b07ddd32a6e3caa3c34183387e1cae18..f09bf0940dad2068f0aa5dce783dd422773d4bbb 100644 +--- a/test/parallel/test-process-env-allowed-flags-are-documented.js ++++ b/test/parallel/test-process-env-allowed-flags-are-documented.js +@@ -49,6 +49,8 @@ if (!hasOpenSSL3) { + documented.delete('--openssl-shared-config'); + } + ++const isV8Sandboxed = process.config.variables.v8_enable_sandbox; ++ + // Filter out options that are conditionally present. + const conditionalOpts = [ + { +@@ -74,6 +76,9 @@ const conditionalOpts = [ + }, { + include: process.features.inspector, + filter: (opt) => opt.startsWith('--inspect') || opt === '--debug-port' ++ }, { ++ include: !isV8Sandboxed, ++ filter: (opt) => ['--secure-heap', '--secure-heap-min'].includes(opt) + }, + ]; + documented.forEach((opt) => { diff --git a/patches/node/test_accomodate_v8_thenable_stack_trace_change_in_snapshot.patch b/patches/node/test_accomodate_v8_thenable_stack_trace_change_in_snapshot.patch index 5024caa3376d5..20dd33ff91c3e 100644 --- a/patches/node/test_accomodate_v8_thenable_stack_trace_change_in_snapshot.patch +++ b/patches/node/test_accomodate_v8_thenable_stack_trace_change_in_snapshot.patch @@ -12,7 +12,7 @@ See: https://chromium-review.googlesource.com/c/v8/v8/+/6826001 diff --git a/test/fixtures/test-runner/output/describe_it.snapshot b/test/fixtures/test-runner/output/describe_it.snapshot -index 347f3789693ddae7e7f9bd4125d8b19a31c1e764..35913d7f487dbd56eb8015e20f14a447de1db9bc 100644 +index 67d4af7f1b9f45d48b35c930cb1490ee019d0bdf..21d8744340c5a4c002d8c91266f46c2b66591b6e 100644 --- a/test/fixtures/test-runner/output/describe_it.snapshot +++ b/test/fixtures/test-runner/output/describe_it.snapshot @@ -690,6 +690,8 @@ not ok 54 - timeouts diff --git a/patches/node/test_formally_mark_some_tests_as_flaky.patch b/patches/node/test_formally_mark_some_tests_as_flaky.patch index c1614283331d4..cf2948d7df336 100644 --- a/patches/node/test_formally_mark_some_tests_as_flaky.patch +++ b/patches/node/test_formally_mark_some_tests_as_flaky.patch @@ -7,7 +7,7 @@ Instead of disabling the tests, flag them as flaky so they still run but don't cause CI failures on flakes. diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status -index 67c0c04d2365e59db111258d008f8c73173e3e96..a4204e7580e7823399f6057d57c09cba56b5ff78 100644 +index 0036beb318df2241d49201dc9d0679763e551e7b..5713f13de818f84b1c598b73024773c1bbf936c6 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -5,6 +5,16 @@ prefix parallel @@ -25,10 +25,10 @@ index 67c0c04d2365e59db111258d008f8c73173e3e96..a4204e7580e7823399f6057d57c09cba +test-cluster-shared-handle-bind-privileged-port: PASS, FLAKY +test-debugger-random-port-with-inspect-port: PASS, FLAKY # https://github.com/nodejs/node/issues/52273 - test-net-write-fully-async-hex-string: PASS, FLAKY - # https://github.com/nodejs/node/issues/52273 + test-shadow-realm-gc: SKIP + test-shadow-realm-gc-module: SKIP diff --git a/test/sequential/sequential.status b/test/sequential/sequential.status -index 4ae3b6c5fd2eb633ae78bed1824046d862d7579b..d291954d4451b63aeb2bf46232e8705150eb9e79 100644 +index c36eac6302d43a6b80ed0bc77db2c628bb66169c..627c4d576787e4363736615d08eebe481800909e 100644 --- a/test/sequential/sequential.status +++ b/test/sequential/sequential.status @@ -7,6 +7,18 @@ prefix sequential diff --git a/patches/node/test_handle_explicit_resource_management_globals.patch b/patches/node/test_handle_explicit_resource_management_globals.patch deleted file mode 100644 index f1f83f9037dc3..0000000000000 --- a/patches/node/test_handle_explicit_resource_management_globals.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= <targos@protonmail.com> -Date: Sat, 21 Dec 2024 09:25:55 +0100 -Subject: test: handle explicit resource management globals - -https://chromium-review.googlesource.com/c/chromium/src/+/6174695 - -diff --git a/test/common/globals.js b/test/common/globals.js -index 5d1c4415eeb09e92d062330afc0aecb1d297b6d3..2c1dac019ba2aa0a23c2434997e2007dd2eacde8 100644 ---- a/test/common/globals.js -+++ b/test/common/globals.js -@@ -64,6 +64,9 @@ const intrinsics = new Set([ - 'Atomics', - 'WebAssembly', - 'Iterator', -+ 'SuppressedError', -+ 'DisposableStack', -+ 'AsyncDisposableStack', - ]); - - if (global.gc) { diff --git a/patches/node/test_update_v8-stats_test_for_v8_12_6.patch b/patches/node/test_update_v8-stats_test_for_v8_12_6.patch deleted file mode 100644 index 671fcb14ed845..0000000000000 --- a/patches/node/test_update_v8-stats_test_for_v8_12_6.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: "targos@protonmail.com" <targos@protonmail.com> -Date: Thu, 9 May 2024 12:00:39 +0200 -Subject: test: update v8-stats test for V8 12.6 - -Refs: https://github.com/v8/v8/commit/e30e228ee6e034de49a40af0173113198a19b497 - -diff --git a/test/parallel/test-v8-stats.js b/test/parallel/test-v8-stats.js -index bb954165f42c9de3db66bc5fdcac647654ad71ea..07be833e6e749a2bb68490c935c6791c178d126f 100644 ---- a/test/parallel/test-v8-stats.js -+++ b/test/parallel/test-v8-stats.js -@@ -48,6 +48,8 @@ const expectedHeapSpaces = [ - 'read_only_space', - 'shared_large_object_space', - 'shared_space', -+ 'shared_trusted_large_object_space', -+ 'shared_trusted_space', - 'trusted_large_object_space', - 'trusted_space', - ]; diff --git a/patches/node/test_use_static_method_names_in_call_stacks.patch b/patches/node/test_use_static_method_names_in_call_stacks.patch deleted file mode 100644 index 5f645c5c3aeb9..0000000000000 --- a/patches/node/test_use_static_method_names_in_call_stacks.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samuel Maddock <smaddock@slack-corp.com> -Date: Fri, 22 Nov 2024 15:18:05 -0500 -Subject: test: use static method names in call stacks - -Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5907815 - -diff --git a/test/message/assert_throws_stack.out b/test/message/assert_throws_stack.out -index 1ecda64889e07fe64d03404d478311f9f8267a4e..2b5587292a2c7a8797589804f14bfd0c3e9725f8 100644 ---- a/test/message/assert_throws_stack.out -+++ b/test/message/assert_throws_stack.out -@@ -24,7 +24,7 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: - actual: Error: foo - at assert.throws.bar (*assert_throws_stack.js:*) - at getActual (node:assert:*) -- at Function.throws (node:assert:*) -+ at strict.throws (node:assert:*) - at Object.<anonymous> (*assert_throws_stack.js:*:*) - at * - at * -diff --git a/test/message/internal_assert_fail.out b/test/message/internal_assert_fail.out -index 9fc86673262dbacb45e544340c81b4d14ee3f845..5f1026791f323d6a5965810917c0ef33ae4bfd53 100644 ---- a/test/message/internal_assert_fail.out -+++ b/test/message/internal_assert_fail.out -@@ -6,7 +6,7 @@ Error [ERR_INTERNAL_ASSERTION]: Unreachable! - This is caused by either a bug in Node.js or incorrect usage of Node.js internals. - Please open an issue with this stack trace at https://github.com/nodejs/node/issues - -- at Function.fail (node:internal/assert:*:*) -+ at assert.fail (node:internal/assert:*:*) - at * (*test*message*internal_assert_fail.js:7:8) - at * - at * -diff --git a/test/parallel/test-fs-promises.js b/test/parallel/test-fs-promises.js -index d28af0f4833c4901e8542c8938cbcf51ff22464d..796ad3224c4dba06b53b2da14fc8469b158f206d 100644 ---- a/test/parallel/test-fs-promises.js -+++ b/test/parallel/test-fs-promises.js -@@ -58,7 +58,7 @@ assert.strictEqual( - code: 'ENOENT', - name: 'Error', - message: /^ENOENT: no such file or directory, access/, -- stack: /at async Function\.rejects/ -+ stack: /at async ok\.rejects/ - } - ).then(common.mustCall()); - diff --git a/script/node-disabled-tests.json b/script/node-disabled-tests.json index 1cec2c885f19e..4d3fbe7da1ef1 100644 --- a/script/node-disabled-tests.json +++ b/script/node-disabled-tests.json @@ -1,7 +1,7 @@ [ "abort/test-abort-backtrace", + "es-module/test-esm-wasm", "es-module/test-vm-compile-function-lineoffset", - "parallel/test-async-context-frame", "parallel/test-bootstrap-modules", "parallel/test-child-process-fork-exec-path", "parallel/test-code-cache", @@ -41,11 +41,11 @@ "parallel/test-module-loading-globalpaths", "parallel/test-module-print-timing", "parallel/test-openssl-ca-options", + "parallel/test-os-checked-function", "parallel/test-process-versions", "parallel/test-process-get-builtin", "parallel/test-repl", "parallel/test-repl-underscore", - "parallel/test-tls-securepair-leak", "parallel/test-single-executable-blob-config", "parallel/test-single-executable-blob-config-errors", "parallel/test-shadow-realm-custom-loaders", @@ -76,6 +76,7 @@ "parallel/test-snapshot-worker", "parallel/test-strace-openat-openssl", "parallel/test-sqlite-backup", + "parallel/test-max-old-space-size-percentage", "parallel/test-tls-alpn-server-client", "parallel/test-tls-cli-min-version-1.0", "parallel/test-tls-cli-max-version-1.2", diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc index c0dd63583951b..1a1ed307dd9cc 100644 --- a/shell/common/node_bindings.cc +++ b/shell/common/node_bindings.cc @@ -284,12 +284,10 @@ v8::MaybeLocal<v8::Promise> HostImportModuleWithPhaseDynamically( context, v8_host_defined_options, v8_referrer_resource_url, v8_specifier, import_phase, v8_import_attributes); case ESMHandlerPlatform::kNodeJS: - // TODO: Switch to node::loader::ImportModuleDynamicallyWithPhase - // once we land the Node.js version that has it in upstream. CHECK(import_phase == v8::ModuleImportPhase::kEvaluation); - return node::loader::ImportModuleDynamically( + return node::loader::ImportModuleDynamicallyWithPhase( context, v8_host_defined_options, v8_referrer_resource_url, - v8_specifier, v8_import_attributes); + v8_specifier, import_phase, v8_import_attributes); case ESMHandlerPlatform::kNone: default: return {}; diff --git a/spec/api-context-bridge-spec.ts b/spec/api-context-bridge-spec.ts index b7fa47104264a..e83244141828b 100644 --- a/spec/api-context-bridge-spec.ts +++ b/spec/api-context-bridge-spec.ts @@ -671,7 +671,7 @@ describe('contextBridge', () => { it('should release the global hold on methods sent across contexts', async () => { await makeBindingWindow(() => { const trackedValues: WeakRef<object>[] = []; - require('electron').ipcRenderer.on('get-gc-info', e => e.sender.send('gc-info', { trackedValues: trackedValues.filter(value => value.deref()).length })); + require('electron').ipcRenderer.on('get-gc-info', (e: any) => e.sender.send('gc-info', { trackedValues: trackedValues.filter(value => value.deref()).length })); contextBridge.exposeInMainWorld('example', { getFunction: () => () => 123, track: (value: object) => { trackedValues.push(new WeakRef(value)); } @@ -699,7 +699,7 @@ describe('contextBridge', () => { it('should not leak the global hold on methods sent across contexts when reloading a sandboxed renderer', async () => { await makeBindingWindow(() => { const trackedValues: WeakRef<object>[] = []; - require('electron').ipcRenderer.on('get-gc-info', e => e.sender.send('gc-info', { trackedValues: trackedValues.filter(value => value.deref()).length })); + require('electron').ipcRenderer.on('get-gc-info', (e: any) => e.sender.send('gc-info', { trackedValues: trackedValues.filter(value => value.deref()).length })); contextBridge.exposeInMainWorld('example', { getFunction: () => () => 123, track: (value: object) => { trackedValues.push(new WeakRef(value)); } diff --git a/spec/api-ipc-spec.ts b/spec/api-ipc-spec.ts index d1be06727ca95..062d99f51e113 100644 --- a/spec/api-ipc-spec.ts +++ b/spec/api-ipc-spec.ts @@ -243,7 +243,6 @@ describe('ipc module', () => { await w.webContents.executeJavaScript(`(${function () { try { const buffer = new ArrayBuffer(10); - // @ts-expect-error require('electron').ipcRenderer.postMessage('port', '', [buffer]); } catch (e) { require('electron').ipcRenderer.postMessage('port', { error: (e as Error).message }); @@ -323,7 +322,7 @@ describe('ipc module', () => { w.loadURL('about:blank'); await w.webContents.executeJavaScript(`(${function () { const { ipcRenderer } = require('electron'); - ipcRenderer.on('port', e => { + ipcRenderer.on('port', (e: any) => { const [port] = e.ports; port.start(); port.onclose = () => { @@ -480,8 +479,8 @@ describe('ipc module', () => { w.loadURL('about:blank'); await w.webContents.executeJavaScript(`(${function () { const { ipcRenderer } = require('electron'); - ipcRenderer.on('port', ev => { - const [port] = ev.ports; + ipcRenderer.on('port', (e: any) => { + const [port] = e.ports; port.onmessage = () => { ipcRenderer.send('done'); }; @@ -498,9 +497,9 @@ describe('ipc module', () => { w.loadURL('about:blank'); await w.webContents.executeJavaScript(`(${function () { const { ipcRenderer } = require('electron'); - ipcRenderer.on('port', e1 => { - e1.ports[0].onmessage = e2 => { - e2.ports[0].onmessage = e3 => { + ipcRenderer.on('port', (e1: any) => { + e1.ports[0].onmessage = (e2: any) => { + e2.ports[0].onmessage = (e3: any) => { ipcRenderer.send('done', e3.data); }; }; @@ -587,7 +586,7 @@ describe('ipc module', () => { w.loadURL('about:blank'); await w.webContents.executeJavaScript(`(${function () { const { ipcRenderer } = require('electron'); - ipcRenderer.on('foo', (_e, msg) => { + ipcRenderer.on('foo', (_e: Event, msg: string) => { ipcRenderer.send('bar', msg); }); }})()`); diff --git a/spec/chromium-spec.ts b/spec/chromium-spec.ts index 4457d2a1bfb8b..08a10abdae6fb 100644 --- a/spec/chromium-spec.ts +++ b/spec/chromium-spec.ts @@ -1909,10 +1909,10 @@ describe('chromium features', () => { }); it('delivers messages that match the origin', async () => { - const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, contextIsolation: false } }); + const w = new BrowserWindow({ show: false }); w.loadFile(path.resolve(__dirname, 'fixtures', 'blank.html')); const data = await w.webContents.executeJavaScript(` - window.open(${JSON.stringify(serverURL)}, '', 'show=no,contextIsolation=no,nodeIntegration=yes'); + window.open(${JSON.stringify(serverURL)}, '', 'show=no'); new Promise(resolve => window.addEventListener('message', resolve, {once: true})).then(e => e.data) `); expect(data).to.equal('deliver'); diff --git a/spec/fixtures/pages/window-opener-targetOrigin.html b/spec/fixtures/pages/window-opener-targetOrigin.html index 9a52296ca22a8..a14480c402a0a 100644 --- a/spec/fixtures/pages/window-opener-targetOrigin.html +++ b/spec/fixtures/pages/window-opener-targetOrigin.html @@ -1,7 +1,6 @@ <html> <body> <script type="text/javascript" charset="utf-8"> - const url = require('node:url') function tryPostMessage(...args) { try { window.opener.postMessage(...args) @@ -9,7 +8,8 @@ console.error(e) } } - if (url.parse(window.location.href, true).query.opened != null) { + const parsedURL = new URL(window.location.href); + if (parsedURL.searchParams.get('opened') != null) { // Ensure origins are properly checked by removing a single character from the end tryPostMessage('do not deliver substring origin', window.location.origin.substring(0, window.location.origin.length - 1)) tryPostMessage('do not deliver file://', 'file://') diff --git a/yarn.lock b/yarn.lock index 8bc6e537ac60d..73bc265cfb0ef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -989,7 +989,7 @@ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== -"@types/node@*", "@types/node@^22.7.7": +"@types/node@*": version "22.7.7" resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.7.tgz#6cd9541c3dccb4f7e8b141b491443f4a1570e307" integrity sha512-SRxCrrg9CL/y54aiMCG3edPKdprgMVGDXjA3gB8UmmBW5TcXzRUYAh8EWzTnSJFAd1rgImPELza+A3bJ+qxz8Q== @@ -1003,6 +1003,13 @@ dependencies: undici-types "~6.19.2" +"@types/node@^24.9.0": + version "24.9.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-24.9.1.tgz#b7360b3c789089e57e192695a855aa4f6981a53c" + integrity sha512-QoiaXANRkSXK6p0Duvt56W208du4P9Uye9hWLWgGMDTEoKPhuenzNcC4vGUmrNkiOKTlIrBoyNQYNpSwfEZXSg== + dependencies: + undici-types "~7.16.0" + "@types/responselike@*", "@types/responselike@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.0.tgz#251f4fe7d154d2bad125abe1b429b23afd262e29" @@ -7769,6 +7776,11 @@ undici-types@~6.19.2: resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== +undici-types@~7.16.0: + version "7.16.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.16.0.tgz#ffccdff36aea4884cbfce9a750a0580224f58a46" + integrity sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw== + unicorn-magic@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/unicorn-magic/-/unicorn-magic-0.3.0.tgz#4efd45c85a69e0dd576d25532fbfa22aa5c8a104" From df2aee7fd6842bdff92888a42a7b8b5c23dab6d5 Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Fri, 31 Oct 2025 11:01:09 -0400 Subject: [PATCH 192/268] chore: bump chromium to 144.0.7500.0 (main) (#48725) * chore: bump chromium in DEPS to 144.0.7500.0 * chore: fixup patch indices * 7088768: Reland "download reclient only for chromeos by default" https://chromium-review.googlesource.com/c/chromium/src/+/7088768 * Revert "7088768: Reland "download reclient only for chromeos by default"" This reverts commit 149d9fc92e395914c086f130a6cfbfc9b405a997. * build: explicitly disable reclient * 7013355: [api] Remove deprecated PropertyCallbackInfo::Holder() https://chromium-review.googlesource.com/c/v8/v8/+/7013355 * [video pip] Enable video picture-in-picture controls update Refs https://chromium-review.googlesource.com/c/chromium/src/+/6701399 * fixup! [api] Remove deprecated PropertyCallbackInfo::Holder() --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: deepak1556 <hop2deep@gmail.com> --- DEPS | 2 +- build/args/all.gn | 3 + patches/chromium/blink_local_frame.patch | 2 +- ..._mojom_interfaces_to_depend_on_blink.patch | 4 +- ..._depend_on_packed_resource_integrity.patch | 12 +- ...ameter_in_script_lifecycle_observers.patch | 10 +- ...ther_in_electron_views_and_delegates.patch | 2 +- .../custom_protocols_plzserviceworker.patch | 8 +- ...moothing_css_rule_and_blink_painting.patch | 6 +- ...allback_for_sync_and_async_clipboard.patch | 2 +- ..._file_existence_before_setting_mtime.patch | 2 +- ...ding_non-standard_schemes_in_iframes.patch | 4 +- .../chromium/fix_export_zlib_symbols.patch | 2 +- ...x_harden_blink_scriptstate_maybefrom.patch | 10 +- ...ingshelper_behind_branding_buildflag.patch | 4 +- ...from_localframe_requestexecutescript.patch | 6 +- ..._avoid_private_macos_api_usage.patch.patch | 14 +- patches/chromium/picture-in-picture.patch | 168 +++++++++++++-- ..._electron_permissiontypes_into_blink.patch | 2 +- ...windowtreehostwin_window_enlargement.patch | 4 +- patches/nan/.patches | 1 + ...precated_propertycallbackinfo_holder.patch | 199 ++++++++++++++++++ 22 files changed, 405 insertions(+), 62 deletions(-) create mode 100644 patches/nan/fix_remove_deprecated_propertycallbackinfo_holder.patch diff --git a/DEPS b/DEPS index 7b11f64d40958..790c4ad564c26 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '143.0.7499.0', + '144.0.7500.0', 'node_version': 'v24.10.0', 'nan_version': diff --git a/build/args/all.gn b/build/args/all.gn index b62e24774ded3..bf4c76abb5480 100644 --- a/build/args/all.gn +++ b/build/args/all.gn @@ -75,3 +75,6 @@ enable_linux_installer = false # Disable "Save to Drive" feature in PDF viewer enable_pdf_save_to_drive = false + +# Explictly disable use_reclient until reclient is completely removed +use_reclient = false diff --git a/patches/chromium/blink_local_frame.patch b/patches/chromium/blink_local_frame.patch index 0cdb9b3279d2a..c9fb7de66f66b 100644 --- a/patches/chromium/blink_local_frame.patch +++ b/patches/chromium/blink_local_frame.patch @@ -49,7 +49,7 @@ index cdb5b9246087b5678cf6a0f2713f6238dafc13de..7efbe7524c5ddd3785fff0e2d8901f93 // its owning reference back to our owning LocalFrame. client_->Detached(type); diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index 0b8972e0ab8ff854fc169b39d762790299f7bf9c..fdbafb9177d345181339fcdf2d95aebbd8665a49 100644 +index ad61f3b044e8ce7591cfe7484af8e3b0c7705673..f42b5f8c7676cda5d73ee035e18165acabb186f3 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc @@ -747,10 +747,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { diff --git a/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch b/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch index 611b5b5febd0d..ce3658f7696aa 100644 --- a/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch +++ b/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch @@ -10,10 +10,10 @@ Needed for: 2) //electron/shell/common:web_contents_utility diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn -index b6511498e08e6d0a280b89175fcfdb61c7e40df4..e214d7ea5e7108baf9f9910d6b44deff587914c2 100644 +index e463b4c63105d021da2467844c8371eec6b8a836..bd81d75d735f997bf6aa9133e142b50759084b47 100644 --- a/content/public/common/BUILD.gn +++ b/content/public/common/BUILD.gn -@@ -370,6 +370,8 @@ mojom("interfaces") { +@@ -371,6 +371,8 @@ mojom("interfaces") { "//content/common/*", "//extensions/common:mojom", "//extensions/common:mojom_blink", diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index f624ad3013aba..c95e99f8754a9 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -33,10 +33,10 @@ index c51468e6fdb46634b5458b387d1c78caf2dd083f..7236611d2a392008f43b1b83ae125e94 "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 848ddc7610d01dee15e0008e2095d4d0af056ac6..6bbacd81a079e54559989050e38e31b852102e15 100644 +index cc003098ca1338334bce844d3e82351b573a3b93..ddd737d756776d2200da89924699de5087fe768d 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4829,7 +4829,7 @@ static_library("browser") { +@@ -4833,7 +4833,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index 848ddc7610d01dee15e0008e2095d4d0af056ac6..6bbacd81a079e54559989050e38e31b8 # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index c0fa565f990a956af43720850ac85451f3c25b8c..bf5e2c0f7e628befdee6e38a6a6dddefea8bce7a 100644 +index 206d205405b06766859abf4f13eb7b65e81667f6..c4138e4c1a03ec6f23a91d19155a70af433a4a89 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7585,9 +7585,12 @@ test("unit_tests") { +@@ -7587,9 +7587,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index c0fa565f990a956af43720850ac85451f3c25b8c..bf5e2c0f7e628befdee6e38a6a6dddef "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8527,6 +8530,10 @@ test("unit_tests") { +@@ -8530,6 +8533,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index c0fa565f990a956af43720850ac85451f3c25b8c..bf5e2c0f7e628befdee6e38a6a6dddef sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8583,7 +8590,6 @@ test("unit_tests") { +@@ -8586,7 +8593,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch index c8865d5b6b505..702389f35be10 100644 --- a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch +++ b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch @@ -66,10 +66,10 @@ index 32dfed04e2fd7cd2e60c7cf145d182f4163feb68..c44c488ef90f4ceaada28666f80a5919 void DidChangeScrollOffset() override; blink::WebMediaStreamDeviceObserver* MediaStreamDeviceObserver() override; diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc -index bf221ce102ea9ca25655f14a7cd90c625799d4b0..c4d81b211016616f6cbbdfcfae6620d4931ce775 100644 +index 37691ecee7a72b2ec47ff575239f628116cf136b..c67e3faf7440514e203e5b15a68fc34525a045a2 100644 --- a/content/renderer/service_worker/service_worker_context_client.cc +++ b/content/renderer/service_worker/service_worker_context_client.cc -@@ -322,6 +322,7 @@ void ServiceWorkerContextClient::WorkerContextStarted( +@@ -318,6 +318,7 @@ void ServiceWorkerContextClient::WorkerContextStarted( } void ServiceWorkerContextClient::WillEvaluateScript( @@ -77,7 +77,7 @@ index bf221ce102ea9ca25655f14a7cd90c625799d4b0..c4d81b211016616f6cbbdfcfae6620d4 v8::Local<v8::Context> v8_context) { DCHECK(worker_task_runner_->RunsTasksInCurrentSequence()); start_timing_->script_evaluation_start_time = base::TimeTicks::Now(); -@@ -340,8 +341,8 @@ void ServiceWorkerContextClient::WillEvaluateScript( +@@ -336,8 +337,8 @@ void ServiceWorkerContextClient::WillEvaluateScript( DCHECK(proxy_); GetContentClient()->renderer()->WillEvaluateServiceWorkerOnWorkerThread( @@ -89,10 +89,10 @@ index bf221ce102ea9ca25655f14a7cd90c625799d4b0..c4d81b211016616f6cbbdfcfae6620d4 void ServiceWorkerContextClient::DidEvaluateScript(bool success) { diff --git a/content/renderer/service_worker/service_worker_context_client.h b/content/renderer/service_worker/service_worker_context_client.h -index 2f3ba35491d17aa76f9baf8ba1cd53680a923654..477c6ac5a77c69cc4f062366c52adff3a36bdc76 100644 +index 1f5e24bc38d6ced52e4773236522e9520efc6f6d..a22ca5968fce5e6a0c436ec9b40f0e2f7c1482cf 100644 --- a/content/renderer/service_worker/service_worker_context_client.h +++ b/content/renderer/service_worker/service_worker_context_client.h -@@ -168,7 +168,8 @@ class ServiceWorkerContextClient +@@ -165,7 +165,8 @@ class ServiceWorkerContextClient void WorkerContextStarted( blink::WebServiceWorkerContextProxy* proxy, scoped_refptr<base::SequencedTaskRunner> worker_task_runner) override; diff --git a/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch b/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch index 785a321a67e05..4f894ba097b72 100644 --- a/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch +++ b/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch @@ -10,7 +10,7 @@ Subject: chore: "grandfather in" Electron Views and Delegates 6448510: Lock further access to View::set_owned_by_client(). | https://chromium-review.googlesource.com/c/chromium/src/+/6448510 diff --git a/ui/views/view.h b/ui/views/view.h -index 4fada89e37b9c63f7690fbbdd2ef4ecf86b5d756..73dd5aa59d8d1bb05aaed080e27426cc58da2d61 100644 +index a34494ddd3daf79d12596c56e752692ace0d1ab2..fd4b87226a364b1104b25379f2d87ebeefbb6927 100644 --- a/ui/views/view.h +++ b/ui/views/view.h @@ -81,6 +81,19 @@ class ArcNotificationContentView; diff --git a/patches/chromium/custom_protocols_plzserviceworker.patch b/patches/chromium/custom_protocols_plzserviceworker.patch index c60e9519682d6..c0f92740ba7b0 100644 --- a/patches/chromium/custom_protocols_plzserviceworker.patch +++ b/patches/chromium/custom_protocols_plzserviceworker.patch @@ -8,10 +8,10 @@ Allow registering custom protocols to handle service worker main script fetching Refs https://bugs.chromium.org/p/chromium/issues/detail?id=996511 diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc -index cdd2f243082290767abbee39b4e80a67c705a789..7168d496663675455b417f709339aab08aabc9f0 100644 +index cb60c976d469958b6d7dbd69dddc91866744c429..88f1cbc3bc7f3efaae01c88c17fa467175d4f8ea 100644 --- a/content/browser/service_worker/service_worker_context_wrapper.cc +++ b/content/browser/service_worker/service_worker_context_wrapper.cc -@@ -1972,6 +1972,26 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( +@@ -1957,6 +1957,26 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( loader_factory_bundle_info = context()->loader_factory_bundle_for_update_check()->Clone(); @@ -38,7 +38,7 @@ index cdd2f243082290767abbee39b4e80a67c705a789..7168d496663675455b417f709339aab0 if (auto* config = content::WebUIConfigMap::GetInstance().GetConfig( browser_context(), scope)) { // If this is a Service Worker for a WebUI, the WebUI's URLDataSource -@@ -1991,9 +2011,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( +@@ -1976,9 +1996,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( features::kEnableServiceWorkersForChromeScheme) && scope.scheme() == kChromeUIScheme) { config->RegisterURLDataSource(browser_context()); @@ -49,7 +49,7 @@ index cdd2f243082290767abbee39b4e80a67c705a789..7168d496663675455b417f709339aab0 .emplace(kChromeUIScheme, CreateWebUIServiceWorkerLoaderFactory( browser_context(), kChromeUIScheme, base::flat_set<std::string>())); -@@ -2001,9 +2019,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( +@@ -1986,9 +2004,7 @@ ServiceWorkerContextWrapper::GetLoaderFactoryForBrowserInitiatedRequest( features::kEnableServiceWorkersForChromeUntrusted) && scope.scheme() == kChromeUIUntrustedScheme) { config->RegisterURLDataSource(browser_context()); diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index 3da9175a20c39..fb6dbe4d10a5c 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -45,10 +45,10 @@ index e189d584f05f2ce6354c03a9b19f56985df8a15e..41b430e8f2416be098494f5c49fb97ca 'internal-forced-visited-'): internal_visited_order = 0 diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 -index bb84e7fb7845a64a336e95a20a47d32d7f74aa16..4849f6ac85715e816930ae35fdd9d2815165a133 100644 +index 9bf6537f620594d6fe1e14e2ef32bc20b6127b3d..e90341e484c40df23974c17de8f5212b0de26029 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5 -@@ -9074,6 +9074,26 @@ +@@ -9057,6 +9057,26 @@ property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], }, @@ -312,7 +312,7 @@ index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index 02815bb434a54acaacbd11e408fb26564bb5d0a6..e47d5eba72cd3e08675eea76927e4efd28b43a31 100644 +index 43474abcc45706874b4d2733bff468b2b79f5d0f..e8e341a58cb86526361d57c5d4753f76bfac5de6 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch index f0131d2947eb4..7f34151a24a68 100644 --- a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch +++ b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch @@ -20,7 +20,7 @@ This patch will be removed when the deprecated sync api support is removed. diff --git a/components/permissions/permission_util.cc b/components/permissions/permission_util.cc -index fc516272be02a3dac1086e4aaf2015dc946cc3c2..86b8df2b23dc975a6db87f04005cb105054305b0 100644 +index c9b607c9bd09d43099a1704d5d4139c64e4beac4..18ad7ed73b0ed4de158519c01342f0bfd7cc3666 100644 --- a/components/permissions/permission_util.cc +++ b/components/permissions/permission_util.cc @@ -536,6 +536,7 @@ ContentSettingsType PermissionUtil::PermissionTypeToContentSettingsTypeSafe( diff --git a/patches/chromium/fix_check_for_file_existence_before_setting_mtime.patch b/patches/chromium/fix_check_for_file_existence_before_setting_mtime.patch index 37b0f1ff31649..33ca2f1da217c 100644 --- a/patches/chromium/fix_check_for_file_existence_before_setting_mtime.patch +++ b/patches/chromium/fix_check_for_file_existence_before_setting_mtime.patch @@ -8,7 +8,7 @@ Check for broken links by confirming the file exists before setting its utime. This patch should be upstreamed & removed. diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py -index bcf4c9b192234aa1d470662e4036ac7a23ce2262..724ccef88dc6d798bb948d3fc89a84640d863174 100755 +index f2a9172815d80e6a9a70d7775eec6fdddd925461..54f78924eb09abf19d19c698e4c37f5ec3dc8249 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py @@ -201,10 +201,9 @@ def DownloadAndUnpack(url, output_dir, path_prefixes=None, is_known_zip=False): diff --git a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch index 1d02f796c12a0..c6be33e90620d 100644 --- a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch +++ b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch @@ -28,10 +28,10 @@ The patch should be removed in favor of either: Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397. diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index 5f6fb36d9302e557ff56f770ff70b091ade0f53a..81e91f51d119b2e02f432c2e7ae81f6d118811b3 100644 +index 3624c9c96f3ac526e99fb09c378144439c707442..fd818f40e9c3e1efe15dcbb369270a27e2f50483 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc -@@ -11454,6 +11454,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { +@@ -11466,6 +11466,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { target_rph_id); } diff --git a/patches/chromium/fix_export_zlib_symbols.patch b/patches/chromium/fix_export_zlib_symbols.patch index 74663cd426e1a..39d76d3b68118 100644 --- a/patches/chromium/fix_export_zlib_symbols.patch +++ b/patches/chromium/fix_export_zlib_symbols.patch @@ -6,7 +6,7 @@ Subject: fix: export zlib symbols This patch sets ZLIB_DLL so that we properly export zlib symbols. diff --git a/third_party/zlib/BUILD.gn b/third_party/zlib/BUILD.gn -index 3d0735452a66d4213d1c4cf7c36cd36b3bf1c6f8..3dc1b24fe5f25b0a8b00d1a7918f518f0bad091d 100644 +index afd3e8cc0f38e95b3b04835b46bd1197a63b4ed1..652fa32d49de9f0c73777c0d4d99421f52e16b38 100644 --- a/third_party/zlib/BUILD.gn +++ b/third_party/zlib/BUILD.gn @@ -333,6 +333,10 @@ component("zlib") { diff --git a/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch b/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch index b58b7d49f5591..ae12112f6a908 100644 --- a/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch +++ b/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch @@ -56,7 +56,7 @@ index cecf528475cb832ed1876381878eade582bc83d6..71308b2d963c2d083328aad6be356dc5 enum EmbedderDataTag : uint16_t { diff --git a/third_party/blink/renderer/platform/bindings/script_state.cc b/third_party/blink/renderer/platform/bindings/script_state.cc -index 7c602990a3f9a3083308d282fe79bf858b642cdf..f8ee61b8b2a45371d259717215a1fb4511514567 100644 +index 8b6522c9299bef5ab766795b64a1ba30bc382a12..54d981405df5edab4695dfd01bb6a7b7dd8b7b3a 100644 --- a/third_party/blink/renderer/platform/bindings/script_state.cc +++ b/third_party/blink/renderer/platform/bindings/script_state.cc @@ -14,6 +14,12 @@ namespace blink { @@ -72,7 +72,7 @@ index 7c602990a3f9a3083308d282fe79bf858b642cdf..f8ee61b8b2a45371d259717215a1fb45 // static void ScriptState::SetCreateCallback(CreateCallback create_callback) { DCHECK(create_callback); -@@ -39,6 +45,10 @@ ScriptState::ScriptState(v8::Local<v8::Context> context, +@@ -40,6 +46,10 @@ ScriptState::ScriptState(v8::Local<v8::Context> context, context_.SetWeak(this, &OnV8ContextCollectedCallback); context->SetAlignedPointerInEmbedderData(kV8ContextPerContextDataIndex, this, gin::kBlinkScriptState); @@ -83,7 +83,7 @@ index 7c602990a3f9a3083308d282fe79bf858b642cdf..f8ee61b8b2a45371d259717215a1fb45 RendererResourceCoordinator::Get()->OnScriptStateCreated(this, execution_context); } -@@ -82,6 +92,10 @@ void ScriptState::DissociateContext() { +@@ -83,6 +93,10 @@ void ScriptState::DissociateContext() { // Cut the reference from V8 context to ScriptState. GetContext()->SetAlignedPointerInEmbedderData( kV8ContextPerContextDataIndex, nullptr, gin::kBlinkScriptState); @@ -95,7 +95,7 @@ index 7c602990a3f9a3083308d282fe79bf858b642cdf..f8ee61b8b2a45371d259717215a1fb45 // Cut the reference from ScriptState to V8 context. diff --git a/third_party/blink/renderer/platform/bindings/script_state.h b/third_party/blink/renderer/platform/bindings/script_state.h -index f06885f429a395b5c2eb55c89803837b550d765c..1d64099b32c2a9a0d68e8b5317d17e13789dc299 100644 +index 5ccdf26cead17031d510589b74288cbe79692779..0bc2fdbf8e70d53a49794defe8b4a3d1d5a501cd 100644 --- a/third_party/blink/renderer/platform/bindings/script_state.h +++ b/third_party/blink/renderer/platform/bindings/script_state.h @@ -6,6 +6,7 @@ @@ -122,7 +122,7 @@ index f06885f429a395b5c2eb55c89803837b550d765c..1d64099b32c2a9a0d68e8b5317d17e13 ScriptState* script_state = static_cast<ScriptState*>(context->GetAlignedPointerFromEmbedderData( isolate, kV8ContextPerContextDataIndex, gin::kBlinkScriptState)); -@@ -267,6 +277,14 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> { +@@ -270,6 +280,14 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> { static_cast<int>(gin::kPerContextDataStartIndex) + static_cast<int>(gin::kEmbedderBlink); diff --git a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch index b34e4e6eb1759..670f7c0db58f3 100644 --- a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch +++ b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch @@ -83,10 +83,10 @@ index de8cfaabed0e4ed3db9b55729f7ea22014f63dd2..45df203c236ed0f36f079ad0dcbe98e9 PictureInPictureOcclusionTracker* diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -index f737adbdc968e659cf5ba59e6cd5fd5fa093edff..0c9d713a51a15abdec331f8991bfa6222984afec 100644 +index c204274499a520aeeb2aaaad12e4aafd43738d23..56afbbf55148b5077253c0189bf6444c2daaf7ba 100644 --- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -@@ -474,11 +474,13 @@ std::unique_ptr<VideoOverlayWindowViews> VideoOverlayWindowViews::Create( +@@ -476,11 +476,13 @@ std::unique_ptr<VideoOverlayWindowViews> VideoOverlayWindowViews::Create( #endif // BUILDFLAG(IS_WIN) diff --git a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch index 84ae6b49d2955..4941eb3b6b390 100644 --- a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch +++ b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch @@ -59,10 +59,10 @@ index cba373664bec3a32abad6fe0396bd67b53b7e67f..a54f1b3351efd2d8f324436f7f35cd43 #endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_SCRIPT_EXECUTION_CALLBACK_H_ diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index fdbafb9177d345181339fcdf2d95aebbd8665a49..56472f526e751790d9163a3445d5ac15b86e187d 100644 +index f42b5f8c7676cda5d73ee035e18165acabb186f3..7ff305ce80f243ce4ab0844321644908ab6addb9 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc -@@ -3188,6 +3188,7 @@ void LocalFrame::RequestExecuteScript( +@@ -3190,6 +3190,7 @@ void LocalFrame::RequestExecuteScript( mojom::blink::EvaluationTiming evaluation_timing, mojom::blink::LoadEventBlockingOption blocking_option, WebScriptExecutionCallback callback, @@ -70,7 +70,7 @@ index fdbafb9177d345181339fcdf2d95aebbd8665a49..56472f526e751790d9163a3445d5ac15 BackForwardCacheAware back_forward_cache_aware, mojom::blink::WantResultOption want_result_option, mojom::blink::PromiseResultOption promise_behavior) { -@@ -3245,7 +3246,7 @@ void LocalFrame::RequestExecuteScript( +@@ -3247,7 +3248,7 @@ void LocalFrame::RequestExecuteScript( PausableScriptExecutor::CreateAndRun( script_state, std::move(script_sources), execute_script_policy, user_gesture, evaluation_timing, blocking_option, want_result_option, diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index b0faed3c0b5b0..ec27e06dc08f7 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -35,7 +35,7 @@ system font by checking if it's kCTFontPriorityAttribute is set to system priority. diff --git a/base/BUILD.gn b/base/BUILD.gn -index 2edc8252e3e83ab0238383091ebea5a21df3186f..3bbea6f7c13914e8f6e791cd77cab82b1eed51dd 100644 +index 7aa2eeb7769e7be0d58f03d35445e3b5564e2718..af777c45221b5db1b2f5699101ad61eed99fc40e 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -1069,6 +1069,7 @@ component("base") { @@ -581,7 +581,7 @@ index e51fd827f7afc01a5189737f86a2414627a6546e..bb50f03ba5622c2bfb96bc75d145f471 return kAttributes; } diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index 548abd4a6857cc47691c276b4b11cb34eadedcdf..3a4ca077145fcd65fcb7ca1be85beabda0112e72 100644 +index 4c555d3c077216fd25d45b5f9727ff3e20b80e83..648cfefa2cdf87524dc4bb12f8d8b37419921ef9 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn @@ -344,6 +344,7 @@ source_set("browser") { @@ -702,10 +702,10 @@ index ea86cb14edf163b02a2b0fda0ab3fb6245edd717..9a507a70493e5a648a25968f917a7829 /////////////////////////////////////////////////////////////////////////////// diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn -index 19c948e949386a1678767cbc606304e65400c507..9394e841d84593ea846b785cffe2ab06efffd7d1 100644 +index f57ce1a0430df7692be55685e79121ed604daf2a..3fbc26fb179a64a2f1eab027a05b16241c185b28 100644 --- a/content/common/BUILD.gn +++ b/content/common/BUILD.gn -@@ -274,6 +274,7 @@ source_set("common") { +@@ -273,6 +273,7 @@ source_set("common") { "//ui/shell_dialogs", "//url", "//url/ipc:url_ipc", @@ -796,7 +796,7 @@ index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbe } // namespace content diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn -index dfd3674692bc984821b52f1d410c1fa2ca56c42e..25dd06214e3aea73ebe556f9b8498ef8a63e42d6 100644 +index 25638e35e38d59adb261185e1387256ba16fc9bd..2b2f7e003bacea00a1421ce3bedf71747b567928 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn @@ -703,6 +703,7 @@ static_library("test_support") { @@ -1395,7 +1395,7 @@ index eb81a70e4d5d5cd3e6ae9b45f8cd1c795ea76c51..9921ccb10d3455600eddd85f77f10228 } // namespace sandbox diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn -index ac8db428b19dc3d442dc668b4e601d56f7b48c61..c6dfcdb6ac8ccc145eaad4087677add1afb217e1 100644 +index e54ba53ed4866e568ae5c2dfe65e72adfe253e03..07d046634534efb28ee4584dd1b11678f7473e8f 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn @@ -428,6 +428,7 @@ component("core") { @@ -1407,7 +1407,7 @@ index ac8db428b19dc3d442dc668b4e601d56f7b48c61..c6dfcdb6ac8ccc145eaad4087677add1 if (is_mac) { diff --git a/third_party/blink/renderer/core/editing/build.gni b/third_party/blink/renderer/core/editing/build.gni -index c771cee7be34f36521de34ef893ee578b648a8c8..b0bd447b848bfdb7a9ff9cd98ba95574cb846cc2 100644 +index 4f04476e9175bae9e89eb9ea4316bffe49a9eb91..e77615c7b26518f4930ac1b004b413173fa0f46b 100644 --- a/third_party/blink/renderer/core/editing/build.gni +++ b/third_party/blink/renderer/core/editing/build.gni @@ -362,10 +362,14 @@ blink_core_sources_editing = [ diff --git a/patches/chromium/picture-in-picture.patch b/patches/chromium/picture-in-picture.patch index fba78174c95f8..85390051553bb 100644 --- a/patches/chromium/picture-in-picture.patch +++ b/patches/chromium/picture-in-picture.patch @@ -38,7 +38,7 @@ index 85df555841ac0d32d2f097547c9991cecf0f4b1a..7a108339448fad3105e87c9d9af678c2 ui::ImageModel::FromVectorIcon(*icon, kColorPipWindowForeground, kCloseButtonIconSize)); diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..f737adbdc968e659cf5ba59e6cd5fd5fa093edff 100644 +index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..c204274499a520aeeb2aaaad12e4aafd43738d23 100644 --- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc @@ -18,12 +18,16 @@ @@ -58,7 +58,18 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..f737adbdc968e659cf5ba59e6cd5fd5f #include "chrome/browser/ui/color/chrome_color_id.h" #include "chrome/browser/ui/views/overlay/back_to_tab_button.h" #include "chrome/browser/ui/views/overlay/back_to_tab_label_button.h" -@@ -79,7 +83,7 @@ +@@ -32,8 +36,10 @@ + #include "chrome/browser/ui/views/overlay/hang_up_button.h" + #include "chrome/browser/ui/views/overlay/minimize_button.h" + #include "chrome/browser/ui/views/overlay/overlay_controls_fade_animation.h" ++#if 0 + #include "chrome/browser/ui/views/overlay/overlay_window_live_caption_button.h" + #include "chrome/browser/ui/views/overlay/overlay_window_live_caption_dialog.h" ++#endif + #include "chrome/browser/ui/views/overlay/playback_image_button.h" + #include "chrome/browser/ui/views/overlay/resize_handle_button.h" + #include "chrome/browser/ui/views/overlay/simple_overlay_window_image_button.h" +@@ -79,7 +85,7 @@ #include "ui/aura/window.h" #endif @@ -67,7 +78,7 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..f737adbdc968e659cf5ba59e6cd5fd5f #include "chrome/browser/shell_integration_win.h" #include "content/public/browser/render_widget_host_view.h" #include "ui/aura/window.h" -@@ -434,7 +438,7 @@ std::unique_ptr<VideoOverlayWindowViews> VideoOverlayWindowViews::Create( +@@ -434,7 +440,7 @@ std::unique_ptr<VideoOverlayWindowViews> VideoOverlayWindowViews::Create( overlay_window->Init(std::move(params)); overlay_window->OnRootViewReady(); @@ -76,13 +87,43 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..f737adbdc968e659cf5ba59e6cd5fd5f std::wstring app_user_model_id; Browser* browser = chrome::FindBrowserWithTab(controller->GetWebContents()); if (browser) { -@@ -1274,11 +1278,13 @@ void VideoOverlayWindowViews::SetUpViews() { - &VideoOverlayWindowViews::OnLiveCaptionButtonPressed, - base::Unretained(this))); - live_caption_button->SetSize(kActionButtonSize); +@@ -734,6 +740,7 @@ void VideoOverlayWindowViews::OnMouseEvent(ui::MouseEvent* event) { + } + + case ui::EventType::kMousePressed: ++#if 0 + // Hide the live caption dialog if it's visible and the user clicks + // outside of it. + if (live_caption_dialog_ && live_caption_dialog_->GetVisible() && +@@ -742,6 +749,7 @@ void VideoOverlayWindowViews::OnMouseEvent(ui::MouseEvent* event) { + SetLiveCaptionDialogVisibility(false); + return; + } ++#endif + break; + + default: +@@ -1136,9 +1144,11 @@ void VideoOverlayWindowViews::SetUpViews() { + std::unique_ptr<HangUpButton> hang_up_button; + std::unique_ptr<global_media_controls::MediaProgressView> progress_view; + std::unique_ptr<views::Label> timestamp; +#if 0 - live_caption_button->SetIsLiveCaptionDialogOpen(false); - live_caption_dialog = std::make_unique<OverlayWindowLiveCaptionDialog>( + std::unique_ptr<views::Label> live_status; + std::unique_ptr<OverlayWindowLiveCaptionButton> live_caption_button; + std::unique_ptr<OverlayWindowLiveCaptionDialog> live_caption_dialog; ++#endif + + if (Use2024UI()) { + play_pause_controls_view->SetSize({kCenterButtonSize, kCenterButtonSize}); +@@ -1261,6 +1271,7 @@ void VideoOverlayWindowViews::SetUpViews() { + timestamp->SetEnabledColor(ui::kColorSysOnSurfaceSubtle); + timestamp->SetBackgroundColor(SK_ColorTRANSPARENT); + timestamp->SetHorizontalAlignment(gfx::ALIGN_LEFT); ++#if 0 + live_status = std::make_unique<views::Label>( + l10n_util::GetStringUTF16(IDS_PICTURE_IN_PICTURE_LIVE_STATUS_TEXT), + views::style::CONTEXT_LABEL, views::style::STYLE_CAPTION_BOLD); +@@ -1279,6 +1290,7 @@ void VideoOverlayWindowViews::SetUpViews() { Profile::FromBrowserContext( controller_->GetWebContents()->GetBrowserContext())); live_caption_dialog->SetVisible(false); @@ -90,19 +131,97 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..f737adbdc968e659cf5ba59e6cd5fd5f toggle_microphone_button = std::make_unique<ToggleMicrophoneButton>(base::BindRepeating( [](VideoOverlayWindowViews* overlay) { -@@ -2415,9 +2421,10 @@ void VideoOverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) { +@@ -1494,6 +1506,7 @@ void VideoOverlayWindowViews::SetUpViews() { + timestamp->layer()->SetFillsBoundsOpaquely(false); + timestamp->layer()->SetName("Timestamp"); + ++#if 0 + live_status->SetPaintToLayer(ui::LAYER_TEXTURED); + live_status->layer()->SetFillsBoundsOpaquely(false); + live_status->layer()->SetName("LiveStatus"); +@@ -1505,6 +1518,7 @@ void VideoOverlayWindowViews::SetUpViews() { + live_caption_dialog->SetPaintToLayer(ui::LAYER_TEXTURED); + live_caption_dialog->layer()->SetFillsBoundsOpaquely(false); + live_caption_dialog->layer()->SetName("LiveCaptionDialog"); ++#endif + } else { + // views::View that holds the skip-ad label button. + // ------------------------- +@@ -1596,13 +1610,14 @@ void VideoOverlayWindowViews::SetUpViews() { + + timestamp_ = + playback_controls_container_view_->AddChildView(std::move(timestamp)); ++#if 0 + live_status_ = + playback_controls_container_view_->AddChildView(std::move(live_status)); +- + live_caption_button_ = playback_controls_container_view_->AddChildView( + std::move(live_caption_button)); + live_caption_dialog_ = + controls_container_view->AddChildView(std::move(live_caption_dialog)); ++#endif + + toggle_camera_button_ = + vc_container->AddChildView(std::move(toggle_camera_button)); +@@ -1897,6 +1912,7 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() { + timestamp_->SetSize({max_timestamp_width, kTimestampHeight}); + timestamp_->SetVisible(!is_live_); + ++#if 0 + live_status_->SetPosition(timestamp_position); + live_status_->SetMaximumWidthSingleLine(max_timestamp_width); + live_status_->SetSize( +@@ -1917,6 +1933,7 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() { + live_caption_dialog_->SetPosition( + {live_caption_button_bounds.right() - live_caption_dialog_->width(), + live_caption_button_bounds.y() - live_caption_dialog_->height()}); ++#endif + + // The play/pause button and replay/forward 10 seconds buttons should not be + // visible while dragging the progress bar or for live media. +@@ -2407,6 +2424,7 @@ void VideoOverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) { + return; + } + ++#if 0 + if (live_caption_dialog_ && live_caption_dialog_->GetVisible()) { + if (!GetLiveCaptionDialogBounds().Contains(event->location())) { + // Hide the live caption dialog if it's visible and the user taps outside +@@ -2415,11 +2433,11 @@ void VideoOverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) { event->SetHandled(); return; } - -+#if 0 // Otherwise, let the live caption dialog handle the gesture. live_caption_dialog_->OnGestureTapEvent(event); -+#endif return; } ++#endif -@@ -2576,6 +2583,7 @@ gfx::Rect VideoOverlayWindowViews::GetLiveCaptionDialogBounds() { + if (GetBackToTabControlsBounds().Contains(event->location())) { + controller_->CloseAndFocusInitiator(); +@@ -2561,21 +2579,28 @@ gfx::Rect VideoOverlayWindowViews::GetProgressViewBounds() { + } + + gfx::Rect VideoOverlayWindowViews::GetLiveCaptionButtonBounds() { ++#if 0 + if (!Use2024UI()) { + return gfx::Rect(); + } + return live_caption_button_->GetMirroredBounds(); ++#endif ++ return gfx::Rect(); + } + + gfx::Rect VideoOverlayWindowViews::GetLiveCaptionDialogBounds() { ++#if 0 + if (!Use2024UI() || !live_caption_dialog_->GetVisible()) { + return gfx::Rect(); + } + return live_caption_dialog_->GetMirroredBounds(); ++#endif ++ return gfx::Rect(); + } bool VideoOverlayWindowViews::HasHighMediaEngagement( const url::Origin& origin) const { @@ -110,7 +229,7 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..f737adbdc968e659cf5ba59e6cd5fd5f MediaEngagementService* service = MediaEngagementService::Get(Profile::FromBrowserContext( GetController()->GetWebContents()->GetBrowserContext())); -@@ -2584,6 +2592,8 @@ bool VideoOverlayWindowViews::HasHighMediaEngagement( +@@ -2584,6 +2609,8 @@ bool VideoOverlayWindowViews::HasHighMediaEngagement( } return service->HasHighEngagement(origin); @@ -119,3 +238,24 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..f737adbdc968e659cf5ba59e6cd5fd5f } bool VideoOverlayWindowViews::IsTrustedForMediaPlayback() const { +@@ -2850,16 +2877,20 @@ void VideoOverlayWindowViews::UpdateTimestampLabel(base::TimeDelta current_time, + } + + void VideoOverlayWindowViews::OnLiveCaptionButtonPressed() { ++#if 0 + SetLiveCaptionDialogVisibility(!live_caption_dialog_->GetVisible()); ++#endif + } + + void VideoOverlayWindowViews::SetLiveCaptionDialogVisibility( + bool wanted_visibility) { ++#if 0 + if (wanted_visibility == live_caption_dialog_->GetVisible()) { + return; + } + live_caption_dialog_->SetVisible(wanted_visibility); + live_caption_button_->SetIsLiveCaptionDialogOpen(wanted_visibility); ++#endif + + views::View* controls_to_be_disabled_when_live_caption_is_open[] = { + minimize_button_.get(), diff --git a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch index 1ea9d34d1701c..135c276983612 100644 --- a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch +++ b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch @@ -6,7 +6,7 @@ Subject: refactor: patch electron PermissionTypes into blink 6387077: [PermissionOptions] Generalize PermissionRequestDescription | https://chromium-review.googlesource.com/c/chromium/src/+/6387077 diff --git a/components/permissions/permission_util.cc b/components/permissions/permission_util.cc -index 86b8df2b23dc975a6db87f04005cb105054305b0..770fd74ac5a21fe6daf68efe68efcf5a69483d84 100644 +index 18ad7ed73b0ed4de158519c01342f0bfd7cc3666..43f46dbbba4fb66b2a2c66580b85de0d7e16bf57 100644 --- a/components/permissions/permission_util.cc +++ b/components/permissions/permission_util.cc @@ -536,7 +536,17 @@ ContentSettingsType PermissionUtil::PermissionTypeToContentSettingsTypeSafe( diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index 56b9a37d98050..ca6603bc630ea 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index f8d61bc2e80c1f32aaae252d5897e6ac65935898..daf0bf82438ec022784ecbfa8e5e8869ec251359 100644 +index 5abbbb2684682532658b33c7f5fe2b91779a81a9..e6db0f72d82203a50728d42cdfcd482caa0126ef 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25517,6 +25517,21 @@ +@@ -25526,6 +25526,21 @@ ] } ], diff --git a/patches/nan/.patches b/patches/nan/.patches index cbc4d0d7f659f..4b609c1fec7b5 100644 --- a/patches/nan/.patches +++ b/patches/nan/.patches @@ -2,3 +2,4 @@ fix_correct_usages_of_v8_returnvalue_void_set_nonempty_for_new.patch fix_replace_deprecated_get_setprototype.patch fix_replace_usage_of_removed_writeutf8_with_writeutf8v2.patch test_use_v8_version_check_instead_of_node_version_check.patch +fix_remove_deprecated_propertycallbackinfo_holder.patch diff --git a/patches/nan/fix_remove_deprecated_propertycallbackinfo_holder.patch b/patches/nan/fix_remove_deprecated_propertycallbackinfo_holder.patch new file mode 100644 index 0000000000000..eae76d8546ad7 --- /dev/null +++ b/patches/nan/fix_remove_deprecated_propertycallbackinfo_holder.patch @@ -0,0 +1,199 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr <shelley.vohr@gmail.com> +Date: Thu, 30 Oct 2025 09:11:54 +0000 +Subject: fix: remove deprecated PropertyCallbackInfo::Holder() + +Removed upstream in https://chromium-review.googlesource.com/c/v8/v8/+/7013355. + +Property interceptors should be migrated to use info.This if they are installed +on the object instance otherwise info.HolderV2 if they are installed on the +prototype chain. + +diff --git a/nan_callbacks_12_inl.h b/nan_callbacks_12_inl.h +index ff3b654de5bcc7a187c4361b9eec26ea4b62a1eb..e40383c095ab329b2e20b7e68ade507788a79fb6 100644 +--- a/nan_callbacks_12_inl.h ++++ b/nan_callbacks_12_inl.h +@@ -160,7 +160,7 @@ class PropertyCallbackInfo { + inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); } + inline v8::Local<v8::Value> Data() const { return data_; } + inline v8::Local<v8::Object> This() const { return info_.This(); } +- inline v8::Local<v8::Object> Holder() const { return info_.Holder(); } ++ inline v8::Local<v8::Object> Holder() const { return info_.HolderV2(); } + inline ReturnValue<T> GetReturnValue() const { + return ReturnValue<T>(info_.GetReturnValue()); + } +diff --git a/test/cpp/accessors.cpp b/test/cpp/accessors.cpp +index 5848a40920c35680360a9d8b1390e983c6896996..e8506e4727e707ca766fe1b4229272ba18864ae0 100644 +--- a/test/cpp/accessors.cpp ++++ b/test/cpp/accessors.cpp +@@ -159,7 +159,7 @@ NAN_SETTER(SetterGetter::SetProp2) { + + NAN_METHOD(SetterGetter::Log) { + SetterGetter* settergetter = +- ObjectWrap::Unwrap<SetterGetter>(info.Holder()); ++ ObjectWrap::Unwrap<SetterGetter>(info.This()); + + info.GetReturnValue().Set(Nan::New(settergetter->log).ToLocalChecked()); + } +diff --git a/test/cpp/accessors2.cpp b/test/cpp/accessors2.cpp +index f5a2b312ca62256bc43141fad145cd68fc300446..59125d33c19856938907ab4dd28dc60037065a16 100644 +--- a/test/cpp/accessors2.cpp ++++ b/test/cpp/accessors2.cpp +@@ -88,7 +88,7 @@ NAN_METHOD(SetterGetter::New) { + + NAN_GETTER(SetterGetter::GetProp1) { + SetterGetter* settergetter = +- ObjectWrap::Unwrap<SetterGetter>(info.Holder()); ++ ObjectWrap::Unwrap<SetterGetter>(info.This()); + assert(strlen(settergetter->log) < sizeof (settergetter->log)); + strncat( + settergetter->log +@@ -110,7 +110,7 @@ NAN_GETTER(SetterGetter::GetProp1) { + + NAN_GETTER(SetterGetter::GetProp2) { + SetterGetter* settergetter = +- ObjectWrap::Unwrap<SetterGetter>(info.Holder()); ++ ObjectWrap::Unwrap<SetterGetter>(info.This()); + assert(strlen(settergetter->log) < sizeof (settergetter->log)); + strncat( + settergetter->log +@@ -132,7 +132,7 @@ NAN_GETTER(SetterGetter::GetProp2) { + + NAN_SETTER(SetterGetter::SetProp2) { + SetterGetter* settergetter = +- ObjectWrap::Unwrap<SetterGetter>(info.Holder()); ++ ObjectWrap::Unwrap<SetterGetter>(info.This()); + strncpy( + settergetter->prop2 + , *Nan::Utf8String(value) +@@ -157,7 +157,7 @@ NAN_SETTER(SetterGetter::SetProp2) { + + NAN_METHOD(SetterGetter::Log) { + SetterGetter* settergetter = +- ObjectWrap::Unwrap<SetterGetter>(info.Holder()); ++ ObjectWrap::Unwrap<SetterGetter>(info.This()); + + info.GetReturnValue().Set(Nan::New(settergetter->log).ToLocalChecked()); + } +diff --git a/test/cpp/indexedinterceptors.cpp b/test/cpp/indexedinterceptors.cpp +index 19b7673ff4c07236b11e1947d805979c21a0876e..668aa22f00ecc624ea4a66de93d289cdc7aad722 100644 +--- a/test/cpp/indexedinterceptors.cpp ++++ b/test/cpp/indexedinterceptors.cpp +@@ -74,7 +74,7 @@ NAN_METHOD(IndexedInterceptor::New) { + + NAN_INDEX_GETTER(IndexedInterceptor::PropertyGetter) { + IndexedInterceptor* interceptor = +- ObjectWrap::Unwrap<IndexedInterceptor>(info.Holder()); ++ ObjectWrap::Unwrap<IndexedInterceptor>(info.This()); + if (index == 0) { + info.GetReturnValue().Set(Nan::New(interceptor->buf).ToLocalChecked()); + } else { +@@ -85,7 +85,7 @@ NAN_INDEX_GETTER(IndexedInterceptor::PropertyGetter) { + + NAN_INDEX_SETTER(IndexedInterceptor::PropertySetter) { + IndexedInterceptor* interceptor = +- ObjectWrap::Unwrap<IndexedInterceptor>(info.Holder()); ++ ObjectWrap::Unwrap<IndexedInterceptor>(info.This()); + if (index == 0) { + std::strncpy( + interceptor->buf +@@ -107,7 +107,7 @@ NAN_INDEX_ENUMERATOR(IndexedInterceptor::PropertyEnumerator) { + + NAN_INDEX_DELETER(IndexedInterceptor::PropertyDeleter) { + IndexedInterceptor* interceptor = +- ObjectWrap::Unwrap<IndexedInterceptor>(info.Holder()); ++ ObjectWrap::Unwrap<IndexedInterceptor>(info.This()); + std::strncpy(interceptor->buf, "goober", sizeof (interceptor->buf)); + info.GetReturnValue().Set(True()); + return Intercepted::Yes(); +diff --git a/test/cpp/methodswithdata.cpp b/test/cpp/methodswithdata.cpp +index 8a908e3246f1efd77290597e500185010293c473..a1ac03c891c14bcd96c139514866acc4c2bd393c 100644 +--- a/test/cpp/methodswithdata.cpp ++++ b/test/cpp/methodswithdata.cpp +@@ -150,7 +150,7 @@ NAN_SETTER(SetterGetter::SetProp2) { + + NAN_METHOD(SetterGetter::Log) { + SetterGetter* settergetter = +- ObjectWrap::Unwrap<SetterGetter>(info.Holder()); ++ ObjectWrap::Unwrap<SetterGetter>(info.This()); + + info.GetReturnValue().Set(Nan::New(settergetter->log).ToLocalChecked()); + } +diff --git a/test/cpp/namedinterceptors.cpp b/test/cpp/namedinterceptors.cpp +index 9f4b3b2000188fbeb53a5ec53969226916bac9da..d0761e5880d91792470ae4fecd0b5dfd3770bfef 100644 +--- a/test/cpp/namedinterceptors.cpp ++++ b/test/cpp/namedinterceptors.cpp +@@ -74,7 +74,7 @@ NAN_METHOD(NamedInterceptor::New) { + + NAN_PROPERTY_GETTER(NamedInterceptor::PropertyGetter) { + NamedInterceptor* interceptor = +- ObjectWrap::Unwrap<NamedInterceptor>(info.Holder()); ++ ObjectWrap::Unwrap<NamedInterceptor>(info.This()); + if (!std::strcmp(*Nan::Utf8String(property), "prop")) { + info.GetReturnValue().Set(Nan::New(interceptor->buf).ToLocalChecked()); + } else { +@@ -85,7 +85,7 @@ NAN_PROPERTY_GETTER(NamedInterceptor::PropertyGetter) { + + NAN_PROPERTY_SETTER(NamedInterceptor::PropertySetter) { + NamedInterceptor* interceptor = +- ObjectWrap::Unwrap<NamedInterceptor>(info.Holder()); ++ ObjectWrap::Unwrap<NamedInterceptor>(info.This()); + if (!std::strcmp(*Nan::Utf8String(property), "prop")) { + std::strncpy( + interceptor->buf +@@ -106,7 +106,7 @@ NAN_PROPERTY_ENUMERATOR(NamedInterceptor::PropertyEnumerator) { + + NAN_PROPERTY_DELETER(NamedInterceptor::PropertyDeleter) { + NamedInterceptor* interceptor = +- ObjectWrap::Unwrap<NamedInterceptor>(info.Holder()); ++ ObjectWrap::Unwrap<NamedInterceptor>(info.This()); + std::strncpy(interceptor->buf, "goober", sizeof (interceptor->buf)); + info.GetReturnValue().Set(True()); + return Intercepted::Yes(); +diff --git a/test/cpp/objectwraphandle.cpp b/test/cpp/objectwraphandle.cpp +index ac4f79aa256c82d2a8b64fa5a0d44d5c2ebbd9c7..64dd9e7ad95d1f37a6223dfd8e385b9d122ba3bc 100644 +--- a/test/cpp/objectwraphandle.cpp ++++ b/test/cpp/objectwraphandle.cpp +@@ -47,17 +47,17 @@ class MyObject : public ObjectWrap { + } + + static NAN_METHOD(GetHandle) { +- MyObject* obj = ObjectWrap::Unwrap<MyObject>(info.Holder()); ++ MyObject* obj = ObjectWrap::Unwrap<MyObject>(info.This()); + info.GetReturnValue().Set(obj->handle()); + } + + static NAN_METHOD(GetHandleConst) { +- MyObject const *obj = ObjectWrap::Unwrap<MyObject>(info.Holder()); ++ MyObject const *obj = ObjectWrap::Unwrap<MyObject>(info.This()); + info.GetReturnValue().Set(obj->handle()); + } + + static NAN_METHOD(GetValue) { +- MyObject* obj = ObjectWrap::Unwrap<MyObject>(info.Holder()); ++ MyObject* obj = ObjectWrap::Unwrap<MyObject>(info.This()); + info.GetReturnValue().Set(obj->value_); + } + +diff --git a/test/cpp/wrappedobjectfactory.cpp b/test/cpp/wrappedobjectfactory.cpp +index 9930a5f12913f703391e3d183b56a37569c60887..ec3955e496ed623966c83b5a5b661103892622fd 100644 +--- a/test/cpp/wrappedobjectfactory.cpp ++++ b/test/cpp/wrappedobjectfactory.cpp +@@ -49,7 +49,7 @@ class InnerObject : public ObjectWrap { + } + + static NAN_METHOD(GetValue) { +- InnerObject* obj = ObjectWrap::Unwrap<InnerObject>(info.Holder()); ++ InnerObject* obj = ObjectWrap::Unwrap<InnerObject>(info.This()); + info.GetReturnValue().Set(obj->value_); + } + +@@ -102,7 +102,7 @@ class MyObject : public ObjectWrap { + } + + static NAN_METHOD(GetValue) { +- MyObject* obj = ObjectWrap::Unwrap<MyObject>(info.Holder()); ++ MyObject* obj = ObjectWrap::Unwrap<MyObject>(info.This()); + info.GetReturnValue().Set(obj->value_); + } + From 5d5dd31927539cdf98229e1392d6532f73a0295c Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Fri, 31 Oct 2025 16:32:34 -0500 Subject: [PATCH 193/268] refactor: use Object.values() instead of Object.keys() in stringifyValues() (#48741) refactor: use Object.values() instead of Object.keys() in stringifyValues we only used the key to get the value --- lib/common/api/net-client-request.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/common/api/net-client-request.ts b/lib/common/api/net-client-request.ts index a2682da670d22..057f0390d7854 100644 --- a/lib/common/api/net-client-request.ts +++ b/lib/common/api/net-client-request.ts @@ -427,9 +427,8 @@ export class ClientRequest extends Writable implements Electron.ClientRequest { this._started = true; const stringifyValues = (obj: Record<string, { name: string, value: string | string[] }>) => { const ret: Record<string, string> = {}; - for (const k of Object.keys(obj)) { - const kv = obj[k]; - ret[kv.name] = kv.value.toString(); + for (const { name, value } of Object.values(obj)) { + ret[name] = value.toString(); } return ret; }; From ce4e9b7724b9303559dea20150dfaed4defdb52a Mon Sep 17 00:00:00 2001 From: Mitchell Cohen <nilay2014@gmail.com> Date: Fri, 31 Oct 2025 17:35:08 -0400 Subject: [PATCH 194/268] docs: clarify BrowserWindow and App API support status on Wayland (#48740) * docs: clarify BrowserWindow API support in Wayland * typo fix * updated docs * wrapping --- docs/api/app.md | 5 +++-- docs/api/browser-window.md | 27 ++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/docs/api/app.md b/docs/api/app.md index 5a7e482aff606..72e80cac33416 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -565,8 +565,9 @@ and subscribing to the `ready` event if the app is not ready yet. * `steal` boolean _macOS_ - Make the receiver the active app even if another app is currently active. -On Linux, focuses on the first visible window. On macOS, makes the application -the active app. On Windows, focuses on the application's first window. +On macOS, makes the application the active app. On Windows, focuses on the application's +first window. On Linux, either focuses on the first visible window (X11) or requests +focus but may instead show a notification or flash the app icon (Wayland). You should seek to use the `steal` option as sparingly as possible. diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 3000d803f8c5c..598c9e428d4fa 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -140,6 +140,10 @@ state is `hidden` in order to minimize power consumption. move. * On Linux the type of modal windows will be changed to `dialog`. * On Linux many desktop environments do not support hiding a modal window. +* On Wayland (Linux) it is generally not possible to programmatically resize windows + after creation, or to position, move, focus, or blur windows without user input. + If your app needs these capabilities, run it in Xwayland by appending the flag + `--ozone-platform=x11`. ## Class: BrowserWindow extends `BaseWindow` @@ -656,10 +660,15 @@ the [close event](#event-close). Focuses on the window. +On Wayland (Linux), the desktop environment may show a notification or flash +the app icon if the window or app is not already focused. + #### `win.blur()` Removes focus from the window. +Not supported on Wayland (Linux). + #### `win.isFocused()` Returns `boolean` - Whether the window is focused. @@ -676,6 +685,8 @@ Shows and gives focus to the window. Shows the window but doesn't focus on it. +Not supported on Wayland (Linux). + #### `win.hide()` Hides the window. @@ -824,6 +835,8 @@ Closes the currently open [Quick Look][quick-look] panel. Resizes and moves the window to the supplied bounds. Any properties that are not supplied will default to their current values. +On Wayland (Linux), has the same limitations as `setSize` and `setPosition`. + ```js const { BrowserWindow } = require('electron') @@ -866,6 +879,8 @@ See [Setting `backgroundColor`](#setting-the-backgroundcolor-property). Resizes and moves the window's client area (e.g. the web page) to the supplied bounds. +On Wayland (Linux), has the same limitations as `setContentSize` and `setPosition`. + #### `win.getContentBounds()` Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window's client area as `Object`. @@ -895,6 +910,8 @@ Returns `boolean` - whether the window is enabled. Resizes the window to `width` and `height`. If `width` or `height` are below any set minimum size constraints the window will snap to its minimum size. +On Wayland (Linux), may not work as some window managers restrict programmatic window resizing. + #### `win.getSize()` Returns `Integer[]` - Contains the window's width and height. @@ -907,6 +924,8 @@ Returns `Integer[]` - Contains the window's width and height. Resizes the window's client area (e.g. the web page) to `width` and `height`. +On Wayland (Linux), may not work as some window managers restrict programmatic window resizing. + #### `win.getContentSize()` Returns `Integer[]` - Contains the window's client area's width and height. @@ -1044,12 +1063,16 @@ this method throws an error. #### `win.moveTop()` -Moves window to top(z-order) regardless of focus +Moves window to top(z-order) regardless of focus. + +Not supported on Wayland (Linux). #### `win.center()` Moves window to the center of the screen. +Not supported on Wayland (Linux). + #### `win.setPosition(x, y[, animate])` * `x` Integer @@ -1058,6 +1081,8 @@ Moves window to the center of the screen. Moves window to `x` and `y`. +Not supported on Wayland (Linux). + #### `win.getPosition()` Returns `Integer[]` - Contains the window's current position. From ebb7cb30f64b4f895106e6385a499bc3dd6d8d46 Mon Sep 17 00:00:00 2001 From: Niklas Wenzel <nilay2014@gmail.com> Date: Mon, 3 Nov 2025 14:37:01 +0100 Subject: [PATCH 195/268] docs: explain how to handle incoming drag and drop (#48718) Fixes https://github.com/electron/electron/issues/48667 --- docs/tutorial/native-file-drag-drop.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/tutorial/native-file-drag-drop.md b/docs/tutorial/native-file-drag-drop.md index bf284cbb6da84..d9fa39c1a0088 100644 --- a/docs/tutorial/native-file-drag-drop.md +++ b/docs/tutorial/native-file-drag-drop.md @@ -110,4 +110,10 @@ the item is a Markdown file located in the root of the project: ![Drag and drop](../images/drag-and-drop.gif) +## Dragging files into your app + +You can use the standard +[Drag and Drop web API](https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API) +for dragging and dropping files into your app. + [`contextBridge`]: ../api/context-bridge.md From 2783209a6e92a01143276b26627b24f17ccbe2c4 Mon Sep 17 00:00:00 2001 From: Mitchell Cohen <nilay2014@gmail.com> Date: Mon, 3 Nov 2025 08:37:42 -0500 Subject: [PATCH 196/268] fix: release mouse buttons on focus loss on Wayland (#48752) --- patches/chromium/.patches | 1 + ...use_buttons_on_focus_loss_on_wayland.patch | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 patches/chromium/fix_release_mouse_buttons_on_focus_loss_on_wayland.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 5de666c64bcd2..dbc105997ccd6 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -143,3 +143,4 @@ expose_referrerscriptinfo_hostdefinedoptionsindex.patch chore_disable_protocol_handler_dcheck.patch fix_check_for_file_existence_before_setting_mtime.patch revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch +fix_release_mouse_buttons_on_focus_loss_on_wayland.patch diff --git a/patches/chromium/fix_release_mouse_buttons_on_focus_loss_on_wayland.patch b/patches/chromium/fix_release_mouse_buttons_on_focus_loss_on_wayland.patch new file mode 100644 index 0000000000000..aab439b5c097f --- /dev/null +++ b/patches/chromium/fix_release_mouse_buttons_on_focus_loss_on_wayland.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mitchell COhen <mitch.cohen@me.com> +Date: Sun, 2 Nov 2025 15:30:56 -0500 +Subject: fix: release mouse buttons on focus loss on Wayland + +Fixes an issue where the mouse flags would get stuck if you right-click +the CSD titlebar in Wayland. + +Bug: 455147429 +Change-Id: I9f5a9f395b3c1d85094a40a92d40691a897dbd05 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7091872 +Reviewed-by: Thomas Anderson <thomasanderson@chromium.org> +Reviewed-by: Kramer Ge <fangzhoug@chromium.org> +Commit-Queue: Thomas Anderson <thomasanderson@chromium.org> +Cr-Commit-Position: refs/heads/main@{#1538048} + +diff --git a/ui/ozone/platform/wayland/host/wayland_event_source.cc b/ui/ozone/platform/wayland/host/wayland_event_source.cc +index 4cc15e842b633e93f1d6654225765769eb75fffd..4e421ccbd36d4efebd43c9def5b575b7d8d5e336 100644 +--- a/ui/ozone/platform/wayland/host/wayland_event_source.cc ++++ b/ui/ozone/platform/wayland/host/wayland_event_source.cc +@@ -336,6 +336,13 @@ void WaylandEventSource::OnPointerFocusChanged( + // Save new pointer location. + pointer_location_ = location; + window_manager_->SetPointerFocusedWindow(window); ++ } else { ++ // The compositor may swallow the release event for any buttons that are ++ // pressed when the window loses focus, e.g. when right-clicking the ++ // titlebar to open the system menu on GNOME. ++ if (!connection_->IsDragInProgress()) { ++ ReleasePressedPointerButtons(window, ui::EventTimeForNow()); ++ } + } + + auto closure = focused ? base::NullCallback() From 052133235ea51429ee996e321b67eb7d11931d96 Mon Sep 17 00:00:00 2001 From: Damglador <nilay2014@gmail.com> Date: Mon, 3 Nov 2025 23:53:53 +0100 Subject: [PATCH 197/268] fix: use app name as a part of tray id on Linux (#48675) * fix: use browser name as tray id * fix: remove unnecessary .c_str() * fix: use string_view instead of string& * fix: move app_name_ to the bottom of private: section https://google.github.io/styleguide/cppguide.html#Declaration_Order * fix: use base's string utils to join strings * docs: note when to remove the patch * fix: update patch * fix: make linter happy * fix: move app_name_ to the bottom of private: section --- patches/chromium/.patches | 1 + patches/chromium/fix_linux_tray_id.patch | 76 ++++++++++++++++++++++++ shell/browser/ui/tray_icon_linux.cc | 3 +- 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 patches/chromium/fix_linux_tray_id.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index dbc105997ccd6..69b906122f0a9 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -144,3 +144,4 @@ chore_disable_protocol_handler_dcheck.patch fix_check_for_file_existence_before_setting_mtime.patch revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch fix_release_mouse_buttons_on_focus_loss_on_wayland.patch +fix_linux_tray_id.patch diff --git a/patches/chromium/fix_linux_tray_id.patch b/patches/chromium/fix_linux_tray_id.patch new file mode 100644 index 0000000000000..0b54aa61e3aeb --- /dev/null +++ b/patches/chromium/fix_linux_tray_id.patch @@ -0,0 +1,76 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Damglador <vse.stopchanskyi@gmail.com> +Date: Mon, 27 Oct 2025 23:35:43 +0100 +Subject: fix: allow setting tray id + +This is needed to allow setting custom tray id when initializing a tray icon. +With current behaviour all programs get chrome_status_icon_1 as their id in tray. +So tray can't tell apart Electron apps, +which introduces issues like https://bugs.kde.org/show_bug.cgi?id=470840. + +This patch can be removed after being upstreamed. See discussion at +https://github.com/electron/electron/pull/48675#issuecomment-3452781711 +for more info. + +diff --git a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc +index e268573d360b1744c739bc516e81261c3869cd23..cf69e72a1a391451a31e28356cb6b86fc6010646 100644 +--- a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc ++++ b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc +@@ -131,8 +131,8 @@ int NextServiceId() { + return ++status_icon_count; + } + +-std::string PropertyIdFromId(int service_id) { +- return "chrome_status_icon_" + base::NumberToString(service_id); ++std::string PropertyIdFromId(int service_id, const std::string_view app_name) { ++ return base::StrCat({ app_name, "_status_icon_", base::NumberToString(service_id) }); + } + + using DbusImage = std::tuple</*width=*/int32_t, +@@ -222,12 +222,13 @@ base::FilePath WriteIconFile(size_t icon_file_id, + + } // namespace + +-StatusIconLinuxDbus::StatusIconLinuxDbus() ++StatusIconLinuxDbus::StatusIconLinuxDbus(const std::string_view app_name) + : bus_(dbus_thread_linux::GetSharedSessionBus()), + should_write_icon_to_file_(ShouldWriteIconToFile()), + icon_task_runner_(base::ThreadPool::CreateSequencedTaskRunner( + {base::MayBlock(), base::TaskPriority::USER_VISIBLE, +- base::TaskShutdownBehavior::BLOCK_SHUTDOWN})) { ++ base::TaskShutdownBehavior::BLOCK_SHUTDOWN})), ++ app_name_(app_name) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + CheckStatusNotifierWatcherHasOwner(); + } +@@ -402,7 +403,7 @@ void StatusIconLinuxDbus::OnHostRegisteredResponse(dbus::Response* response) { + properties_->SetProperty<"s">(kInterfaceStatusNotifierItem, kPropertyCategory, + kPropertyValueCategory, false); + properties_->SetProperty<"s">(kInterfaceStatusNotifierItem, kPropertyId, +- PropertyIdFromId(service_id_), false); ++ PropertyIdFromId(service_id_, app_name_), false); + properties_->SetProperty<"s">(kInterfaceStatusNotifierItem, + kPropertyOverlayIconName, "", false); + properties_->SetProperty<"s">(kInterfaceStatusNotifierItem, kPropertyStatus, +diff --git a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h +index 78c0ddf50ae6cafed1badaeb951b1dab3110f095..984673954bb7f0b4c902677c70ab88c602201060 100644 +--- a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h ++++ b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h +@@ -35,7 +35,7 @@ class StatusIconLinuxDbus : public ui::StatusIconLinux, + public ui::SimpleMenuModel::Delegate, + public base::RefCounted<StatusIconLinuxDbus> { + public: +- StatusIconLinuxDbus(); ++ StatusIconLinuxDbus(const std::string_view app_name = "chrome"); + + StatusIconLinuxDbus(const StatusIconLinuxDbus&) = delete; + StatusIconLinuxDbus& operator=(const StatusIconLinuxDbus&) = delete; +@@ -136,6 +136,8 @@ class StatusIconLinuxDbus : public ui::StatusIconLinux, + size_t icon_file_id_ = 0; + base::FilePath icon_file_; + ++ std::string app_name_; ++ + base::WeakPtrFactory<StatusIconLinuxDbus> weak_factory_{this}; + }; + diff --git a/shell/browser/ui/tray_icon_linux.cc b/shell/browser/ui/tray_icon_linux.cc index b7d0f1e137c13..b7147c7bed270 100644 --- a/shell/browser/ui/tray_icon_linux.cc +++ b/shell/browser/ui/tray_icon_linux.cc @@ -6,6 +6,7 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h" +#include "shell/browser/browser.h" #include "shell/browser/ui/status_icon_gtk.h" #include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia_rep.h" @@ -32,7 +33,7 @@ gfx::ImageSkia GetBestImageRep(const gfx::ImageSkia& image) { } // namespace TrayIconLinux::TrayIconLinux() - : status_icon_dbus_(new StatusIconLinuxDbus), + : status_icon_dbus_(new StatusIconLinuxDbus(Browser::Get()->GetName())), status_icon_type_(StatusIconType::kDbus) { status_icon_dbus_->SetDelegate(this); } From db982f9001e01183102e4ff6cc446860c138c5df Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Mon, 3 Nov 2025 21:26:16 -0800 Subject: [PATCH 198/268] chore: bump chromium to 144.0.7506.0 (main) (#48744) * chore: bump chromium in DEPS to 144.0.7504.0 * chore: bump chromium in DEPS to 144.0.7506.0 * chore: update patches * Revert "build: explicitly disable reclient" This reverts commit e08c6adb08eb12b9f47cadfcccb9305e3ecadc25. No longer needed after https://crrev.com/c/7099239 * 7097498: Remove MSG_ROUTING_* constants from ipc_message.h https://chromium-review.googlesource.com/c/chromium/src/+/7097498 * 7090671: [//gpu] Remove unneeded GpuInfo methods https://chromium-review.googlesource.com/c/chromium/src/+/7090671 * 7103701: Remove IPC::PlatformFileForTransit. https://chromium-review.googlesource.com/c/chromium/src/+/7103701 (This should have been removed with https://github.com/electron/electron/pull/17406). * chore: update filenames.libcxx.gni --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> --- DEPS | 2 +- build/args/all.gn | 3 -- filenames.libcxx.gni | 1 + .../add_didinstallconditionalfeatures.patch | 8 +-- ...adjust_accessibility_ui_for_electron.patch | 52 ++++++++++--------- ..._scheduler_throttling_per_renderview.patch | 38 +++++++------- ..._windows_to_have_different_web_prefs.patch | 16 +++--- patches/chromium/blink_local_frame.patch | 2 +- ..._depend_on_packed_resource_integrity.patch | 8 +-- patches/chromium/can_create_window.patch | 16 +++--- ...ameter_in_script_lifecycle_observers.patch | 8 +-- ...ther_in_electron_views_and_delegates.patch | 2 +- ..._introduce_blocking_api_for_electron.patch | 6 +-- .../chore_patch_out_profile_methods.patch | 2 +- ...screationoverridden_with_full_params.patch | 10 ++-- .../disable_compositor_recycling.patch | 2 +- patches/chromium/disable_hidden.patch | 4 +- patches/chromium/dom_storage_limits.patch | 2 +- ...xpose_setuseragent_on_networkcontext.patch | 4 +- .../extend_apply_webpreferences.patch | 4 +- ...d_data_parameter_to_processsingleton.patch | 10 ++-- ..._registry_to_multibuffer_data_source.patch | 14 ++--- ...t_allow_code_cache_in_custom_schemes.patch | 6 +-- ...to_add_observers_on_created_hunspell.patch | 6 +-- ...e_launch_options_for_service_process.patch | 6 +-- ...moothing_css_rule_and_blink_painting.patch | 18 +++---- ..._raw_response_headers_from_urlloader.patch | 10 ++-- ...allback_for_sync_and_async_clipboard.patch | 2 +- ...dless_mode_handling_in_native_widget.patch | 2 +- ...ding_non-standard_schemes_in_iframes.patch | 6 +-- ...ingshelper_behind_branding_buildflag.patch | 8 +-- ...board_hides_on_input_blur_in_webview.patch | 4 +- ..._properly_honor_printing_page_ranges.patch | 6 +-- ...original_resize_performance_on_macos.patch | 2 +- ...from_localframe_requestexecutescript.patch | 4 +- ...ated_generic_capturer_when_available.patch | 6 +-- patches/chromium/frame_host_manager.patch | 2 +- .../chromium/gritsettings_resource_ids.patch | 4 +- ..._avoid_private_macos_api_usage.patch.patch | 40 +++++++------- ...emote_certificate_verification_logic.patch | 6 +-- .../chromium/notification_provenance.patch | 6 +-- ...xture_remove_keyed_mutex_on_win_dxgi.patch | 2 +- patches/chromium/printing.patch | 18 +++---- patches/chromium/process_singleton.patch | 2 +- ...r_changes_to_the_webcontentsobserver.patch | 2 +- ..._expose_file_system_access_blocklist.patch | 4 +- ...pose_hostimportmoduledynamically_and.patch | 12 ++--- ..._electron_permissiontypes_into_blink.patch | 2 +- .../render_widget_host_view_mac.patch | 2 +- ...eature_windelayspellcheckserviceinit.patch | 10 ++-- ...ean_up_stale_macwebcontentsocclusion.patch | 8 +-- ...al_remove_unused_prehandlemouseevent.patch | 2 +- ...windowtreehostwin_window_enlargement.patch | 4 +- patches/chromium/scroll_bounce_flag.patch | 4 +- .../support_mixed_sandbox_with_zygote.patch | 4 +- patches/chromium/webview_fullscreen.patch | 4 +- shell/browser/api/gpu_info_enumerator.cc | 13 ----- shell/browser/api/gpu_info_enumerator.h | 4 -- shell/browser/electron_browser_client.cc | 5 +- .../browser/net/proxying_url_loader_factory.h | 3 +- shell/browser/ui/inspectable_web_contents.cc | 4 +- .../renderer/electron_render_frame_observer.h | 3 -- 62 files changed, 227 insertions(+), 243 deletions(-) diff --git a/DEPS b/DEPS index 790c4ad564c26..005b62ea4b6ef 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '144.0.7500.0', + '144.0.7506.0', 'node_version': 'v24.10.0', 'nan_version': diff --git a/build/args/all.gn b/build/args/all.gn index bf4c76abb5480..b62e24774ded3 100644 --- a/build/args/all.gn +++ b/build/args/all.gn @@ -75,6 +75,3 @@ enable_linux_installer = false # Disable "Save to Drive" feature in PDF viewer enable_pdf_save_to_drive = false - -# Explictly disable use_reclient until reclient is completely removed -use_reclient = false diff --git a/filenames.libcxx.gni b/filenames.libcxx.gni index a4628ed2bc4b5..051b368ff3e3a 100644 --- a/filenames.libcxx.gni +++ b/filenames.libcxx.gni @@ -1105,6 +1105,7 @@ libcxx_headers = [ "//third_party/libc++/src/include/__locale_dir/support/freebsd.h", "//third_party/libc++/src/include/__locale_dir/support/fuchsia.h", "//third_party/libc++/src/include/__locale_dir/support/linux.h", + "//third_party/libc++/src/include/__locale_dir/support/netbsd.h", "//third_party/libc++/src/include/__locale_dir/support/no_locale/characters.h", "//third_party/libc++/src/include/__locale_dir/support/no_locale/strtonum.h", "//third_party/libc++/src/include/__locale_dir/support/windows.h", diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index ec81d0cdd6ee9..63f9a72be6ae4 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -23,10 +23,10 @@ index 5196f155cdc641b66c4faa77d8b00097145a1290..bbfac47a74f989482343c222b78f187b int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 298387873e7ded5f96c788bc53ad7256a8f5b13e..7e64e34a2ebd9738d33bfc9cc7fd827b8757037d 100644 +index 30c2972e1fbc21d382304897c542ecd7fa95b896..3f512dcaec9f1d8a1375277ab8c6649d69070a33 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4659,6 +4659,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, +@@ -4665,6 +4665,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context, observer.DidCreateScriptContext(context, world_id); } @@ -40,10 +40,10 @@ index 298387873e7ded5f96c788bc53ad7256a8f5b13e..7e64e34a2ebd9738d33bfc9cc7fd827b int world_id) { for (auto& observer : observers_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index b6acf7101932961b4a81738e1fcda07efc714edc..32dfed04e2fd7cd2e60c7cf145d182f4163feb68 100644 +index c3c45d6a953d7c068c0d6c8bfb6855cd4403aa6d..b3fd71b237c134853f796a1d8d803e4d28519d53 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -603,6 +603,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -602,6 +602,8 @@ class CONTENT_EXPORT RenderFrameImpl void DidObserveLayoutShift(double score, bool after_input_or_scroll) override; void DidCreateScriptContext(v8::Local<v8::Context> context, int world_id) override; diff --git a/patches/chromium/adjust_accessibility_ui_for_electron.patch b/patches/chromium/adjust_accessibility_ui_for_electron.patch index b1376e7588f2c..5a517f6b5446b 100644 --- a/patches/chromium/adjust_accessibility_ui_for_electron.patch +++ b/patches/chromium/adjust_accessibility_ui_for_electron.patch @@ -10,7 +10,7 @@ usage of BrowserList and Browser as we subclass related methods and use our WindowList. diff --git a/chrome/browser/ui/webui/accessibility/accessibility_ui.cc b/chrome/browser/ui/webui/accessibility/accessibility_ui.cc -index 049ae3881eff6426b37a1ba09cfd8a10a7e9a597..0cdb542da696e9fc85e9bf321182da2967073016 100644 +index 3a9f87d82212bfeab23b312a593fb855df344780..83b4a7fe7149f2b195e53fcb05f77da3b33c3777 100644 --- a/chrome/browser/ui/webui/accessibility/accessibility_ui.cc +++ b/chrome/browser/ui/webui/accessibility/accessibility_ui.cc @@ -48,6 +48,7 @@ @@ -21,16 +21,16 @@ index 049ae3881eff6426b37a1ba09cfd8a10a7e9a597..0cdb542da696e9fc85e9bf321182da29 #include "ui/accessibility/accessibility_features.h" #include "ui/accessibility/ax_mode.h" #include "ui/accessibility/ax_updates_and_events.h" -@@ -178,7 +179,7 @@ base::Value::Dict BuildTargetDescriptor(content::RenderViewHost* rvh) { +@@ -179,7 +180,7 @@ base::Value::Dict BuildTargetDescriptor(content::RenderViewHost* rvh) { rvh->GetRoutingID(), accessibility_mode); } -#if !BUILDFLAG(IS_ANDROID) +#if 0 - base::Value::Dict BuildTargetDescriptor(Browser* browser) { + base::Value::Dict BuildTargetDescriptor(BrowserWindowInterface* browser) { base::Value::Dict target_data; - target_data.Set(kSessionIdField, browser->session_id().id()); -@@ -224,7 +225,7 @@ void HandleAccessibilityRequestCallback( + target_data.Set(kSessionIdField, browser->GetSessionID().id()); +@@ -226,7 +227,7 @@ void HandleAccessibilityRequestCallback( auto& browser_accessibility_state = *content::BrowserAccessibilityState::GetInstance(); base::Value::Dict data; @@ -39,7 +39,7 @@ index 049ae3881eff6426b37a1ba09cfd8a10a7e9a597..0cdb542da696e9fc85e9bf321182da29 ui::AXMode mode = browser_accessibility_state.GetAccessibilityMode(); bool native = mode.has_mode(ui::AXMode::kNativeAPIs); bool web = mode.has_mode(ui::AXMode::kWebContents); -@@ -285,7 +286,7 @@ void HandleAccessibilityRequestCallback( +@@ -287,7 +288,7 @@ void HandleAccessibilityRequestCallback( data.Set(kIsScreenReaderActive, is_screen_reader_active); std::string pref_api_type = @@ -48,21 +48,23 @@ index 049ae3881eff6426b37a1ba09cfd8a10a7e9a597..0cdb542da696e9fc85e9bf321182da29 bool pref_api_type_supported = false; std::vector<ui::AXApiType::Type> supported_api_types = -@@ -353,11 +354,11 @@ void HandleAccessibilityRequestCallback( +@@ -355,13 +356,13 @@ void HandleAccessibilityRequestCallback( data.Set(kPagesField, std::move(page_list)); base::Value::List browser_list; -#if !BUILDFLAG(IS_ANDROID) +#if 0 - for (Browser* browser : *BrowserList::GetInstance()) { - browser_list.Append(BuildTargetDescriptor(browser)); - } + ForEachCurrentBrowserWindowInterfaceOrderedByActivation( + [&browser_list](BrowserWindowInterface* browser) { + browser_list.Append(BuildTargetDescriptor(browser)); + return true; + }); -#endif // !BUILDFLAG(IS_ANDROID) +#endif data.Set(kBrowsersField, std::move(browser_list)); #if BUILDFLAG(IS_WIN) -@@ -844,7 +845,8 @@ void AccessibilityUIMessageHandler::SetGlobalString( +@@ -848,7 +849,8 @@ void AccessibilityUIMessageHandler::SetGlobalString( const std::string value = CheckJSValue(data.FindString(kValueField)); if (string_name == kApiTypeField) { @@ -72,7 +74,7 @@ index 049ae3881eff6426b37a1ba09cfd8a10a7e9a597..0cdb542da696e9fc85e9bf321182da29 pref->SetString(prefs::kShownAccessibilityApiType, value); } } -@@ -898,7 +900,8 @@ void AccessibilityUIMessageHandler::RequestWebContentsTree( +@@ -902,7 +904,8 @@ void AccessibilityUIMessageHandler::RequestWebContentsTree( AXPropertyFilter::ALLOW_EMPTY); AddPropertyFilters(property_filters, deny, AXPropertyFilter::DENY); @@ -82,23 +84,25 @@ index 049ae3881eff6426b37a1ba09cfd8a10a7e9a597..0cdb542da696e9fc85e9bf321182da29 ui::AXApiType::Type api_type = ui::AXApiType::From(pref->GetString(prefs::kShownAccessibilityApiType)); std::string accessibility_contents = -@@ -925,6 +928,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( - AXPropertyFilter::ALLOW_EMPTY); - AddPropertyFilters(property_filters, deny, AXPropertyFilter::DENY); +@@ -922,7 +925,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( + AllowJavascript(); + +-#if !BUILDFLAG(IS_ANDROID) +#if 0 - for (Browser* browser : *BrowserList::GetInstance()) { - if (browser->session_id().id() == session_id) { - base::Value::Dict result = BuildTargetDescriptor(browser); -@@ -937,6 +941,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( - return; - } + std::vector<AXPropertyFilter> property_filters; + AddPropertyFilters(property_filters, allow, AXPropertyFilter::ALLOW); + AddPropertyFilters(property_filters, allow_empty, +@@ -949,7 +952,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( + if (found) { + return; } +-#endif // !BUILDFLAG(IS_ANDROID) +#endif - #endif // !BUILDFLAG(IS_ANDROID) // No browser with the specified |session_id| was found. base::Value::Dict result; -@@ -980,11 +985,13 @@ void AccessibilityUIMessageHandler::StopRecording( + result.Set(kSessionIdField, session_id); +@@ -992,11 +995,13 @@ void AccessibilityUIMessageHandler::StopRecording( } ui::AXApiType::Type AccessibilityUIMessageHandler::GetRecordingApiType() { @@ -115,7 +119,7 @@ index 049ae3881eff6426b37a1ba09cfd8a10a7e9a597..0cdb542da696e9fc85e9bf321182da29 // Check to see if it is in the supported types list. if (std::find(supported_types.begin(), supported_types.end(), api_type) == supported_types.end()) { -@@ -1054,10 +1061,13 @@ void AccessibilityUIMessageHandler::RequestAccessibilityEvents( +@@ -1066,10 +1071,13 @@ void AccessibilityUIMessageHandler::RequestAccessibilityEvents( // static void AccessibilityUIMessageHandler::RegisterProfilePrefs( user_prefs::PrefRegistrySyncable* registry) { diff --git a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch index ff4822bc8d855..c7dd726909076 100644 --- a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -6,10 +6,10 @@ Subject: allow disabling blink scheduler throttling per RenderView This allows us to disable throttling for hidden windows. diff --git a/content/browser/renderer_host/navigation_controller_impl_unittest.cc b/content/browser/renderer_host/navigation_controller_impl_unittest.cc -index 74b39146bbb8151a66ecb4f138f769fffc2525b2..a54948fa36c85c5c5dd04b9836951b1ce1279038 100644 +index 5765fe8264ecf117d68cdc2c95517f2fcc22715f..37a734f120427571cf5f4f7b6b6eabb881ba59cb 100644 --- a/content/browser/renderer_host/navigation_controller_impl_unittest.cc +++ b/content/browser/renderer_host/navigation_controller_impl_unittest.cc -@@ -173,6 +173,12 @@ class MockPageBroadcast : public blink::mojom::PageBroadcast { +@@ -168,6 +168,12 @@ class MockPageBroadcast : public blink::mojom::PageBroadcast { (bool supports_draggable_regions), (override)); @@ -23,10 +23,10 @@ index 74b39146bbb8151a66ecb4f138f769fffc2525b2..a54948fa36c85c5c5dd04b9836951b1c return receiver_.BindNewEndpointAndPassDedicatedRemote(); } diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc -index a9e4dbfd99b56167d05aa6c30c09408036bc897d..1b0f636cc3705eda221389967d9cd3acf563f00d 100644 +index 357dc106e4c53122e87ea09a780f7976ad37f25e..5209b85dc285f5e177377bd06e36b8b175581cbb 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc -@@ -779,6 +779,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) { +@@ -767,6 +767,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) { GetWidget()->GetAssociatedFrameWidget()->SetBackgroundOpaque(opaque); } @@ -51,7 +51,7 @@ index 7944fe64e0da112fc670358b75506bb199bb5e4a..0e3c16c6af2a078943e9f39808134ab2 void SendRendererPreferencesToRenderer( const blink::RendererPreferences& preferences); diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index d97cbb4fd8e12bcbff19bf8cc8378997110c60c0..1041d25d5ef78abdcf7b85fe8457ec2a20e2a759 100644 +index 84899b5208f036bd58ba51513820404b6c5a24b9..87fd5aa4fab7ddd0b444a3c8473ae35066c87054 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -632,8 +632,8 @@ void RenderWidgetHostViewAura::ShowImpl(PageVisibilityState page_visibility) { @@ -80,22 +80,22 @@ index 782bed0fdc08d57eceb059f398f253fab9233b1b..f1ab5b981ea68af1b11313e67f2c5060 // This interface should only be implemented inside content. friend class RenderViewHostImpl; diff --git a/content/test/test_page_broadcast.h b/content/test/test_page_broadcast.h -index 8762811ec25069ddd0c57e3ffb50d158532a39b1..f5cdae891cc3b98371ae18dbc119b5e7f379f2bf 100644 +index 4c8d44cdb2fde8e174b78aee7defb980651da18e..f8bf421b5b32af4cd197cbf23f4bd281c3a12514 100644 --- a/content/test/test_page_broadcast.h +++ b/content/test/test_page_broadcast.h -@@ -54,6 +54,7 @@ class TestPageBroadcast : public blink::mojom::PageBroadcast { - void UpdateCanvasNoiseToken( - std::optional<blink::NoiseToken> canvas_noise_token) override; +@@ -52,6 +52,7 @@ class TestPageBroadcast : public blink::mojom::PageBroadcast { + void UpdateColorProviders( + const blink::ColorProviderColorMaps& color_provider_colors) override; void SetSupportsDraggableRegions(bool supports_draggable_regions) override; + void SetSchedulerThrottling(bool allowed) override {} mojo::AssociatedReceiver<blink::mojom::PageBroadcast> receiver_; }; diff --git a/third_party/blink/public/mojom/page/page.mojom b/third_party/blink/public/mojom/page/page.mojom -index fb846303b126c0bbaa252b8b6c5b9b2971100c62..e6dcf94dcde8515e9cf73656d6c1659492aac4b4 100644 +index b00bc8a8a5044fbf46f627f9db56cea7f09d7ef6..114c3a4522d11c1348f681af500c487ccd97eea9 100644 --- a/third_party/blink/public/mojom/page/page.mojom +++ b/third_party/blink/public/mojom/page/page.mojom -@@ -186,4 +186,7 @@ interface PageBroadcast { +@@ -180,4 +180,7 @@ interface PageBroadcast { // Indicates that the page's main frame should collect draggable regions set // using the app-region CSS property. SetSupportsDraggableRegions(bool supports_draggable_regions); @@ -104,10 +104,10 @@ index fb846303b126c0bbaa252b8b6c5b9b2971100c62..e6dcf94dcde8515e9cf73656d6c16594 + SetSchedulerThrottling(bool allowed); }; diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h -index 11a31c9ed26b5abde0ea812eae6b219340ed711c..a72cf76b820cb86b9495ea147efbdcf53b8a9845 100644 +index 7f995dc1fab7a1b5319f6fe9bb4d37b3851dbf87..58c93c5acf9f63eb3391fafe2904b20284381a85 100644 --- a/third_party/blink/public/web/web_view.h +++ b/third_party/blink/public/web/web_view.h -@@ -366,6 +366,7 @@ class BLINK_EXPORT WebView { +@@ -361,6 +361,7 @@ class BLINK_EXPORT WebView { // Scheduling ----------------------------------------------------------- virtual PageScheduler* Scheduler() const = 0; @@ -116,10 +116,10 @@ index 11a31c9ed26b5abde0ea812eae6b219340ed711c..a72cf76b820cb86b9495ea147efbdcf5 // Visibility ----------------------------------------------------------- diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index 9d1d25758c8f5f7adb613516a87e81c33e31072b..de1c308b599377dd2598a75427347dc5c980fc07 100644 +index 2bb50e492558f0130918717605bf48b8a61f1e14..b50e4805af36aa96c0ce69359adcf1b18d80c62a 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -2501,6 +2501,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( +@@ -2499,6 +2499,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( TRACE_EVENT2("navigation", "WebViewImpl::SetPageLifecycleStateInternal", "old_state", old_state, "new_state", new_state); @@ -130,7 +130,7 @@ index 9d1d25758c8f5f7adb613516a87e81c33e31072b..de1c308b599377dd2598a75427347dc5 bool storing_in_bfcache = new_state->is_in_back_forward_cache && !old_state->is_in_back_forward_cache; bool restoring_from_bfcache = !new_state->is_in_back_forward_cache && -@@ -4018,10 +4022,23 @@ PageScheduler* WebViewImpl::Scheduler() const { +@@ -4007,10 +4011,23 @@ PageScheduler* WebViewImpl::Scheduler() const { return GetPage()->GetPageScheduler(); } @@ -155,10 +155,10 @@ index 9d1d25758c8f5f7adb613516a87e81c33e31072b..de1c308b599377dd2598a75427347dc5 // Do not throttle if the page should be painting. bool is_visible = diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h -index 5dd87ed6a78156cf7d1fc130fc2db6b399227d76..6bd345d2fb854c5d2a79bfcfa9d8618c35bd8489 100644 +index 881e561c0b4c55e30f6b4f69bcbbe092cc449fd1..9afced261ae85244f99dac4372fb7b1c3eabfbaa 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h -@@ -452,6 +452,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, +@@ -447,6 +447,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, LocalDOMWindow* PagePopupWindow() const; PageScheduler* Scheduler() const override; @@ -166,7 +166,7 @@ index 5dd87ed6a78156cf7d1fc130fc2db6b399227d76..6bd345d2fb854c5d2a79bfcfa9d8618c void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state, bool is_initial_state) override; mojom::blink::PageVisibilityState GetVisibilityState() override; -@@ -945,6 +946,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, +@@ -939,6 +940,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, // If true, we send IPC messages when |preferred_size_| changes. bool send_preferred_size_changes_ = false; diff --git a/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch b/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch index 709249b55a4b9..52c006a2fc873 100644 --- a/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch +++ b/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch @@ -8,10 +8,10 @@ WebPreferences of in-process child windows, rather than relying on process-level command line switches, as before. diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc -index 845edd77da72cfe2d9a56e15cf1e50bdd391be49..9b50605b67c0da8692653816c8638ea89561282f 100644 +index 42005e4758187331909b87f82e6e008a03a14f7f..f76615d34483b3485d7729889d0a895d13961f57 100644 --- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc +++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc -@@ -148,6 +148,19 @@ bool StructTraits<blink::mojom::WebPreferencesDataView, +@@ -150,6 +150,19 @@ bool StructTraits<blink::mojom::WebPreferencesDataView, out->v8_cache_options = data.v8_cache_options(); out->record_whole_document = data.record_whole_document(); out->stylus_handwriting_enabled = data.stylus_handwriting_enabled(); @@ -32,7 +32,7 @@ index 845edd77da72cfe2d9a56e15cf1e50bdd391be49..9b50605b67c0da8692653816c8638ea8 out->accelerated_video_decode_enabled = data.accelerated_video_decode_enabled(); diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h -index da99e295dd7c063b5416d310fe91d422e74bf5fb..0c91e14c0fb760dd075f517731d110caa3f7739a 100644 +index c1f0a4cae029527f9ea966b53fea2faa31c4cd90..e2bfc5356fc824b79231775ad85a45c6634093f7 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences.h +++ b/third_party/blink/public/common/web_preferences/web_preferences.h @@ -9,6 +9,7 @@ @@ -43,7 +43,7 @@ index da99e295dd7c063b5416d310fe91d422e74bf5fb..0c91e14c0fb760dd075f517731d110ca #include "build/build_config.h" #include "net/nqe/effective_connection_type.h" #include "third_party/blink/public/common/common_export.h" -@@ -460,6 +461,19 @@ struct BLINK_COMMON_EXPORT WebPreferences { +@@ -461,6 +462,19 @@ struct BLINK_COMMON_EXPORT WebPreferences { bool should_screenshot_on_mainframe_same_doc_navigation = true; #endif // BUILDFLAG(IS_ANDROID) @@ -64,7 +64,7 @@ index da99e295dd7c063b5416d310fe91d422e74bf5fb..0c91e14c0fb760dd075f517731d110ca // chrome, except for the cases where it would require lots of extra work for // the embedder to use the same default value. diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h -index b46fc738d5813a71212c4e1a29a8d08fc15982b3..f65ece291742e9776612cd1e5d2bf2f741c6a400 100644 +index 3ab13439f0e03d1777ca78b638b98978d972bda5..c5f6f203d1ba36c3b1bb213d44b17adc472afbc4 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h +++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h @@ -8,6 +8,7 @@ @@ -75,7 +75,7 @@ index b46fc738d5813a71212c4e1a29a8d08fc15982b3..f65ece291742e9776612cd1e5d2bf2f7 #include "mojo/public/cpp/bindings/struct_traits.h" #include "net/nqe/effective_connection_type.h" #include "third_party/blink/public/common/common_export.h" -@@ -434,6 +435,52 @@ struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::WebPreferencesDataView, +@@ -439,6 +440,52 @@ struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::WebPreferencesDataView, return r.stylus_handwriting_enabled; } @@ -129,7 +129,7 @@ index b46fc738d5813a71212c4e1a29a8d08fc15982b3..f65ece291742e9776612cd1e5d2bf2f7 return r.cookie_enabled; } diff --git a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom -index 03ae611eda0f4b9888c498b89e4b805dbe629268..b96998d728c9b107532b2ec67320367eaa6b1f94 100644 +index 8b8f9837a5efd984ea1bd7b7b0c9462f65f5ac7e..7a3ccc78fc82181e1e9da9004305a827a80ed745 100644 --- a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom +++ b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom @@ -4,6 +4,7 @@ @@ -140,7 +140,7 @@ index 03ae611eda0f4b9888c498b89e4b805dbe629268..b96998d728c9b107532b2ec67320367e import "mojo/public/mojom/base/string16.mojom"; import "skia/public/mojom/skcolor.mojom"; import "third_party/blink/public/mojom/css/preferred_color_scheme.mojom"; -@@ -223,6 +224,19 @@ struct WebPreferences { +@@ -224,6 +225,19 @@ struct WebPreferences { // If true, stylus handwriting recognition to text input will be available in // editable input fields which are non-password type. bool stylus_handwriting_enabled; diff --git a/patches/chromium/blink_local_frame.patch b/patches/chromium/blink_local_frame.patch index c9fb7de66f66b..fe0f6150bd035 100644 --- a/patches/chromium/blink_local_frame.patch +++ b/patches/chromium/blink_local_frame.patch @@ -15,7 +15,7 @@ Refs changes in: This patch reverts the changes to fix associated crashes in Electron. diff --git a/third_party/blink/renderer/core/frame/frame.cc b/third_party/blink/renderer/core/frame/frame.cc -index cdb5b9246087b5678cf6a0f2713f6238dafc13de..7efbe7524c5ddd3785fff0e2d8901f931f024f48 100644 +index 2670ea1361ccd8a9e3bac507e94dd25b7205ecf9..c12f78d925e4ccb4ac2fd3851a9c61e87058dc75 100644 --- a/third_party/blink/renderer/core/frame/frame.cc +++ b/third_party/blink/renderer/core/frame/frame.cc @@ -134,14 +134,6 @@ bool Frame::Detach(FrameDetachType type) { diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index c95e99f8754a9..3659ce4883503 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -33,10 +33,10 @@ index c51468e6fdb46634b5458b387d1c78caf2dd083f..7236611d2a392008f43b1b83ae125e94 "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index cc003098ca1338334bce844d3e82351b573a3b93..ddd737d756776d2200da89924699de5087fe768d 100644 +index c3e8b9a6d64f4c278fc478cbb45c9cec6897faca..03ad5a81382bb01d62bfdc2279670345b37a7089 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4833,7 +4833,7 @@ static_library("browser") { +@@ -4816,7 +4816,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index cc003098ca1338334bce844d3e82351b573a3b93..ddd737d756776d2200da89924699de50 # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 206d205405b06766859abf4f13eb7b65e81667f6..c4138e4c1a03ec6f23a91d19155a70af433a4a89 100644 +index b1fcad8d0580e3e37036599e758a2cb84a6cf055..bcbf93a6229b6358164a0b9a3c8fee14be2e20d4 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7587,9 +7587,12 @@ test("unit_tests") { +@@ -7593,9 +7593,12 @@ test("unit_tests") { "//chrome/notification_helper", ] diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index dd50b491b78cf..e6e1066d5ba25 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,10 +9,10 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index ce1e5c65773a1967bcaa31e5b2572d4e7fa8b148..9d54e7e7ccabad6dfcdc54214683df8b3b414208 100644 +index 289545aae997d5a1458a063e38832484e2f8a11e..5f973dba78748ba2aeaab377534e9866d96a44fe 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -9953,6 +9953,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -9962,6 +9962,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To<Referrer>(), params->frame_name, params->disposition, *params->features, @@ -62,10 +62,10 @@ index 5aa061cd96f291eb955892363180e412c495f1d6..f208b31c5e39cb8c4e5e50ed3dd236bd new_contents_impl, opener, params.target_url, params.referrer.To<Referrer>(), params.disposition, diff --git a/content/common/frame.mojom b/content/common/frame.mojom -index 3ef244ccfe40506e22b5c3d293a25d04e908ddcf..d17fd7226d7f8a585e82a9f155459a6835504be4 100644 +index 599077542beacefc94f9e7ce6167312c9d66aaae..389896afb982dd0fc48274857c18fcd98337b1fc 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom -@@ -658,6 +658,10 @@ struct CreateNewWindowParams { +@@ -653,6 +653,10 @@ struct CreateNewWindowParams { pending_associated_remote<blink.mojom.Widget> widget; pending_associated_receiver<blink.mojom.FrameWidgetHost> frame_widget_host; pending_associated_remote<blink.mojom.FrameWidget> frame_widget; @@ -77,7 +77,7 @@ index 3ef244ccfe40506e22b5c3d293a25d04e908ddcf..d17fd7226d7f8a585e82a9f155459a68 // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 8e4e1a3b7d84803077b0b7719d2c6a87a4ed1d91..de9ae56525931d3497881acf287abb798acc19f5 100644 +index 928667b4308ace9b6b6f7d1a9479a1107b061034..eaaa92a4b6dba03422838b8e83364dc8716ba6db 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc @@ -883,6 +883,8 @@ bool ContentBrowserClient::CanCreateWindow( @@ -90,7 +90,7 @@ index 8e4e1a3b7d84803077b0b7719d2c6a87a4ed1d91..de9ae56525931d3497881acf287abb79 bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 038f760010334a1f27a6e31bdeb87fa691f4cd17..86967a3df04e0ce4f464f399d547ca0252168af0 100644 +index 4432cd1a9b0af50398409dbbcbdad80375f429e9..87c78abf57a26c83b153f2ac978024506a32a909 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -202,6 +202,7 @@ class NetworkService; @@ -170,10 +170,10 @@ index 0c3d4f8ed4df5ca8d9db5424fa2be2d26510c4c9..98492cff13c97388d001fc33cc948261 // typically happens when popups are created. virtual void WebContentsCreated(WebContents* source_contents, diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 9d495e31443cf4c50024b9c892fb7c7d0b40bed0..298387873e7ded5f96c788bc53ad7256a8f5b13e 100644 +index ab58f018ba8e4cee5a2cea45407333902f05f438..30c2972e1fbc21d382304897c542ecd7fa95b896 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -6740,6 +6740,10 @@ WebView* RenderFrameImpl::CreateNewWindow( +@@ -6746,6 +6746,10 @@ WebView* RenderFrameImpl::CreateNewWindow( request.HasUserGesture(), GetWebFrame()->IsAdFrame(), GetWebFrame()->IsAdScriptInStack()); diff --git a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch index 702389f35be10..078beb2b864f4 100644 --- a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch +++ b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch @@ -34,10 +34,10 @@ index bbfac47a74f989482343c222b78f187b70297e4e..3677ca3345fbc775d139684a12fe3624 virtual void DidClearWindowObject() {} virtual void DidChangeScrollOffset() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 7e64e34a2ebd9738d33bfc9cc7fd827b8757037d..6c89f28ff89e9a5019834751acf34e73bcdb4dcb 100644 +index 3f512dcaec9f1d8a1375277ab8c6649d69070a33..45c8978bf9a45c14b15436851cdab9ae3d958f25 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4665,10 +4665,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( +@@ -4671,10 +4671,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( observer.DidInstallConditionalFeatures(context, world_id); } @@ -52,10 +52,10 @@ index 7e64e34a2ebd9738d33bfc9cc7fd827b8757037d..6c89f28ff89e9a5019834751acf34e73 void RenderFrameImpl::DidChangeScrollOffset() { diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index 32dfed04e2fd7cd2e60c7cf145d182f4163feb68..c44c488ef90f4ceaada28666f80a5919fcc0c992 100644 +index b3fd71b237c134853f796a1d8d803e4d28519d53..0b74cee0213daebef1e66d0abebd23787d764997 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -605,7 +605,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -604,7 +604,8 @@ class CONTENT_EXPORT RenderFrameImpl int world_id) override; void DidInstallConditionalFeatures(v8::Local<v8::Context> context, int world_id) override; diff --git a/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch b/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch index 4f894ba097b72..2d5394b17148a 100644 --- a/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch +++ b/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch @@ -10,7 +10,7 @@ Subject: chore: "grandfather in" Electron Views and Delegates 6448510: Lock further access to View::set_owned_by_client(). | https://chromium-review.googlesource.com/c/chromium/src/+/6448510 diff --git a/ui/views/view.h b/ui/views/view.h -index a34494ddd3daf79d12596c56e752692ace0d1ab2..fd4b87226a364b1104b25379f2d87ebeefbb6927 100644 +index a6d23b384136e27eeb8d864af154aa020cab0fb1..bdc88396c84b0cccc2933a19a7772c1483cdb63d 100644 --- a/ui/views/view.h +++ b/ui/views/view.h @@ -81,6 +81,19 @@ class ArcNotificationContentView; diff --git a/patches/chromium/chore_introduce_blocking_api_for_electron.patch b/patches/chromium/chore_introduce_blocking_api_for_electron.patch index 20437f7b8925a..b363b3985a9d9 100644 --- a/patches/chromium/chore_introduce_blocking_api_for_electron.patch +++ b/patches/chromium/chore_introduce_blocking_api_for_electron.patch @@ -7,7 +7,7 @@ This patch comes after Chromium removed the ScopedAllowIO API in favor of explicitly adding ScopedAllowBlocking calls as friends. diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h -index 7739b7379ba67a596ee1ae2c26640f01687121d1..c69779a9e84972f1ef02451328e6eb18ec2d6716 100644 +index 04f3b585ece1ab90d494dbd15874d793f2429771..c659070d53a1bc20f364fc57e79b8c5038691b4f 100644 --- a/base/threading/thread_restrictions.h +++ b/base/threading/thread_restrictions.h @@ -133,6 +133,7 @@ class KeyStorageLinux; @@ -28,7 +28,7 @@ index 7739b7379ba67a596ee1ae2c26640f01687121d1..c69779a9e84972f1ef02451328e6eb18 namespace enterprise_connectors { class LinuxKeyRotationCommand; } // namespace enterprise_connectors -@@ -575,6 +579,7 @@ class BASE_EXPORT ScopedAllowBlocking { +@@ -576,6 +580,7 @@ class BASE_EXPORT ScopedAllowBlocking { friend class ::DesktopNotificationBalloon; friend class ::FirefoxProfileLock; friend class ::GaiaConfig; @@ -36,7 +36,7 @@ index 7739b7379ba67a596ee1ae2c26640f01687121d1..c69779a9e84972f1ef02451328e6eb18 friend class ::ProfileImpl; friend class ::ScopedAllowBlockingForProfile; friend class ::StartupTabProviderImpl; -@@ -617,6 +622,7 @@ class BASE_EXPORT ScopedAllowBlocking { +@@ -618,6 +623,7 @@ class BASE_EXPORT ScopedAllowBlocking { friend class cronet::CronetPrefsManager; friend class crypto::ScopedAllowBlockingForNSS; // http://crbug.com/59847 friend class drive::FakeDriveService; diff --git a/patches/chromium/chore_patch_out_profile_methods.patch b/patches/chromium/chore_patch_out_profile_methods.patch index c4341b254e8c2..dd7a2e7aa1d61 100644 --- a/patches/chromium/chore_patch_out_profile_methods.patch +++ b/patches/chromium/chore_patch_out_profile_methods.patch @@ -84,7 +84,7 @@ index bc0bad82ebcdceadc505e912ff27202b452fefab..6b77c57fccc4619a1df3b4ed661d2bdd ProfileSelection ProfileSelections::GetProfileSelection( diff --git a/chrome/browser/spellchecker/spellcheck_service.cc b/chrome/browser/spellchecker/spellcheck_service.cc -index eba2400655be58628ad1dbf37692a963cc031bf8..02da80b42f936f347c9043f4499d9a324bdf43d2 100644 +index f8a36ced14288698849cd5730309e29d47d3d1d4..97b8fc0f38650e816bcae00e074543766f71e0d0 100644 --- a/chrome/browser/spellchecker/spellcheck_service.cc +++ b/chrome/browser/spellchecker/spellcheck_service.cc @@ -21,8 +21,10 @@ diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index 6a1e4035aedeb..5f88a07df2f0b 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -80,10 +80,10 @@ index 39fa45f0a0f9076bd7ac0be6f455dd540a276512..3d0381d463eed73470b28085830f2a23 content::WebContents* source, const content::OpenURLParams& params, diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index e550b21eba674396ba97b9ec21535964502d1b36..24e13b4f6ab01bdbefba791002edb0a4faf4811a 100644 +index d27effbf90aba2a888f479b6999fd16e58fdbcbf..1fd7f6166efd55ccc74a91763c87b1fe7987aaff 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc -@@ -2369,7 +2369,8 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2376,7 +2376,8 @@ bool Browser::IsWebContentsCreationOverridden( content::mojom::WindowContainerType window_container_type, const GURL& opener_url, const std::string& frame_name, @@ -93,7 +93,7 @@ index e550b21eba674396ba97b9ec21535964502d1b36..24e13b4f6ab01bdbefba791002edb0a4 if (HasActorTask(profile(), opener)) { // If an ExecutionEngine is acting on the opener, prevent it from creating a // new WebContents. We'll instead force the navigation to happen in the same -@@ -2382,7 +2383,7 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2389,7 +2390,7 @@ bool Browser::IsWebContentsCreationOverridden( return (window_container_type == content::mojom::WindowContainerType::BACKGROUND && ShouldCreateBackgroundContents(source_site_instance, opener_url, @@ -103,7 +103,7 @@ index e550b21eba674396ba97b9ec21535964502d1b36..24e13b4f6ab01bdbefba791002edb0a4 WebContents* Browser::CreateCustomWebContents( diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h -index e0d63627518a5e0e1bdef510f3c0d849db4cc0d8..a052d78b6578a1e1fab88e1acafff77e5871c335 100644 +index 46715de09311e36046c9d49e6eb0a6444532f49f..0883f12668347f76d20517df95885b2c73d98598 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -935,8 +935,7 @@ class Browser : public TabStripModelObserver, @@ -159,7 +159,7 @@ index 3bbd4e568ba99245622a96f0801d2b6cd203025f..1e0b7d16b33daed980961dd49c667a3b } content::WebContents* CreateCustomWebContents( diff --git a/components/embedder_support/android/delegate/web_contents_delegate_android.cc b/components/embedder_support/android/delegate/web_contents_delegate_android.cc -index c7eaf8d34ea50ba356ed1997f2fe6477aee9bcb1..acb8b12f0b2796ef836069ce54539e1ac6b66dc5 100644 +index 24f78a1c6b439c2f66683bb43b784f696f9a7419..7a5b6eccffe451787101042673d6efe4456237b4 100644 --- a/components/embedder_support/android/delegate/web_contents_delegate_android.cc +++ b/components/embedder_support/android/delegate/web_contents_delegate_android.cc @@ -210,15 +210,14 @@ bool WebContentsDelegateAndroid::IsWebContentsCreationOverridden( diff --git a/patches/chromium/disable_compositor_recycling.patch b/patches/chromium/disable_compositor_recycling.patch index 1ffdb9bf22b9e..5b97aba2d8ee4 100644 --- a/patches/chromium/disable_compositor_recycling.patch +++ b/patches/chromium/disable_compositor_recycling.patch @@ -6,7 +6,7 @@ Subject: fix: disabling compositor recycling Compositor recycling is useful for Chrome because there can be many tabs and spinning up a compositor for each one would be costly. In practice, Chrome uses the parent compositor code path of browser_compositor_view_mac.mm; the NSView of each tab is detached when it's hidden and attached when it's shown. For Electron, there is no parent compositor, so we're forced into the "own compositor" code path, which seems to be non-optimal and pretty ruthless in terms of the release of resources. Electron has no real concept of multiple tabs per window, so it should be okay to disable this ruthless recycling altogether in Electron. diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index 9a507a70493e5a648a25968f917a7829105fa6d1..596bef745e62f96a25e95d713a1a4d6d30361fac 100644 +index 00f9abc97d2001fc0bd095d2c62097f2ed1ae047..71fb36989aeb2c3232f624501933ed48a50e06cd 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -559,7 +559,11 @@ diff --git a/patches/chromium/disable_hidden.patch b/patches/chromium/disable_hidden.patch index 6a5778486f411..6572cc63d3e77 100644 --- a/patches/chromium/disable_hidden.patch +++ b/patches/chromium/disable_hidden.patch @@ -6,7 +6,7 @@ Subject: disable_hidden.patch Electron uses this to disable background throttling for hidden windows. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 16c3a86ec4543c95d37198cf7c90f8d2285d2337..1c74f5f7de96f5950b7eac3348528970aae7175c 100644 +index 4c3ab7e4a7d35a8933715ae2966768049f28b715..982b5edc933fdf1c4884dd0e0e7b957cee31c5ef 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -841,6 +841,10 @@ void RenderWidgetHostImpl::WasHidden() { @@ -34,7 +34,7 @@ index 2d32d91eb98fe749ae262ba06a1a399813aa7bab..8ebf542046ffba6823804b797e373c80 // |routing_id| must not be IPC::mojom::kRoutingIdNone. // If this object outlives |delegate|, DetachDelegate() must be called when diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index 816bb7c6f1c00c121f66e67d20d709008c33f02f..d97cbb4fd8e12bcbff19bf8cc8378997110c60c0 100644 +index 9b1712382e208ef949616243d6ec1feab46f8fb3..84899b5208f036bd58ba51513820404b6c5a24b9 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -696,7 +696,7 @@ void RenderWidgetHostViewAura::HideImpl() { diff --git a/patches/chromium/dom_storage_limits.patch b/patches/chromium/dom_storage_limits.patch index 23e4b10695b87..2d44ada44adb3 100644 --- a/patches/chromium/dom_storage_limits.patch +++ b/patches/chromium/dom_storage_limits.patch @@ -9,7 +9,7 @@ Previous versions of this patch attempted to circumvent the restriction altogether. However, this can lead to other problems, such as crashing the Dev Tools when attempting to read or write values that exceed -`IPC::Channel::kMaximumMessageSize` (128MiB). +`IPC::mojom::kChannelMaximumMessageSize` (128MiB). Increasing the quota rather than bypassing it reduces the amount of chromium code that needs to be changed for Electron diff --git a/patches/chromium/expose_setuseragent_on_networkcontext.patch b/patches/chromium/expose_setuseragent_on_networkcontext.patch index c928703a00d2f..e041f545be599 100644 --- a/patches/chromium/expose_setuseragent_on_networkcontext.patch +++ b/patches/chromium/expose_setuseragent_on_networkcontext.patch @@ -63,10 +63,10 @@ index 90cf1a70c068771ac98b2d5a283cba5e54c05ff4..0dc8de8d4e37e48cb28d8112c0233ac8 void SetEnableReferrers(bool enable_referrers) override; #if BUILDFLAG(IS_CT_SUPPORTED) diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index 434cd63a228ddbdf2efffc0c6a17ab6376beb19d..75d2ad3ccdf4408a2c40c042be60ebd75c320b90 100644 +index 58c53f7bab65af0b797f502a4633ca47933e26f0..474baf5e969c4397c9f61c9dea7ec2a466510dd8 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -1357,6 +1357,9 @@ interface NetworkContext { +@@ -1352,6 +1352,9 @@ interface NetworkContext { mojo_base.mojom.UnguessableToken throttling_profile_id, pending_receiver<DurableMessageCollector> receiver); diff --git a/patches/chromium/extend_apply_webpreferences.patch b/patches/chromium/extend_apply_webpreferences.patch index faf0c635ad23f..a1dc40335316d 100644 --- a/patches/chromium/extend_apply_webpreferences.patch +++ b/patches/chromium/extend_apply_webpreferences.patch @@ -15,10 +15,10 @@ Ideally we could add an embedder observer pattern here but that can be done in future work. diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index de1c308b599377dd2598a75427347dc5c980fc07..1b6bf9c45f70b904b4f5648a04067fe372d88f6c 100644 +index b50e4805af36aa96c0ce69359adcf1b18d80c62a..5379c42a81f231592bd8a0dc02b05c67960bcb86 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -1901,6 +1901,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, +@@ -1899,6 +1899,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, #if BUILDFLAG(IS_MAC) web_view_impl->SetMaximumLegibleScale( prefs.default_maximum_page_scale_factor); diff --git a/patches/chromium/feat_add_data_parameter_to_processsingleton.patch b/patches/chromium/feat_add_data_parameter_to_processsingleton.patch index 0a804cbcb1539..d0f6a882fc05d 100644 --- a/patches/chromium/feat_add_data_parameter_to_processsingleton.patch +++ b/patches/chromium/feat_add_data_parameter_to_processsingleton.patch @@ -180,7 +180,7 @@ index 08cbe32a258bf478f1da0a07064d3e9ef14c44a5..b9f2a43cb90fac4b031a4b4da38d6435 if (!WriteToSocket(socket.fd(), to_send.data(), to_send.length())) { // Try to kill the other process, because it might have been dead. diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc -index 64ebf49c0d1b6396d1cfbe3bf91480f61b47688d..bec94d4039379400ae8b00f1adbbb16a02ccbac0 100644 +index 8bff42918d0780b3c89ad06886e0853a8e5b9052..3e89d1333e97ca3e32807a52612e0c3e83c83b88 100644 --- a/chrome/browser/process_singleton_win.cc +++ b/chrome/browser/process_singleton_win.cc @@ -81,10 +81,12 @@ BOOL CALLBACK BrowserWindowEnumeration(HWND window, LPARAM param) { @@ -258,11 +258,11 @@ index 64ebf49c0d1b6396d1cfbe3bf91480f61b47688d..bec94d4039379400ae8b00f1adbbb16a - switch (AttemptToNotifyRunningChrome(remote_window_)) { + switch (AttemptToNotifyRunningChrome(remote_window_, additional_data_)) { - case NotifyChromeResult::NOTIFY_SUCCESS: + case NotifyChromeResult::kSuccess: return PROCESS_NOTIFIED; - case NotifyChromeResult::NOTIFY_FAILED: + case NotifyChromeResult::kFailed: diff --git a/chrome/browser/win/chrome_process_finder.cc b/chrome/browser/win/chrome_process_finder.cc -index 58a4c5adfda49fb4bd1b5351bd02d358946043bd..adaa070eb0f3cf8f771b57743a7436fd48a1e576 100644 +index 594f3bc08a4385c177fb488123cef79448e94850..5a1dde19a4bc2bf728eba4c738f831c3e5b73942 100644 --- a/chrome/browser/win/chrome_process_finder.cc +++ b/chrome/browser/win/chrome_process_finder.cc @@ -39,7 +39,9 @@ HWND FindRunningChromeWindow(const base::FilePath& user_data_dir) { @@ -303,7 +303,7 @@ index 58a4c5adfda49fb4bd1b5351bd02d358946043bd..adaa070eb0f3cf8f771b57743a7436fd // window (otherwise it will just flash in the taskbar). ::AllowSetForegroundWindow(process_id); diff --git a/chrome/browser/win/chrome_process_finder.h b/chrome/browser/win/chrome_process_finder.h -index 91e5e623840b9912bd05d024c12e3eb3f1ba2f53..63b5b10013c96dea4e77e5e56a060973a1752faa 100644 +index 62e232f41189a557534e0b01d912469b2ca26148..3a4dfb027cdc690ee7561fc8b632f35cb6b8f4be 100644 --- a/chrome/browser/win/chrome_process_finder.h +++ b/chrome/browser/win/chrome_process_finder.h @@ -7,6 +7,7 @@ diff --git a/patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch b/patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch index 293ac9ab1ff7d..4d46496656b44 100644 --- a/patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch +++ b/patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch @@ -17,13 +17,13 @@ which removed range-requests-supported on non-http protocols. See https://issues for more information. diff --git a/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc b/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc -index 23d5e86aad9509159c74fef32419e26ca68b2e4c..767e6b7e4c85f9f2fafac282c4ebc6ba80e52528 100644 +index d1565bfe05342915d516d9c46eb7c4922c361b22..a5f35e7782c047b147458e569924de0fd30db7ce 100644 --- a/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc +++ b/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc @@ -11,8 +11,10 @@ #include "base/containers/adapters.h" #include "base/location.h" - #include "base/memory/raw_ptr.h" + #include "base/memory/raw_span.h" +#include "base/no_destructor.h" #include "base/numerics/safe_conversions.h" #include "base/task/single_thread_task_runner.h" @@ -42,7 +42,7 @@ index 23d5e86aad9509159c74fef32419e26ca68b2e4c..767e6b7e4c85f9f2fafac282c4ebc6ba class MultiBufferDataSource::ReadOperation { public: ReadOperation() = delete; -@@ -143,13 +149,29 @@ MultiBufferDataSource::~MultiBufferDataSource() { +@@ -136,13 +142,29 @@ MultiBufferDataSource::~MultiBufferDataSource() { DCHECK(render_task_runner_->BelongsToCurrentThread()); } @@ -74,10 +74,10 @@ index 23d5e86aad9509159c74fef32419e26ca68b2e4c..767e6b7e4c85f9f2fafac282c4ebc6ba void MultiBufferDataSource::SetReader( diff --git a/third_party/blink/renderer/platform/media/multi_buffer_data_source.h b/third_party/blink/renderer/platform/media/multi_buffer_data_source.h -index 8c92f1c0c5028069cdad967b5be2bccf8005ed43..8b49dc182296f7f277981aed29b58947fb0980cb 100644 +index 5100bd21163f9ceadb728ed5306dcf8320e528a8..c2ee03ca6a75a2fef1ce778e663a74bda608acb4 100644 --- a/third_party/blink/renderer/platform/media/multi_buffer_data_source.h +++ b/third_party/blink/renderer/platform/media/multi_buffer_data_source.h -@@ -17,6 +17,7 @@ +@@ -18,6 +18,7 @@ #include "media/base/data_source.h" #include "media/base/ranges.h" #include "media/base/tuneable.h" @@ -85,7 +85,7 @@ index 8c92f1c0c5028069cdad967b5be2bccf8005ed43..8b49dc182296f7f277981aed29b58947 #include "third_party/blink/renderer/platform/media/url_index.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/vector.h" -@@ -34,6 +35,8 @@ namespace blink { +@@ -35,6 +36,8 @@ namespace blink { class BufferedDataSourceHost; class MultiBufferReader; @@ -94,7 +94,7 @@ index 8c92f1c0c5028069cdad967b5be2bccf8005ed43..8b49dc182296f7f277981aed29b58947 // A data source capable of loading URLs and buffering the data using an // in-memory sliding window. // -@@ -63,6 +66,8 @@ class PLATFORM_EXPORT MultiBufferDataSource +@@ -64,6 +67,8 @@ class PLATFORM_EXPORT MultiBufferDataSource return url_data_->mime_type(); } diff --git a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch index a0eb4a81f5823..726346f3033cd 100644 --- a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch +++ b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch @@ -391,7 +391,7 @@ index 225e017909b8869231b870eaaf161a0b5e93e2a0..846a5251429630b8528a84a3d67ed56c if (schemes.allow_non_standard_schemes_in_origins) url::EnableNonStandardSchemesForAndroidWebView(); diff --git a/content/public/common/content_client.h b/content/public/common/content_client.h -index 70a23343d5815db0722e2977d966219b824a83b1..85ac45c1868832c47460108f93d86a51118daa53 100644 +index c81434acc7cad0f6aa2e807c3c4037052863179e..d0da89f78308fc95778a5ce705a43f03c9c5813f 100644 --- a/content/public/common/content_client.h +++ b/content/public/common/content_client.h @@ -139,6 +139,9 @@ class CONTENT_EXPORT ContentClient { @@ -405,7 +405,7 @@ index 70a23343d5815db0722e2977d966219b824a83b1..85ac45c1868832c47460108f93d86a51 std::vector<std::string> extension_schemes; // Registers a URL scheme with a predefined default custom handler. diff --git a/url/url_util.cc b/url/url_util.cc -index 90c06884c9c7e91a706d58917b38c0919e546c1b..f3aa192ac229423fa0b9c8caa8f7b1df18cc45ec 100644 +index 039d39d55ff6984df478d62c40e852d60ab35c21..175abe714683841f046c7516c11e17ed24b225ab 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -136,6 +136,9 @@ struct SchemeRegistry { @@ -418,7 +418,7 @@ index 90c06884c9c7e91a706d58917b38c0919e546c1b..f3aa192ac229423fa0b9c8caa8f7b1df // Schemes with a predefined default custom handler. std::vector<SchemeWithHandler> predefined_handler_schemes; -@@ -677,6 +680,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() { +@@ -676,6 +679,15 @@ const std::vector<std::string>& GetEmptyDocumentSchemes() { return GetSchemeRegistry().empty_document_schemes; } diff --git a/patches/chromium/feat_allow_embedders_to_add_observers_on_created_hunspell.patch b/patches/chromium/feat_allow_embedders_to_add_observers_on_created_hunspell.patch index 6ba0b7d2a0f45..bb455382c6ec1 100644 --- a/patches/chromium/feat_allow_embedders_to_add_observers_on_created_hunspell.patch +++ b/patches/chromium/feat_allow_embedders_to_add_observers_on_created_hunspell.patch @@ -7,10 +7,10 @@ Subject: feat: allow embedders to add observers on created hunspell This patch is used by Electron to implement spellchecker events. diff --git a/chrome/browser/spellchecker/spellcheck_service.cc b/chrome/browser/spellchecker/spellcheck_service.cc -index dbc05afd488118396c191c61a37692aba1fe858b..eba2400655be58628ad1dbf37692a963cc031bf8 100644 +index 592ef6e731e0539471408ad0ce5f089bfe2549be..f8a36ced14288698849cd5730309e29d47d3d1d4 100644 --- a/chrome/browser/spellchecker/spellcheck_service.cc +++ b/chrome/browser/spellchecker/spellcheck_service.cc -@@ -476,6 +476,8 @@ void SpellcheckService::LoadDictionaries() { +@@ -477,6 +477,8 @@ void SpellcheckService::LoadDictionaries() { std::make_unique<SpellcheckHunspellDictionary>( dictionary, platform_spellcheck_language, context_, this)); hunspell_dictionaries_.back()->AddObserver(this); @@ -19,7 +19,7 @@ index dbc05afd488118396c191c61a37692aba1fe858b..eba2400655be58628ad1dbf37692a963 hunspell_dictionaries_.back()->Load(); } -@@ -526,6 +528,20 @@ bool SpellcheckService::IsSpellcheckEnabled() const { +@@ -527,6 +529,20 @@ bool SpellcheckService::IsSpellcheckEnabled() const { (!hunspell_dictionaries_.empty() || enable_if_uninitialized); } diff --git a/patches/chromium/feat_configure_launch_options_for_service_process.patch b/patches/chromium/feat_configure_launch_options_for_service_process.patch index bba63f7e1ff59..fa6bab52636a3 100644 --- a/patches/chromium/feat_configure_launch_options_for_service_process.patch +++ b/patches/chromium/feat_configure_launch_options_for_service_process.patch @@ -19,7 +19,7 @@ to STDOUT_FILENO/STD_OUTPUT_HANDLE and STDERR_FILENO/STD_ERROR_HANDLE allowing t parent process to read from the pipe. diff --git a/content/browser/child_process_launcher.h b/content/browser/child_process_launcher.h -index dbbf190cbbb24d07b338a991b2432aae70247b05..66d114b5cf1fcf8237a49ae6e61c3b0580c735bb 100644 +index 6ca293e617f98b814484a012d74e3529e670ec01..d472adb01f934c12670d96b99cd4fbe8aaa16c21 100644 --- a/content/browser/child_process_launcher.h +++ b/content/browser/child_process_launcher.h @@ -33,6 +33,7 @@ @@ -30,7 +30,7 @@ index dbbf190cbbb24d07b338a991b2432aae70247b05..66d114b5cf1fcf8237a49ae6e61c3b05 #endif #if BUILDFLAG(IS_POSIX) -@@ -197,7 +198,10 @@ struct ChildProcessLauncherFileData { +@@ -194,7 +195,10 @@ struct ChildProcessLauncherFileData { delete; ~ChildProcessLauncherFileData(); @@ -42,7 +42,7 @@ index dbbf190cbbb24d07b338a991b2432aae70247b05..66d114b5cf1fcf8237a49ae6e61c3b05 // Files opened by the browser and passed as corresponding file descriptors // in the child process. If a FilePath is provided, the file will be opened // and the descriptor cached for future process launches. If a ScopedFD is -@@ -212,6 +216,15 @@ struct ChildProcessLauncherFileData { +@@ -209,6 +213,15 @@ struct ChildProcessLauncherFileData { std::map<std::string, std::variant<base::FilePath, base::ScopedFD>> files_to_preload; #endif diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index fb6dbe4d10a5c..4d7cec2a24a8f 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -20,7 +20,7 @@ making three primary changes to Blink: * Controls whether the CSS rule is available. diff --git a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom -index cd3f33a59c40705ee5aa0869c298dc11b3caac21..803212c1b7662f9b78f4e1f7a61acec129f54280 100644 +index 555b4c5dfa44a40cd2c558241d030cca6d9ae9fe..ff77a0ea897d673b21ec57f443b851ec5c52c67e 100644 --- a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom +++ b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom @@ -48,6 +48,7 @@ enum CSSSampleId { @@ -45,10 +45,10 @@ index e189d584f05f2ce6354c03a9b19f56985df8a15e..41b430e8f2416be098494f5c49fb97ca 'internal-forced-visited-'): internal_visited_order = 0 diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 -index 9bf6537f620594d6fe1e14e2ef32bc20b6127b3d..e90341e484c40df23974c17de8f5212b0de26029 100644 +index b22689b90a99b843e5d44738a7f434c958086867..4ee7e10c46ddf11cb665c54a3addf5e17ff72a7f 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5 -@@ -9057,6 +9057,26 @@ +@@ -9163,6 +9163,26 @@ property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], }, @@ -76,7 +76,7 @@ index 9bf6537f620594d6fe1e14e2ef32bc20b6127b3d..e90341e484c40df23974c17de8f5212b { name: "-internal-visited-color", diff --git a/third_party/blink/renderer/core/css/css_property_equality.cc b/third_party/blink/renderer/core/css/css_property_equality.cc -index 64a361128ec56be0382c72ef40db1bd01cb8d9a0..1dc51536f5860448dda9adc2b1129f53efbbd595 100644 +index 75ca85adcfaab9d64aa98d539a886bf76ee45727..4f96e8638f254fb493a026984a43869d5ac3485c 100644 --- a/third_party/blink/renderer/core/css/css_property_equality.cc +++ b/third_party/blink/renderer/core/css/css_property_equality.cc @@ -354,6 +354,8 @@ bool CSSPropertyEquality::PropertiesEqual(const PropertyHandle& property, @@ -89,10 +89,10 @@ index 64a361128ec56be0382c72ef40db1bd01cb8d9a0..1dc51536f5860448dda9adc2b1129f53 return a.EmptyCells() == b.EmptyCells(); case CSSPropertyID::kFill: diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -index c818580d191226b88dbac41d4eabbabf0b6035d9..c91591362e5b5fce9a383c07270f3c5e62771fe2 100644 +index 3a793e1450ec1df6e6d9c86c9973a93c62fc3452..5147753fb6ddb43a4218eeb1243e70efea190618 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -@@ -12521,5 +12521,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( +@@ -12674,5 +12674,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( CSSValueID::kNone>(stream); } @@ -201,10 +201,10 @@ index 0802c73aa4aaf4e1fb5efd367758f19c36691f71..5f06c0af277a7c937e694470beac707a return result; } diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn -index d7a67479b6140a407a9097b189cdf874c68f7dea..ab707c142986b6f9ee8c0e28064116746f1db248 100644 +index b8c29abdeb33dc26de820d5eaa78eced73f83921..ae154954c7b5e6f7c492a9d5eaef4b67e4dc97e9 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn -@@ -1668,6 +1668,8 @@ component("platform") { +@@ -1669,6 +1669,8 @@ component("platform") { "widget/widget_base.h", "widget/widget_base_client.h", "windows_keyboard_codes.h", @@ -312,7 +312,7 @@ index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index 43474abcc45706874b4d2733bff468b2b79f5d0f..e8e341a58cb86526361d57c5d4753f76bfac5de6 100644 +index 973b8fbfe2d7ceb8953ce52a0d1013197026f613..885ea984ee2c148d056e0f4354b03a3855ba1f3a 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch index 152516e9387d0..0cd45ec55b8f7 100644 --- a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch +++ b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch @@ -90,7 +90,7 @@ index df9bd2130004821582903699aac1b38403c785a6..8b10c16a10119f2628300b3c52cca0fe // when it receives the AcceptCHFrame. EnabledClientHints? enabled_client_hints; diff --git a/services/network/public/mojom/url_response_head.mojom b/services/network/public/mojom/url_response_head.mojom -index 96fe8a372fa6a166db928c61b2c983b86a74b1a3..2a10810d50d083ab0a7340757d544a40484a4b7e 100644 +index 13a211107294e856616d1626fa1dc9c79eb5646c..549a36886d665c1a8100f09b7a86c8dc13c80e84 100644 --- a/services/network/public/mojom/url_response_head.mojom +++ b/services/network/public/mojom/url_response_head.mojom @@ -14,6 +14,7 @@ import "services/network/public/mojom/encoded_body_length.mojom"; @@ -112,7 +112,7 @@ index 96fe8a372fa6a166db928c61b2c983b86a74b1a3..2a10810d50d083ab0a7340757d544a40 string mime_type; diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc -index 622190e414ef1b4f3910ab09c99e7e27e15e5693..57f1532901e4ba4d1e71c38e232a693b3af9da44 100644 +index 132a0cf07682e68b8f188c265dd7e11fe66f2641..cd73879c90c20c225f7c178c6c7f2aff22648dfb 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc @@ -406,6 +406,9 @@ URLLoader::URLLoader( @@ -134,7 +134,7 @@ index 622190e414ef1b4f3910ab09c99e7e27e15e5693..57f1532901e4ba4d1e71c38e232a693b url_request_->SetResponseHeadersCallback(base::BindRepeating( &URLLoader::SetRawResponseHeaders, base::Unretained(this))); } -@@ -1164,6 +1167,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) { +@@ -1157,6 +1160,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) { } response_ = BuildResponseHead(); @@ -155,10 +155,10 @@ index 622190e414ef1b4f3910ab09c99e7e27e15e5693..57f1532901e4ba4d1e71c38e232a693b ad_auction_event_record_request_helper_.HandleResponse( diff --git a/services/network/url_loader.h b/services/network/url_loader.h -index 09c035a73fea5a328193c67a7906d3e8b455d619..1c1e59764fa6a701f61765060428f811029b3d6e 100644 +index d78b426e45a805ce03ec9ad6e160995f18d6ff24..26d998bdf534c5aa85dcef75f2df0a4f39296bfb 100644 --- a/services/network/url_loader.h +++ b/services/network/url_loader.h -@@ -622,6 +622,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader +@@ -623,6 +623,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader std::unique_ptr<ResourceScheduler::ScheduledResourceRequest> resource_scheduler_request_handle_; diff --git a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch index 7f34151a24a68..deb4a0700b58c 100644 --- a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch +++ b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch @@ -32,7 +32,7 @@ index c9b607c9bd09d43099a1704d5d4139c64e4beac4..18ad7ed73b0ed4de158519c01342f0bf break; } diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc -index 2011a912add2bbd74129e7ecad9ca6f5bade24ee..87dc1b64e3cedf6d59d8ab2dc811bf8300193bdc 100644 +index eeacd30992233f44f8972f242f37637cb240dc06..e56096991dfbffa3a16aa3aca602b59fbd48a4d5 100644 --- a/content/browser/permissions/permission_controller_impl.cc +++ b/content/browser/permissions/permission_controller_impl.cc @@ -94,6 +94,7 @@ PermissionToSchedulingFeature(PermissionType permission_name) { diff --git a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch index 8fc0e9d0dbee4..dd68d9bfeb562 100644 --- a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch +++ b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch @@ -57,7 +57,7 @@ index 2239b085ac7fd87fe06aef1001551f8afe8e21e4..9ead3ab0755fe5c3500893325f0597e0 gfx::Rect window_bounds_before_fullscreen_; diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -index ae113be147f5bfe9d6218a20495897600cc5299d..cb67460205f4db04a3256151d49a2713688c7627 100644 +index d2204fd2b737f7f3e146cb1be80c3be6bfce8cd4..9064b3d019aca6e8b77b10c3f0d0447b52f5245a 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm @@ -467,6 +467,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, diff --git a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch index c6be33e90620d..292fef0cb1547 100644 --- a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch +++ b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch @@ -28,10 +28,10 @@ The patch should be removed in favor of either: Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397. diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index 3624c9c96f3ac526e99fb09c378144439c707442..fd818f40e9c3e1efe15dcbb369270a27e2f50483 100644 +index c4a2394c13e549d6997222910f1a8d150434c11d..68da5f9629d071b9ef70341592ea50830dd8a6a0 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc -@@ -11466,6 +11466,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { +@@ -11453,6 +11453,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { target_rph_id); } @@ -44,7 +44,7 @@ index 3624c9c96f3ac526e99fb09c378144439c707442..fd818f40e9c3e1efe15dcbb369270a27 // origin of |common_params.url| and/or |common_params.initiator_origin|. url::Origin resolved_origin = url::Origin::Resolve( diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc -index 347137f6e28054860d3616a8559c4e38374465e6..546044c8b2479f601f6620617f902d3899b5d28c 100644 +index 4fd00e73d1805a8579f8b762fe4f105759df8f14..2b5fefefb928d91c22c4e9fbd219a54801357bac 100644 --- a/third_party/blink/renderer/core/loader/document_loader.cc +++ b/third_party/blink/renderer/core/loader/document_loader.cc @@ -2324,6 +2324,10 @@ Frame* DocumentLoader::CalculateOwnerFrame() { diff --git a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch index 670f7c0db58f3..45f794fb675a8 100644 --- a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch +++ b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch @@ -9,7 +9,7 @@ to support content settings UI. The support pulls in chrome content settings and UI code which are not valid in the scope of Electron. diff --git a/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc b/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc -index de8cfaabed0e4ed3db9b55729f7ea22014f63dd2..45df203c236ed0f36f079ad0dcbe98e9fc177b08 100644 +index 0447540c064d7234775e8faf13718d9b786c9395..2a41ce63b49e905128a804da579cf1749cc17c37 100644 --- a/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc +++ b/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc @@ -6,6 +6,7 @@ @@ -64,8 +64,8 @@ index de8cfaabed0e4ed3db9b55729f7ea22014f63dd2..45df203c236ed0f36f079ad0dcbe98e9 +#if !BUILDFLAG(IS_ANDROID) && BUILDFLAG(GOOGLE_CHROME_BRANDING) // Always show document picture-in-picture in a new window. When this is // not opened via the AutoPictureInPictureTabHelper, focus the window. - params.window_action = ShouldFocusPictureInPictureWindow(params) -@@ -679,6 +684,7 @@ PictureInPictureWindowManager::GetOverlayView( + params.window_action = +@@ -680,6 +685,7 @@ PictureInPictureWindowManager::GetOverlayView( return nullptr; } @@ -73,7 +73,7 @@ index de8cfaabed0e4ed3db9b55729f7ea22014f63dd2..45df203c236ed0f36f079ad0dcbe98e9 // It would be nice to create this in `EnterPictureInPicture*`, but detecting // auto-pip while pip is in the process of opening doesn't work. // -@@ -717,6 +723,8 @@ PictureInPictureWindowManager::GetOverlayView( +@@ -718,6 +724,8 @@ PictureInPictureWindowManager::GetOverlayView( } return overlay_view; diff --git a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch index 01b434713291c..637e601bfabd5 100644 --- a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch +++ b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch @@ -9,10 +9,10 @@ focus node change via TextInputManager. chromium-bug: https://crbug.com/1369605 diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index 1041d25d5ef78abdcf7b85fe8457ec2a20e2a759..f91f346c93749ff77844143b53d27d14735a6a06 100644 +index 87fd5aa4fab7ddd0b444a3c8473ae35066c87054..6edf04acfaea8029e7dd1a573942cdd0ecd610c3 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -3332,6 +3332,12 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( +@@ -3345,6 +3345,12 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( } } diff --git a/patches/chromium/fix_properly_honor_printing_page_ranges.patch b/patches/chromium/fix_properly_honor_printing_page_ranges.patch index 3fc0ce71b2f48..8194b41fb0de8 100644 --- a/patches/chromium/fix_properly_honor_printing_page_ranges.patch +++ b/patches/chromium/fix_properly_honor_printing_page_ranges.patch @@ -25,10 +25,10 @@ index 8be4ca70ff71cfc33cd812ec0cc9ae8155538532..f7985331838387232b27e557e4351134 // Returns true if duplex mode is set. bool SetDuplexModeInPrintSettings(mojom::DuplexMode mode); diff --git a/printing/printing_context_mac.mm b/printing/printing_context_mac.mm -index b504350cb53273d1db7204771ae080647fe6b878..8fdf6a14d0913aca8f14c412c4afae3ad7ec37e5 100644 +index a8afc92f4894f32774573920271f1eb7c47822c2..963ad79fb4b46e048a36e1b7e696f7e0d26ed151 100644 --- a/printing/printing_context_mac.mm +++ b/printing/printing_context_mac.mm -@@ -522,7 +522,8 @@ bool IsIppColorModelColorful(mojom::ColorModel color_model) { +@@ -544,7 +544,8 @@ bool IsIppColorModelColorful(mojom::ColorModel color_model) { !SetCollateInPrintSettings(settings_->collate()) || !SetDuplexModeInPrintSettings(settings_->duplex_mode()) || !SetOutputColor(static_cast<int>(settings_->color())) || @@ -38,7 +38,7 @@ index b504350cb53273d1db7204771ae080647fe6b878..8fdf6a14d0913aca8f14c412c4afae3a return OnError(); } } -@@ -675,6 +676,22 @@ bool IsIppColorModelColorful(mojom::ColorModel color_model) { +@@ -697,6 +698,22 @@ bool IsIppColorModelColorful(mojom::ColorModel color_model) { return PMSetCopies(print_settings, copies, false) == noErr; } diff --git a/patches/chromium/fix_restore_original_resize_performance_on_macos.patch b/patches/chromium/fix_restore_original_resize_performance_on_macos.patch index e263ff13f990f..a6c2b8dd4d6fe 100644 --- a/patches/chromium/fix_restore_original_resize_performance_on_macos.patch +++ b/patches/chromium/fix_restore_original_resize_performance_on_macos.patch @@ -11,7 +11,7 @@ This patch should be upstreamed as a conditional revert of the logic in desktop vs mobile runtimes. i.e. restore the old logic only on desktop platforms diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index d197909a774d78aa33d6aa4b67ced27973d03331..4708741ea709c9dbdb1f88503562f0a4891b3465 100644 +index f28d6f919b5c6aca87c3feb701967a255c45d7db..2fa9876286ecda6a60a2c1970896cb275bbd7ab9 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -2156,9 +2156,8 @@ RenderWidgetHostImpl::GetWidgetInputHandler() { diff --git a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch index 4941eb3b6b390..37e1e45670859 100644 --- a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch +++ b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch @@ -215,10 +215,10 @@ index 865bb234bce920120dd8a78f701a598fe38388c7..f052ea9f89abffde2345d398eb6d683d mojom::blink::WantResultOption::kWantResult, wait_for_promise); } diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -index 3b5083071269dea475c18165ebbc5db46520e640..838838d2065c2e22661f3c83b8e18480cce7fa41 100644 +index 6566e16a08dfcb02cd17a18f627c3ad425485c15..10fe6ab8e8f0fce54c00aec08325f74d0ca7c25c 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -@@ -1127,14 +1127,15 @@ void WebLocalFrameImpl::RequestExecuteScript( +@@ -1128,14 +1128,15 @@ void WebLocalFrameImpl::RequestExecuteScript( mojom::blink::EvaluationTiming evaluation_timing, mojom::blink::LoadEventBlockingOption blocking_option, WebScriptExecutionCallback callback, diff --git a/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch b/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch index ff76857574dc7..5f9902240cafc 100644 --- a/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch +++ b/patches/chromium/fix_use_delegated_generic_capturer_when_available.patch @@ -15,10 +15,10 @@ capturer was window or screen-specific, as the IDs remain valid for generic capturer as well. diff --git a/content/browser/media/capture/desktop_capture_device.cc b/content/browser/media/capture/desktop_capture_device.cc -index e880eb61f6cbbb6b3cb9e0262981457e77360e5b..e69e25b301deb94216397badadc333aaf10af3b5 100644 +index 24eac68b596bc11af617d1a27b20d3e8e7ab742b..ac439cbae8cb45f8f7f423aa09651109b4d874fe 100644 --- a/content/browser/media/capture/desktop_capture_device.cc +++ b/content/browser/media/capture/desktop_capture_device.cc -@@ -976,9 +976,16 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( +@@ -1007,9 +1007,16 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( switch (source.type) { case DesktopMediaID::TYPE_SCREEN: { @@ -38,7 +38,7 @@ index e880eb61f6cbbb6b3cb9e0262981457e77360e5b..e69e25b301deb94216397badadc333aa if (screen_capturer && screen_capturer->SelectSource(source.id)) { capturer = std::make_unique<webrtc::DesktopAndCursorComposer>( std::move(screen_capturer), options); -@@ -995,8 +1002,15 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( +@@ -1026,8 +1033,15 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( } case DesktopMediaID::TYPE_WINDOW: { diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index 1b2814a4baae1..43fdc2f99f560 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -20,7 +20,7 @@ index 53bbf0174048d62b252b797b06695e6290273e80..4350b57ebf424e392c54dd2b54e62690 } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 86967a3df04e0ce4f464f399d547ca0252168af0..c5affc638d982da531e47037b7f4df08c2960fe1 100644 +index 87c78abf57a26c83b153f2ac978024506a32a909..57b120cdb13b099f3ed960a3b136446f9c7d8f69 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -340,6 +340,11 @@ class CONTENT_EXPORT ContentBrowserClient { diff --git a/patches/chromium/gritsettings_resource_ids.patch b/patches/chromium/gritsettings_resource_ids.patch index b47c339c5ab10..3dce6865e0031 100644 --- a/patches/chromium/gritsettings_resource_ids.patch +++ b/patches/chromium/gritsettings_resource_ids.patch @@ -6,10 +6,10 @@ Subject: gritsettings_resource_ids.patch Add electron resources file to the list of resource ids generation. diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec -index aeb9f8b8eaf68c076348278f6a8b394cae2ef827..edfddee6f923b86fae535dbde1ce886b61c5510f 100644 +index 57ee47577331f6f424d7fa775b5dd9a0fb4b093d..22f5d6c58b80c41b805d54b0f1e4798becfe7a4d 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec -@@ -1597,6 +1597,11 @@ +@@ -1601,6 +1601,11 @@ "messages": [10120], }, diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index ec27e06dc08f7..e17b740920c6c 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -35,7 +35,7 @@ system font by checking if it's kCTFontPriorityAttribute is set to system priority. diff --git a/base/BUILD.gn b/base/BUILD.gn -index 7aa2eeb7769e7be0d58f03d35445e3b5564e2718..af777c45221b5db1b2f5699101ad61eed99fc40e 100644 +index 2a127468d8fcb1d24c2e05ce0e54528386686dff..430ceff387516f71fac947017df1e45e4929f164 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -1069,6 +1069,7 @@ component("base") { @@ -547,7 +547,7 @@ index 010c713090e5038dc90db131c8f621422d30c03b..20c35e887a0496ee609c077e3b0494bd void ForwardKeyboardEvent(const input::NativeWebKeyboardEvent& key_event, diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -index e51fd827f7afc01a5189737f86a2414627a6546e..bb50f03ba5622c2bfb96bc75d145f471a920c3bf 100644 +index 6f3496b2541fa21fd0bba1d95026eab30e3ab96d..ef481cd946a15f5eaba928fa4e720e6c42556a93 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -34,6 +34,7 @@ @@ -581,10 +581,10 @@ index e51fd827f7afc01a5189737f86a2414627a6546e..bb50f03ba5622c2bfb96bc75d145f471 return kAttributes; } diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index 4c555d3c077216fd25d45b5f9727ff3e20b80e83..648cfefa2cdf87524dc4bb12f8d8b37419921ef9 100644 +index 4d4d187ad8c62c4e18454b385c8003a5c478d3ad..20c94074e61cffcf2806fa6b713b0603631f98f8 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn -@@ -344,6 +344,7 @@ source_set("browser") { +@@ -343,6 +343,7 @@ source_set("browser") { "//ui/webui/resources", "//v8", "//v8:v8_version", @@ -627,7 +627,7 @@ index 29a5a99fa2c8e90812bd7ff40b153ead807bdbef..c8683c70f8cabfa89c95c28dc5fe59f4 // Used to force the NSApplication's focused accessibility element to be the // content::BrowserAccessibilityCocoa accessibility tree when the NSView for diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index ea86cb14edf163b02a2b0fda0ab3fb6245edd717..9a507a70493e5a648a25968f917a7829105fa6d1 100644 +index 503af3ee51ac6058a803a10e7c9cfea985866188..00f9abc97d2001fc0bd095d2c62097f2ed1ae047 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -52,6 +52,7 @@ @@ -649,7 +649,7 @@ index ea86cb14edf163b02a2b0fda0ab3fb6245edd717..9a507a70493e5a648a25968f917a7829 // Reset `ns_view_` before resetting `remote_ns_view_` to avoid dangling // pointers. `ns_view_` gets reinitialized later in this method. -@@ -1654,10 +1657,12 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1655,10 +1658,12 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, gfx::NativeViewAccessible RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() { @@ -662,7 +662,7 @@ index ea86cb14edf163b02a2b0fda0ab3fb6245edd717..9a507a70493e5a648a25968f917a7829 return gfx::NativeViewAccessible([GetInProcessNSView() window]); } -@@ -1709,9 +1714,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1710,9 +1715,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, } void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) { @@ -674,7 +674,7 @@ index ea86cb14edf163b02a2b0fda0ab3fb6245edd717..9a507a70493e5a648a25968f917a7829 } bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame( -@@ -2214,20 +2221,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -2215,20 +2222,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, void RenderWidgetHostViewMac::GetRenderWidgetAccessibilityToken( GetRenderWidgetAccessibilityTokenCallback callback) { base::ProcessId pid = getpid(); @@ -796,7 +796,7 @@ index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbe } // namespace content diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn -index 25638e35e38d59adb261185e1387256ba16fc9bd..2b2f7e003bacea00a1421ce3bedf71747b567928 100644 +index 88911eb5fe3d6e6423b12e2116704988cd032592..5852f0936d8a8de32fcce44f9833fca8aa4fcd7f 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn @@ -703,6 +703,7 @@ static_library("test_support") { @@ -816,7 +816,7 @@ index 25638e35e38d59adb261185e1387256ba16fc9bd..2b2f7e003bacea00a1421ce3bedf7174 } mojom("content_test_mojo_bindings") { -@@ -2068,6 +2071,7 @@ test("content_browsertests") { +@@ -2066,6 +2069,7 @@ test("content_browsertests") { "//ui/shell_dialogs", "//ui/snapshot", "//ui/webui:test_support", @@ -824,7 +824,7 @@ index 25638e35e38d59adb261185e1387256ba16fc9bd..2b2f7e003bacea00a1421ce3bedf7174 ] if (!(is_chromeos && target_cpu == "arm64" && current_cpu == "arm")) { -@@ -3406,6 +3410,7 @@ test("content_unittests") { +@@ -3403,6 +3407,7 @@ test("content_unittests") { "//ui/shell_dialogs", "//ui/webui:test_support", "//url", @@ -833,10 +833,10 @@ index 25638e35e38d59adb261185e1387256ba16fc9bd..2b2f7e003bacea00a1421ce3bedf7174 if (is_chromeos) { diff --git a/content/web_test/BUILD.gn b/content/web_test/BUILD.gn -index ab961bccc3e4f0f5a40ac74df97447118b256c68..43f00bf0879809e986308a2cb26145c4a2a51dd3 100644 +index 23eccafa5fbc79d633168923855644f5811a4b80..7174d4816765fa2d3cde99a6756048a42b0c4a5a 100644 --- a/content/web_test/BUILD.gn +++ b/content/web_test/BUILD.gn -@@ -227,6 +227,7 @@ static_library("web_test_browser") { +@@ -228,6 +228,7 @@ static_library("web_test_browser") { "//ui/gl", "//ui/shell_dialogs", "//url", @@ -1859,10 +1859,10 @@ index bbe355cf69f160866188216cc274d75bd35603db..06ee100d7ea2e892dbf3c0b1adc96c50 // enough. return PlatformFontMac::SystemFontType::kGeneral; diff --git a/ui/views/BUILD.gn b/ui/views/BUILD.gn -index dd2fcedc84417c324021e4aba4e78a84ff098803..ed3b4b5b8e9d931e7b7f9b5d91f93f5fcda4ef2c 100644 +index becf47ac859e2ea5d68d449010606bc787606239..45f13c71703bc2e67aa668b8360f555f592c9555 100644 --- a/ui/views/BUILD.gn +++ b/ui/views/BUILD.gn -@@ -721,6 +721,8 @@ component("views") { +@@ -723,6 +723,8 @@ component("views") { "IOSurface.framework", "QuartzCore.framework", ] @@ -1871,7 +1871,7 @@ index dd2fcedc84417c324021e4aba4e78a84ff098803..ed3b4b5b8e9d931e7b7f9b5d91f93f5f } if (is_win) { -@@ -1151,6 +1153,8 @@ source_set("test_support") { +@@ -1153,6 +1155,8 @@ source_set("test_support") { "//ui/base/mojom:ui_base_types", ] @@ -1916,7 +1916,7 @@ index fdc7eb4e4c5e8338c725f7d317559b091d8b38fe..2239b085ac7fd87fe06aef1001551f8a // Used to force the NSApplication's focused accessibility element to be the // views::Views accessibility tree when the NSView for this is focused. diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -index 99bac834cb77f16b061c7dcf209b4f90cc6da8d8..ae113be147f5bfe9d6218a20495897600cc5299d 100644 +index 5c0d4134c8205b018a4f71509879485a7f92bcf2..d2204fd2b737f7f3e146cb1be80c3be6bfce8cd4 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm @@ -21,6 +21,7 @@ @@ -1953,7 +1953,7 @@ index 99bac834cb77f16b061c7dcf209b4f90cc6da8d8..ae113be147f5bfe9d6218a2049589760 } remote_cocoa::mojom::NativeWidgetNSWindow* -@@ -1447,9 +1456,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -1451,9 +1460,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator, // for PWAs. However this breaks accessibility on in-process windows, // so set it back to NO when a local window gains focus. See // https://crbug.com/41485830. @@ -1965,7 +1965,7 @@ index 99bac834cb77f16b061c7dcf209b4f90cc6da8d8..ae113be147f5bfe9d6218a2049589760 // Explicitly set the keyboard accessibility state on regaining key // window status. if (is_key && is_content_first_responder) { -@@ -1602,17 +1613,20 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -1606,17 +1617,20 @@ void HandleAccelerator(const ui::Accelerator& accelerator, void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens( const std::vector<uint8_t>& window_token, const std::vector<uint8_t>& view_token) { @@ -1986,7 +1986,7 @@ index 99bac834cb77f16b061c7dcf209b4f90cc6da8d8..ae113be147f5bfe9d6218a2049589760 *pid = getpid(); id element_id = GetNativeViewAccessible(); -@@ -1625,6 +1639,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -1629,6 +1643,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, } *token = ui::RemoteAccessibility::GetTokenForLocalElement(element_id); diff --git a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch index ddd26f5070c78..95674e36cd0bd 100644 --- a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch +++ b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch @@ -190,10 +190,10 @@ index 3795ce4def719c36e1dace911be53b0103aeafc5..90cf1a70c068771ac98b2d5a283cba5e std::unique_ptr<HostResolver> internal_host_resolver_; std::set<std::unique_ptr<HostResolver>, base::UniquePtrComparator> diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index f6f90744b2faab08fd44f7b0ecc9c271abf62813..434cd63a228ddbdf2efffc0c6a17ab6376beb19d 100644 +index 4a2a6525e636b4963fbaf630d497fbc5a5aa6e90..58c53f7bab65af0b797f502a4633ca47933e26f0 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -316,6 +316,17 @@ struct SocketBrokerRemotes { +@@ -311,6 +311,17 @@ struct SocketBrokerRemotes { pending_remote<SocketBroker> server; }; @@ -211,7 +211,7 @@ index f6f90744b2faab08fd44f7b0ecc9c271abf62813..434cd63a228ddbdf2efffc0c6a17ab63 // Parameters for constructing a network context. struct NetworkContextParams { // The user agent string. -@@ -1013,6 +1024,9 @@ interface NetworkContext { +@@ -1008,6 +1019,9 @@ interface NetworkContext { // Sets a client for this network context. SetClient(pending_remote<NetworkContextClient> client); diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index 1eb94405eaaa2..38ba89a8869bc 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -133,10 +133,10 @@ index 9bf238e64af483294ae3c3f18a4e9aed49a8658d..b9b2a4c8c387b8e8b4eb1f02fc0f891c const GURL& document_url, const WeakDocumentPtr& weak_document_ptr, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 29a6786b54d38367745a04cc349ad018a379b724..9d2f7d1715eeb066789180684ef918e399dab9ae 100644 +index 7ee58f179c7948df29982cd3eac8beb82338391d..2601e4f7b4d236c53d29d81b7f1e418082b85121 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -2349,7 +2349,7 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2348,7 +2348,7 @@ void RenderProcessHostImpl::CreateNotificationService( case RenderProcessHost::NotificationServiceCreatorType::kSharedWorker: case RenderProcessHost::NotificationServiceCreatorType::kDedicatedWorker: { storage_partition_impl_->GetPlatformNotificationContext()->CreateService( @@ -145,7 +145,7 @@ index 29a6786b54d38367745a04cc349ad018a379b724..9d2f7d1715eeb066789180684ef918e3 creator_type, std::move(receiver)); break; } -@@ -2357,7 +2357,7 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2356,7 +2356,7 @@ void RenderProcessHostImpl::CreateNotificationService( CHECK(rfh); storage_partition_impl_->GetPlatformNotificationContext()->CreateService( diff --git a/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch b/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch index eb8a2d9304f79..9a85a3f2aac8f 100644 --- a/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch +++ b/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch @@ -11,7 +11,7 @@ For resolving complex conflict please pin @reitowo For more reason please see: https://crrev.com/c/5465148 diff --git a/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc b/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc -index 157a7e3a7cf9d07b41e386d56b85cf185a53957b..dfef68d807d39255996d475c5c55b67c1b6c4f8f 100644 +index 6fd14970d156d6c5636a3c1b04d86f79beca0e3e..a0c619264f8b6d4641813369169baa0bbe4b2b15 100644 --- a/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc +++ b/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc @@ -381,7 +381,8 @@ gfx::GpuMemoryBufferHandle D3DImageBackingFactory::CreateGpuMemoryBufferHandle( diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch index 5dfe58b2e529a..a2b870519af15 100644 --- a/patches/chromium/printing.patch +++ b/patches/chromium/printing.patch @@ -666,7 +666,7 @@ index ac2f719be566020d9f41364560c12e6d6d0fe3d8..16d758a6936f66148a196761cfb875f6 PrintingFailed(int32 cookie, PrintFailureReason reason); diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc -index 5fc3803e0cc9e41d508c5752a5a9b5bee4eee0d9..810847718a808418e171939e9b8203098ddf19cd 100644 +index 2e151997ca968271449a3a3b4144c1b50f86c24f..71bcd655c36b322451261daffd09d99d1f7d929f 100644 --- a/components/printing/renderer/print_render_frame_helper.cc +++ b/components/printing/renderer/print_render_frame_helper.cc @@ -53,6 +53,7 @@ @@ -677,7 +677,7 @@ index 5fc3803e0cc9e41d508c5752a5a9b5bee4eee0d9..810847718a808418e171939e9b820309 #include "printing/units.h" #include "services/metrics/public/cpp/ukm_source_id.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" -@@ -1245,14 +1246,14 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { +@@ -1243,14 +1244,14 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { } print_in_progress_ = true; @@ -694,7 +694,7 @@ index 5fc3803e0cc9e41d508c5752a5a9b5bee4eee0d9..810847718a808418e171939e9b820309 if (!weak_this) { return; } -@@ -1283,12 +1284,14 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver( +@@ -1281,12 +1282,14 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver( receivers_.Add(this, std::move(receiver)); } @@ -712,7 +712,7 @@ index 5fc3803e0cc9e41d508c5752a5a9b5bee4eee0d9..810847718a808418e171939e9b820309 ScopedIPC scoped_ipc(weak_ptr_factory_.GetWeakPtr()); if (ipc_nesting_level_ > kAllowedIpcDepthForPrint) { return; -@@ -1305,9 +1308,10 @@ void PrintRenderFrameHelper::PrintRequestedPagesInternal( +@@ -1303,9 +1306,10 @@ void PrintRenderFrameHelper::PrintRequestedPagesInternal( is_loading_ = frame->WillPrintSoon(); if (is_loading_) { @@ -726,7 +726,7 @@ index 5fc3803e0cc9e41d508c5752a5a9b5bee4eee0d9..810847718a808418e171939e9b820309 SetupOnStopLoadingTimeout(); return; } -@@ -1317,7 +1321,7 @@ void PrintRenderFrameHelper::PrintRequestedPagesInternal( +@@ -1315,7 +1319,7 @@ void PrintRenderFrameHelper::PrintRequestedPagesInternal( // plugin node and print that instead. auto plugin = delegate_->GetPdfElement(frame); @@ -735,7 +735,7 @@ index 5fc3803e0cc9e41d508c5752a5a9b5bee4eee0d9..810847718a808418e171939e9b820309 if (render_frame_gone_) { return; -@@ -1473,6 +1477,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) { +@@ -1471,6 +1475,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) { if (ipc_nesting_level_ > kAllowedIpcDepthForPrint) return; @@ -744,7 +744,7 @@ index 5fc3803e0cc9e41d508c5752a5a9b5bee4eee0d9..810847718a808418e171939e9b820309 print_preview_context_.OnPrintPreview(); #if BUILDFLAG(IS_CHROMEOS) -@@ -2085,17 +2091,25 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { +@@ -2083,17 +2089,25 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, const blink::WebNode& node, @@ -773,7 +773,7 @@ index 5fc3803e0cc9e41d508c5752a5a9b5bee4eee0d9..810847718a808418e171939e9b820309 DidFinishPrinting(PrintingResult::kFailPrintInit); return; } -@@ -2116,8 +2130,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, +@@ -2114,8 +2128,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, print_pages_params_->params->print_scaling_option; auto self = weak_ptr_factory_.GetWeakPtr(); @@ -790,7 +790,7 @@ index 5fc3803e0cc9e41d508c5752a5a9b5bee4eee0d9..810847718a808418e171939e9b820309 // Check if `this` is still valid. if (!self) return; -@@ -2384,29 +2405,43 @@ void PrintRenderFrameHelper::IPCProcessed() { +@@ -2382,29 +2403,43 @@ void PrintRenderFrameHelper::IPCProcessed() { } bool PrintRenderFrameHelper::InitPrintSettings(blink::WebLocalFrame* frame, diff --git a/patches/chromium/process_singleton.patch b/patches/chromium/process_singleton.patch index 421e9fcb26143..846b18810d5a7 100644 --- a/patches/chromium/process_singleton.patch +++ b/patches/chromium/process_singleton.patch @@ -165,7 +165,7 @@ index 9d7be37f1d1fbde55773b4005878d8ff03cac22a..08cbe32a258bf478f1da0a07064d3e9e int dir_mode = 0; CHECK(base::GetPosixFilePermissions(socket_dir_.GetPath(), &dir_mode) && diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc -index 1bc2d932c882d68b5ed4ed3cdaaa903850ab4989..64ebf49c0d1b6396d1cfbe3bf91480f61b47688d 100644 +index b1c5ce01eb052989bafadd320ac662ee1129d0ad..8bff42918d0780b3c89ad06886e0853a8e5b9052 100644 --- a/chrome/browser/process_singleton_win.cc +++ b/chrome/browser/process_singleton_win.cc @@ -29,7 +29,9 @@ diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index 8b415488e8c22..424e60cc3f116 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -30,7 +30,7 @@ index 9a4195a3e53353342c75d6c4372ed4c27ef13fd3..bc1bfa1ac381ec94121a264d9dcbae9e // RenderWidgetHost on the primary main frame, and false otherwise. virtual bool IsWidgetForPrimaryMainFrame(RenderWidgetHostImpl*); diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 1c74f5f7de96f5950b7eac3348528970aae7175c..d197909a774d78aa33d6aa4b67ced27973d03331 100644 +index 982b5edc933fdf1c4884dd0e0e7b957cee31c5ef..f28d6f919b5c6aca87c3feb701967a255c45d7db 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -2075,6 +2075,9 @@ void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) { diff --git a/patches/chromium/refactor_expose_file_system_access_blocklist.patch b/patches/chromium/refactor_expose_file_system_access_blocklist.patch index 96eb9137c03e6..ad51081667622 100644 --- a/patches/chromium/refactor_expose_file_system_access_blocklist.patch +++ b/patches/chromium/refactor_expose_file_system_access_blocklist.patch @@ -8,11 +8,11 @@ it in Electron and prevent drift from Chrome's blocklist. We should look for a w to upstream this change to Chrome. diff --git a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc -index dcbd14a2e6c8f39a68f0ce7ea9dbc17a0deef070..43c66151ae48983d6f36fdec3637cfdad8863a37 100644 +index ff5f771212a489cc202b39100a0b42413b904e0c..ebede6f938eb1ec08cc472cba65f2faf1c6f971c 100644 --- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc +++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc @@ -84,11 +84,13 @@ - #include "chrome/browser/ui/browser_window/public/browser_window_interface_iterator.h" + #include "chrome/browser/ui/browser_window/public/browser_window_interface_iterator.h" // nogncheck crbug.com/40147906 #include "chrome/browser/ui/tabs/public/tab_features.h" #include "chrome/browser/ui/views/file_system_access/file_system_access_page_action_controller.h" +#if 0 diff --git a/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch b/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch index 78c73f5b8eb84..031d0e6982534 100644 --- a/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch +++ b/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch @@ -7,10 +7,10 @@ Subject: refactor: expose HostImportModuleDynamically and This is so that Electron can blend Blink's and Node's implementations of these isolate handlers. diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -index 8f01e066661cfb4df9ad52a8f30782c1ed595fe4..0a74a57b7a0878a2edfa5bcd8b9f34620a2a5344 100644 +index b55ebf73e7afb85f56424a093c0934ee3a87436b..1612ec99332d134ba7e59f4a522bbb06f728c63a 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -@@ -646,8 +646,9 @@ bool WasmCustomDescriptorsEnabledCallback(v8::Local<v8::Context> context) { +@@ -710,8 +710,9 @@ bool WasmCustomDescriptorsEnabledCallback(v8::Local<v8::Context> context) { return RuntimeEnabledFeatures::WebAssemblyCustomDescriptorsEnabled( execution_context); } @@ -21,7 +21,7 @@ index 8f01e066661cfb4df9ad52a8f30782c1ed595fe4..0a74a57b7a0878a2edfa5bcd8b9f3462 v8::Local<v8::Context> context, v8::Local<v8::Data> v8_host_defined_options, v8::Local<v8::Value> v8_referrer_resource_url, -@@ -725,20 +726,23 @@ v8::MaybeLocal<v8::Promise> HostImportModuleWithPhaseDynamically( +@@ -789,20 +790,23 @@ v8::MaybeLocal<v8::Promise> HostImportModuleWithPhaseDynamically( return resolver->Promise().V8Promise(); } @@ -47,7 +47,7 @@ index 8f01e066661cfb4df9ad52a8f30782c1ed595fe4..0a74a57b7a0878a2edfa5bcd8b9f3462 v8::Local<v8::Module> module, v8::Local<v8::Object> meta) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); -@@ -765,6 +769,7 @@ void HostGetImportMetaProperties(v8::Local<v8::Context> context, +@@ -829,6 +833,7 @@ void HostGetImportMetaProperties(v8::Local<v8::Context> context, meta->CreateDataProperty(context, resolve_key, resolve_value).ToChecked(); } @@ -55,7 +55,7 @@ index 8f01e066661cfb4df9ad52a8f30782c1ed595fe4..0a74a57b7a0878a2edfa5bcd8b9f3462 bool IsDOMExceptionWrapper(v8::Isolate* isolate, v8::Local<v8::Object> object) { return V8DOMException::HasInstance(isolate, object); } -@@ -795,7 +800,6 @@ void EmitDevToolsEvent(v8::Isolate* isolate) { +@@ -859,7 +864,6 @@ void EmitDevToolsEvent(v8::Isolate* isolate) { } // namespace @@ -63,7 +63,7 @@ index 8f01e066661cfb4df9ad52a8f30782c1ed595fe4..0a74a57b7a0878a2edfa5bcd8b9f3462 void V8Initializer::InitializeV8Common(v8::Isolate* isolate) { // Set up garbage collection before setting up anything else as V8 may trigger // GCs during Blink setup. -@@ -811,9 +815,9 @@ void V8Initializer::InitializeV8Common(v8::Isolate* isolate) { +@@ -875,9 +879,9 @@ void V8Initializer::InitializeV8Common(v8::Isolate* isolate) { SharedArrayBufferConstructorEnabledCallback); isolate->SetHostImportModuleDynamicallyCallback(HostImportModuleDynamically); isolate->SetHostImportModuleWithPhaseDynamicallyCallback( diff --git a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch index 135c276983612..af8b5a6e251c5 100644 --- a/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch +++ b/patches/chromium/refactor_patch_electron_permissiontypes_into_blink.patch @@ -28,7 +28,7 @@ index 18ad7ed73b0ed4de158519c01342f0bfd7cc3666..43f46dbbba4fb66b2a2c66580b85de0d break; } diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc -index 87dc1b64e3cedf6d59d8ab2dc811bf8300193bdc..9041414efe3e20edeb170117b1ad396e32508aae 100644 +index e56096991dfbffa3a16aa3aca602b59fbd48a4d5..80451d235373443f4e3d3f26d64e927b7951bdb5 100644 --- a/content/browser/permissions/permission_controller_impl.cc +++ b/content/browser/permissions/permission_controller_impl.cc @@ -94,7 +94,15 @@ PermissionToSchedulingFeature(PermissionType permission_name) { diff --git a/patches/chromium/render_widget_host_view_mac.patch b/patches/chromium/render_widget_host_view_mac.patch index b7735ba9242cf..b1a9f80b6f599 100644 --- a/patches/chromium/render_widget_host_view_mac.patch +++ b/patches/chromium/render_widget_host_view_mac.patch @@ -8,7 +8,7 @@ respond to the first mouse click in their window, which is desirable for some kinds of utility windows. Similarly for `disableAutoHideCursor`. diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -index 63ecc872cd8ef58ebc3decb2aa0f88885bc76ca5..e51fd827f7afc01a5189737f86a2414627a6546e 100644 +index 84fabfc88085ab5c4d3e19db4bc472316e56f2f1..6f3496b2541fa21fd0bba1d95026eab30e3ab96d 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -167,6 +167,15 @@ void ExtractUnderlines(NSAttributedString* string, diff --git a/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch b/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch index a6cf4773d4449..b71eca6167607 100644 --- a/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch +++ b/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch @@ -37,7 +37,7 @@ index 2034b961d99225ebe9b606af915f5d90fdae913e..a7ee864ae4d14d36bdf5f7f4fb0ba862 #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || \ diff --git a/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc b/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc -index 5bad748fdfc7944a44dbe4dd7891eda31e3128d3..c1701b71a76695c3e941009bdd55777167907834 100644 +index 3e617c9bf924e089e27784f960f08a21b98fee0a..8fd91821d588b5d70d1b320b64cc640c77be8d7d 100644 --- a/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc +++ b/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc @@ -275,15 +275,21 @@ LanguageSettingsPrivateGetLanguageListFunction::Run() { @@ -272,7 +272,7 @@ index 081e422f9a29fc36eea19ed730b430ba5ceb2861..7817bc7a6f9f2c7fdeb08c9b185d2dd3 +} +#endif // BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) diff --git a/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc b/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc -index c51c5747f45010548fe0cb7d31016605cf43c8e3..a99eb10c4ba77a1d3a89a308acffb5064d690b4a 100644 +index 4eda6aba66af11df4e8719e075e807564d54baac..29d9399c78fc6b4d597ab1f0dc53571131bffd95 100644 --- a/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc +++ b/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc @@ -186,21 +186,27 @@ void SpellCheckHostChromeImpl::InitializeDictionaries( @@ -399,7 +399,7 @@ index 31ab441aedd69c08c6f1beefa2129e60bd44a7f3..308c90516a9881b82da5cedec5d80208 + RunSpellCheckReturnMessageTest(); +} diff --git a/chrome/browser/spellchecker/spellcheck_service.cc b/chrome/browser/spellchecker/spellcheck_service.cc -index 02da80b42f936f347c9043f4499d9a324bdf43d2..8fbb2025d157e58c90c701f9e3478f6c99b88aa1 100644 +index 97b8fc0f38650e816bcae00e074543766f71e0d0..83d9e177e9b5e13587655915b9fbbddf5f9f275d 100644 --- a/chrome/browser/spellchecker/spellcheck_service.cc +++ b/chrome/browser/spellchecker/spellcheck_service.cc @@ -170,7 +170,9 @@ SpellcheckService::SpellcheckService(content::BrowserContext* context) @@ -413,7 +413,7 @@ index 02da80b42f936f347c9043f4499d9a324bdf43d2..8fbb2025d157e58c90c701f9e3478f6c // If initialization of the spellcheck service is on-demand, it is up to the // instantiator of the spellcheck service to call InitializeDictionaries // with a callback. -@@ -492,7 +494,9 @@ void SpellcheckService::LoadDictionaries() { +@@ -493,7 +495,9 @@ void SpellcheckService::LoadDictionaries() { } #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) @@ -424,7 +424,7 @@ index 02da80b42f936f347c9043f4499d9a324bdf43d2..8fbb2025d157e58c90c701f9e3478f6c // Only want to fire the callback on first call to LoadDictionaries // originating from InitializeDictionaries, since supported platform // dictionaries are cached throughout the browser session and not -@@ -520,7 +524,9 @@ bool SpellcheckService::IsSpellcheckEnabled() const { +@@ -521,7 +525,9 @@ bool SpellcheckService::IsSpellcheckEnabled() const { bool enable_if_uninitialized = false; #if BUILDFLAG(IS_WIN) diff --git a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch index 57ecf36a27857..5f5abfbcb47c0 100644 --- a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch +++ b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch @@ -254,10 +254,10 @@ index 17d6d7d935f93afefa9123f56ef9c138c3070f93..8dfa7501a6a2998e107bf9b51f5e5c3d } diff --git a/content/common/features.cc b/content/common/features.cc -index f4c4f0cd75e8e8331d4a223d6faa6735401f0a86..5efe4e75273dec930534049e7e2a4935af0140c1 100644 +index d4ceee4abd5439ac81cbd3f33f293d4ef95d3e80..a3eea5ba266dd2b7b8e24522728711f0bc32c261 100644 --- a/content/common/features.cc +++ b/content/common/features.cc -@@ -311,6 +311,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); +@@ -312,6 +312,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kIOSurfaceCapturer, base::FEATURE_ENABLED_BY_DEFAULT); #endif @@ -273,10 +273,10 @@ index f4c4f0cd75e8e8331d4a223d6faa6735401f0a86..5efe4e75273dec930534049e7e2a4935 BASE_FEATURE(kKeepChildProcessAfterIPCReset, base::FEATURE_DISABLED_BY_DEFAULT); diff --git a/content/common/features.h b/content/common/features.h -index b9bb81ea381fbd57c850546b72fd652644db3cb0..9fcab77a6255bb2c36cc01c027840f778c25bbdb 100644 +index fbe32fbd471fbbb0e50d6956521eb13085088ba7..9d527a620e913b37a210afa514f05283b2792c7d 100644 --- a/content/common/features.h +++ b/content/common/features.h -@@ -110,6 +110,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); +@@ -111,6 +111,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); #if BUILDFLAG(IS_MAC) CONTENT_EXPORT BASE_DECLARE_FEATURE(kIOSurfaceCapturer); #endif diff --git a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch index f49185647669c..61e4456c4dcd3 100644 --- a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch +++ b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch @@ -39,7 +39,7 @@ index bc1bfa1ac381ec94121a264d9dcbae9e02ab5a81..c6fc03ae158b3ce87fd684d765a3f1b0 // event before sending it to the renderer. See enum for details on return // value. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 4708741ea709c9dbdb1f88503562f0a4891b3465..eb2f21c4ed5cdb570cca72afb884495c29d8d80c 100644 +index 2fa9876286ecda6a60a2c1970896cb275bbd7ab9..3f14e59de0e296b17f574aa40b879d2f373bb93e 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -1589,6 +1589,10 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index ca6603bc630ea..a51b8701fdb31 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index 5abbbb2684682532658b33c7f5fe2b91779a81a9..e6db0f72d82203a50728d42cdfcd482caa0126ef 100644 +index d17495e674e0455ef8b487714559efd688d375a1..dada6a92c2dd8b19a2001960da570744ad027858 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25526,6 +25526,21 @@ +@@ -25581,6 +25581,21 @@ ] } ], diff --git a/patches/chromium/scroll_bounce_flag.patch b/patches/chromium/scroll_bounce_flag.patch index 5f73920366559..579b7c9ef188a 100644 --- a/patches/chromium/scroll_bounce_flag.patch +++ b/patches/chromium/scroll_bounce_flag.patch @@ -6,10 +6,10 @@ Subject: scroll_bounce_flag.patch Patch to make scrollBounce option work. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc -index 8e9c4ced0e595f972281c84adfbbd7a2d5845d60..8c0cd8a98feb8e1390bdb0e2482ab5d5c233e2a3 100644 +index 0e56546b71167bf9f9ea8fba9de8a2cf50d44f4b..b76a714368f87ad8d6b92e3ea37a71ecf666d5ed 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc -@@ -1209,7 +1209,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { +@@ -1208,7 +1208,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { } bool RenderThreadImpl::IsElasticOverscrollEnabled() { diff --git a/patches/chromium/support_mixed_sandbox_with_zygote.patch b/patches/chromium/support_mixed_sandbox_with_zygote.patch index b1474afdb45e0..a02d333b68258 100644 --- a/patches/chromium/support_mixed_sandbox_with_zygote.patch +++ b/patches/chromium/support_mixed_sandbox_with_zygote.patch @@ -22,10 +22,10 @@ However, the patch would need to be reviewed by the security team, as it does touch a security-sensitive class. diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 9d2f7d1715eeb066789180684ef918e399dab9ae..3a6fef89877f2a6a58e9e03856d70a90b443c5d4 100644 +index 2601e4f7b4d236c53d29d81b7f1e418082b85121..4b3d822c58b0224299448dbbe6caffe7081b17b6 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -1927,6 +1927,10 @@ bool RenderProcessHostImpl::Init() { +@@ -1926,6 +1926,10 @@ bool RenderProcessHostImpl::Init() { std::unique_ptr<SandboxedProcessLauncherDelegate> sandbox_delegate = std::make_unique<RendererSandboxedProcessLauncherDelegateWin>( *cmd_line, IsPdf(), IsJitDisabled()); diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index f3a0fcceef3db..481b611b1920f 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,10 +15,10 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 9d54e7e7ccabad6dfcdc54214683df8b3b414208..d5284c4a18f779b4a0fefa9e15ba4f8c023ca352 100644 +index 5f973dba78748ba2aeaab377534e9866d96a44fe..d66a52d58cc9daf00a785cd9654fd453fd958a5e 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -9048,6 +9048,17 @@ void RenderFrameHostImpl::EnterFullscreen( +@@ -9057,6 +9057,17 @@ void RenderFrameHostImpl::EnterFullscreen( } } diff --git a/shell/browser/api/gpu_info_enumerator.cc b/shell/browser/api/gpu_info_enumerator.cc index caf458f4a9a72..da6b215750ab8 100644 --- a/shell/browser/api/gpu_info_enumerator.cc +++ b/shell/browser/api/gpu_info_enumerator.cc @@ -80,19 +80,6 @@ void GPUInfoEnumerator::EndVideoEncodeAcceleratorSupportedProfile() { value_stack_.pop(); } -void GPUInfoEnumerator::BeginImageDecodeAcceleratorSupportedProfile() { - value_stack_.push(std::move(current_)); - current_ = {}; -} - -void GPUInfoEnumerator::EndImageDecodeAcceleratorSupportedProfile() { - auto& top_value = value_stack_.top(); - top_value.Set(kImageDecodeAcceleratorSupportedProfileKey, - std::move(current_)); - current_ = std::move(top_value); - value_stack_.pop(); -} - void GPUInfoEnumerator::BeginAuxAttributes() { value_stack_.push(std::move(current_)); current_ = {}; diff --git a/shell/browser/api/gpu_info_enumerator.h b/shell/browser/api/gpu_info_enumerator.h index c6fb3d5820989..87c68e6786947 100644 --- a/shell/browser/api/gpu_info_enumerator.h +++ b/shell/browser/api/gpu_info_enumerator.h @@ -21,8 +21,6 @@ class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator { "videoDecodeAcceleratorSupportedProfile"; const char* const kVideoEncodeAcceleratorSupportedProfileKey = "videoEncodeAcceleratorSupportedProfile"; - const char* const kImageDecodeAcceleratorSupportedProfileKey = - "imageDecodeAcceleratorSupportedProfile"; const char* const kAuxAttributesKey = "auxAttributes"; const char* const kOverlayInfo = "overlayInfo"; @@ -45,8 +43,6 @@ class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator { void EndVideoDecodeAcceleratorSupportedProfile() override; void BeginVideoEncodeAcceleratorSupportedProfile() override; void EndVideoEncodeAcceleratorSupportedProfile() override; - void BeginImageDecodeAcceleratorSupportedProfile() override; - void EndImageDecodeAcceleratorSupportedProfile() override; void BeginAuxAttributes() override; void EndAuxAttributes() override; void BeginOverlayInfo() override; diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index 2e33cb86eb656..054d5e89a47c9 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -56,6 +56,7 @@ #include "electron/fuses.h" #include "extensions/browser/extension_navigation_ui_data.h" #include "extensions/common/extension_id.h" +#include "ipc/constants.mojom.h" #include "mojo/public/cpp/bindings/binder_map.h" #include "mojo/public/cpp/bindings/self_owned_associated_receiver.h" #include "net/ssl/ssl_cert_request_info.h" @@ -1388,8 +1389,8 @@ void ElectronBrowserClient::WillCreateURLLoaderFactory( new ProxyingURLLoaderFactory( web_request.get(), protocol_registry->intercept_handlers(), render_process_id, - frame_host ? frame_host->GetRoutingID() : MSG_ROUTING_NONE, &next_id_, - std::move(navigation_ui_data), std::move(navigation_id), + frame_host ? frame_host->GetRoutingID() : IPC::mojom::kRoutingIdNone, + &next_id_, std::move(navigation_ui_data), std::move(navigation_id), std::move(proxied_receiver), std::move(target_factory_remote), std::move(header_client_receiver), type); } diff --git a/shell/browser/net/proxying_url_loader_factory.h b/shell/browser/net/proxying_url_loader_factory.h index d40fb14083d0f..7862ebc937823 100644 --- a/shell/browser/net/proxying_url_loader_factory.h +++ b/shell/browser/net/proxying_url_loader_factory.h @@ -18,6 +18,7 @@ #include "base/memory/weak_ptr.h" #include "content/public/browser/content_browser_client.h" #include "extensions/browser/api/web_request/web_request_info.h" +#include "ipc/constants.mojom.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/receiver_set.h" #include "mojo/public/cpp/bindings/remote.h" @@ -140,7 +141,7 @@ class ProxyingURLLoaderFactory const std::optional<url::Origin> original_initiator_; const uint64_t request_id_ = 0; const int32_t network_service_request_id_ = 0; - const int32_t frame_routing_id_ = MSG_ROUTING_NONE; + const int32_t frame_routing_id_ = IPC::mojom::kRoutingIdNone; const uint32_t options_ = 0; const net::MutableNetworkTrafficAnnotationTag traffic_annotation_; mojo::Receiver<network::mojom::URLLoader> proxied_loader_receiver_; diff --git a/shell/browser/ui/inspectable_web_contents.cc b/shell/browser/ui/inspectable_web_contents.cc index 57e07ed09cc3c..d641ce572450f 100644 --- a/shell/browser/ui/inspectable_web_contents.cc +++ b/shell/browser/ui/inspectable_web_contents.cc @@ -36,7 +36,7 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/shared_cors_origin_access_list.h" #include "content/public/browser/storage_partition.h" -#include "ipc/ipc_channel.h" +#include "ipc/constants.mojom.h" #include "net/http/http_response_headers.h" #include "net/http/http_status_code.h" #include "services/network/public/cpp/simple_url_loader.h" @@ -93,7 +93,7 @@ constexpr std::string_view kFrontendHostMethod = "method"; constexpr std::string_view kFrontendHostParams = "params"; constexpr std::string_view kTitleFormat = "Developer Tools - %s"; -const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4; +const size_t kMaxMessageChunkSize = IPC::mojom::kChannelMaximumMessageSize / 4; base::Value::Dict RectToDictionary(const gfx::Rect& bounds) { return base::Value::Dict{} diff --git a/shell/renderer/electron_render_frame_observer.h b/shell/renderer/electron_render_frame_observer.h index bf3ff8232345c..54582eb68ccd1 100644 --- a/shell/renderer/electron_render_frame_observer.h +++ b/shell/renderer/electron_render_frame_observer.h @@ -8,7 +8,6 @@ #include <string> #include "content/public/renderer/render_frame_observer.h" -#include "ipc/platform_file_for_transit.h" #include "third_party/blink/public/web/web_local_frame.h" namespace electron { @@ -40,8 +39,6 @@ class ElectronRenderFrameObserver : private content::RenderFrameObserver { [[nodiscard]] bool ShouldNotifyClient(int world_id) const; void CreateIsolatedWorldContext(); - void OnTakeHeapSnapshot(IPC::PlatformFileForTransit file_handle, - const std::string& channel); bool has_delayed_node_initialization_ = false; raw_ptr<content::RenderFrame> render_frame_; From 1cb8f095984e72f56fce66f8af83d06d94077400 Mon Sep 17 00:00:00 2001 From: David Sanders <nilay2014@gmail.com> Date: Tue, 4 Nov 2025 01:07:52 -0800 Subject: [PATCH 199/268] build: remove patch that landed in Chromium roll (#48771) --- patches/chromium/.patches | 1 - ...use_buttons_on_focus_loss_on_wayland.patch | 34 ------------------- 2 files changed, 35 deletions(-) delete mode 100644 patches/chromium/fix_release_mouse_buttons_on_focus_loss_on_wayland.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 69b906122f0a9..47ae576770976 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -143,5 +143,4 @@ expose_referrerscriptinfo_hostdefinedoptionsindex.patch chore_disable_protocol_handler_dcheck.patch fix_check_for_file_existence_before_setting_mtime.patch revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch -fix_release_mouse_buttons_on_focus_loss_on_wayland.patch fix_linux_tray_id.patch diff --git a/patches/chromium/fix_release_mouse_buttons_on_focus_loss_on_wayland.patch b/patches/chromium/fix_release_mouse_buttons_on_focus_loss_on_wayland.patch deleted file mode 100644 index aab439b5c097f..0000000000000 --- a/patches/chromium/fix_release_mouse_buttons_on_focus_loss_on_wayland.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mitchell COhen <mitch.cohen@me.com> -Date: Sun, 2 Nov 2025 15:30:56 -0500 -Subject: fix: release mouse buttons on focus loss on Wayland - -Fixes an issue where the mouse flags would get stuck if you right-click -the CSD titlebar in Wayland. - -Bug: 455147429 -Change-Id: I9f5a9f395b3c1d85094a40a92d40691a897dbd05 -Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7091872 -Reviewed-by: Thomas Anderson <thomasanderson@chromium.org> -Reviewed-by: Kramer Ge <fangzhoug@chromium.org> -Commit-Queue: Thomas Anderson <thomasanderson@chromium.org> -Cr-Commit-Position: refs/heads/main@{#1538048} - -diff --git a/ui/ozone/platform/wayland/host/wayland_event_source.cc b/ui/ozone/platform/wayland/host/wayland_event_source.cc -index 4cc15e842b633e93f1d6654225765769eb75fffd..4e421ccbd36d4efebd43c9def5b575b7d8d5e336 100644 ---- a/ui/ozone/platform/wayland/host/wayland_event_source.cc -+++ b/ui/ozone/platform/wayland/host/wayland_event_source.cc -@@ -336,6 +336,13 @@ void WaylandEventSource::OnPointerFocusChanged( - // Save new pointer location. - pointer_location_ = location; - window_manager_->SetPointerFocusedWindow(window); -+ } else { -+ // The compositor may swallow the release event for any buttons that are -+ // pressed when the window loses focus, e.g. when right-clicking the -+ // titlebar to open the system menu on GNOME. -+ if (!connection_->IsDragInProgress()) { -+ ReleasePressedPointerButtons(window, ui::EventTimeForNow()); -+ } - } - - auto closure = focused ? base::NullCallback() From 55461289b8a68973011ae489f863070213376368 Mon Sep 17 00:00:00 2001 From: axolotl <nilay2014@gmail.com> Date: Tue, 4 Nov 2025 21:15:34 +1100 Subject: [PATCH 200/268] feat: add SF Symbol support to NativeImage::CreateFromNamedImage (#48203) * feat: add SF Symbol support to NativeImage::CreateFromNamedImage * use obj-c name in NSImage constructor * add test for named symbol image * apply suggested simplification * fix: support NX cocoa prefix --- docs/api/native-image.md | 3 +-- shell/common/api/electron_api_native_image_mac.mm | 13 +++++++++++-- spec/api-native-image-spec.ts | 5 +++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/docs/api/native-image.md b/docs/api/native-image.md index 61b3c5ab3173e..d9b87c0c33284 100644 --- a/docs/api/native-image.md +++ b/docs/api/native-image.md @@ -202,8 +202,7 @@ Creates a new `NativeImage` instance from `dataUrl`, a base 64 encoded [Data URL Returns `NativeImage` Creates a new `NativeImage` instance from the `NSImage` that maps to the -given image name. See Apple's [`NSImageName`](https://developer.apple.com/documentation/appkit/nsimagename#2901388) -documentation for a list of possible values. +given image name. See Apple's [`NSImageName`](https://developer.apple.com/documentation/appkit/nsimagename#2901388) documentation and [SF Symbols](https://developer.apple.com/sf-symbols/) for a list of possible values. The `hslShift` is applied to the image with the following rules: diff --git a/shell/common/api/electron_api_native_image_mac.mm b/shell/common/api/electron_api_native_image_mac.mm index f25a4e0b640dc..2075fdcdd6854 100644 --- a/shell/common/api/electron_api_native_image_mac.mm +++ b/shell/common/api/electron_api_native_image_mac.mm @@ -120,9 +120,18 @@ void ReceivedThumbnailResult(CGSize size, name.erase(pos, to_remove.length()); } - NSImage* image = [NSImage imageNamed:base::SysUTF8ToNSString(name)]; + NSImage* image = nil; + NSString* ns_name = base::SysUTF8ToNSString(name); + + // Treat non-Cocoa-prefixed names as SF Symbols first. + if (!base::StartsWith(name, "NS") && !base::StartsWith(name, "NX")) { + image = [NSImage imageWithSystemSymbolName:ns_name + accessibilityDescription:nil]; + } else { + image = [NSImage imageNamed:ns_name]; + } - if (!image.valid) { + if (!image || !image.valid) { return CreateEmpty(args->isolate()); } diff --git a/spec/api-native-image-spec.ts b/spec/api-native-image-spec.ts index 9d32af6d7cc50..3ad3e08be6586 100644 --- a/spec/api-native-image-spec.ts +++ b/spec/api-native-image-spec.ts @@ -348,6 +348,11 @@ describe('nativeImage module', () => { expect(image.isEmpty()).to.be.false(); }); + ifit(process.platform === 'darwin')('returns a valid named symbol on darwin', function () { + const image = nativeImage.createFromNamedImage('atom'); + expect(image.isEmpty()).to.be.false(); + }); + ifit(process.platform === 'darwin')('returns allows an HSL shift for a valid image on darwin', function () { const image = nativeImage.createFromNamedImage('NSActionTemplate', [0.5, 0.2, 0.8]); expect(image.isEmpty()).to.be.false(); From b220c0cf2d8309ee1b13803b7630570e39ecb30d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Tue, 4 Nov 2025 11:54:19 +0100 Subject: [PATCH 201/268] build(deps): bump actions-cool/issues-helper from 3.6.2 to 3.7.1 (#48763) Bumps [actions-cool/issues-helper](https://github.com/actions-cool/issues-helper) from 3.6.2 to 3.7.1. - [Release notes](https://github.com/actions-cool/issues-helper/releases) - [Changelog](https://github.com/actions-cool/issues-helper/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions-cool/issues-helper/compare/50068f49b7b2b3857270ead65e2d02e4459b022c...564cd9b1baacd7a9cd634e8039a149901ee5f600) --- updated-dependencies: - dependency-name: actions-cool/issues-helper dependency-version: 3.7.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/issue-labeled.yml | 2 +- .github/workflows/issue-opened.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml index 80066a103a359..e9c4195d47060 100644 --- a/.github/workflows/issue-labeled.yml +++ b/.github/workflows/issue-labeled.yml @@ -72,7 +72,7 @@ jobs: creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} - name: Create comment if: ${{ steps.check-for-comment.outputs.SHOULD_COMMENT }} - uses: actions-cool/issues-helper@50068f49b7b2b3857270ead65e2d02e4459b022c # v3.6.2 + uses: actions-cool/issues-helper@564cd9b1baacd7a9cd634e8039a149901ee5f600 # v3.7.1 with: actions: 'create-comment' token: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/issue-opened.yml b/.github/workflows/issue-opened.yml index d01349b22701f..323df66aa4c83 100644 --- a/.github/workflows/issue-opened.yml +++ b/.github/workflows/issue-opened.yml @@ -134,7 +134,7 @@ jobs: } - name: Create unsupported major comment if: ${{ steps.add-labels.outputs.unsupportedMajor }} - uses: actions-cool/issues-helper@50068f49b7b2b3857270ead65e2d02e4459b022c # v3.6.2 + uses: actions-cool/issues-helper@564cd9b1baacd7a9cd634e8039a149901ee5f600 # v3.7.1 with: actions: 'create-comment' token: ${{ steps.generate-token.outputs.token }} From 5e0f355355580b0cd90e643123d82ade04b3647d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <nilay2014@gmail.com> Date: Tue, 4 Nov 2025 11:54:33 +0100 Subject: [PATCH 202/268] build(deps): bump github/codeql-action from 4.31.0 to 4.31.2 (#48764) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.0 to 4.31.2. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/4e94bd11f71e507f7f87df81788dff88d1dacbfb...0499de31b99561a6d14a36a5f662c2a54f91beee) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.31.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/scorecards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index d72ac359b570d..e24c43fdcf4fc 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -50,6 +50,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v3.29.5 + uses: github/codeql-action/upload-sarif@0499de31b99561a6d14a36a5f662c2a54f91beee # v3.29.5 with: sarif_file: results.sarif From 38a11b14a1e47e5929660c96b441a99cef96c341 Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <nilay2014@gmail.com> Date: Tue, 4 Nov 2025 14:09:33 +0100 Subject: [PATCH 203/268] chore: bump node to v24.11.0 (main) (#48728) chore: bump node in DEPS to v24.11.0 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 005b62ea4b6ef..2295902161663 100644 --- a/DEPS +++ b/DEPS @@ -4,7 +4,7 @@ vars = { 'chromium_version': '144.0.7506.0', 'node_version': - 'v24.10.0', + 'v24.11.0', 'nan_version': '675cefebca42410733da8a454c8d9391fcebfbc2', 'squirrel.mac_version': From c824be08c0d92aa49b3debbc22b4ae6a52f3accf Mon Sep 17 00:00:00 2001 From: Keeley Hammond <nilay2014@gmail.com> Date: Tue, 4 Nov 2025 07:20:42 -0800 Subject: [PATCH 204/268] build: apply additional compression on upload (#48766) build: apply additional compression on upload for large files --- script/lib/util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/lib/util.py b/script/lib/util.py index 38bb70cc8d029..a65321b876586 100644 --- a/script/lib/util.py +++ b/script/lib/util.py @@ -70,17 +70,17 @@ def make_zip(zip_file_path, files, dirs): safe_unlink(zip_file_path) if sys.platform == 'darwin': allfiles = files + dirs - execute(['zip', '-r', '-y', zip_file_path] + allfiles) + execute(['zip', '-r', '-y', '-9', zip_file_path] + allfiles) else: with zipfile.ZipFile(zip_file_path, "w", zipfile.ZIP_DEFLATED, allowZip64=True) as zip_file: for filename in files: - zip_file.write(filename, filename) + zip_file.write(filename, filename, compress_type=zipfile.ZIP_DEFLATED, compresslevel=9) for dirname in dirs: for root, _, filenames in os.walk(dirname): for f in filenames: - zip_file.write(os.path.join(root, f)) + zip_file.write(os.path.join(root, f), compress_type=zipfile.ZIP_DEFLATED, compresslevel=9) zip_file.close() From 8933189675c89042080571e12bf10ab2f7b77174 Mon Sep 17 00:00:00 2001 From: BILL SHEN <nilay2014@gmail.com> Date: Wed, 5 Nov 2025 17:33:05 +0800 Subject: [PATCH 205/268] fix: draw smoothing round rect corner (#48769) --- shell/renderer/electron_smooth_round_rect.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/renderer/electron_smooth_round_rect.cc b/shell/renderer/electron_smooth_round_rect.cc index 58bbc49152cc8..08d8f93cb34ab 100644 --- a/shell/renderer/electron_smooth_round_rect.cc +++ b/shell/renderer/electron_smooth_round_rect.cc @@ -302,8 +302,8 @@ SkPath DrawSmoothRoundRect(float x, bottom_right_smoothness, SkPoint::Make(x + width, y + height), 2); // Bottom left corner - DrawCorner(path, bottom_left_radius, left_bottom_smoothness, - bottom_left_smoothness, SkPoint::Make(x, y + height), 3); + DrawCorner(path, bottom_left_radius, bottom_left_smoothness, + left_bottom_smoothness, SkPoint::Make(x, y + height), 3); path.close(); return path; From ff05f5b367de11789ae73881eba5c3579aa17df5 Mon Sep 17 00:00:00 2001 From: Shelley Vohr <nilay2014@gmail.com> Date: Wed, 5 Nov 2025 20:00:51 +0100 Subject: [PATCH 206/268] refactor: remove `base::AdaptCallbackForRepeating` patch (#48774) refactor: remove base::AdaptCallbackForRepeating patch --- filenames.gni | 1 + patches/chromium/.patches | 1 - ...store_base_adaptcallbackforrepeating.patch | 40 ----------------- shell/browser/api/electron_api_app.cc | 4 +- shell/browser/api/electron_api_menu_views.cc | 3 +- shell/common/callback_util.h | 43 +++++++++++++++++++ .../gin_converters/callback_converter.h | 3 +- 7 files changed, 51 insertions(+), 44 deletions(-) delete mode 100644 patches/chromium/refactor_restore_base_adaptcallbackforrepeating.patch create mode 100644 shell/common/callback_util.h diff --git a/filenames.gni b/filenames.gni index a41f5cae22f5a..941dd9f7e4715 100644 --- a/filenames.gni +++ b/filenames.gni @@ -580,6 +580,7 @@ filenames = { "shell/common/asar/asar_util.h", "shell/common/asar/scoped_temporary_file.cc", "shell/common/asar/scoped_temporary_file.h", + "shell/common/callback_util.h", "shell/common/color_util.cc", "shell/common/color_util.h", "shell/common/crash_keys.cc", diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 47ae576770976..0c203ab91cbcb 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -59,7 +59,6 @@ webview_fullscreen.patch extend_apply_webpreferences.patch build_libc_as_static_library.patch build_do_not_depend_on_packed_resource_integrity.patch -refactor_restore_base_adaptcallbackforrepeating.patch logging_win32_only_create_a_console_if_logging_to_stderr.patch fix_media_key_usage_with_globalshortcuts.patch feat_expose_raw_response_headers_from_urlloader.patch diff --git a/patches/chromium/refactor_restore_base_adaptcallbackforrepeating.patch b/patches/chromium/refactor_restore_base_adaptcallbackforrepeating.patch deleted file mode 100644 index 5b21cb50a234d..0000000000000 --- a/patches/chromium/refactor_restore_base_adaptcallbackforrepeating.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Charles Kerr <charles@charleskerr.com> -Date: Wed, 9 Jun 2021 14:28:08 -0500 -Subject: refactor: restore base::AdaptCallbackForRepeating - -Undo https://chromium-review.googlesource.com/c/chromium/src/+/2941842 -to reinstate base::AdaptCallbackForRepeating(). It was removed to fix -https://bugs.chromium.org/p/chromium/issues/detail?id=730593 . - -We use AdaptCallbackForRepeating() in about a dozen places. This patch -should be removed as soon as those have been updated. Patching because -every instance is a FTBFS that prevents testing any one instance's fix. - -diff --git a/base/functional/callback_helpers.h b/base/functional/callback_helpers.h -index f1aa11fec7c0994ac19a26a02800f25de8f2f519..bbfdb3e4839ed96e4c6238235458a421c917411f 100644 ---- a/base/functional/callback_helpers.h -+++ b/base/functional/callback_helpers.h -@@ -99,6 +99,22 @@ RepeatingCallback<void(Args...)> ForwardRepeatingCallbacks( - std::move(v)); - } - -+// Wraps the given OnceCallback into a RepeatingCallback that relays its -+// invocation to the original OnceCallback on the first invocation. The -+// following invocations are just ignored. -+// -+// Note that this deliberately subverts the Once/Repeating paradigm of Callbacks -+// but helps ease the migration from old-style Callbacks. Avoid if possible; use -+// if necessary for migration. TODO(tzik): Remove it. https://crbug.com/730593 -+template <typename... Args> -+RepeatingCallback<void(Args...)> AdaptCallbackForRepeating( -+ OnceCallback<void(Args...)> callback) { -+ using Helper = internal::OnceCallbackHolder<Args...>; -+ return base::BindRepeating( -+ &Helper::Run, std::make_unique<Helper>(std::move(callback), -+ /*ignore_extra_runs=*/true)); -+} -+ - // Wraps the given OnceCallback and returns two OnceCallbacks with an identical - // signature. On first invokation of either returned callbacks, the original - // callback is invoked. Invoking the remaining callback results in a crash. diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc index a6153ff0dad9b..2632282b52f2b 100644 --- a/shell/browser/api/electron_api_app.cc +++ b/shell/browser/api/electron_api_app.cc @@ -62,6 +62,7 @@ #include "shell/browser/net/resolve_proxy_helper.h" #include "shell/browser/relauncher.h" #include "shell/common/application_info.h" +#include "shell/common/callback_util.h" #include "shell/common/electron_command_line.h" #include "shell/common/electron_paths.h" #include "shell/common/gin_converters/base_converter.h" @@ -735,7 +736,8 @@ void App::AllowCertificateError( bool is_main_frame_request, bool strict_enforcement, base::OnceCallback<void(content::CertificateRequestResultType)> callback) { - auto adapted_callback = base::AdaptCallbackForRepeating(std::move(callback)); + auto adapted_callback = + electron::AdaptCallbackForRepeating(std::move(callback)); v8::Isolate* isolate = JavascriptEnvironment::GetIsolate(); v8::HandleScope handle_scope(isolate); bool prevent_default = Emit( diff --git a/shell/browser/api/electron_api_menu_views.cc b/shell/browser/api/electron_api_menu_views.cc index 1fa67b3bb4390..2003ae4e59a39 100644 --- a/shell/browser/api/electron_api_menu_views.cc +++ b/shell/browser/api/electron_api_menu_views.cc @@ -10,6 +10,7 @@ #include "shell/browser/api/electron_api_base_window.h" #include "shell/browser/api/electron_api_web_frame_main.h" #include "shell/browser/native_window_views.h" +#include "shell/common/callback_util.h" #include "ui/display/screen.h" #include "v8/include/cppgc/allocation.h" #include "v8/include/v8-cppgc.h" @@ -54,7 +55,7 @@ void MenuViews::PopupAt(BaseWindow* window, // callback, it is fine passing OnceCallback to it because we reset the // menu runner immediately when the menu is closed. int32_t window_id = window->weak_map_id(); - auto close_callback = base::AdaptCallbackForRepeating( + auto close_callback = electron::AdaptCallbackForRepeating( base::BindOnce(&MenuViews::OnClosed, weak_factory_.GetWeakPtr(), window_id, std::move(callback_with_ref))); auto& runner = menu_runners_[window_id] = diff --git a/shell/common/callback_util.h b/shell/common/callback_util.h new file mode 100644 index 0000000000000..70f454cf58f3a --- /dev/null +++ b/shell/common/callback_util.h @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft GmbH. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#ifndef ELECTRON_SHELL_COMMON_CALLBACK_UTIL_H_ +#define ELECTRON_SHELL_COMMON_CALLBACK_UTIL_H_ + +#include <memory> +#include <utility> + +#include "base/functional/bind.h" +#include "base/functional/callback.h" + +namespace electron { + +namespace internal { +template <typename... Args> +class OnceCallbackHolder { + public: + explicit OnceCallbackHolder(base::OnceCallback<void(Args...)> cb) + : cb_(std::move(cb)) {} + + void Run(Args... args) { + if (cb_) + std::move(cb_).Run(std::forward<Args>(args)...); + } + + private: + base::OnceCallback<void(Args...)> cb_; +}; +} // namespace internal + +template <typename... Args> +base::RepeatingCallback<void(Args...)> AdaptCallbackForRepeating( + base::OnceCallback<void(Args...)> cb) { + using Holder = internal::OnceCallbackHolder<Args...>; + return base::BindRepeating(&Holder::Run, + std::make_unique<Holder>(std::move(cb))); +} + +} // namespace electron + +#endif // ELECTRON_SHELL_COMMON_CALLBACK_UTIL_H_ diff --git a/shell/common/gin_converters/callback_converter.h b/shell/common/gin_converters/callback_converter.h index ca2bc900c0d66..1fe807de6c78b 100644 --- a/shell/common/gin_converters/callback_converter.h +++ b/shell/common/gin_converters/callback_converter.h @@ -8,6 +8,7 @@ #include <utility> #include "base/functional/callback_helpers.h" +#include "shell/common/callback_util.h" #include "shell/common/gin_helper/callback.h" namespace gin { @@ -41,7 +42,7 @@ struct Converter<base::OnceCallback<Sig>> { static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, base::OnceCallback<Sig> in) { return gin::ConvertToV8(isolate, - base::AdaptCallbackForRepeating(std::move(in))); + electron::AdaptCallbackForRepeating(std::move(in))); } static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val, From 90660604d5870671e18d9224a3e8d8c50827d2b1 Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Wed, 5 Nov 2025 17:28:33 -0600 Subject: [PATCH 207/268] refactor: remove unnecessary template type in `EmitEvent()` (#48778) refactor: remove unnecessary template type in EmitEvent() refactor: CallMethodWithArgs() takes a std::string_view --- shell/common/gin_helper/event_emitter_caller.cc | 7 ++++--- shell/common/gin_helper/event_emitter_caller.h | 17 +++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/shell/common/gin_helper/event_emitter_caller.cc b/shell/common/gin_helper/event_emitter_caller.cc index d21a3fb77a6fe..a64f36d6144b9 100644 --- a/shell/common/gin_helper/event_emitter_caller.cc +++ b/shell/common/gin_helper/event_emitter_caller.cc @@ -11,7 +11,7 @@ namespace gin_helper::internal { v8::Local<v8::Value> CallMethodWithArgs( v8::Isolate* isolate, v8::Local<v8::Object> obj, - const char* method, + const std::string_view method, const base::span<v8::Local<v8::Value>> args) { v8::EscapableHandleScope handle_scope{isolate}; @@ -27,8 +27,9 @@ v8::Local<v8::Value> CallMethodWithArgs( v8::MicrotasksScope::kRunMicrotasks); // node::MakeCallback will also run pending tasks in Node.js. - v8::MaybeLocal<v8::Value> ret = node::MakeCallback( - isolate, obj, method, args.size(), args.data(), {0, 0}); + v8::MaybeLocal<v8::Value> ret = + node::MakeCallback(isolate, obj, gin::StringToV8(isolate, method), + args.size(), args.data(), {0, 0}); // If the JS function throws an exception (doesn't return a value) the result // of MakeCallback will be empty and therefore ToLocal will be false, in this diff --git a/shell/common/gin_helper/event_emitter_caller.h b/shell/common/gin_helper/event_emitter_caller.h index 25c935d660cbf..5ac2f40363180 100644 --- a/shell/common/gin_helper/event_emitter_caller.h +++ b/shell/common/gin_helper/event_emitter_caller.h @@ -6,6 +6,7 @@ #define ELECTRON_SHELL_COMMON_GIN_HELPER_EVENT_EMITTER_CALLER_H_ #include <array> +#include <string_view> #include <utility> #include "base/containers/span.h" @@ -20,17 +21,17 @@ namespace internal { v8::Local<v8::Value> CallMethodWithArgs(v8::Isolate* isolate, v8::Local<v8::Object> obj, - const char* method, + std::string_view method, base::span<v8::Local<v8::Value>> args); } // namespace internal // obj.emit(name, args...); // The caller is responsible of allocating a HandleScope. -template <typename StringType, typename... Args> +template <typename... Args> v8::Local<v8::Value> EmitEvent(v8::Isolate* isolate, v8::Local<v8::Object> obj, - const StringType& name, + const std::string_view name, Args&&... args) { v8::EscapableHandleScope scope{isolate}; std::array<v8::Local<v8::Value>, 1U + sizeof...(args)> converted_args = { @@ -45,7 +46,7 @@ v8::Local<v8::Value> EmitEvent(v8::Isolate* isolate, template <typename... Args> v8::Local<v8::Value> CustomEmit(v8::Isolate* isolate, v8::Local<v8::Object> object, - const char* custom_emit, + const std::string_view custom_emit, Args&&... args) { v8::EscapableHandleScope scope{isolate}; std::array<v8::Local<v8::Value>, sizeof...(args)> converted_args = { @@ -58,7 +59,7 @@ v8::Local<v8::Value> CustomEmit(v8::Isolate* isolate, template <typename T, typename... Args> v8::Local<v8::Value> CallMethod(v8::Isolate* isolate, gin_helper::DeprecatedWrappable<T>* object, - const char* method_name, + const std::string_view method_name, Args&&... args) { v8::EscapableHandleScope scope(isolate); v8::Local<v8::Object> v8_object; @@ -71,7 +72,7 @@ v8::Local<v8::Value> CallMethod(v8::Isolate* isolate, template <typename T, typename... Args> v8::Local<v8::Value> CallMethod(gin_helper::DeprecatedWrappable<T>* object, - const char* method_name, + const std::string_view method_name, Args&&... args) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); return CallMethod(isolate, object, method_name, std::forward<Args>(args)...); @@ -80,7 +81,7 @@ v8::Local<v8::Value> CallMethod(gin_helper::DeprecatedWrappable<T>* object, template <typename T, typename... Args> v8::Local<v8::Value> CallMethod(v8::Isolate* isolate, gin::Wrappable<T>* object, - const char* method_name, + const std::string_view method_name, Args&&... args) { v8::EscapableHandleScope scope(isolate); v8::Local<v8::Object> v8_object; @@ -93,7 +94,7 @@ v8::Local<v8::Value> CallMethod(v8::Isolate* isolate, template <typename T, typename... Args> v8::Local<v8::Value> CallMethod(gin::Wrappable<T>* object, - const char* method_name, + const std::string_view method_name, Args&&... args) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); return CallMethod(isolate, object, method_name, std::forward<Args>(args)...); From 41e6c388448da1b85596b74fa969f3455040855d Mon Sep 17 00:00:00 2001 From: Keeley Hammond <nilay2014@gmail.com> Date: Wed, 5 Nov 2025 15:49:43 -0800 Subject: [PATCH 208/268] fix: revert allow disabling all NSMenuItems, fix menu crash (#48794) Revert "fix: allow disabling all `NSMenuItems` (#48598)" This reverts commit 0cb4fdd0f2ae28d7bf3cd753cd2b641947e637aa. --- lib/browser/api/menu.ts | 21 +--- .../ui/cocoa/electron_menu_controller.mm | 111 ++++++++---------- 2 files changed, 50 insertions(+), 82 deletions(-) diff --git a/lib/browser/api/menu.ts b/lib/browser/api/menu.ts index 5f607b4ed3980..859f70fd1a7c3 100644 --- a/lib/browser/api/menu.ts +++ b/lib/browser/api/menu.ts @@ -25,30 +25,11 @@ Menu.prototype._isCommandIdChecked = function (id) { }; Menu.prototype._isCommandIdEnabled = function (id) { - const item = this.commandsMap[id]; - if (!item) return false; - - const focusedWindow = BaseWindow.getFocusedWindow(); - - if (item.role === 'minimize' && focusedWindow) { - return focusedWindow.isMinimizable(); - } - - if (item.role === 'togglefullscreen' && focusedWindow) { - return focusedWindow.isFullScreenable(); - } - - if (item.role === 'close' && focusedWindow) { - return focusedWindow.isClosable(); - } - - return item.enabled; + return this.commandsMap[id] ? this.commandsMap[id].enabled : false; }; - Menu.prototype._shouldCommandIdWorkWhenHidden = function (id) { return this.commandsMap[id]?.acceleratorWorksWhenHidden ?? false; }; - Menu.prototype._isCommandIdVisible = function (id) { return this.commandsMap[id]?.visible ?? false; }; diff --git a/shell/browser/ui/cocoa/electron_menu_controller.mm b/shell/browser/ui/cocoa/electron_menu_controller.mm index 789dd24f24fa4..1e78e57f01dc1 100644 --- a/shell/browser/ui/cocoa/electron_menu_controller.mm +++ b/shell/browser/ui/cocoa/electron_menu_controller.mm @@ -90,7 +90,6 @@ bool MenuHasVisibleItems(const electron::ElectronMenuModel* model) { // "(empty)" into the submenu. Matches Windows behavior. NSMenu* MakeEmptySubmenu() { NSMenu* submenu = [[NSMenu alloc] initWithTitle:@""]; - submenu.autoenablesItems = NO; NSString* empty_menu_title = l10n_util::GetNSString(IDS_APP_MENU_EMPTY_SUBMENU); @@ -232,9 +231,6 @@ - (void)cancel { // be invoked recursively. - (NSMenu*)menuFromModel:(electron::ElectronMenuModel*)model { NSMenu* menu = [[NSMenu alloc] initWithTitle:@""]; - // We manually manage enabled/disabled/hidden state for every item, - // including Cocoa role-based selectors. - menu.autoenablesItems = NO; const int count = model->GetItemCount(); for (int index = 0; index < count; index++) { @@ -244,7 +240,6 @@ - (NSMenu*)menuFromModel:(electron::ElectronMenuModel*)model { [self addItemToMenu:menu atIndex:index fromModel:model]; } - menu.delegate = self; return menu; } @@ -299,11 +294,9 @@ - (NSMenu*)createShareMenuForItem:(const SharingItem&)item { if ([items count] == 0) return MakeEmptySubmenu(); NSMenu* menu = [[NSMenu alloc] init]; - menu.autoenablesItems = NO; NSArray* services = [NSSharingService sharingServicesForItems:items]; for (NSSharingService* service in services) [menu addItem:[self menuItemForService:service withItems:items]]; - [menu setDelegate:self]; return menu; } @@ -360,22 +353,27 @@ - (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index std::u16string title = u"Services"; NSString* sub_label = l10n_util::FixUpWindowsStyleLabel(title); - item.target = nil; - item.action = nil; + [item setTarget:nil]; + [item setAction:nil]; NSMenu* submenu = [[NSMenu alloc] initWithTitle:sub_label]; - item.submenu = submenu; + [item setSubmenu:submenu]; [NSApp setServicesMenu:submenu]; } else if (role == u"sharemenu") { SharingItem sharing_item; model->GetSharingItemAt(index, &sharing_item); - item.target = nil; - item.action = nil; + [item setTarget:nil]; + [item setAction:nil]; [item setSubmenu:[self createShareMenuForItem:sharing_item]]; } else if (type == electron::ElectronMenuModel::TYPE_SUBMENU && model->IsVisibleAt(index)) { + // We need to specifically check that the submenu top-level item has been + // enabled as it's not validated by validateUserInterfaceItem + if (!model->IsEnabledAt(index)) + [item setEnabled:NO]; + // Recursively build a submenu from the sub-model at this index. - item.target = nil; - item.action = nil; + [item setTarget:nil]; + [item setAction:nil]; electron::ElectronMenuModel* submenuModel = static_cast<electron::ElectronMenuModel*>( model->GetSubmenuModelAt(index)); @@ -390,12 +388,8 @@ - (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index } } - submenu.title = item.title; - item.submenu = submenu; - item.tag = index; - item.representedObject = - [WeakPtrToElectronMenuModelAsNSObject weakPtrForModel:model]; - submenu.delegate = self; + [submenu setTitle:[item title]]; + [item setSubmenu:submenu]; // Set submenu's role. if ((role == u"window" || role == u"windowmenu") && [submenu numberOfItems]) @@ -410,9 +404,9 @@ - (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index // the model so hierarchical menus check the correct index in the correct // model. Setting the target to |self| allows this class to participate // in validation of the menu items. - item.tag = index; - item.representedObject = - [WeakPtrToElectronMenuModelAsNSObject weakPtrForModel:model]; + [item setTag:index]; + [item setRepresentedObject:[WeakPtrToElectronMenuModelAsNSObject + weakPtrForModel:model]]; ui::Accelerator accelerator; if (model->GetAcceleratorAtWithParams(index, useDefaultAccelerator_, &accelerator)) { @@ -440,20 +434,20 @@ - (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index ui::MacKeyCodeForWindowsKeyCode(accelerator.key_code(), modifier_mask, nullptr, &character); } - item.keyEquivalent = [NSString stringWithFormat:@"%C", character]; - item.keyEquivalentModifierMask = modifier_mask; + [item setKeyEquivalent:[NSString stringWithFormat:@"%C", character]]; + [item setKeyEquivalentModifierMask:modifier_mask]; } [(id)item setAllowsKeyEquivalentWhenHidden:(model->WorksWhenHiddenAt(index))]; // Set menu item's role. - item.target = self; + [item setTarget:self]; if (!role.empty()) { for (const Role& pair : kRolesMap) { if (role == base::ASCIIToUTF16(pair.role)) { - item.target = nil; - item.action = pair.selector; + [item setTarget:nil]; + [item setAction:pair.selector]; break; } } @@ -463,37 +457,6 @@ - (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index return item; } -- (void)applyStateToMenuItem:(NSMenuItem*)item { - id represented = item.representedObject; - if (!represented) - return; - - electron::ElectronMenuModel* model = - [WeakPtrToElectronMenuModelAsNSObject getFrom:represented]; - if (!model) - return; - - NSInteger index = item.tag; - int count = model->GetItemCount(); - if (index < 0 || index >= count) - return; - - item.hidden = !model->IsVisibleAt(index); - item.enabled = model->IsEnabledAt(index); - item.state = model->IsItemCheckedAt(index) ? NSControlStateValueOn - : NSControlStateValueOff; -} - -// Recursively refreshes the menu tree starting from |menu|, applying the -// model state to each menu item. -- (void)refreshMenuTree:(NSMenu*)menu { - for (NSMenuItem* item in menu.itemArray) { - [self applyStateToMenuItem:item]; - if (item.submenu) - [self refreshMenuTree:item.submenu]; - } -} - // Adds an item or a hierarchical menu to the item at the |index|, // associated with the entry in the model identified by |modelIndex|. - (void)addItemToMenu:(NSMenu*)menu @@ -503,6 +466,32 @@ - (void)addItemToMenu:(NSMenu*)menu atIndex:index]; } +// Called before the menu is to be displayed to update the state (enabled, +// radio, etc) of each item in the menu. +- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { + SEL action = [item action]; + if (action == @selector(performShare:)) + return YES; + if (action != @selector(itemSelected:)) + return NO; + + NSInteger modelIndex = [item tag]; + electron::ElectronMenuModel* model = [WeakPtrToElectronMenuModelAsNSObject + getFrom:[(id)item representedObject]]; + DCHECK(model); + if (model) { + BOOL checked = model->IsItemCheckedAt(modelIndex); + DCHECK([(id)item isKindOfClass:[NSMenuItem class]]); + + [(id)item + setState:(checked ? NSControlStateValueOn : NSControlStateValueOff)]; + [(id)item setHidden:(!model->IsVisibleAt(modelIndex))]; + + return model->IsEnabledAt(modelIndex); + } + return NO; +} + // Called when the user chooses a particular menu item. |sender| is the menu // item chosen. - (void)itemSelected:(id)sender { @@ -537,11 +526,10 @@ - (NSMenu*)menu { menu_ = menu; } else { menu_ = [[NSMenu alloc] initWithTitle:@""]; - menu_.autoenablesItems = NO; if (model_) [self populateWithModel:model_.get()]; } - menu_.delegate = self; + [menu_ setDelegate:self]; return menu_; } @@ -551,7 +539,6 @@ - (BOOL)isMenuOpen { - (void)menuWillOpen:(NSMenu*)menu { isMenuOpen_ = YES; - [self refreshMenuTree:menu]; if (model_) model_->MenuWillShow(); } From 0b490b569d0d907290704a043dce822b8e4100ac Mon Sep 17 00:00:00 2001 From: Charles Kerr <nilay2014@gmail.com> Date: Thu, 6 Nov 2025 02:05:50 -0600 Subject: [PATCH 209/268] refactor: remove `electron::WebRequestAPI` interface (#48792) * refactor: remove electron::WebRequestAPI interface Remove the |electron::WebRequestAPI| interface class. Use handles to the concrete class |electron::api::WebRequest| instead. Prerequisite for https://github.com/electron/electron/pull/48762. Two classes (electron::ProxyingURLLoaderFactory and electron::ProxyingWebSocket) hold a handle to a WebRequest via |raw_ptr<electron::WebRequestAPI>|. |electron::WebRequestAPI| is a pure virtual interface whose concrete impl is |electron::api::WebRequest|. This is a problem when migrating |electron::api::WebRequest| to cppgc: we need to change those |raw_ptr<>|s to |cppgc::WeakPersistent<>| but can't instantiate |cppgc::WeakPersistent<electron::WebRequestAPI>| as-is. We also can't change it to inherit from |cppgc::GarbageCollectedMixin|, since that causes problems when |electron::api::WebRequest| inherits from both |electron::WebRequestAPI| and |cppgc::GarbageCollected|. * refactor: use name web_request, not web_request_api * refactor: make ProxyingURLLoaderFactory::web_request() private * chore: make linter happy by fixing whitespace --- filenames.gni | 1 - shell/browser/api/electron_api_web_request.h | 34 ++++++---- .../extensions/electron_extension_loader.cc | 5 +- .../net/proxying_url_loader_factory.cc | 36 +++++----- .../browser/net/proxying_url_loader_factory.h | 11 ++-- shell/browser/net/proxying_websocket.cc | 28 ++++---- shell/browser/net/proxying_websocket.h | 8 +-- shell/browser/net/web_request_api_interface.h | 65 ------------------- 8 files changed, 64 insertions(+), 124 deletions(-) delete mode 100644 shell/browser/net/web_request_api_interface.h diff --git a/filenames.gni b/filenames.gni index 941dd9f7e4715..f37edbb0061c2 100644 --- a/filenames.gni +++ b/filenames.gni @@ -456,7 +456,6 @@ filenames = { "shell/browser/net/system_network_context_manager.h", "shell/browser/net/url_loader_network_observer.cc", "shell/browser/net/url_loader_network_observer.h", - "shell/browser/net/web_request_api_interface.h", "shell/browser/network_hints_handler_impl.cc", "shell/browser/network_hints_handler_impl.h", "shell/browser/notifications/notification.cc", diff --git a/shell/browser/api/electron_api_web_request.h b/shell/browser/api/electron_api_web_request.h index c2e97e6dc6d02..258e2ec21071c 100644 --- a/shell/browser/api/electron_api_web_request.h +++ b/shell/browser/api/electron_api_web_request.h @@ -7,9 +7,11 @@ #include <map> #include <set> +#include <string> #include "base/memory/raw_ptr.h" -#include "shell/browser/net/web_request_api_interface.h" +#include "net/base/completion_once_callback.h" +#include "services/network/public/cpp/resource_request.h" #include "shell/common/gin_helper/wrappable.h" class URLPattern; @@ -19,6 +21,7 @@ class BrowserContext; } namespace extensions { +struct WebRequestInfo; enum class WebRequestResourceType : uint8_t; } // namespace extensions @@ -33,9 +36,13 @@ class Handle; namespace electron::api { -class WebRequest final : public gin_helper::DeprecatedWrappable<WebRequest>, - public WebRequestAPI { +class WebRequest final : public gin_helper::DeprecatedWrappable<WebRequest> { public: + using BeforeSendHeadersCallback = + base::OnceCallback<void(const std::set<std::string>& removed_headers, + const std::set<std::string>& set_headers, + int error_code)>; + // Return the WebRequest object attached to |browser_context|, create if there // is no one. // Note that the lifetime of WebRequest object is managed by Session, instead @@ -62,38 +69,37 @@ class WebRequest final : public gin_helper::DeprecatedWrappable<WebRequest>, v8::Isolate* isolate) override; const char* GetTypeName() override; - // WebRequestAPI: - bool HasListener() const override; + bool HasListener() const; int OnBeforeRequest(extensions::WebRequestInfo* info, const network::ResourceRequest& request, net::CompletionOnceCallback callback, - GURL* new_url) override; + GURL* new_url); int OnBeforeSendHeaders(extensions::WebRequestInfo* info, const network::ResourceRequest& request, BeforeSendHeadersCallback callback, - net::HttpRequestHeaders* headers) override; + net::HttpRequestHeaders* headers); int OnHeadersReceived( extensions::WebRequestInfo* info, const network::ResourceRequest& request, net::CompletionOnceCallback callback, const net::HttpResponseHeaders* original_response_headers, scoped_refptr<net::HttpResponseHeaders>* override_response_headers, - GURL* allowed_unsafe_redirect_url) override; + GURL* allowed_unsafe_redirect_url); void OnSendHeaders(extensions::WebRequestInfo* info, const network::ResourceRequest& request, - const net::HttpRequestHeaders& headers) override; + const net::HttpRequestHeaders& headers); void OnBeforeRedirect(extensions::WebRequestInfo* info, const network::ResourceRequest& request, - const GURL& new_location) override; + const GURL& new_location); void OnResponseStarted(extensions::WebRequestInfo* info, - const network::ResourceRequest& request) override; + const network::ResourceRequest& request); void OnErrorOccurred(extensions::WebRequestInfo* info, const network::ResourceRequest& request, - int net_error) override; + int net_error); void OnCompleted(extensions::WebRequestInfo* info, const network::ResourceRequest& request, - int net_error) override; - void OnRequestWillBeDestroyed(extensions::WebRequestInfo* info) override; + int net_error); + void OnRequestWillBeDestroyed(extensions::WebRequestInfo* info); private: WebRequest(v8::Isolate* isolate, content::BrowserContext* browser_context); diff --git a/shell/browser/extensions/electron_extension_loader.cc b/shell/browser/extensions/electron_extension_loader.cc index 19bc33423abfa..26fef0216fc63 100644 --- a/shell/browser/extensions/electron_extension_loader.cc +++ b/shell/browser/extensions/electron_extension_loader.cc @@ -145,8 +145,9 @@ void ElectronExtensionLoader::FinishExtensionLoad( if (extension) { extension_registrar_->AddExtension(extension); - // Write extension install time to ExtensionPrefs. This is required by - // WebRequestAPI which calls extensions::ExtensionPrefs::GetInstallTime. + // Write extension install time to ExtensionPrefs. + // This is required by extensions::WebRequestAPI + // which calls extensions::ExtensionPrefs::GetInstallTime. // // Implementation for writing the pref was based on // PreferenceAPIBase::SetExtensionControlledPref. diff --git a/shell/browser/net/proxying_url_loader_factory.cc b/shell/browser/net/proxying_url_loader_factory.cc index bb361278dfecf..c0c9d676491e0 100644 --- a/shell/browser/net/proxying_url_loader_factory.cc +++ b/shell/browser/net/proxying_url_loader_factory.cc @@ -88,7 +88,7 @@ ProxyingURLLoaderFactory::InProgressRequest::~InProgressRequest() { // This is important to ensure that no outstanding blocking requests continue // to reference state owned by this object. if (info_) { - factory_->web_request_api()->OnRequestWillBeDestroyed(&info_.value()); + factory_->web_request()->OnRequestWillBeDestroyed(&info_.value()); } if (on_before_send_headers_callback_) { std::move(on_before_send_headers_callback_) @@ -147,7 +147,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::RestartInternal() { weak_factory_.GetWeakPtr()); } redirect_url_ = GURL(); - int result = factory_->web_request_api()->OnBeforeRequest( + int result = factory_->web_request()->OnBeforeRequest( &info_.value(), request_, continuation, &redirect_url_); if (result == net::ERR_BLOCKED_BY_CLIENT) { // The request was cancelled synchronously. Dispatch an error notification @@ -293,8 +293,8 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnComplete( } target_client_->OnComplete(status); - factory_->web_request_api()->OnCompleted(&info_.value(), request_, - status.error_code); + factory_->web_request()->OnCompleted(&info_.value(), request_, + status.error_code); // Deletes |this|. factory_->RemoveRequest(network_service_request_id_, request_id_); @@ -441,7 +441,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::ContinueToBeforeSendHeaders( auto continuation = base::BindRepeating( &InProgressRequest::ContinueToSendHeaders, weak_factory_.GetWeakPtr()); // Note: In Electron onBeforeSendHeaders is called for all protocols. - int result = factory_->web_request_api()->OnBeforeSendHeaders( + int result = factory_->web_request()->OnBeforeSendHeaders( &info_.value(), request_, continuation, &request_.headers); if (result == net::ERR_BLOCKED_BY_CLIENT) { @@ -555,8 +555,8 @@ void ProxyingURLLoaderFactory::InProgressRequest::ContinueToSendHeaders( proxied_client_receiver_.Resume(); // Note: In Electron onSendHeaders is called for all protocols. - factory_->web_request_api()->OnSendHeaders(&info_.value(), request_, - request_.headers); + factory_->web_request()->OnSendHeaders(&info_.value(), request_, + request_.headers); if (!current_request_uses_header_client_) ContinueToStartRequest(net::OK); @@ -598,8 +598,8 @@ void ProxyingURLLoaderFactory::InProgressRequest:: if (info_->response_code == net::HTTP_PROXY_AUTHENTICATION_REQUIRED) return; // We notify the completion here, and delete |this|. - factory_->web_request_api()->OnResponseStarted(&info_.value(), request_); - factory_->web_request_api()->OnCompleted(&info_.value(), request_, net::OK); + factory_->web_request()->OnResponseStarted(&info_.value(), request_); + factory_->web_request()->OnCompleted(&info_.value(), request_, net::OK); factory_->RemoveRequest(network_service_request_id_, request_id_); return; @@ -653,7 +653,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::ContinueToResponseStarted( proxied_client_receiver_.Resume(); - factory_->web_request_api()->OnResponseStarted(&info_.value(), request_); + factory_->web_request()->OnResponseStarted(&info_.value(), request_); target_client_->OnReceiveResponse(current_response_.Clone(), std::move(current_body_), std::move(current_cached_metadata_)); @@ -672,8 +672,8 @@ void ProxyingURLLoaderFactory::InProgressRequest::ContinueToBeforeRedirect( if (proxied_client_receiver_.is_bound()) proxied_client_receiver_.Resume(); - factory_->web_request_api()->OnBeforeRedirect(&info_.value(), request_, - redirect_info.new_url); + factory_->web_request()->OnBeforeRedirect(&info_.value(), request_, + redirect_info.new_url); target_client_->OnReceiveRedirect(redirect_info, current_response_.Clone()); request_.url = redirect_info.new_url; request_.method = redirect_info.new_method; @@ -696,7 +696,7 @@ void ProxyingURLLoaderFactory::InProgressRequest:: auto callback_pair = base::SplitOnceCallback(std::move(continuation)); DCHECK(info_.has_value()); - int result = factory_->web_request_api()->OnHeadersReceived( + int result = factory_->web_request()->OnHeadersReceived( &info_.value(), request_, std::move(callback_pair.first), current_response_->headers.get(), &override_headers_, &redirect_url_); if (result == net::ERR_BLOCKED_BY_CLIENT) { @@ -724,15 +724,15 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnRequestError( const network::URLLoaderCompletionStatus& status) { if (target_client_) target_client_->OnComplete(status); - factory_->web_request_api()->OnErrorOccurred(&info_.value(), request_, - status.error_code); + factory_->web_request()->OnErrorOccurred(&info_.value(), request_, + status.error_code); // Deletes |this|. factory_->RemoveRequest(network_service_request_id_, request_id_); } ProxyingURLLoaderFactory::ProxyingURLLoaderFactory( - WebRequestAPI* web_request_api, + api::WebRequest* web_request, const HandlersMap& intercepted_handlers, int render_process_id, int frame_routing_id, @@ -744,7 +744,7 @@ ProxyingURLLoaderFactory::ProxyingURLLoaderFactory( mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient> header_client_receiver, content::ContentBrowserClient::URLLoaderFactoryType loader_factory_type) - : web_request_api_(web_request_api), + : web_request_{web_request}, intercepted_handlers_(intercepted_handlers), render_process_id_(render_process_id), frame_routing_id_(frame_routing_id), @@ -824,7 +824,7 @@ void ProxyingURLLoaderFactory::CreateLoaderAndStart( return; } - if (!web_request_api()->HasListener()) { + if (!web_request()->HasListener()) { // Pass-through to the original factory. target_factory_->CreateLoaderAndStart(std::move(loader), request_id, options, request, std::move(client), diff --git a/shell/browser/net/proxying_url_loader_factory.h b/shell/browser/net/proxying_url_loader_factory.h index 7862ebc937823..0623946cf528e 100644 --- a/shell/browser/net/proxying_url_loader_factory.h +++ b/shell/browser/net/proxying_url_loader_factory.h @@ -30,8 +30,8 @@ #include "services/network/public/mojom/url_loader_factory.mojom.h" #include "services/network/public/mojom/url_response_head.mojom-forward.h" #include "services/network/url_loader_factory.h" +#include "shell/browser/api/electron_api_web_request.h" #include "shell/browser/net/electron_url_loader_factory.h" -#include "shell/browser/net/web_request_api_interface.h" #include "url/gurl.h" namespace mojo { @@ -197,7 +197,7 @@ class ProxyingURLLoaderFactory }; ProxyingURLLoaderFactory( - WebRequestAPI* web_request_api, + api::WebRequest* web_request, const HandlersMap& intercepted_handlers, int render_process_id, int frame_routing_id, @@ -239,11 +239,11 @@ class ProxyingURLLoaderFactory mojo::PendingReceiver<network::mojom::TrustedHeaderClient> receiver) override; - WebRequestAPI* web_request_api() { return web_request_api_; } - bool IsForServiceWorkerScript() const; private: + api::WebRequest* web_request() { return web_request_; } + void OnTargetFactoryError(); void OnProxyBindingError(); void RemoveRequest(int32_t network_service_request_id, uint64_t request_id); @@ -251,8 +251,7 @@ class ProxyingURLLoaderFactory bool ShouldIgnoreConnectionsLimit(const network::ResourceRequest& request); - // Passed from api::WebRequest. - raw_ptr<WebRequestAPI> web_request_api_; + raw_ptr<api::WebRequest> web_request_; // This is passed from api::Protocol. // diff --git a/shell/browser/net/proxying_websocket.cc b/shell/browser/net/proxying_websocket.cc index e9cfd0878762c..109250b271d2e 100644 --- a/shell/browser/net/proxying_websocket.cc +++ b/shell/browser/net/proxying_websocket.cc @@ -17,7 +17,7 @@ namespace electron { ProxyingWebSocket::ProxyingWebSocket( - WebRequestAPI* web_request_api, + api::WebRequest* web_request, WebSocketFactory factory, const network::ResourceRequest& request, mojo::PendingRemote<network::mojom::WebSocketHandshakeClient> @@ -27,7 +27,7 @@ ProxyingWebSocket::ProxyingWebSocket( int render_frame_id, content::BrowserContext* browser_context, uint64_t* request_id_generator) - : web_request_api_(web_request_api), + : web_request_{web_request}, request_(request), factory_(std::move(factory)), forwarding_handshake_client_(std::move(handshake_client)), @@ -70,8 +70,8 @@ void ProxyingWebSocket::Start() { weak_factory_.GetWeakPtr()); } - int result = web_request_api_->OnBeforeRequest(&info_, request_, continuation, - &redirect_url_); + int result = web_request_->OnBeforeRequest(&info_, request_, continuation, + &redirect_url_); if (result == net::ERR_BLOCKED_BY_CLIENT) { OnError(result); @@ -97,7 +97,7 @@ void ProxyingWebSocket::ContinueToHeadersReceived() { base::BindRepeating(&ProxyingWebSocket::OnHeadersReceivedComplete, weak_factory_.GetWeakPtr()); info_.AddResponseInfoFromResourceResponse(*response_); - int result = web_request_api_->OnHeadersReceived( + int result = web_request_->OnHeadersReceived( &info_, request_, continuation, response_->headers.get(), &override_headers_, &redirect_url_); @@ -152,7 +152,7 @@ void ProxyingWebSocket::OnConnectionEstablished( void ProxyingWebSocket::ContinueToCompleted() { DCHECK(forwarding_handshake_client_); DCHECK(is_done_); - web_request_api_->OnCompleted(&info_, request_, net::ERR_WS_UPGRADE); + web_request_->OnCompleted(&info_, request_, net::ERR_WS_UPGRADE); forwarding_handshake_client_->OnConnectionEstablished( std::move(websocket_), std::move(client_receiver_), std::move(handshake_response_), std::move(readable_), @@ -180,7 +180,7 @@ void ProxyingWebSocket::OnAuthRequired( base::BindRepeating(&ProxyingWebSocket::OnHeadersReceivedCompleteForAuth, weak_factory_.GetWeakPtr(), auth_info); info_.AddResponseInfoFromResourceResponse(*response_); - int result = web_request_api_->OnHeadersReceived( + int result = web_request_->OnHeadersReceived( &info_, request_, continuation, response_->headers.get(), &override_headers_, &redirect_url_); @@ -219,7 +219,7 @@ void ProxyingWebSocket::OnHeadersReceived(const std::string& headers, } void ProxyingWebSocket::StartProxying( - WebRequestAPI* web_request_api, + api::WebRequest* web_request, WebSocketFactory factory, const GURL& url, const net::SiteForCookies& site_for_cookies, @@ -242,7 +242,7 @@ void ProxyingWebSocket::StartProxying( request.request_initiator = origin; auto* proxy = new ProxyingWebSocket( - web_request_api, std::move(factory), request, std::move(handshake_client), + web_request, std::move(factory), request, std::move(handshake_client), has_extra_headers, process_id, render_frame_id, browser_context, request_id_generator); proxy->Start(); @@ -262,8 +262,8 @@ void ProxyingWebSocket::OnBeforeRequestComplete(int error_code) { weak_factory_.GetWeakPtr()); info_.AddResponseInfoFromResourceResponse(*response_); - int result = web_request_api_->OnBeforeSendHeaders( - &info_, request_, continuation, &request_headers_); + int result = web_request_->OnBeforeSendHeaders(&info_, request_, continuation, + &request_headers_); if (result == net::ERR_BLOCKED_BY_CLIENT) { OnError(result); @@ -296,7 +296,7 @@ void ProxyingWebSocket::OnBeforeSendHeadersComplete( } info_.AddResponseInfoFromResourceResponse(*response_); - web_request_api_->OnSendHeaders(&info_, request_, request_headers_); + web_request_->OnSendHeaders(&info_, request_, request_headers_); if (!receiver_as_header_client_.is_bound()) ContinueToStartRequest(net::OK); @@ -366,7 +366,7 @@ void ProxyingWebSocket::OnHeadersReceivedComplete(int error_code) { ResumeIncomingMethodCallProcessing(); info_.AddResponseInfoFromResourceResponse(*response_); - web_request_api_->OnResponseStarted(&info_, request_); + web_request_->OnResponseStarted(&info_, request_); if (!receiver_as_header_client_.is_bound()) ContinueToCompleted(); @@ -424,7 +424,7 @@ void ProxyingWebSocket::ResumeIncomingMethodCallProcessing() { void ProxyingWebSocket::OnError(int error_code) { if (!is_done_) { is_done_ = true; - web_request_api_->OnErrorOccurred(&info_, request_, error_code); + web_request_->OnErrorOccurred(&info_, request_, error_code); } // Deletes |this|. diff --git a/shell/browser/net/proxying_websocket.h b/shell/browser/net/proxying_websocket.h index 8940757adaa98..4ce67b658e1a7 100644 --- a/shell/browser/net/proxying_websocket.h +++ b/shell/browser/net/proxying_websocket.h @@ -19,7 +19,7 @@ #include "services/network/public/cpp/resource_request.h" #include "services/network/public/mojom/network_context.mojom.h" #include "services/network/public/mojom/websocket.mojom.h" -#include "shell/browser/net/web_request_api_interface.h" +#include "shell/browser/api/electron_api_web_request.h" #include "url/gurl.h" #include "url/origin.h" @@ -52,7 +52,7 @@ class ProxyingWebSocket : public network::mojom::WebSocketHandshakeClient, }; ProxyingWebSocket( - WebRequestAPI* web_request_api, + api::WebRequest* web_request, WebSocketFactory factory, const network::ResourceRequest& request, mojo::PendingRemote<network::mojom::WebSocketHandshakeClient> @@ -97,7 +97,7 @@ class ProxyingWebSocket : public network::mojom::WebSocketHandshakeClient, OnHeadersReceivedCallback callback) override; static void StartProxying( - WebRequestAPI* web_request_api, + api::WebRequest* web_request, WebSocketFactory factory, const GURL& url, const net::SiteForCookies& site_for_cookies, @@ -136,7 +136,7 @@ class ProxyingWebSocket : public network::mojom::WebSocketHandshakeClient, void OnMojoConnectionError(); // Passed from api::WebRequest. - raw_ptr<WebRequestAPI> web_request_api_; + raw_ptr<api::WebRequest> web_request_; // Saved to feed the api::WebRequest. network::ResourceRequest request_; diff --git a/shell/browser/net/web_request_api_interface.h b/shell/browser/net/web_request_api_interface.h deleted file mode 100644 index d93a6aa94391e..0000000000000 --- a/shell/browser/net/web_request_api_interface.h +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2020 GitHub, Inc. -// Use of this source code is governed by the MIT license that can be -// found in the LICENSE file. - -#ifndef ELECTRON_SHELL_BROWSER_NET_WEB_REQUEST_API_INTERFACE_H_ -#define ELECTRON_SHELL_BROWSER_NET_WEB_REQUEST_API_INTERFACE_H_ - -#include <set> -#include <string> - -#include "net/base/completion_once_callback.h" -#include "services/network/public/cpp/resource_request.h" - -namespace extensions { -struct WebRequestInfo; -} // namespace extensions - -namespace electron { - -// Defines the interface for WebRequest API, implemented by api::WebRequestNS. -class WebRequestAPI { - public: - virtual ~WebRequestAPI() = default; - - using BeforeSendHeadersCallback = - base::OnceCallback<void(const std::set<std::string>& removed_headers, - const std::set<std::string>& set_headers, - int error_code)>; - - virtual bool HasListener() const = 0; - virtual int OnBeforeRequest(extensions::WebRequestInfo* info, - const network::ResourceRequest& request, - net::CompletionOnceCallback callback, - GURL* new_url) = 0; - virtual int OnBeforeSendHeaders(extensions::WebRequestInfo* info, - const network::ResourceRequest& request, - BeforeSendHeadersCallback callback, - net::HttpRequestHeaders* headers) = 0; - virtual int OnHeadersReceived( - extensions::WebRequestInfo* info, - const network::ResourceRequest& request, - net::CompletionOnceCallback callback, - const net::HttpResponseHeaders* original_response_headers, - scoped_refptr<net::HttpResponseHeaders>* override_response_headers, - GURL* allowed_unsafe_redirect_url) = 0; - virtual void OnSendHeaders(extensions::WebRequestInfo* info, - const network::ResourceRequest& request, - const net::HttpRequestHeaders& headers) = 0; - virtual void OnBeforeRedirect(extensions::WebRequestInfo* info, - const network::ResourceRequest& request, - const GURL& new_location) = 0; - virtual void OnResponseStarted(extensions::WebRequestInfo* info, - const network::ResourceRequest& request) = 0; - virtual void OnErrorOccurred(extensions::WebRequestInfo* info, - const network::ResourceRequest& request, - int net_error) = 0; - virtual void OnCompleted(extensions::WebRequestInfo* info, - const network::ResourceRequest& request, - int net_error) = 0; - virtual void OnRequestWillBeDestroyed(extensions::WebRequestInfo* info) = 0; -}; - -} // namespace electron - -#endif // ELECTRON_SHELL_BROWSER_NET_WEB_REQUEST_API_INTERFACE_H_ From 9c1f06b82710bf33f2221b16fe0f481c8c378b73 Mon Sep 17 00:00:00 2001 From: David Sanders <nilay2014@gmail.com> Date: Thu, 6 Nov 2025 00:07:09 -0800 Subject: [PATCH 210/268] build: use --keep-non-patch flag with git am (#48797) --- script/lib/git.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/lib/git.py b/script/lib/git.py index 68789d8add0c8..55a3a560bebb3 100644 --- a/script/lib/git.py +++ b/script/lib/git.py @@ -52,7 +52,8 @@ def get_repo_root(path): def am(repo, patch_data, threeway=False, directory=None, exclude=None, committer_name=None, committer_email=None, keep_cr=True): - args = [] + # --keep-non-patch prevents stripping leading bracketed strings on the subject line + args = ['--keep-non-patch'] if threeway: args += ['--3way'] if directory is not None: From 05e26ba25461e101d066b327b1b07dcaca21164a Mon Sep 17 00:00:00 2001 From: Robo <nilay2014@gmail.com> Date: Thu, 6 Nov 2025 21:58:13 +0900 Subject: [PATCH 211/268] fix: oom crash in v8 when optimizing wasm (#48791) --- patches/v8/.patches | 1 + ...avoid_introducing_too_many_variables.patch | 475 ++++++++++++++++++ 2 files changed, 476 insertions(+) create mode 100644 patches/v8/turboshaft_avoid_introducing_too_many_variables.patch diff --git a/patches/v8/.patches b/patches/v8/.patches index dc98544242e85..671c7bed3ddaf 100644 --- a/patches/v8/.patches +++ b/patches/v8/.patches @@ -1 +1,2 @@ chore_allow_customizing_microtask_policy_per_context.patch +turboshaft_avoid_introducing_too_many_variables.patch diff --git a/patches/v8/turboshaft_avoid_introducing_too_many_variables.patch b/patches/v8/turboshaft_avoid_introducing_too_many_variables.patch new file mode 100644 index 0000000000000..78cd272ca5ab0 --- /dev/null +++ b/patches/v8/turboshaft_avoid_introducing_too_many_variables.patch @@ -0,0 +1,475 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Darius Mercadier <dmercadier@chromium.org> +Date: Wed, 5 Nov 2025 14:06:54 +0100 +Subject: [turboshaft] Avoid introducing too many Variables + +.... if we have very large merges. + +Cf https://crbug.com/418027512#comment5 for explanations of why this +is necessary (and the following comment for why I don't see a good +alternative to this CL). + +I've locally confirmed that this fixes the OOM from +https://crbug.com/457625181, and it reduces memory consumption on +binaries/crbug-40219016-zelda/zelda.wasm (from +https://crbug.com/418027512) by 20+%. + +Bug: 418027512, 457625181 +Change-Id: If55af659667723ce85ff71bcac66a43aff863e05 +Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7119378 +Commit-Queue: Darius Mercadier <dmercadier@chromium.org> +Auto-Submit: Darius Mercadier <dmercadier@chromium.org> +Reviewed-by: Matthias Liedtke <mliedtke@chromium.org> +Cr-Commit-Position: refs/heads/main@{#103534} + +diff --git a/src/compiler/turboshaft/branch-elimination-reducer.h b/src/compiler/turboshaft/branch-elimination-reducer.h +index c1862c2f1eeb2f4c8d8f1198d41e1f6113adb258..bf15cd9efc16fddaf99f959344c54257d6dfe21c 100644 +--- a/src/compiler/turboshaft/branch-elimination-reducer.h ++++ b/src/compiler/turboshaft/branch-elimination-reducer.h +@@ -371,6 +371,10 @@ class BranchEliminationReducer : public Next { + goto no_change; + } + ++ if (!__ CanCreateNVariables(destination_origin->OpCountUpperBound())) { ++ goto no_change; ++ } ++ + if (const BranchOp* branch = last_op.template TryCast<BranchOp>()) { + V<Word32> condition = + __ template MapToNewGraph<true>(branch->condition()); +diff --git a/src/compiler/turboshaft/copying-phase.h b/src/compiler/turboshaft/copying-phase.h +index ae9a67b8406214246cc13780d3b79ddbe7789cb8..14f31ad867f292d7a00ed8b596cd747ac7764c7e 100644 +--- a/src/compiler/turboshaft/copying-phase.h ++++ b/src/compiler/turboshaft/copying-phase.h +@@ -714,9 +714,23 @@ class GraphVisitor : public OutputGraphAssembler<GraphVisitor<AfterNext>, + if (Asm().CanAutoInlineBlocksWithSinglePredecessor() && + terminator.Is<GotoOp>()) { + Block* destination = terminator.Cast<GotoOp>().destination; +- if (destination->PredecessorCount() == 1) { +- block_to_inline_now_ = destination; +- return; ++ // Inlining the destination will require setting it in needs_variables_ ++ // mode; we thus check that we can actually create enough variables to do ++ // this. ++ // TODO(dmercadier): in practice, the only reason we need variables for ++ // the destination is because we could be currently in a phase that cloned ++ // the current block, which could lead to {destination} being cloned as ++ // well. No all phases can do this, so we could check that we're not in ++ // such a phase, and if so, not use variables for the destination. One way ++ // to do this would be to have a DisallowCloningReducer which would ++ // static_assert that LoopUnrolling/LoopPeeling/BranchElimination aren't ++ // on the stack and would also prevent using CloneSubGraph, ++ // CloneAndInlineBlock and CloneBlockAndGoto. ++ if (Asm().CanCreateNVariables(destination->OpCountUpperBound())) { ++ if (destination->PredecessorCount() == 1) { ++ block_to_inline_now_ = destination; ++ return; ++ } + } + } + // Just going through the regular VisitOp function. +diff --git a/src/compiler/turboshaft/graph.h b/src/compiler/turboshaft/graph.h +index 936c8b0269a9b87a4ffa20c40bbd908fb8c69010..a3c1c40e4e7097f518e107d85786c7cc5466e595 100644 +--- a/src/compiler/turboshaft/graph.h ++++ b/src/compiler/turboshaft/graph.h +@@ -608,6 +608,7 @@ class Graph { + operation_origins_.Reset(); + operation_types_.Reset(); + dominator_tree_depth_ = 0; ++ max_merge_pred_count_ = 0; + #ifdef DEBUG + block_type_refinement_.Reset(); + // Do not reset of graph_created_from_turbofan_ as it is propagated along +@@ -791,6 +792,8 @@ class Graph { + bound_blocks_.push_back(block); + uint32_t depth = block->ComputeDominator(); + dominator_tree_depth_ = std::max<uint32_t>(dominator_tree_depth_, depth); ++ max_merge_pred_count_ = ++ std::max<uint32_t>(max_merge_pred_count_, block->PredecessorCount()); + + #ifdef DEBUG + if (v8_flags.turboshaft_trace_emitted) { +@@ -1016,6 +1019,8 @@ class Graph { + + uint32_t DominatorTreeDepth() const { return dominator_tree_depth_; } + ++ uint32_t max_merge_pred_count() const { return max_merge_pred_count_; } ++ + const GrowingOpIndexSidetable<Type>& operation_types() const { + return operation_types_; + } +@@ -1068,6 +1073,7 @@ class Graph { + std::swap(next_block_, companion.next_block_); + std::swap(block_permutation_, companion.block_permutation_); + std::swap(graph_zone_, companion.graph_zone_); ++ std::swap(max_merge_pred_count_, companion.max_merge_pred_count_); + op_to_block_.SwapData(companion.op_to_block_); + source_positions_.SwapData(companion.source_positions_); + operation_origins_.SwapData(companion.operation_origins_); +@@ -1206,6 +1212,9 @@ class Graph { + GrowingOpIndexSidetable<SourcePosition> source_positions_; + GrowingOpIndexSidetable<OpIndex> operation_origins_; + uint32_t dominator_tree_depth_ = 0; ++ // {max_merge_pred_count_} stores the maximum number of predecessors that any ++ // Merge in the graph has. ++ uint32_t max_merge_pred_count_ = 0; + GrowingOpIndexSidetable<Type> operation_types_; + #ifdef DEBUG + GrowingBlockSidetable<TypeRefinements> block_type_refinement_; +diff --git a/src/compiler/turboshaft/loop-peeling-reducer.h b/src/compiler/turboshaft/loop-peeling-reducer.h +index a9b5eaaf4c88354164b3a5833d4bd6b2760b12a0..b7df7acb61d048669a2cacfbc4e2156df69788dc 100644 +--- a/src/compiler/turboshaft/loop-peeling-reducer.h ++++ b/src/compiler/turboshaft/loop-peeling-reducer.h +@@ -57,8 +57,7 @@ class LoopPeelingReducer : public Next { + const Block* dst = gto.destination; + if (dst->IsLoop() && !gto.is_backedge && CanPeelLoop(dst)) { + if (ShouldSkipOptimizationStep()) goto no_change; +- PeelFirstIteration(dst); +- return {}; ++ if (PeelFirstIteration(dst)) return {}; + } else if (IsEmittingPeeledIteration() && dst == current_loop_header_) { + // We skip the backedge of the loop: PeelFirstIeration will instead emit a + // forward edge to the non-peeled header. +@@ -111,13 +110,21 @@ class LoopPeelingReducer : public Next { + kEmittingUnpeeledBody + }; + +- void PeelFirstIteration(const Block* header) { ++ bool PeelFirstIteration(const Block* header) { + TRACE("LoopPeeling: peeling loop at " << header->index()); + DCHECK_EQ(peeling_, PeelingStatus::kNotPeeling); + ScopedModification<PeelingStatus> scope(&peeling_, + PeelingStatus::kEmittingPeeledLoop); + current_loop_header_ = header; + ++ constexpr int kNumberOfLoopCopies = 2; // peeled + unpeeled ++ size_t op_count_upper_bound = ++ loop_finder_.GetLoopInfo(header).op_count * kNumberOfLoopCopies; ++ if (!__ CanCreateNVariables(op_count_upper_bound)) { ++ TRACE("> Too many variables, skipping peeling"); ++ return false; ++ } ++ + // Emitting the peeled iteration. + auto loop_body = loop_finder_.GetLoopBody(header); + // Note that this call to CloneSubGraph will not emit the backedge because +@@ -133,7 +140,7 @@ class LoopPeelingReducer : public Next { + // While peeling, we realized that the 2nd iteration of the loop is not + // reachable. + TRACE("> Second iteration is not reachable, stopping now"); +- return; ++ return true; + } + + // We now emit the regular unpeeled loop. +@@ -141,6 +148,7 @@ class LoopPeelingReducer : public Next { + TRACE("> Emitting unpeeled loop body"); + __ CloneSubGraph(loop_body, /* keep_loop_kinds */ true, + /* is_loop_after_peeling */ true); ++ return true; + } + + bool CanPeelLoop(const Block* header) { +diff --git a/src/compiler/turboshaft/loop-unrolling-reducer.h b/src/compiler/turboshaft/loop-unrolling-reducer.h +index 181d298bfa27d21f013016b34a586078d12f8a58..92d6f7b36d4c5c0a64723f7d18427a62347bad9f 100644 +--- a/src/compiler/turboshaft/loop-unrolling-reducer.h ++++ b/src/compiler/turboshaft/loop-unrolling-reducer.h +@@ -211,6 +211,11 @@ class V8_EXPORT_PRIVATE LoopUnrollingAnalyzer { + info.op_count < kMaxLoopSizeForPartialUnrolling; + } + ++ size_t GetLoopOpCount(const Block* loop_header) { ++ DCHECK(loop_header->IsLoop()); ++ return loop_finder_.GetLoopInfo(loop_header).op_count; ++ } ++ + // The returned unroll count is the total number of copies of the loop body + // in the resulting graph, i.e., an unroll count of N means N-1 copies of the + // body which were partially unrolled, and 1 for the original/remaining body. +@@ -383,14 +388,12 @@ class LoopUnrollingReducer : public Next { + // header (note that loop headers only have 2 predecessor, including the + // backedge), and that isn't the backedge. + if (ShouldSkipOptimizationStep()) goto no_change; +- if (analyzer_.ShouldRemoveLoop(dst)) { +- RemoveLoop(dst); ++ if (analyzer_.ShouldRemoveLoop(dst) && RemoveLoop(dst)) { + return {}; +- } else if (analyzer_.ShouldFullyUnrollLoop(dst)) { +- FullyUnrollLoop(dst); ++ } else if (analyzer_.ShouldFullyUnrollLoop(dst) && FullyUnrollLoop(dst)) { + return {}; +- } else if (analyzer_.ShouldPartiallyUnrollLoop(dst)) { +- PartiallyUnrollLoop(dst); ++ } else if (analyzer_.ShouldPartiallyUnrollLoop(dst) && ++ PartiallyUnrollLoop(dst)) { + return {}; + } + } else if ((unrolling_ == UnrollingStatus::kUnrolling) && +@@ -467,9 +470,9 @@ class LoopUnrollingReducer : public Next { + // and would like to not emit the loop body that follows. + kRemoveLoop, + }; +- void RemoveLoop(const Block* header); +- void FullyUnrollLoop(const Block* header); +- void PartiallyUnrollLoop(const Block* header); ++ bool RemoveLoop(const Block* header); ++ bool FullyUnrollLoop(const Block* header); ++ bool PartiallyUnrollLoop(const Block* header); + void FixLoopPhis(const Block* input_graph_loop, Block* output_graph_loop, + const Block* backedge_block); + bool IsRunningBuiltinPipeline() { +@@ -508,10 +511,16 @@ class LoopUnrollingReducer : public Next { + }; + + template <class Next> +-void LoopUnrollingReducer<Next>::PartiallyUnrollLoop(const Block* header) { ++bool LoopUnrollingReducer<Next>::PartiallyUnrollLoop(const Block* header) { + TRACE("LoopUnrolling: partially unrolling loop at " << header->index().id()); + DCHECK_EQ(unrolling_, UnrollingStatus::kNotUnrolling); + DCHECK(!skip_next_stack_check_); ++ ++ if (!__ CanCreateNVariables(analyzer_.GetLoopOpCount(header))) { ++ TRACE("> Too many variables, skipping unrolling"); ++ return false; ++ } ++ + unrolling_ = UnrollingStatus::kUnrolling; + + auto loop_body = analyzer_.GetLoopBody(header); +@@ -533,7 +542,7 @@ void LoopUnrollingReducer<Next>::PartiallyUnrollLoop(const Block* header) { + __ CloneSubGraph(loop_body, /* keep_loop_kinds */ true); + if (StopUnrollingIfUnreachable(output_graph_header)) { + TRACE("> Next iteration is unreachable, stopping unrolling"); +- return; ++ return true; + } + + // Emitting the subsequent folded iterations. We set `unrolling_` to +@@ -549,7 +558,7 @@ void LoopUnrollingReducer<Next>::PartiallyUnrollLoop(const Block* header) { + __ CloneSubGraph(loop_body, /* keep_loop_kinds */ false); + if (StopUnrollingIfUnreachable(output_graph_header)) { + TRACE("> Next iteration is unreachable, stopping unrolling"); +- return; ++ return true; + } + } + +@@ -567,6 +576,7 @@ void LoopUnrollingReducer<Next>::PartiallyUnrollLoop(const Block* header) { + + unrolling_ = UnrollingStatus::kNotUnrolling; + TRACE("> Finished partially unrolling loop " << header->index().id()); ++ return true; + } + + template <class Next> +@@ -622,10 +632,20 @@ void LoopUnrollingReducer<Next>::FixLoopPhis(const Block* input_graph_loop, + } + + template <class Next> +-void LoopUnrollingReducer<Next>::RemoveLoop(const Block* header) { ++bool LoopUnrollingReducer<Next>::RemoveLoop(const Block* header) { + TRACE("LoopUnrolling: removing loop at " << header->index().id()); + DCHECK_EQ(unrolling_, UnrollingStatus::kNotUnrolling); + DCHECK(!skip_next_stack_check_); ++ ++ if (!__ CanCreateNVariables(analyzer_.GetLoopOpCount(header))) { ++ TRACE("> Too many variables, skipping removal"); ++ // TODO(dmercadier): in theory, RemoveLoop shouldn't need Variables, since ++ // it cannot be called while unrolling an outer loop, since we only unroll ++ // innermost loops. We should teach CloneAndInlineBlock that it doesn't ++ // always need to introduce Variables, and then remove this bailout. ++ return false; ++ } ++ + // When removing a loop, we still need to emit the header (since it has to + // always be executed before the 1st iteration anyways), but by setting + // {unrolling_} to `kRemoveLoop`, the final Branch of the loop will become a +@@ -633,15 +653,21 @@ void LoopUnrollingReducer<Next>::RemoveLoop(const Block* header) { + unrolling_ = UnrollingStatus::kRemoveLoop; + __ CloneAndInlineBlock(header); + unrolling_ = UnrollingStatus::kNotUnrolling; ++ return true; + } + + template <class Next> +-void LoopUnrollingReducer<Next>::FullyUnrollLoop(const Block* header) { ++bool LoopUnrollingReducer<Next>::FullyUnrollLoop(const Block* header) { + TRACE("LoopUnrolling: fully unrolling loop at " << header->index().id()); + DCHECK_EQ(unrolling_, UnrollingStatus::kNotUnrolling); + DCHECK(!skip_next_stack_check_); + ScopedModification<bool> skip_stack_checks(&skip_next_stack_check_, true); + ++ if (!__ CanCreateNVariables(analyzer_.GetLoopOpCount(header))) { ++ TRACE("> Too many variables, skipping unrolling"); ++ return false; ++ } ++ + size_t iter_count = analyzer_.GetIterationCount(header).exact_count(); + TRACE("> iter_count: " << iter_count); + +@@ -654,7 +680,7 @@ void LoopUnrollingReducer<Next>::FullyUnrollLoop(const Block* header) { + __ CloneSubGraph(loop_body, /* keep_loop_kinds */ false); + if (StopUnrollingIfUnreachable()) { + TRACE("> Next iteration is unreachable, stopping unrolling"); +- return; ++ return true; + } + } + +@@ -667,6 +693,7 @@ void LoopUnrollingReducer<Next>::FullyUnrollLoop(const Block* header) { + + unrolling_ = UnrollingStatus::kNotUnrolling; + TRACE("> Finished fully unrolling loop " << header->index().id()); ++ return true; + } + + #undef TRACE +diff --git a/src/compiler/turboshaft/turbolev-graph-builder.cc b/src/compiler/turboshaft/turbolev-graph-builder.cc +index a716474214131adfcfd95af7e492ec1d83c99893..9fe6313137c97847750b2c3362eb114f5671d0dc 100644 +--- a/src/compiler/turboshaft/turbolev-graph-builder.cc ++++ b/src/compiler/turboshaft/turbolev-graph-builder.cc +@@ -115,12 +115,7 @@ class BlockOriginTrackingReducer : public Next { + } + void Bind(Block* block) { + Next::Bind(block); +- // The 1st block we bind doesn't exist in Maglev and is meant to hold +- // Constants (which in Maglev are not in any block), and thus +- // {maglev_input_block_} should still be nullptr. In all other cases, +- // {maglev_input_block_} should not be nullptr. +- DCHECK_EQ(maglev_input_block_ == nullptr, +- block == &__ output_graph().StartBlock()); ++ DCHECK_NOT_NULL(maglev_input_block_); + turboshaft_block_origins_[block->index()] = maglev_input_block_; + } + +@@ -516,9 +511,11 @@ class GraphBuildingNodeProcessor { + block_mapping_[block] = + block->is_loop() ? __ NewLoopHeader() : __ NewBlock(); + } +- // Constants are not in a block in Maglev but are in Turboshaft. We bind a +- // block now, so that Constants can then be emitted. +- __ Bind(__ NewBlock()); ++ // Constants are not in a block in Maglev but are in Turboshaft. We bind the ++ // 1st block now, so that Constants can then be emitted. ++ const maglev::BasicBlock* first_maglev_block = graph->blocks().front(); ++ __ SetMaglevInputBlock(first_maglev_block); ++ __ Bind(block_mapping_[first_maglev_block]); + + // Initializing undefined constant so that we don't need to recreate it too + // often. +@@ -604,9 +601,20 @@ class GraphBuildingNodeProcessor { + Block* turboshaft_block = Map(maglev_block); + + if (__ current_block() != nullptr) { +- // The first block for Constants doesn't end with a Jump, so we add one +- // now. +- __ Goto(turboshaft_block); ++ // We must be in the first block of the graph, inserted by Turboshaft in ++ // PreProcessGraph so that constants can be bound in a block. No need to ++ // do anything else: we don't emit a Goto so that the actual 1st block of ++ // the Maglev graph gets inlined into this first block of the Turboshaft ++ // graph, which, in addition to saving a Goto, saves the need to clone the ++ // destination into the current block later, and also ensures that ++ // Parameters are always in the 1st block. ++ DCHECK_EQ(__ output_graph().block_count(), 1); ++ DCHECK_EQ(maglev_block->id(), 0); ++ DCHECK_EQ(__ current_block(), block_mapping_[maglev_block]); ++ // maglev_input_block should have been set by calling SetMaglevInputBlock ++ // in PreProcessGraph. ++ DCHECK_EQ(__ maglev_input_block(), maglev_block); ++ return maglev::BlockProcessResult::kContinue; + } + + #ifdef DEBUG +diff --git a/src/compiler/turboshaft/variable-reducer.h b/src/compiler/turboshaft/variable-reducer.h +index ccc19512d40bbc06071d499b012b5a6fa059d706..f4c75010845bc86c5b79d3a2429dac77835e32f8 100644 +--- a/src/compiler/turboshaft/variable-reducer.h ++++ b/src/compiler/turboshaft/variable-reducer.h +@@ -9,6 +9,7 @@ + #include <optional> + + #include "src/base/logging.h" ++#include "src/base/macros.h" + #include "src/codegen/machine-type.h" + #include "src/compiler/turboshaft/assembler.h" + #include "src/compiler/turboshaft/graph.h" +@@ -91,6 +92,15 @@ class VariableReducer : public RequiredOptimizationReducer<AfterNext> { + public: + TURBOSHAFT_REDUCER_BOILERPLATE(VariableReducer) + ++ ~VariableReducer() { ++ if (too_many_variables_bailouts_count_ != 0 && ++ V8_UNLIKELY(v8_flags.trace_turbo_bailouts)) { ++ std::cout << "Bailing out from block cloning " ++ << too_many_variables_bailouts_count_ << " time" ++ << (too_many_variables_bailouts_count_ > 1 ? "s" : "") << "\n"; ++ } ++ } ++ + void Bind(Block* new_block) { + Next::Bind(new_block); + +@@ -191,6 +201,26 @@ class VariableReducer : public RequiredOptimizationReducer<AfterNext> { + return table_.GetPredecessorValue(var, predecessor_index); + } + ++ bool CanCreateNVariables(size_t n) { ++ // Merges with many predecessors combined with many variables can quickly ++ // blow up memory since the SnapshotTable needs to create a state whose ++ // size can be up to number_of_predecessor*variable_count (note: in ++ // practice, it's often not quite variable_count but less since only ++ // variables that are live in at least one predecessor are counted). To ++ // avoid OOM or otherwise huge memory consumption, we thus stop creating ++ // variables (and bail out on optimizations that need variables) when this ++ // number becomes too large. I somewhat arbitrarily selected 100K here, ++ // which sounds high, but in terms of memory, it's just 100K*8=800KB, which ++ // is less than 1MB, which isn't going to amount for much in a function ++ // that is probably very large if it managed to reach this limit. ++ constexpr uint32_t kMaxAllowedMergeStateSize = 100'000; ++ bool can_create = ++ __ input_graph().max_merge_pred_count() * (variable_count_ + n) < ++ kMaxAllowedMergeStateSize; ++ if (!can_create) too_many_variables_bailouts_count_++; ++ return can_create; ++ } ++ + void SetVariable(Variable var, OpIndex new_index) { + DCHECK(!is_temporary_); + if (V8_UNLIKELY(__ generating_unreachable_operations())) return; +@@ -207,10 +237,12 @@ class VariableReducer : public RequiredOptimizationReducer<AfterNext> { + + Variable NewLoopInvariantVariable(MaybeRegisterRepresentation rep) { + DCHECK(!is_temporary_); ++ variable_count_++; + return table_.NewKey(VariableData{rep, true}, OpIndex::Invalid()); + } + Variable NewVariable(MaybeRegisterRepresentation rep) { + DCHECK(!is_temporary_); ++ variable_count_++; + return table_.NewKey(VariableData{rep, false}, OpIndex::Invalid()); + } + +@@ -316,6 +348,10 @@ class VariableReducer : public RequiredOptimizationReducer<AfterNext> { + __ input_graph().block_count(), std::nullopt, __ phase_zone()}; + bool is_temporary_ = false; + ++ // Tracks the number of variables that have been created. ++ uint32_t variable_count_ = 0; ++ uint32_t too_many_variables_bailouts_count_ = 0; ++ + // {predecessors_} is used during merging, but we use an instance variable for + // it, in order to save memory and not reallocate it for each merge. + ZoneVector<Snapshot> predecessors_{__ phase_zone()}; +diff --git a/test/unittests/compiler/turboshaft/control-flow-unittest.cc b/test/unittests/compiler/turboshaft/control-flow-unittest.cc +index 204ef0f0676511a31e79e5ecff32d53018fa1ea8..1d23775d8c0cd8f2591db997501acc799d7d4dd6 100644 +--- a/test/unittests/compiler/turboshaft/control-flow-unittest.cc ++++ b/test/unittests/compiler/turboshaft/control-flow-unittest.cc +@@ -55,7 +55,7 @@ TEST_F(ControlFlowTest, DefaultBlockInlining) { + // BranchElimination should remove such branches by cloning the block with the + // branch. In the end, the graph should contain (almost) no branches anymore. + TEST_F(ControlFlowTest, BranchElimination) { +- static constexpr int kSize = 10000; ++ static constexpr int kSize = 200; + + auto test = CreateFromGraph(1, [](auto& Asm) { + V<Word32> cond = From e16368d236527f2589cb209abc369045a97d8f1c Mon Sep 17 00:00:00 2001 From: George Xu <nilay2014@gmail.com> Date: Thu, 6 Nov 2025 19:02:04 -0800 Subject: [PATCH 212/268] fix(reland): allow disabling all `NSMenuItems` (#48795) * fix: allow disabling all `NSMenuItems` (#48598) fix: allow disabling all NSMenuItems * fix: add guard for type --------- Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> --- lib/browser/api/menu.ts | 21 +++- .../ui/cocoa/electron_menu_controller.mm | 117 ++++++++++-------- 2 files changed, 88 insertions(+), 50 deletions(-) diff --git a/lib/browser/api/menu.ts b/lib/browser/api/menu.ts index 859f70fd1a7c3..5f607b4ed3980 100644 --- a/lib/browser/api/menu.ts +++ b/lib/browser/api/menu.ts @@ -25,11 +25,30 @@ Menu.prototype._isCommandIdChecked = function (id) { }; Menu.prototype._isCommandIdEnabled = function (id) { - return this.commandsMap[id] ? this.commandsMap[id].enabled : false; + const item = this.commandsMap[id]; + if (!item) return false; + + const focusedWindow = BaseWindow.getFocusedWindow(); + + if (item.role === 'minimize' && focusedWindow) { + return focusedWindow.isMinimizable(); + } + + if (item.role === 'togglefullscreen' && focusedWindow) { + return focusedWindow.isFullScreenable(); + } + + if (item.role === 'close' && focusedWindow) { + return focusedWindow.isClosable(); + } + + return item.enabled; }; + Menu.prototype._shouldCommandIdWorkWhenHidden = function (id) { return this.commandsMap[id]?.acceleratorWorksWhenHidden ?? false; }; + Menu.prototype._isCommandIdVisible = function (id) { return this.commandsMap[id]?.visible ?? false; }; diff --git a/shell/browser/ui/cocoa/electron_menu_controller.mm b/shell/browser/ui/cocoa/electron_menu_controller.mm index 1e78e57f01dc1..56691ec9ef90e 100644 --- a/shell/browser/ui/cocoa/electron_menu_controller.mm +++ b/shell/browser/ui/cocoa/electron_menu_controller.mm @@ -90,6 +90,7 @@ bool MenuHasVisibleItems(const electron::ElectronMenuModel* model) { // "(empty)" into the submenu. Matches Windows behavior. NSMenu* MakeEmptySubmenu() { NSMenu* submenu = [[NSMenu alloc] initWithTitle:@""]; + submenu.autoenablesItems = NO; NSString* empty_menu_title = l10n_util::GetNSString(IDS_APP_MENU_EMPTY_SUBMENU); @@ -231,6 +232,9 @@ - (void)cancel { // be invoked recursively. - (NSMenu*)menuFromModel:(electron::ElectronMenuModel*)model { NSMenu* menu = [[NSMenu alloc] initWithTitle:@""]; + // We manually manage enabled/disabled/hidden state for every item, + // including Cocoa role-based selectors. + menu.autoenablesItems = NO; const int count = model->GetItemCount(); for (int index = 0; index < count; index++) { @@ -240,6 +244,7 @@ - (NSMenu*)menuFromModel:(electron::ElectronMenuModel*)model { [self addItemToMenu:menu atIndex:index fromModel:model]; } + menu.delegate = self; return menu; } @@ -294,9 +299,11 @@ - (NSMenu*)createShareMenuForItem:(const SharingItem&)item { if ([items count] == 0) return MakeEmptySubmenu(); NSMenu* menu = [[NSMenu alloc] init]; + menu.autoenablesItems = NO; NSArray* services = [NSSharingService sharingServicesForItems:items]; for (NSSharingService* service in services) [menu addItem:[self menuItemForService:service withItems:items]]; + [menu setDelegate:self]; return menu; } @@ -353,27 +360,22 @@ - (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index std::u16string title = u"Services"; NSString* sub_label = l10n_util::FixUpWindowsStyleLabel(title); - [item setTarget:nil]; - [item setAction:nil]; + item.target = nil; + item.action = nil; NSMenu* submenu = [[NSMenu alloc] initWithTitle:sub_label]; - [item setSubmenu:submenu]; + item.submenu = submenu; [NSApp setServicesMenu:submenu]; } else if (role == u"sharemenu") { SharingItem sharing_item; model->GetSharingItemAt(index, &sharing_item); - [item setTarget:nil]; - [item setAction:nil]; + item.target = nil; + item.action = nil; [item setSubmenu:[self createShareMenuForItem:sharing_item]]; } else if (type == electron::ElectronMenuModel::TYPE_SUBMENU && model->IsVisibleAt(index)) { - // We need to specifically check that the submenu top-level item has been - // enabled as it's not validated by validateUserInterfaceItem - if (!model->IsEnabledAt(index)) - [item setEnabled:NO]; - // Recursively build a submenu from the sub-model at this index. - [item setTarget:nil]; - [item setAction:nil]; + item.target = nil; + item.action = nil; electron::ElectronMenuModel* submenuModel = static_cast<electron::ElectronMenuModel*>( model->GetSubmenuModelAt(index)); @@ -388,8 +390,12 @@ - (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index } } - [submenu setTitle:[item title]]; - [item setSubmenu:submenu]; + submenu.title = item.title; + item.submenu = submenu; + item.tag = index; + item.representedObject = + [WeakPtrToElectronMenuModelAsNSObject weakPtrForModel:model]; + submenu.delegate = self; // Set submenu's role. if ((role == u"window" || role == u"windowmenu") && [submenu numberOfItems]) @@ -404,9 +410,9 @@ - (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index // the model so hierarchical menus check the correct index in the correct // model. Setting the target to |self| allows this class to participate // in validation of the menu items. - [item setTag:index]; - [item setRepresentedObject:[WeakPtrToElectronMenuModelAsNSObject - weakPtrForModel:model]]; + item.tag = index; + item.representedObject = + [WeakPtrToElectronMenuModelAsNSObject weakPtrForModel:model]; ui::Accelerator accelerator; if (model->GetAcceleratorAtWithParams(index, useDefaultAccelerator_, &accelerator)) { @@ -434,20 +440,20 @@ - (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index ui::MacKeyCodeForWindowsKeyCode(accelerator.key_code(), modifier_mask, nullptr, &character); } - [item setKeyEquivalent:[NSString stringWithFormat:@"%C", character]]; - [item setKeyEquivalentModifierMask:modifier_mask]; + item.keyEquivalent = [NSString stringWithFormat:@"%C", character]; + item.keyEquivalentModifierMask = modifier_mask; } [(id)item setAllowsKeyEquivalentWhenHidden:(model->WorksWhenHiddenAt(index))]; // Set menu item's role. - [item setTarget:self]; + item.target = self; if (!role.empty()) { for (const Role& pair : kRolesMap) { if (role == base::ASCIIToUTF16(pair.role)) { - [item setTarget:nil]; - [item setAction:pair.selector]; + item.target = nil; + item.action = pair.selector; break; } } @@ -457,6 +463,43 @@ - (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index return item; } +- (void)applyStateToMenuItem:(NSMenuItem*)item { + id represented = item.representedObject; + if (!represented) + return; + + if (![represented + isKindOfClass:[WeakPtrToElectronMenuModelAsNSObject class]]) { + NSLog(@"representedObject is not a WeakPtrToElectronMenuModelAsNSObject"); + return; + } + + electron::ElectronMenuModel* model = + [WeakPtrToElectronMenuModelAsNSObject getFrom:represented]; + if (!model) + return; + + NSInteger index = item.tag; + int count = model->GetItemCount(); + if (index < 0 || index >= count) + return; + + item.hidden = !model->IsVisibleAt(index); + item.enabled = model->IsEnabledAt(index); + item.state = model->IsItemCheckedAt(index) ? NSControlStateValueOn + : NSControlStateValueOff; +} + +// Recursively refreshes the menu tree starting from |menu|, applying the +// model state to each menu item. +- (void)refreshMenuTree:(NSMenu*)menu { + for (NSMenuItem* item in menu.itemArray) { + [self applyStateToMenuItem:item]; + if (item.submenu) + [self refreshMenuTree:item.submenu]; + } +} + // Adds an item or a hierarchical menu to the item at the |index|, // associated with the entry in the model identified by |modelIndex|. - (void)addItemToMenu:(NSMenu*)menu @@ -466,32 +509,6 @@ - (void)addItemToMenu:(NSMenu*)menu atIndex:index]; } -// Called before the menu is to be displayed to update the state (enabled, -// radio, etc) of each item in the menu. -- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { - SEL action = [item action]; - if (action == @selector(performShare:)) - return YES; - if (action != @selector(itemSelected:)) - return NO; - - NSInteger modelIndex = [item tag]; - electron::ElectronMenuModel* model = [WeakPtrToElectronMenuModelAsNSObject - getFrom:[(id)item representedObject]]; - DCHECK(model); - if (model) { - BOOL checked = model->IsItemCheckedAt(modelIndex); - DCHECK([(id)item isKindOfClass:[NSMenuItem class]]); - - [(id)item - setState:(checked ? NSControlStateValueOn : NSControlStateValueOff)]; - [(id)item setHidden:(!model->IsVisibleAt(modelIndex))]; - - return model->IsEnabledAt(modelIndex); - } - return NO; -} - // Called when the user chooses a particular menu item. |sender| is the menu // item chosen. - (void)itemSelected:(id)sender { @@ -526,10 +543,11 @@ - (NSMenu*)menu { menu_ = menu; } else { menu_ = [[NSMenu alloc] initWithTitle:@""]; + menu_.autoenablesItems = NO; if (model_) [self populateWithModel:model_.get()]; } - [menu_ setDelegate:self]; + menu_.delegate = self; return menu_; } @@ -539,6 +557,7 @@ - (BOOL)isMenuOpen { - (void)menuWillOpen:(NSMenu*)menu { isMenuOpen_ = YES; + [self refreshMenuTree:menu]; if (model_) model_->MenuWillShow(); } From cd0422935f449087487253df730fb4e21f292ece Mon Sep 17 00:00:00 2001 From: reito <nilay2014@gmail.com> Date: Fri, 7 Nov 2025 16:50:28 +0800 Subject: [PATCH 213/268] feat: add `sharedTexture` module to import shared texture (#47317) feat: add `sharedTexture` module. --- BUILD.gn | 1 + docs/api/shared-texture.md | 58 ++ .../shared-texture-import-texture-info.md | 11 + .../shared-texture-imported-subtle.md | 9 + .../api/structures/shared-texture-imported.md | 6 + docs/api/structures/shared-texture-subtle.md | 6 + .../structures/shared-texture-sync-token.md | 3 + .../api/structures/shared-texture-transfer.md | 10 + filenames.auto.gni | 11 + filenames.gni | 1 + lib/browser/api/module-list.ts | 1 + lib/browser/api/shared-texture.ts | 191 +++++ lib/browser/ipc-main-internal-utils.ts | 24 + lib/common/ipc-messages.ts | 3 + lib/renderer/api/module-list.ts | 1 + lib/renderer/api/shared-texture.ts | 45 + lib/sandboxed_renderer/api/module-list.ts | 4 + .../osr/osr_render_widget_host_view.cc | 9 + .../common/api/electron_api_shared_texture.cc | 810 ++++++++++++++++++ .../common/api/electron_api_shared_texture.h | 23 + shell/common/gin_converters/gfx_converter.cc | 30 +- shell/common/node_bindings.cc | 1 + spec/api-shared-texture-spec.ts | 281 ++++++ spec/fixtures/api/shared-texture/common.js | 168 ++++ spec/fixtures/api/shared-texture/image.png | Bin 0 -> 873 bytes .../api/shared-texture/managed/frame.html | 12 + .../api/shared-texture/managed/index.html | 14 + .../api/shared-texture/managed/preload.js | 28 + .../api/shared-texture/managed/renderer.js | 21 + spec/fixtures/api/shared-texture/osr.html | 13 + .../api/shared-texture/subtle/index.html | 14 + .../api/shared-texture/subtle/preload.js | 30 + .../api/shared-texture/subtle/renderer.js | 21 + typings/internal-ambient.d.ts | 1 + 34 files changed, 1846 insertions(+), 15 deletions(-) create mode 100644 docs/api/shared-texture.md create mode 100644 docs/api/structures/shared-texture-import-texture-info.md create mode 100644 docs/api/structures/shared-texture-imported-subtle.md create mode 100644 docs/api/structures/shared-texture-imported.md create mode 100644 docs/api/structures/shared-texture-subtle.md create mode 100644 docs/api/structures/shared-texture-sync-token.md create mode 100644 docs/api/structures/shared-texture-transfer.md create mode 100644 lib/browser/api/shared-texture.ts create mode 100644 lib/renderer/api/shared-texture.ts create mode 100644 shell/common/api/electron_api_shared_texture.cc create mode 100644 shell/common/api/electron_api_shared_texture.h create mode 100644 spec/api-shared-texture-spec.ts create mode 100644 spec/fixtures/api/shared-texture/common.js create mode 100644 spec/fixtures/api/shared-texture/image.png create mode 100644 spec/fixtures/api/shared-texture/managed/frame.html create mode 100644 spec/fixtures/api/shared-texture/managed/index.html create mode 100644 spec/fixtures/api/shared-texture/managed/preload.js create mode 100644 spec/fixtures/api/shared-texture/managed/renderer.js create mode 100644 spec/fixtures/api/shared-texture/osr.html create mode 100644 spec/fixtures/api/shared-texture/subtle/index.html create mode 100644 spec/fixtures/api/shared-texture/subtle/preload.js create mode 100644 spec/fixtures/api/shared-texture/subtle/renderer.js diff --git a/BUILD.gn b/BUILD.gn index c933f2e25b4d9..9eac9b970c2be 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -480,6 +480,7 @@ source_set("electron_lib") { "//device/bluetooth", "//device/bluetooth/public/cpp", "//gin", + "//gpu/ipc/client", "//media/capture/mojom:video_capture", "//media/mojo/mojom", "//media/mojo/mojom:web_speech_recognition", diff --git a/docs/api/shared-texture.md b/docs/api/shared-texture.md new file mode 100644 index 0000000000000..6aecb71d6aa4b --- /dev/null +++ b/docs/api/shared-texture.md @@ -0,0 +1,58 @@ +# sharedTexture + +> Import shared textures into Electron and converts platform specific handles into [`VideoFrame`](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame). Supports all Web rendering systems, and can be transferred across Electron processes. Read [here](https://github.com/electron/electron/blob/main/shell/common/api/shared_texture/README.md) for more information. + +Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process) + +## Methods + +The `sharedTexture` module has the following methods: + +**Note:** Experimental APIs are marked as such and could be removed in the future. + +### `sharedTexture.importSharedTexture(options)` _Experimental_ + +* `options` Object - Options for importing shared textures. + * `textureInfo` [SharedTextureImportTextureInfo](structures/shared-texture-import-texture-info.md) - The information of the shared texture to import. + * `allReferencesReleased` Function (optional) - Called when all references in all processes are released. You should keep the imported texture valid until this callback is called. + +Imports the shared texture from the given options. + +> [!NOTE] +> This method is only available in the main process. + +Returns `SharedTextureImported` - The imported shared texture. + +### `sharedTexture.sendSharedTexture(options, ...args)` _Experimental_ + +* `options` Object - Options for sending shared texture. + * `frame` [WebFrameMain](web-frame-main.md) - The target frame to transfer the shared texture to. For `WebContents`, you can pass `webContents.mainFrame`. If you provide a `webFrameMain` that is not a main frame, you'll need to enable `webPreferences.nodeIntegrationInSubFrames` for this, since this feature requires [IPC](https://www.electronjs.org/docs/latest/api/web-frame-main#frameipc-readonly) between main and the frame. + * `importedSharedTexture` [SharedTextureImported](structures/shared-texture-imported.md) - The imported shared texture. +* `...args` any[] - Additional arguments to pass to the renderer process. + +Send the imported shared texture to a renderer process. You must register a receiver at renderer process before calling this method. This method has a 1000ms timeout. Ensure the receiver is set and the renderer process is alive before calling this method. + +> [!NOTE] +> This method is only available in the main process. + +Returns `Promise<void>` - Resolves when the transfer is complete. + +### `sharedTexture.setSharedTextureReceiver(callback)` _Experimental_ + +* `callback` Function\<Promise\<void\>\> - The function to receive the imported shared texture. + * `receivedSharedTextureData` Object - The data received from the main process. + * `importedSharedTexture` [SharedTextureImported](structures/shared-texture-imported.md) - The imported shared texture. + * `...args` any[] - Additional arguments passed from the main process. + +Set a callback to receive imported shared textures from the main process. + +> [!NOTE] +> This method is only available in the renderer process. + +## Properties + +The `sharedTexture` module has the following properties: + +### `sharedTexture.subtle` _Experimental_ + +A [`SharedTextureSubtle`](structures/shared-texture-subtle.md) property, provides subtle APIs for interacting with shared texture for advanced users. diff --git a/docs/api/structures/shared-texture-import-texture-info.md b/docs/api/structures/shared-texture-import-texture-info.md new file mode 100644 index 0000000000000..47c9338c8fa3e --- /dev/null +++ b/docs/api/structures/shared-texture-import-texture-info.md @@ -0,0 +1,11 @@ +# SharedTextureImportTextureInfo Object + +* `pixelFormat` string - The pixel format of the texture. + * `bgra` - 32bpp BGRA (byte-order), 1 plane. + * `rgba` - 32bpp RGBA (byte-order), 1 plane. + * `rgbaf16` - Half float RGBA, 1 plane. +* `colorSpace` [ColorSpace](color-space.md) (optional) - The color space of the texture. +* `codedSize` [Size](size.md) - The full dimensions of the shared texture. +* `visibleRect` [Rectangle](rectangle.md) (optional) - A subsection of [0, 0, codedSize.width, codedSize.height]. In common cases, it is the full section area. +* `timestamp` number (optional) - A timestamp in microseconds that will be reflected to `VideoFrame`. +* `handle` [SharedTextureHandle](shared-texture-handle.md) - The shared texture handle. diff --git a/docs/api/structures/shared-texture-imported-subtle.md b/docs/api/structures/shared-texture-imported-subtle.md new file mode 100644 index 0000000000000..c0c934ee1a281 --- /dev/null +++ b/docs/api/structures/shared-texture-imported-subtle.md @@ -0,0 +1,9 @@ +# SharedTextureImportedSubtle Object + +* `getVideoFrame` Function\<[VideoFrame](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame)\> - Create a `VideoFrame` that uses the imported shared texture in the current process. You can call `VideoFrame.close()` once you've finished using the object. The underlying resources will wait for GPU finish internally. +* `release` Function - Release the resources. If you transferred and get multiple `SharedTextureImported` objects, you have to `release` every one of them. The resource on the GPU process will be destroyed when the last one is released. + * `callback` Function (optional) - Callback when the GPU command buffer finishes using this shared texture. It provides a precise event to safely release dependent resources. For example, if this object is created by `finishTransferSharedTexture`, you can use this callback to safely release the original one that called `startTransferSharedTexture` in other processes. You can also release the source shared texture that was used to `importSharedTexture` safely. +* `startTransferSharedTexture` Function\<[SharedTextureTransfer](shared-texture-transfer.md)\> - Create a `SharedTextureTransfer` that can be serialized and transferred to other processes. +* `getFrameCreationSyncToken` Function\<[SharedTextureSyncToken](shared-texture-sync-token.md)\> - This method is for advanced users. If used, it is typically called after `finishTransferSharedTexture`, and should be passed to the object which was called `startTransferSharedTexture` to prevent the source object release the underlying resource before the target object actually acquire the reference at gpu process asyncly. +* `setReleaseSyncToken` Function - This method is for advanced users. If used, this object's underlying resource will not be released until the set sync token is fulfilled at gpu process. By using sync tokens, users are not required to use release callbacks for lifetime management. + * `syncToken` [SharedTextureSyncToken](shared-texture-sync-token.md) - The sync token to set. diff --git a/docs/api/structures/shared-texture-imported.md b/docs/api/structures/shared-texture-imported.md new file mode 100644 index 0000000000000..e6fea2f420488 --- /dev/null +++ b/docs/api/structures/shared-texture-imported.md @@ -0,0 +1,6 @@ +# SharedTextureImported Object + +* `textureId` string - The unique identifier of the imported shared texture. +* `getVideoFrame` Function\<[VideoFrame](https://developer.mozilla.org/en-US/docs/Web/API/VideoFrame)\> - Create a `VideoFrame` that uses the imported shared texture in the current process. You can call `VideoFrame.close()` once you've finished using the object. The underlying resources will wait for GPU finish internally. +* `release` Function - Release this object's reference of the imported shared texture. The underlying resource will be alive until every reference is released. +* `subtle` [SharedTextureImportedSubtle](shared-texture-imported-subtle.md) - Provides subtle APIs to interact with the imported shared texture for advanced users. diff --git a/docs/api/structures/shared-texture-subtle.md b/docs/api/structures/shared-texture-subtle.md new file mode 100644 index 0000000000000..a20f4ff8928ab --- /dev/null +++ b/docs/api/structures/shared-texture-subtle.md @@ -0,0 +1,6 @@ +# SharedTextureSubtle Object + +* `importSharedTexture` Function\<[SharedTextureImportedSubtle](shared-texture-imported-subtle.md)\> - Imports the shared texture from the given options. Returns the imported shared texture. + * `textureInfo` [SharedTextureImportTextureInfo](shared-texture-import-texture-info.md) - The information of shared texture to import. +* `finishTransferSharedTexture` Function\<[SharedTextureImportedSubtle](shared-texture-imported-subtle.md)\> - Finishes the transfer of the shared texture and gets the transferred shared texture. Returns the imported shared texture from the transfer object. + * `transfer` [SharedTextureTransfer](shared-texture-transfer.md) - The transfer object of the shared texture. diff --git a/docs/api/structures/shared-texture-sync-token.md b/docs/api/structures/shared-texture-sync-token.md new file mode 100644 index 0000000000000..abc3b6e28748a --- /dev/null +++ b/docs/api/structures/shared-texture-sync-token.md @@ -0,0 +1,3 @@ +# SharedTextureSyncToken Object + +* `syncToken` string - The opaque data for sync token. diff --git a/docs/api/structures/shared-texture-transfer.md b/docs/api/structures/shared-texture-transfer.md new file mode 100644 index 0000000000000..3d36ab650bf2a --- /dev/null +++ b/docs/api/structures/shared-texture-transfer.md @@ -0,0 +1,10 @@ +# SharedTextureTransfer Object + +* `transfer` string _Readonly_ - The opaque transfer data of the shared texture. This can be transferred across Electron processes. +* `syncToken` string _Readonly_ - The opaque sync token data for frame creation. +* `pixelFormat` string _Readonly_ - The pixel format of the transferring texture. +* `codedSize` [Size](size.md) _Readonly_ - The full dimensions of the shared texture. +* `visibleRect` [Rectangle](rectangle.md) _Readonly_ - A subsection of [0, 0, codedSize.width(), codedSize.height()]. In common cases, it is the full section area. +* `timestamp` number _Readonly_ - A timestamp in microseconds that will be reflected to `VideoFrame`. + +Use `sharedTexture.subtle.finishTransferSharedTexture` to get [`SharedTextureImportedSubtle`](shared-texture-imported-subtle.md) back. diff --git a/filenames.auto.gni b/filenames.auto.gni index 9491b55b149ae..95c779b8e3152 100644 --- a/filenames.auto.gni +++ b/filenames.auto.gni @@ -52,6 +52,7 @@ auto_filenames = { "docs/api/service-workers.md", "docs/api/session.md", "docs/api/share-menu.md", + "docs/api/shared-texture.md", "docs/api/shell.md", "docs/api/structures", "docs/api/system-preferences.md", @@ -145,6 +146,12 @@ auto_filenames = { "docs/api/structures/shared-dictionary-info.md", "docs/api/structures/shared-dictionary-usage-info.md", "docs/api/structures/shared-texture-handle.md", + "docs/api/structures/shared-texture-import-texture-info.md", + "docs/api/structures/shared-texture-imported-subtle.md", + "docs/api/structures/shared-texture-imported.md", + "docs/api/structures/shared-texture-subtle.md", + "docs/api/structures/shared-texture-sync-token.md", + "docs/api/structures/shared-texture-transfer.md", "docs/api/structures/shared-worker-info.md", "docs/api/structures/sharing-item.md", "docs/api/structures/shortcut-details.md", @@ -176,6 +183,7 @@ auto_filenames = { "lib/renderer/api/context-bridge.ts", "lib/renderer/api/crash-reporter.ts", "lib/renderer/api/ipc-renderer.ts", + "lib/renderer/api/shared-texture.ts", "lib/renderer/api/web-frame.ts", "lib/renderer/api/web-utils.ts", "lib/renderer/common-init.ts", @@ -257,6 +265,7 @@ auto_filenames = { "lib/browser/api/service-worker-main.ts", "lib/browser/api/session.ts", "lib/browser/api/share-menu.ts", + "lib/browser/api/shared-texture.ts", "lib/browser/api/system-preferences.ts", "lib/browser/api/touch-bar.ts", "lib/browser/api/tray.ts", @@ -312,6 +321,7 @@ auto_filenames = { "lib/renderer/api/exports/electron.ts", "lib/renderer/api/ipc-renderer.ts", "lib/renderer/api/module-list.ts", + "lib/renderer/api/shared-texture.ts", "lib/renderer/api/web-frame.ts", "lib/renderer/api/web-utils.ts", "lib/renderer/common-init.ts", @@ -352,6 +362,7 @@ auto_filenames = { "lib/renderer/api/exports/electron.ts", "lib/renderer/api/ipc-renderer.ts", "lib/renderer/api/module-list.ts", + "lib/renderer/api/shared-texture.ts", "lib/renderer/api/web-frame.ts", "lib/renderer/api/web-utils.ts", "lib/renderer/ipc-renderer-bindings.ts", diff --git a/filenames.gni b/filenames.gni index f37edbb0061c2..8808b3b907054 100644 --- a/filenames.gni +++ b/filenames.gni @@ -563,6 +563,7 @@ filenames = { "shell/common/api/electron_api_native_image.cc", "shell/common/api/electron_api_native_image.h", "shell/common/api/electron_api_net.cc", + "shell/common/api/electron_api_shared_texture.cc", "shell/common/api/electron_api_shell.cc", "shell/common/api/electron_api_testing.cc", "shell/common/api/electron_api_url_loader.cc", diff --git a/lib/browser/api/module-list.ts b/lib/browser/api/module-list.ts index 81547d159a60c..8463e7027eb17 100644 --- a/lib/browser/api/module-list.ts +++ b/lib/browser/api/module-list.ts @@ -31,6 +31,7 @@ export const browserModuleList: ElectronInternal.ModuleEntry[] = [ { name: 'screen', loader: () => require('./screen') }, { name: 'ServiceWorkerMain', loader: () => require('./service-worker-main') }, { name: 'session', loader: () => require('./session') }, + { name: 'sharedTexture', loader: () => require('./shared-texture') }, { name: 'ShareMenu', loader: () => require('./share-menu') }, { name: 'systemPreferences', loader: () => require('./system-preferences') }, { name: 'TouchBar', loader: () => require('./touch-bar') }, diff --git a/lib/browser/api/shared-texture.ts b/lib/browser/api/shared-texture.ts new file mode 100644 index 0000000000000..85fcd49001168 --- /dev/null +++ b/lib/browser/api/shared-texture.ts @@ -0,0 +1,191 @@ +import ipcMain from '@electron/internal/browser/api/ipc-main'; +import * as ipcMainInternalUtils from '@electron/internal/browser/ipc-main-internal-utils'; +import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages'; + +import { randomUUID } from 'crypto'; + +const transferTimeout = 1000; +const sharedTextureNative = process._linkedBinding('electron_common_shared_texture'); +const managedSharedTextures = new Map<string, SharedTextureImportedWrapper>(); + +type AllReleasedCallback = (imported: Electron.SharedTextureImported) => void; + +type SharedTextureImportedWrapper = { + texture: Electron.SharedTextureImported; + allReferencesReleased: AllReleasedCallback | undefined; + mainReference: boolean; + rendererFrameReferences: Map<number, { count: number, reference: Electron.WebFrameMain }>; +} + +ipcMain.handle(IPC_MESSAGES.IMPORT_SHARED_TEXTURE_RELEASE_RENDERER_TO_MAIN, (event: Electron.IpcMainInvokeEvent, textureId: string) => { + const frameTreeNodeId = event.frameTreeNodeId ?? event.sender.mainFrame.frameTreeNodeId; + wrapperReleaseFromRenderer(textureId, frameTreeNodeId); +}); + +let checkManagedSharedTexturesInterval: NodeJS.Timeout | null = null; + +function scheduleCheckManagedSharedTextures () { + if (checkManagedSharedTexturesInterval === null) { + checkManagedSharedTexturesInterval = setInterval(checkManagedSharedTextures, 1000); + } +} + +function unscheduleCheckManagedSharedTextures () { + if (checkManagedSharedTexturesInterval !== null) { + clearInterval(checkManagedSharedTexturesInterval); + checkManagedSharedTexturesInterval = null; + } +} + +function checkManagedSharedTextures () { + const texturesToRemoveTracking = new Set<string>(); + for (const [, wrapper] of managedSharedTextures) { + for (const [frameTreeNodeId, entry] of wrapper.rendererFrameReferences) { + const frame = entry.reference; + if (!frame || frame.isDestroyed()) { + console.error(`The imported shared texture ${wrapper.texture.textureId} is referenced by a destroyed webContent/webFrameMain, this means a imported shared texture in renderer process is not released before the process is exited. Releasing that dangling reference now.`); + wrapper.rendererFrameReferences.delete(frameTreeNodeId); + } + } + + if (wrapper.rendererFrameReferences.size === 0 && !wrapper.mainReference) { + texturesToRemoveTracking.add(wrapper.texture.textureId); + wrapper.texture.subtle.release(() => { + wrapper.allReferencesReleased?.(wrapper.texture); + }); + } + } + + for (const id of texturesToRemoveTracking) { + managedSharedTextures.delete(id); + } + + if (managedSharedTextures.size === 0) { + unscheduleCheckManagedSharedTextures(); + } +} + +function wrapperReleaseFromRenderer (id: string, frameTreeNodeId: number) { + const wrapper = managedSharedTextures.get(id); + if (!wrapper) { + throw new Error(`Shared texture with id ${id} not found`); + } + + const entry = wrapper.rendererFrameReferences.get(frameTreeNodeId); + if (!entry) { + throw new Error(`Shared texture ${id} is not referenced by renderer frame ${frameTreeNodeId}`); + } + + entry.count -= 1; + if (entry.count === 0) { + wrapper.rendererFrameReferences.delete(frameTreeNodeId); + } else { + wrapper.rendererFrameReferences.set(frameTreeNodeId, entry); + } + + // Actually release the texture if no one is referencing it + if (wrapper.rendererFrameReferences.size === 0 && !wrapper.mainReference) { + managedSharedTextures.delete(id); + wrapper.texture.subtle.release(() => { + wrapper.allReferencesReleased?.(wrapper.texture); + }); + } +} + +function wrapperReleaseFromMain (id: string) { + const wrapper = managedSharedTextures.get(id); + if (!wrapper) { + throw new Error(`Shared texture with id ${id} not found`); + } + + // Actually release the texture if no one is referencing it + wrapper.mainReference = false; + if (wrapper.rendererFrameReferences.size === 0) { + managedSharedTextures.delete(id); + wrapper.texture.subtle.release(() => { + wrapper.allReferencesReleased?.(wrapper.texture); + }); + } +} + +async function sendSharedTexture (options: Electron.SendSharedTextureOptions, ...args: any[]) { + const imported = options.importedSharedTexture; + const transfer = imported.subtle.startTransferSharedTexture(); + + let timeoutHandle: NodeJS.Timeout | null = null; + const timeoutPromise = new Promise<never>((resolve, reject) => { + timeoutHandle = setTimeout(() => { + reject(new Error(`transfer shared texture timed out after ${transferTimeout}ms, ensure you have registered receiver at renderer process.`)); + }, transferTimeout); + }); + + const targetFrame: Electron.WebFrameMain | undefined = options.frame; + if (!targetFrame) { + throw new Error('`frame` should be provided'); + } + + const invokePromise: Promise<Electron.SharedTextureSyncToken> = ipcMainInternalUtils.invokeInWebFrameMain<Electron.SharedTextureSyncToken>( + targetFrame, + IPC_MESSAGES.IMPORT_SHARED_TEXTURE_TRANSFER_MAIN_TO_RENDERER, + transfer, + imported.textureId, + ...args + ); + + try { + const syncToken = await Promise.race([invokePromise, timeoutPromise]); + imported.subtle.setReleaseSyncToken(syncToken); + + const wrapper = managedSharedTextures.get(imported.textureId); + if (!wrapper) { + throw new Error(`Shared texture with id ${imported.textureId} not found`); + } + + const key = targetFrame.frameTreeNodeId; + const existing = wrapper.rendererFrameReferences.get(key); + if (existing) { + existing.count += 1; + wrapper.rendererFrameReferences.set(key, existing); + } else { + wrapper.rendererFrameReferences.set(key, { count: 1, reference: targetFrame }); + } + } finally { + if (timeoutHandle) { + clearTimeout(timeoutHandle); + } + } + + // Schedule a check to see if any texture is referenced by any dangling renderer + scheduleCheckManagedSharedTextures(); +} + +function importSharedTexture (options: Electron.ImportSharedTextureOptions) { + const id = randomUUID(); + const imported = sharedTextureNative.importSharedTexture(Object.assign(options.textureInfo, { id })); + const ret: Electron.SharedTextureImported = { + textureId: id, + subtle: imported, + getVideoFrame: imported.getVideoFrame, + release: () => { + wrapperReleaseFromMain(id); + } + }; + + const wrapper: SharedTextureImportedWrapper = { + texture: ret, + allReferencesReleased: options.allReferencesReleased, + mainReference: true, + rendererFrameReferences: new Map() + }; + managedSharedTextures.set(id, wrapper); + + return ret; +} + +const sharedTexture = { + subtle: sharedTextureNative, + importSharedTexture, + sendSharedTexture +}; + +export default sharedTexture; diff --git a/lib/browser/ipc-main-internal-utils.ts b/lib/browser/ipc-main-internal-utils.ts index d763cd6807374..602aa000cc06e 100644 --- a/lib/browser/ipc-main-internal-utils.ts +++ b/lib/browser/ipc-main-internal-utils.ts @@ -36,3 +36,27 @@ export function invokeInWebContents<T> (sender: Electron.WebContents, command: s sender._sendInternal(command, requestId, ...args); }); } + +export function invokeInWebFrameMain<T> (sender: Electron.WebFrameMain, command: string, ...args: any[]) { + return new Promise<T>((resolve, reject) => { + const requestId = ++nextId; + const channel = `${command}_RESPONSE_${requestId}`; + const frameTreeNodeId = sender.frameTreeNodeId; + ipcMainInternal.on(channel, function handler (event, error: Error, result: any) { + if (event.type === 'frame' && event.frameTreeNodeId !== frameTreeNodeId) { + console.error(`Reply to ${command} sent by unexpected WebFrameMain (${event.frameTreeNodeId})`); + return; + } + + ipcMainInternal.removeListener(channel, handler); + + if (error) { + reject(error); + } else { + resolve(result); + } + }); + + sender._sendInternal(command, requestId, ...args); + }); +} diff --git a/lib/common/ipc-messages.ts b/lib/common/ipc-messages.ts index a980924f121db..4988eb08008fe 100644 --- a/lib/common/ipc-messages.ts +++ b/lib/common/ipc-messages.ts @@ -25,4 +25,7 @@ export const enum IPC_MESSAGES { INSPECTOR_CONFIRM = 'INSPECTOR_CONFIRM', INSPECTOR_CONTEXT_MENU = 'INSPECTOR_CONTEXT_MENU', INSPECTOR_SELECT_FILE = 'INSPECTOR_SELECT_FILE', + + IMPORT_SHARED_TEXTURE_TRANSFER_MAIN_TO_RENDERER = 'IMPORT_SHARED_TEXTURE_TRANSFER_MAIN_TO_RENDERER', + IMPORT_SHARED_TEXTURE_RELEASE_RENDERER_TO_MAIN = 'IMPORT_SHARED_TEXTURE_RELEASE_RENDERER_TO_MAIN', } diff --git a/lib/renderer/api/module-list.ts b/lib/renderer/api/module-list.ts index 7ac9ea67a64cc..46d3fcf3df457 100644 --- a/lib/renderer/api/module-list.ts +++ b/lib/renderer/api/module-list.ts @@ -4,6 +4,7 @@ export const rendererModuleList: ElectronInternal.ModuleEntry[] = [ { name: 'contextBridge', loader: () => require('./context-bridge') }, { name: 'crashReporter', loader: () => require('./crash-reporter') }, { name: 'ipcRenderer', loader: () => require('./ipc-renderer') }, + { name: 'sharedTexture', loader: () => require('./shared-texture') }, { name: 'webFrame', loader: () => require('./web-frame') }, { name: 'webUtils', loader: () => require('./web-utils') } ]; diff --git a/lib/renderer/api/shared-texture.ts b/lib/renderer/api/shared-texture.ts new file mode 100644 index 0000000000000..5448edb46efef --- /dev/null +++ b/lib/renderer/api/shared-texture.ts @@ -0,0 +1,45 @@ +import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages'; +import ipcRenderer from '@electron/internal/renderer/api/ipc-renderer'; +import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal'; + +const sharedTextureNative = process._linkedBinding('electron_common_shared_texture'); +const transferChannelName = IPC_MESSAGES.IMPORT_SHARED_TEXTURE_TRANSFER_MAIN_TO_RENDERER; + +type SharedTextureReceiverCallback = (data: Electron.ReceivedSharedTextureData, ...args: any[]) => Promise<void>; +let sharedTextureReceiverCallback: SharedTextureReceiverCallback | null = null; + +ipcRendererInternal.on(transferChannelName, async (event, requestId, ...args) => { + const replyChannel = `${transferChannelName}_RESPONSE_${requestId}`; + try { + const transfer = args[0] as Electron.SharedTextureTransfer; + const textureId = args[1] as string; + const imported = sharedTextureNative.finishTransferSharedTexture(Object.assign(transfer, { id: textureId })); + const syncToken = imported.getFrameCreationSyncToken(); + event.sender.send(replyChannel, null, syncToken); + + const wrapper: Electron.SharedTextureImported = { + textureId, + subtle: imported, + getVideoFrame: imported.getVideoFrame, + release: () => { + imported.release(async () => { + await ipcRenderer.invoke(IPC_MESSAGES.IMPORT_SHARED_TEXTURE_RELEASE_RENDERER_TO_MAIN, textureId); + }); + } + }; + + const data: Electron.ReceivedSharedTextureData = { importedSharedTexture: wrapper }; + await sharedTextureReceiverCallback?.(data, ...args.slice(2)); + } catch (error) { + event.sender.send(replyChannel, error); + } +}); + +const sharedTexture = { + subtle: sharedTextureNative, + setSharedTextureReceiver: (callback: SharedTextureReceiverCallback) => { + sharedTextureReceiverCallback = callback; + } +}; + +export default sharedTexture; diff --git a/lib/sandboxed_renderer/api/module-list.ts b/lib/sandboxed_renderer/api/module-list.ts index 36454319e1f63..72aa778e6556a 100644 --- a/lib/sandboxed_renderer/api/module-list.ts +++ b/lib/sandboxed_renderer/api/module-list.ts @@ -15,6 +15,10 @@ export const moduleList: ElectronInternal.ModuleEntry[] = [ name: 'nativeImage', loader: () => require('@electron/internal/common/api/native-image') }, + { + name: 'sharedTexture', + loader: () => require('@electron/internal/renderer/api/shared-texture') + }, { name: 'webFrame', loader: () => require('@electron/internal/renderer/api/web-frame') diff --git a/shell/browser/osr/osr_render_widget_host_view.cc b/shell/browser/osr/osr_render_widget_host_view.cc index ff2cd93c0c81b..c9fdc0a8a679b 100644 --- a/shell/browser/osr/osr_render_widget_host_view.cc +++ b/shell/browser/osr/osr_render_widget_host_view.cc @@ -210,6 +210,15 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView( compositor_->SetDelegate(this); compositor_->SetRootLayer(root_layer_.get()); + // For offscreen rendering with format rgbaf16, we need to set correct display + // color spaces to the compositor, otherwise it won't support hdr. + if (offscreen_use_shared_texture_ && + offscreen_shared_texture_pixel_format_ == "rgbaf16") { + gfx::DisplayColorSpaces hdr_display_color_spaces( + gfx::ColorSpace::CreateSRGBLinear(), viz::SinglePlaneFormat::kRGBA_F16); + compositor_->SetDisplayColorSpaces(hdr_display_color_spaces); + } + ResizeRootLayer(false); render_widget_host_->SetView(this); diff --git a/shell/common/api/electron_api_shared_texture.cc b/shell/common/api/electron_api_shared_texture.cc new file mode 100644 index 0000000000000..f8b825bb10aab --- /dev/null +++ b/shell/common/api/electron_api_shared_texture.cc @@ -0,0 +1,810 @@ +// Copyright (c) 2025 Reito <reito@chromium.org> +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#include "shell/common/api/electron_api_shared_texture.h" + +#include "base/base64.h" +#include "base/command_line.h" +#include "base/numerics/byte_conversions.h" +#include "components/viz/common/resources/shared_image_format_utils.h" +#include "content/browser/compositor/image_transport_factory.h" // nogncheck +#include "gpu/command_buffer/client/context_support.h" +#include "gpu/ipc/client/client_shared_image_interface.h" +#include "gpu/ipc/client/gpu_channel_host.h" +#include "gpu/ipc/common/exported_shared_image.mojom-shared.h" +#include "gpu/ipc/common/exported_shared_image_mojom_traits.h" +#include "media/base/format_utils.h" +#include "media/base/video_frame.h" +#include "media/mojo/mojom/video_frame_mojom_traits.h" +#include "shell/common/gin_converters/blink_converter.h" +#include "shell/common/gin_converters/callback_converter.h" +#include "shell/common/gin_converters/gfx_converter.h" +#include "shell/common/gin_helper/dictionary.h" +#include "shell/common/gin_helper/error_thrower.h" +#include "shell/common/node_includes.h" +#include "shell/common/node_util.h" +#include "third_party/blink/renderer/modules/webcodecs/video_frame.h" // nogncheck +#include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h" // nogncheck +#include "ui/compositor/compositor.h" + +#if BUILDFLAG(IS_LINUX) +#include "base/posix/eintr_wrapper.h" +#include "base/strings/string_number_conversions.h" +#endif + +namespace { + +bool IsBrowserProcess() { + static int is_browser_process = -1; + if (is_browser_process == -1) { + // Browser process does not specify a type. + is_browser_process = base::CommandLine::ForCurrentProcess() + ->GetSwitchValueASCII("type") + .empty(); + } + + return is_browser_process == 1; +} + +gpu::ContextSupport* GetContextSupport() { + if (IsBrowserProcess()) { + auto* factory = content::ImageTransportFactory::GetInstance(); + return factory->GetContextFactory() + ->SharedMainThreadRasterContextProvider() + ->ContextSupport(); + } else { + return blink::SharedGpuContext::ContextProviderWrapper() + ->ContextProvider() + .ContextSupport(); + } +} + +gpu::SharedImageInterface* GetSharedImageInterface() { + if (IsBrowserProcess()) { + auto* factory = content::ImageTransportFactory::GetInstance(); + return factory->GetContextFactory() + ->SharedMainThreadRasterContextProvider() + ->SharedImageInterface(); + } else { + return blink::SharedGpuContext::SharedImageInterfaceProvider() + ->SharedImageInterface(); + } +} + +std::string GetBase64StringFromSyncToken(gpu::SyncToken& sync_token) { + if (!sync_token.verified_flush()) { + auto* sii = GetSharedImageInterface(); + sii->VerifySyncToken(sync_token); + } + + auto sync_token_data = base::Base64Encode(UNSAFE_BUFFERS( + base::span(reinterpret_cast<uint8_t*>(sync_token.GetData()), + sizeof(gpu::SyncToken)))); + + return sync_token_data; +} + +gpu::SyncToken GetSyncTokenFromBase64String( + const std::string& sync_token_data) { + if (sync_token_data.empty()) { + LOG(ERROR) << "Sync token data is empty."; + return {}; + } + + auto sync_token_bytes = base::Base64Decode(sync_token_data); + if (!sync_token_bytes.has_value()) { + LOG(ERROR) << "Failed to decode sync token from base64 string."; + return {}; + } + + if (sync_token_bytes->size() != sizeof(gpu::SyncToken)) { + LOG(ERROR) << "Invalid sync token size: " << sync_token_bytes->size(); + return {}; + } + + base::span<const uint8_t> sync_token_span = UNSAFE_BUFFERS( + base::span(sync_token_bytes->data(), sync_token_bytes->size())); + auto* sync_token_source = + reinterpret_cast<const gpu::SyncToken*>(sync_token_span.data()); + gpu::SyncToken sync_token(sync_token_source->namespace_id(), + sync_token_source->command_buffer_id(), + sync_token_source->release_count()); + + if (sync_token_source->verified_flush()) { + sync_token.SetVerifyFlush(); + } + + return sync_token; +} + +std::string TransferVideoPixelFormatToString(media::VideoPixelFormat format) { + switch (format) { + case media::PIXEL_FORMAT_ARGB: + return "bgra"; + case media::PIXEL_FORMAT_ABGR: + return "rgba"; + case media::PIXEL_FORMAT_RGBAF16: + return "rgbaf16"; + default: + NOTREACHED(); + } +} + +struct ImportedSharedTexture + : base::RefCountedThreadSafe<ImportedSharedTexture> { + // Metadata + gfx::Size coded_size; + gfx::Rect visible_rect; + int64_t timestamp; + media::VideoPixelFormat pixel_format; + + // Holds a reference to prevent it from being destroyed. + scoped_refptr<gpu::ClientSharedImage> client_shared_image; + gpu::SyncToken frame_creation_sync_token; + base::Lock release_sync_token_lock_; + gpu::SyncToken release_sync_token GUARDED_BY(release_sync_token_lock_); + base::OnceClosure release_callback; + + // Texture id for printing warnings like GC check. + std::string id; + + void UpdateReleaseSyncToken(const gpu::SyncToken& token); + void SetupReleaseSyncTokenCallback(); + + // Transfer to other Chromium processes. + v8::Local<v8::Value> StartTransferSharedTexture(v8::Isolate* isolate); + + // Get the creation sync token for the shared image. This is called + // after |finishTransferSharedTexture| and users need to pass the + // sync token back to the source object, and call |setReleaseSyncToken| + // to prevent the resource being released before actual acquisition + // happens for the target object. + v8::Local<v8::Value> GetFrameCreationSyncToken(v8::Isolate* isolate); + + // Set a release sync token for this shared texture. This is set + // when |finishTransferSharedTexture| is called and prevent the source + // object release the underlying resource before the target object + // actually done acquiring the resource at gpu process. + // Note that this is optional to set, if not set, users can still use + // `release()` and use the callback to wait for the signal that source + // object is safe to do the further release. If set, users can call + // `release()` on the source object without worrying the target object + // didn't finish acquiring the resource at gpu process. + void SetReleaseSyncToken(v8::Isolate* isolate, v8::Local<v8::Value> options); + + // The cleanup happens at destructor. + private: + friend class base::RefCountedThreadSafe<ImportedSharedTexture>; + ~ImportedSharedTexture(); +}; + +// Wraps the structure so that it can be ref counted. +struct ImportedSharedTextureWrapper { + // Make the import shared texture wrapper ref counted, so that it can be + // held by multiple VideoFrames. + scoped_refptr<ImportedSharedTexture> ist; + + // Monitor garbage collection. + std::unique_ptr<v8::Persistent<v8::Value>> persistent_; + void ResetPersistent() const { persistent_->Reset(); } + v8::Persistent<v8::Value>* CreatePersistent(v8::Isolate* isolate, + v8::Local<v8::Value> value) { + persistent_ = std::make_unique<v8::Persistent<v8::Value>>(isolate, value); + return persistent_.get(); + } + + // Create VideoFrame from the shared image. + v8::Local<v8::Value> CreateVideoFrame(v8::Isolate* isolate); + + // Release the shared image. + bool IsReferenceReleased() const { return ist.get() == nullptr; } + void ReleaseReference(); +}; + +void ImportedSharedTextureWrapper::ReleaseReference() { + if (IsReferenceReleased()) { + LOG(ERROR) << "This imported shared texture is already released."; + return; + } + + // Drop the reference, if at lease one VideoFrame is still holding it, + // the final clean up will wait for them. + ist.reset(); +} + +// This function will be called when the VideoFrame is destructed. +void OnVideoFrameMailboxReleased( + const scoped_refptr<ImportedSharedTexture>& ist, + const gpu::SyncToken& sync_token) { + ist->UpdateReleaseSyncToken(sync_token); +} + +v8::Local<v8::Value> ImportedSharedTextureWrapper::CreateVideoFrame( + v8::Isolate* isolate) { + auto* current_script_state = blink::ScriptState::ForCurrentRealm(isolate); + auto* current_execution_context = + blink::ToExecutionContext(current_script_state); + + auto si = ist->client_shared_image; + auto cb = base::BindOnce(OnVideoFrameMailboxReleased, ist); + + scoped_refptr<media::VideoFrame> raw_frame = + media::VideoFrame::WrapSharedImage( + ist->pixel_format, si, ist->frame_creation_sync_token, std::move(cb), + ist->coded_size, ist->visible_rect, ist->coded_size, + base::Microseconds(ist->timestamp)); + + raw_frame->set_color_space(si->color_space()); + + blink::VideoFrame* frame = blink::MakeGarbageCollected<blink::VideoFrame>( + raw_frame, current_execution_context); + return blink::ToV8Traits<blink::VideoFrame>::ToV8(current_script_state, + frame); +} + +v8::Local<v8::Value> ImportedSharedTexture::StartTransferSharedTexture( + v8::Isolate* isolate) { + auto exported = client_shared_image->Export(); + + // Use mojo to serialize the exported shared image. + mojo::Message message(0, 0, MOJO_CREATE_MESSAGE_FLAG_UNLIMITED_SIZE, 0); + mojo::internal::MessageFragment< + gpu::mojom::internal::ExportedSharedImage_Data> + data(message); + data.Allocate(); + mojo::internal::Serializer<gpu::mojom::ExportedSharedImageDataView, + gpu::ExportedSharedImage>::Serialize(exported, + data); + + auto encoded = base::Base64Encode(UNSAFE_BUFFERS( + base::span(message.payload(), message.payload_num_bytes()))); + gin_helper::Dictionary root(isolate, v8::Object::New(isolate)); + root.SetReadOnly("transfer", encoded); + + auto sync_token = GetBase64StringFromSyncToken(frame_creation_sync_token); + root.SetReadOnly("syncToken", sync_token); + + root.SetReadOnly("pixelFormat", + TransferVideoPixelFormatToString(pixel_format)); + root.SetReadOnly("codedSize", coded_size); + root.SetReadOnly("visibleRect", visible_rect); + root.SetReadOnly("timestamp", timestamp); + + return gin::ConvertToV8(isolate, root); +} + +v8::Local<v8::Value> ImportedSharedTexture::GetFrameCreationSyncToken( + v8::Isolate* isolate) { + gin::Dictionary root(isolate, v8::Object::New(isolate)); + + auto sync_token = GetBase64StringFromSyncToken(frame_creation_sync_token); + root.Set("syncToken", sync_token); + + return gin::ConvertToV8(isolate, root); +} + +void ImportedSharedTexture::SetReleaseSyncToken(v8::Isolate* isolate, + v8::Local<v8::Value> options) { + std::string sync_token_data; + gin::Dictionary dict(isolate, options.As<v8::Object>()); + dict.Get("syncToken", &sync_token_data); + + auto sync_token = GetSyncTokenFromBase64String(sync_token_data); + UpdateReleaseSyncToken(sync_token); +} + +ImportedSharedTexture::~ImportedSharedTexture() { + // When nothing holds this, 1) all VideoFrames are destructed and the + // release_sync_token have been updated; 2) the user called `release()` + // explicitly. This is destructed and the final clean up is started. + SetupReleaseSyncTokenCallback(); + client_shared_image.reset(); +} + +void ImportedSharedTexture::UpdateReleaseSyncToken( + const gpu::SyncToken& token) { + base::AutoLock locker(release_sync_token_lock_); + + auto* sii = GetSharedImageInterface(); + if (release_sync_token.HasData()) { + // If we already have a release sync token, we need to wait for it + // to be signaled before we can set the new one. + sii->WaitSyncToken(release_sync_token); + } + + // Set the new release sync token to use at last. + release_sync_token = token; +} + +void ImportedSharedTexture::SetupReleaseSyncTokenCallback() { + base::AutoLock locker(release_sync_token_lock_); + + auto* sii = GetSharedImageInterface(); + if (!release_sync_token.HasData()) { + release_sync_token = sii->GenUnverifiedSyncToken(); + } + + client_shared_image->UpdateDestructionSyncToken(release_sync_token); + + if (release_callback) { + GetContextSupport()->SignalSyncToken(release_sync_token, + std::move(release_callback)); + } +} + +void PersistentCallbackPass1( + const v8::WeakCallbackInfo<ImportedSharedTextureWrapper>& data) { + auto* wrapper = data.GetParameter(); + // The |wrapper->ist| must be valid here, as we are a holder of it. + if (!wrapper->IsReferenceReleased()) { + // Emit a warning when the user didn't properly manually release the + // texture. + LOG(ERROR) << "The imported shared texture " << wrapper->ist->id + << " was garbage collected before calling `release()`. You have " + "to manually release the resource once you're done with it."; + + // Release it for user here. + wrapper->ReleaseReference(); + } + // We are responsible for resetting the persistent handle. + wrapper->ResetPersistent(); + // Finally, release the import monitor; + delete wrapper; +} + +void ImportedTextureGetVideoFrame( + const v8::FunctionCallbackInfo<v8::Value>& info) { + auto* isolate = info.GetIsolate(); + auto* wrapper = static_cast<ImportedSharedTextureWrapper*>( + info.Data().As<v8::External>()->Value()); + + if (wrapper->IsReferenceReleased()) { + gin_helper::ErrorThrower(isolate).ThrowTypeError( + "The shared texture has been released."); + return; + } + + if (IsBrowserProcess()) { + gin_helper::ErrorThrower(isolate).ThrowTypeError( + "The VideoFrame cannot be created at current process."); + return; + } + + auto ret = wrapper->CreateVideoFrame(isolate); + info.GetReturnValue().Set(ret); +} + +void ImportedTextureStartTransferSharedTexture( + const v8::FunctionCallbackInfo<v8::Value>& info) { + auto* isolate = info.GetIsolate(); + auto* wrapper = static_cast<ImportedSharedTextureWrapper*>( + info.Data().As<v8::External>()->Value()); + + if (wrapper->IsReferenceReleased()) { + gin_helper::ErrorThrower(isolate).ThrowTypeError( + "The shared texture has been released."); + return; + } + + auto ret = wrapper->ist->StartTransferSharedTexture(isolate); + info.GetReturnValue().Set(ret); +} + +void ImportedTextureRelease(const v8::FunctionCallbackInfo<v8::Value>& info) { + auto* wrapper = static_cast<ImportedSharedTextureWrapper*>( + info.Data().As<v8::External>()->Value()); + + auto cb = info[0]; + if (cb->IsFunction()) { + auto* isolate = info.GetIsolate(); + gin::ConvertFromV8(isolate, cb, &wrapper->ist->release_callback); + } + + // Release the shared texture, so that future frames can be generated. + wrapper->ReleaseReference(); + + // Release of the wrapper happens at GC persistent callback. + // Release of the |ist| happens when nothing holds a reference to it. +} + +void ImportedTextureGetFrameCreationSyncToken( + const v8::FunctionCallbackInfo<v8::Value>& info) { + auto* isolate = info.GetIsolate(); + auto* wrapper = static_cast<ImportedSharedTextureWrapper*>( + info.Data().As<v8::External>()->Value()); + + if (wrapper->IsReferenceReleased()) { + gin_helper::ErrorThrower(isolate).ThrowTypeError( + "The shared texture has been released."); + return; + } + + auto ret = wrapper->ist->GetFrameCreationSyncToken(isolate); + info.GetReturnValue().Set(ret); +} + +void ImportedTextureSetReleaseSyncToken( + const v8::FunctionCallbackInfo<v8::Value>& info) { + auto* isolate = info.GetIsolate(); + auto* wrapper = static_cast<ImportedSharedTextureWrapper*>( + info.Data().As<v8::External>()->Value()); + + if (wrapper->IsReferenceReleased()) { + gin_helper::ErrorThrower(isolate).ThrowTypeError( + "The shared texture has been released."); + return; + } + + if (info.Length() < 1 || !info[0]->IsObject()) { + gin_helper::ErrorThrower(isolate).ThrowTypeError( + "Expected an options object with a syncToken property."); + return; + } + + wrapper->ist->SetReleaseSyncToken(isolate, info[0].As<v8::Object>()); +} + +v8::Local<v8::Value> CreateImportedSharedTextureFromSharedImage( + v8::Isolate* isolate, + ImportedSharedTexture* imported) { + auto* wrapper = new ImportedSharedTextureWrapper(); + wrapper->ist = base::WrapRefCounted(imported); + + auto imported_wrapped = v8::External::New(isolate, wrapper); + gin::Dictionary root(isolate, v8::Object::New(isolate)); + + auto releaser = v8::Function::New(isolate->GetCurrentContext(), + ImportedTextureRelease, imported_wrapped) + .ToLocalChecked(); + + auto get_video_frame = + v8::Function::New(isolate->GetCurrentContext(), + ImportedTextureGetVideoFrame, imported_wrapped) + .ToLocalChecked(); + + auto start_transfer = + v8::Function::New(isolate->GetCurrentContext(), + ImportedTextureStartTransferSharedTexture, + imported_wrapped) + .ToLocalChecked(); + + auto get_frame_creation_sync_token = + v8::Function::New(isolate->GetCurrentContext(), + ImportedTextureGetFrameCreationSyncToken, + imported_wrapped) + .ToLocalChecked(); + + auto set_release_sync_token = + v8::Function::New(isolate->GetCurrentContext(), + ImportedTextureSetReleaseSyncToken, imported_wrapped) + .ToLocalChecked(); + + root.Set("release", releaser); + root.Set("getVideoFrame", get_video_frame); + root.Set("startTransferSharedTexture", start_transfer); + root.Set("getFrameCreationSyncToken", get_frame_creation_sync_token); + root.Set("setReleaseSyncToken", set_release_sync_token); + + auto root_local = gin::ConvertToV8(isolate, root); + auto* persistent = wrapper->CreatePersistent(isolate, root_local); + + persistent->SetWeak(wrapper, PersistentCallbackPass1, + v8::WeakCallbackType::kParameter); + + return root_local; +} + +struct ImportSharedTextureInfoPlane { + // The strides and offsets in bytes to be used when accessing the buffers + // via a memory mapping. One per plane per entry. Size in bytes of the + // plane is necessary to map the buffers. + uint32_t stride; + uint64_t offset; + uint64_t size; + + // File descriptor for the underlying memory object (usually dmabuf). + int fd = 0; +}; + +struct ImportSharedTextureInfo { + // Texture id for printing warnings like GC check. + std::string id; + + // The pixel format of the shared texture, RGBA or BGRA depends on platform. + media::VideoPixelFormat pixel_format; + + // The full dimensions of the video frame data. + gfx::Size coded_size; + + // A subsection of [0, 0, coded_size().width(), coded_size.height()]. + // In OSR case, it is expected to have the full area of the section. + gfx::Rect visible_rect; + + // The color space of the video frame. + gfx::ColorSpace color_space = gfx::ColorSpace::CreateSRGB(); + + // The capture timestamp, microseconds since capture start + int64_t timestamp = 0; + +#if BUILDFLAG(IS_WIN) + // On Windows, it must be a NT HANDLE (CreateSharedHandle) to the shared + // texture, it can't be a deprecated non-NT HANDLE (GetSharedHandle). This + // must be a handle already duplicated for the current process and can be + // owned by this. + uintptr_t nt_handle = 0; +#elif BUILDFLAG(IS_APPLE) + // On macOS, it is an IOSurfaceRef, this must be a valid IOSurface at the + // current process. + uintptr_t io_surface = 0; +#elif BUILDFLAG(IS_LINUX) + // On Linux, to be implemented. + std::vector<ImportSharedTextureInfoPlane> planes; + uint64_t modifier = gfx::NativePixmapHandle::kNoModifier; + bool supports_zero_copy_webgpu_import = false; +#endif +}; + +} // namespace + +namespace gin { + +template <> +struct Converter<ImportSharedTextureInfo> { + static bool FromV8(v8::Isolate* isolate, + v8::Local<v8::Value> val, + ImportSharedTextureInfo* out) { + if (!val->IsObject()) + return false; + gin::Dictionary dict(isolate, val.As<v8::Object>()); + + std::string pixel_format_str; + if (dict.Get("pixelFormat", &pixel_format_str)) { + if (pixel_format_str == "bgra") + out->pixel_format = media::PIXEL_FORMAT_ARGB; + else if (pixel_format_str == "rgba") + out->pixel_format = media::PIXEL_FORMAT_ABGR; + else if (pixel_format_str == "rgbaf16") + out->pixel_format = media::PIXEL_FORMAT_RGBAF16; + else + return false; + } + + dict.Get("codedSize", &out->coded_size); + if (!dict.Get("visibleRect", &out->visible_rect)) { + out->visible_rect = gfx::Rect(out->coded_size); + } + dict.Get("colorSpace", &out->color_space); + dict.Get("timestamp", &out->timestamp); + dict.Get("id", &out->id); + + gin::Dictionary shared_texture(isolate, val.As<v8::Object>()); + if (!dict.Get("handle", &shared_texture)) { + return false; + } + +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) + auto GetNativeHandle = [&](const std::string& property_key, + uintptr_t* output) { + v8::Local<v8::Value> handle_buf; + if (shared_texture.Get(property_key, &handle_buf) && + node::Buffer::HasInstance(handle_buf)) { + char* data = node::Buffer::Data(handle_buf); + if (node::Buffer::Length(handle_buf) == sizeof(uintptr_t)) { + *output = *reinterpret_cast<uintptr_t*>(data); + } + } + }; +#endif + +#if BUILDFLAG(IS_WIN) + GetNativeHandle("ntHandle", &out->nt_handle); +#elif BUILDFLAG(IS_APPLE) + GetNativeHandle("ioSurface", &out->io_surface); +#elif BUILDFLAG(IS_LINUX) + v8::Local<v8::Object> native_pixmap; + if (shared_texture.Get("nativePixmap", &native_pixmap)) { + gin::Dictionary v8_native_pixmap(isolate, native_pixmap); + v8::Local<v8::Array> v8_planes; + if (v8_native_pixmap.Get("planes", &v8_planes)) { + out->planes.clear(); + for (uint32_t i = 0; i < v8_planes->Length(); ++i) { + v8::Local<v8::Value> v8_item = + v8_planes->Get(isolate->GetCurrentContext(), i).ToLocalChecked(); + gin::Dictionary v8_plane(isolate, v8_item.As<v8::Object>()); + ImportSharedTextureInfoPlane plane; + v8_plane.Get("stride", &plane.stride); + v8_plane.Get("offset", &plane.offset); + v8_plane.Get("size", &plane.size); + v8_plane.Get("fd", &plane.fd); + out->planes.push_back(plane); + } + } + std::string modifier_str; + if (v8_native_pixmap.Get("modifier", &modifier_str)) { + base::StringToUint64(modifier_str, &out->modifier); + } + v8_native_pixmap.Get("supportsZeroCopyWebGpuImport", + &out->supports_zero_copy_webgpu_import); + } +#endif + + return true; + } +}; + +} // namespace gin + +namespace electron::api::shared_texture { + +v8::Local<v8::Value> ImportSharedTexture(v8::Isolate* isolate, + v8::Local<v8::Value> options) { + ImportSharedTextureInfo shared_texture{}; + if (!gin::ConvertFromV8(isolate, options, &shared_texture)) { + gin_helper::ErrorThrower(isolate).ThrowTypeError( + "Invalid shared texture info object"); + return v8::Null(isolate); + } + + gfx::GpuMemoryBufferHandle gmb_handle; +#if BUILDFLAG(IS_WIN) + if (shared_texture.nt_handle == 0) { + gin_helper::ErrorThrower(isolate).ThrowTypeError("Invalid ntHandle value"); + return v8::Null(isolate); + } + + auto handle = reinterpret_cast<HANDLE>(shared_texture.nt_handle); + + HANDLE dup_handle; + // Duplicate the handle to allow scoped handle close it. + if (!DuplicateHandle(GetCurrentProcess(), handle, GetCurrentProcess(), + &dup_handle, 0, FALSE, DUPLICATE_SAME_ACCESS)) { + gin_helper::ErrorThrower(isolate).ThrowTypeError( + "Unable to duplicate handle."); + return v8::Null(isolate); + } + + auto dxgi_handle = gfx::DXGIHandle(base::win::ScopedHandle(dup_handle)); + gmb_handle = gfx::GpuMemoryBufferHandle(std::move(dxgi_handle)); +#elif BUILDFLAG(IS_APPLE) + if (shared_texture.io_surface == 0) { + gin_helper::ErrorThrower(isolate).ThrowTypeError("Invalid ioSurface value"); + return v8::Null(isolate); + } + + // Retain the io_surface reference to increase the reference count. + auto io_surface = reinterpret_cast<IOSurfaceRef>(shared_texture.io_surface); + auto io_surface_scoped = base::apple::ScopedCFTypeRef<IOSurfaceRef>( + io_surface, base::scoped_policy::RETAIN); + gmb_handle = gfx::GpuMemoryBufferHandle(std::move(io_surface_scoped)); +#elif BUILDFLAG(IS_LINUX) + gfx::NativePixmapHandle pixmap; + pixmap.modifier = shared_texture.modifier; + pixmap.supports_zero_copy_webgpu_import = + shared_texture.supports_zero_copy_webgpu_import; + + for (const auto& plane : shared_texture.planes) { + gfx::NativePixmapPlane plane_info; + plane_info.stride = plane.stride; + plane_info.offset = plane.offset; + plane_info.size = plane.size; + + // Duplicate fd, otherwise the process may already have ownership. + int checked_dup = HANDLE_EINTR(dup(plane.fd)); + plane_info.fd = base::ScopedFD(checked_dup); + + pixmap.planes.push_back(std::move(plane_info)); + } + + gmb_handle = gfx::GpuMemoryBufferHandle(std::move(pixmap)); +#endif + + gfx::Size coded_size = shared_texture.coded_size; + media::VideoPixelFormat pixel_format = shared_texture.pixel_format; + gfx::ColorSpace color_space = shared_texture.color_space; + + auto buffer_format = media::VideoPixelFormatToGfxBufferFormat(pixel_format); + if (!buffer_format.has_value()) { + gin_helper::ErrorThrower(isolate).ThrowTypeError( + "Invalid shared texture buffer format"); + return v8::Null(isolate); + } + + auto* sii = GetSharedImageInterface(); + gpu::SharedImageUsageSet shared_image_usage = +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) + gpu::SHARED_IMAGE_USAGE_GLES2_READ | gpu::SHARED_IMAGE_USAGE_GLES2_WRITE | + gpu::SHARED_IMAGE_USAGE_RASTER_READ | + gpu::SHARED_IMAGE_USAGE_DISPLAY_READ | + gpu::SHARED_IMAGE_USAGE_WEBGPU_READ | + gpu::SHARED_IMAGE_USAGE_WEBGPU_WRITE; +#else + gpu::SHARED_IMAGE_USAGE_GLES2_READ | gpu::SHARED_IMAGE_USAGE_GLES2_WRITE | + gpu::SHARED_IMAGE_USAGE_RASTER_READ | + gpu::SHARED_IMAGE_USAGE_DISPLAY_READ; +#endif + + auto si_format = viz::GetSharedImageFormat(buffer_format.value()); + auto si = + sii->CreateSharedImage({si_format, coded_size, color_space, + shared_image_usage, "SharedTextureVideoFrame"}, + std::move(gmb_handle)); + + ImportedSharedTexture* imported = new ImportedSharedTexture(); + imported->pixel_format = shared_texture.pixel_format; + imported->coded_size = shared_texture.coded_size; + imported->visible_rect = shared_texture.visible_rect; + imported->timestamp = shared_texture.timestamp; + imported->frame_creation_sync_token = si->creation_sync_token(); + imported->client_shared_image = std::move(si); + imported->id = shared_texture.id; + + return CreateImportedSharedTextureFromSharedImage(isolate, imported); +} + +v8::Local<v8::Value> FinishTransferSharedTexture(v8::Isolate* isolate, + v8::Local<v8::Value> options) { + ImportSharedTextureInfo partial{}; + gin::ConvertFromV8(isolate, options, &partial); + + std::string id; + std::string transfer; + std::string sync_token_data; + + gin::Dictionary dict(isolate, options.As<v8::Object>()); + dict.Get("id", &id); + dict.Get("transfer", &transfer); + dict.Get("syncToken", &sync_token_data); + + auto transfer_data = base::Base64Decode(transfer); + + // Use mojo to deserialize the exported shared image. + mojo::Message message(transfer_data.value(), {}); + mojo::internal::MessageFragment< + gpu::mojom::internal::ExportedSharedImage_Data> + data(message); + data.Claim(message.mutable_payload()); + + gpu::ExportedSharedImage exported; + mojo::internal::Serializer<gpu::mojom::ExportedSharedImageDataView, + gpu::ExportedSharedImage>::Deserialize(data.data(), + &exported, + &message); + + auto* sii = GetSharedImageInterface(); + auto si = sii->ImportSharedImage(std::move(exported)); + + auto source_st = GetSyncTokenFromBase64String(sync_token_data); + sii->WaitSyncToken(source_st); + + ImportedSharedTexture* imported = new ImportedSharedTexture(); + imported->pixel_format = partial.pixel_format; + imported->coded_size = partial.coded_size; + imported->visible_rect = partial.visible_rect; + imported->timestamp = partial.timestamp; + imported->frame_creation_sync_token = sii->GenUnverifiedSyncToken(); + imported->client_shared_image = std::move(si); + imported->id = id; + + return CreateImportedSharedTextureFromSharedImage(isolate, imported); +} + +} // namespace electron::api::shared_texture + +namespace { + +void Initialize(v8::Local<v8::Object> exports, + v8::Local<v8::Value> unused, + v8::Local<v8::Context> context, + void* priv) { + v8::Isolate* const isolate = v8::Isolate::GetCurrent(); + gin_helper::Dictionary dict(isolate, exports); + dict.SetMethod("importSharedTexture", + &electron::api::shared_texture::ImportSharedTexture); + dict.SetMethod("finishTransferSharedTexture", + &electron::api::shared_texture::FinishTransferSharedTexture); +} + +} // namespace + +NODE_LINKED_BINDING_CONTEXT_AWARE(electron_common_shared_texture, Initialize) diff --git a/shell/common/api/electron_api_shared_texture.h b/shell/common/api/electron_api_shared_texture.h new file mode 100644 index 0000000000000..2e74245c73d02 --- /dev/null +++ b/shell/common/api/electron_api_shared_texture.h @@ -0,0 +1,23 @@ +// Copyright (c) 2025 Reito <reito@chromium.org> +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#ifndef ELECTRON_SHELL_COMMON_API_ELECTRON_API_SHARED_TEXTURE_H_ +#define ELECTRON_SHELL_COMMON_API_ELECTRON_API_SHARED_TEXTURE_H_ + +#include <string> +#include <vector> + +#include "v8/include/v8-forward.h" + +namespace electron::api::shared_texture { + +v8::Local<v8::Value> ImportSharedTexture(v8::Isolate* isolate, + v8::Local<v8::Value> options); + +v8::Local<v8::Value> FinishTransferSharedTexture(v8::Isolate* isolate, + v8::Local<v8::Value> options); + +} // namespace electron::api::shared_texture + +#endif // ELECTRON_SHELL_COMMON_API_ELECTRON_API_SHARED_TEXTURE_H_ diff --git a/shell/common/gin_converters/gfx_converter.cc b/shell/common/gin_converters/gfx_converter.cc index 8984d20aa784c..9f2787eaad3ef 100644 --- a/shell/common/gin_converters/gfx_converter.cc +++ b/shell/common/gin_converters/gfx_converter.cc @@ -455,6 +455,12 @@ bool Converter<gfx::ColorSpace>::FromV8(v8::Isolate* isolate, // Get primaries if (dict.Get("primaries", &primaries_str)) { + if (primaries_str == "custom") { + gin_helper::ErrorThrower(isolate).ThrowTypeError( + "'custom' not supported."); + return false; + } + if (primaries_str == "bt709") primaries = gfx::ColorSpace::PrimaryID::BT709; else if (primaries_str == "bt470m") @@ -485,18 +491,18 @@ bool Converter<gfx::ColorSpace>::FromV8(v8::Isolate* isolate, primaries = gfx::ColorSpace::PrimaryID::WIDE_GAMUT_COLOR_SPIN; else if (primaries_str == "ebu-3213-e") primaries = gfx::ColorSpace::PrimaryID::EBU_3213_E; - - if (primaries_str == "custom") { - gin_helper::ErrorThrower(isolate).ThrowTypeError( - "'custom' not supported."); - return false; - } else { + else primaries = gfx::ColorSpace::PrimaryID::INVALID; - } } // Get transfer if (dict.Get("transfer", &transfer_str)) { + if (transfer_str == "custom" || transfer_str == "custom-hdr") { + gin_helper::ErrorThrower(isolate).ThrowTypeError( + "'custom', 'custom-hdr' not supported."); + return false; + } + if (transfer_str == "bt709") transfer = gfx::ColorSpace::TransferID::BT709; else if (transfer_str == "bt709-apple") @@ -541,14 +547,8 @@ bool Converter<gfx::ColorSpace>::FromV8(v8::Isolate* isolate, transfer = gfx::ColorSpace::TransferID::LINEAR_HDR; else if (transfer_str == "scrgb-linear-80-nits") transfer = gfx::ColorSpace::TransferID::SCRGB_LINEAR_80_NITS; - - if (transfer_str == "custom" || transfer_str == "custom-hdr") { - gin_helper::ErrorThrower(isolate).ThrowTypeError( - "'custom', 'custom-hdr' not supported."); - return false; - } else { - primaries = gfx::ColorSpace::PrimaryID::INVALID; - } + else + transfer = gfx::ColorSpace::TransferID::INVALID; } // Get matrix diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc index 1a1ed307dd9cc..450069cffd7fe 100644 --- a/shell/common/node_bindings.cc +++ b/shell/common/node_bindings.cc @@ -99,6 +99,7 @@ V(electron_common_environment) \ V(electron_common_features) \ V(electron_common_native_image) \ + V(electron_common_shared_texture) \ V(electron_common_shell) \ V(electron_common_v8_util) diff --git a/spec/api-shared-texture-spec.ts b/spec/api-shared-texture-spec.ts new file mode 100644 index 0000000000000..a89edb50b272f --- /dev/null +++ b/spec/api-shared-texture-spec.ts @@ -0,0 +1,281 @@ +import { BaseWindow } from 'electron'; + +import { expect } from 'chai'; + +import { randomUUID } from 'node:crypto'; +import * as path from 'node:path'; + +import { closeWindow } from './lib/window-helpers'; + +const fixtures = path.resolve(__dirname, 'fixtures'); + +describe('sharedTexture module', () => { + const { + nativeImage + } = require('electron'); + + const debugSpec = false; + const dirPath = path.join(fixtures, 'api', 'shared-texture'); + const osrPath = path.join(dirPath, 'osr.html'); + const imagePath = path.join(dirPath, 'image.png'); + const targetImage = nativeImage.createFromPath(imagePath); + + describe('import shared texture produced by osr', () => { + const { + app, + BrowserWindow, + sharedTexture, + ipcMain + } = require('electron'); + + afterEach(async () => { + ipcMain.removeAllListeners(); + for (const w of BaseWindow.getAllWindows()) { + await closeWindow(w); + } + }); + + it('successfully imported and rendered with subtle api', (done) => { + type CapturedTextureHolder = { + importedSubtle: Electron.SharedTextureImportedSubtle, + texture: Electron.OffscreenSharedTexture + } + + const capturedTextures = new Map<string, CapturedTextureHolder>(); + const preloadPath = path.join(dirPath, 'subtle', 'preload.js'); + const htmlPath = path.join(dirPath, 'subtle', 'index.html'); + + const createWindow = () => { + const win = new BrowserWindow({ + width: 256, + height: 256, + show: debugSpec, + webPreferences: { + preload: preloadPath + } + }); + + const osr = new BrowserWindow({ + width: 128, + height: 128, + show: debugSpec, + webPreferences: { + offscreen: { + useSharedTexture: true + } + } + }); + + osr.webContents.setFrameRate(1); + osr.webContents.on('paint', (event: any) => { + // Step 1: Input source of shared texture handle. + const texture = event.texture; + + if (!texture) { + console.error('No texture, GPU may be unavailable, skipping.'); + done(); + return; + } + + // Step 2: Import as SharedTextureImported + console.log(texture.textureInfo); + const importedSubtle = sharedTexture.subtle.importSharedTexture(texture.textureInfo); + + // Step 3: Prepare for transfer to another process (win's renderer) + const transfer = importedSubtle.startTransferSharedTexture(); + + const id = randomUUID(); + capturedTextures.set(id, { importedSubtle, texture }); + + // Step 4: Send the shared texture to the renderer process (goto preload.js) + win.webContents.send('shared-texture', id, transfer); + }); + + ipcMain.on('shared-texture-done', (event: any, id: string) => { + // Step 12: Release the shared texture resources at main process + const data = capturedTextures.get(id); + if (data) { + capturedTextures.delete(id); + const { importedSubtle, texture } = data; + + // Step 13: Release the imported shared texture + importedSubtle.release(() => { + // Step 14: Release the shared texture once GPU is done + texture.release(); + }); + + // Step 15: Slightly timeout and capture the node screenshot + setTimeout(async () => { + // Step 16: Compare the captured image with the target image + const captured = await win.webContents.capturePage({ + x: 16, + y: 16, + width: 128, + height: 128 + }); + + // Step 17: Resize the target image to match the captured image size, in case dpr != 1 + const target = targetImage.resize({ ...captured.getSize() }); + + // Step 18: nativeImage have error comparing pixel data when color space is different, + // send to browser for comparison using canvas. + win.webContents.send('verify-captured-image', { + captured: captured.toDataURL(), + target: target.toDataURL() + }); + }, 300); + } + }); + + ipcMain.on('verify-captured-image-done', (event: any, result: { difference: number, total: number }) => { + // Step 22: Verify the result from renderer process + try { + // macOS may have tiny color difference after the whole rendering process, + // and the color may change slightly when resizing at device pixel ratio != 1. + // Limit error should not be different more than 1% of the whole image. + const ratio = result.difference / result.total; + console.log('image difference: ', ratio); + expect(ratio).to.be.lessThan(0.01); + done(); + } catch (e) { + done(e); + } + }); + + ipcMain.on('webgpu-unavailable', () => { + console.error('WebGPU is not available, skipping.'); + done(); + }); + + win.loadFile(htmlPath); + osr.loadFile(osrPath); + }; + + app.whenReady().then(() => { + createWindow(); + }); + }).timeout(debugSpec ? 100000 : 10000); + + const runSharedTextureManagedTest = (done: Mocha.Done, iframe: boolean) => { + const preloadPath = path.join(dirPath, 'managed', 'preload.js'); + const htmlPath = path.join(dirPath, 'managed', iframe ? 'frame.html' : 'index.html'); + + const createWindow = () => { + const win = new BrowserWindow({ + width: 256, + height: 256, + show: debugSpec, + webPreferences: { + preload: preloadPath, + nodeIntegrationInSubFrames: iframe + } + }); + + const osr = new BrowserWindow({ + width: 128, + height: 128, + show: debugSpec, + webPreferences: { + offscreen: { + useSharedTexture: true + } + } + }); + + osr.webContents.setFrameRate(1); + osr.webContents.on('paint', async (event: any) => { + const targetFrame = iframe ? win.webContents.mainFrame.frames[0] : win.webContents.mainFrame; + if (!targetFrame) { + done(new Error('Target frame not found')); + return; + } + + // Step 1: Input source of shared texture handle. + const texture = event.texture; + + if (!texture) { + console.error('No texture, GPU may be unavailable, skipping.'); + done(); + return; + } + + // Step 2: Import as SharedTextureImported + console.log(texture.textureInfo); + const imported = sharedTexture.importSharedTexture({ + textureInfo: texture.textureInfo, + allReferencesReleased: () => { + // Release the shared texture source once GPU is done. + // Will be called when all processes have finished using the shared texture. + texture.release(); + + // Slightly timeout and capture the node screenshot + setTimeout(async () => { + // Compare the captured image with the target image + const captured = await win.webContents.capturePage({ + x: 16, + y: 16, + width: 128, + height: 128 + }); + + // Resize the target image to match the captured image size, in case dpr != 1 + const target = targetImage.resize({ ...captured.getSize() }); + + // nativeImage have error comparing pixel data when color space is different, + // send to browser for comparison using canvas. + targetFrame.send('verify-captured-image', { + captured: captured.toDataURL(), + target: target.toDataURL() + }); + }, 300); + } + }); + + // Step 3: Transfer to another process (win's renderer) + await sharedTexture.sendSharedTexture({ + frame: iframe ? targetFrame : win.webContents.mainFrame, + importedSharedTexture: imported + }); + + // Step 4: Release the imported and wait for signal to release the source + imported.release(); + }); + + ipcMain.on('verify-captured-image-done', (event: any, result: { difference: number, total: number }) => { + // Verify the result from renderer process + try { + // macOS may have tiny color difference after the whole rendering process, + // and the color may change slightly when resizing at device pixel ratio != 1. + // Limit error should not be different more than 1% of the whole image. + const ratio = result.difference / result.total; + console.log('image difference: ', ratio); + expect(ratio).to.be.lessThan(0.01); + done(); + } catch (e) { + setTimeout(() => done(e), 1000000); + } + }); + + ipcMain.on('webgpu-unavailable', () => { + console.error('WebGPU is not available, skipping.'); + done(); + }); + + win.loadFile(htmlPath); + osr.loadFile(osrPath); + }; + + app.whenReady().then(() => { + createWindow(); + }); + }; + + it('successfully imported and rendered with managed api, without iframe', (done) => { + runSharedTextureManagedTest(done, false); + }).timeout(debugSpec ? 100000 : 10000); + + it('successfully imported and rendered with managed api, with iframe', (done) => { + runSharedTextureManagedTest(done, true); + }).timeout(debugSpec ? 100000 : 10000); + }); +}); diff --git a/spec/fixtures/api/shared-texture/common.js b/spec/fixtures/api/shared-texture/common.js new file mode 100644 index 0000000000000..2674a18803974 --- /dev/null +++ b/spec/fixtures/api/shared-texture/common.js @@ -0,0 +1,168 @@ +window.verifyCapturedImage = (images, result) => { + const { captured, target } = images; + // Compare the captured image with the target image + const capturedImage = new Image(); + capturedImage.src = captured; + capturedImage.onload = () => { + const targetImage = new Image(); + targetImage.src = target; + targetImage.onload = () => { + const canvas = document.createElement('canvas'); + canvas.width = capturedImage.width; + canvas.height = capturedImage.height; + + const ctx = canvas.getContext('2d'); + ctx.drawImage(capturedImage, 0, 0); + const capturedData = ctx.getImageData(0, 0, canvas.width, canvas.height).data; + + ctx.clearRect(0, 0, canvas.width, canvas.height); + ctx.drawImage(targetImage, 0, 0); + const targetData = ctx.getImageData(0, 0, canvas.width, canvas.height).data; + + // Compare the pixel data + let difference = 0; + for (let i = 0; i < capturedData.length; i += 4) { + difference += Math.abs(capturedData[i] - targetData[i]); + difference += Math.abs(capturedData[i + 1] - targetData[i + 1]); + difference += Math.abs(capturedData[i + 2] - targetData[i + 2]); + difference += Math.abs(capturedData[i + 3] - targetData[i + 3]); + } + + // Send the result back to the main process + result({ difference, total: capturedData.length * 255 }); + canvas.remove(); + capturedImage.remove(); + targetImage.remove(); + }; + }; +}; + +window.initWebGpu = async () => { + // Init WebGPU + const canvas = document.createElement('canvas'); + canvas.width = 128; + canvas.height = 128; + canvas.style.width = '128px'; + canvas.style.height = '128px'; + canvas.style.position = 'absolute'; + canvas.style.top = '16px'; + canvas.style.left = '16px'; + + document.body.appendChild(canvas); + const context = canvas.getContext('webgpu'); + + // Configure WebGPU context + const adapter = await navigator.gpu.requestAdapter(); + const device = await adapter.requestDevice(); + const format = navigator.gpu.getPreferredCanvasFormat(); + context.configure({ device, format }); + + window.renderFrame = async (frame) => { + try { + // Create external texture + const externalTexture = device.importExternalTexture({ source: frame }); + + // Create bind group layout, correctly specifying the external texture type + const bindGroupLayout = device.createBindGroupLayout({ + entries: [ + { + binding: 0, + visibility: window.GPUShaderStage.FRAGMENT, + externalTexture: {} + }, + { + binding: 1, + visibility: window.GPUShaderStage.FRAGMENT, + sampler: {} + } + ] + }); + + // Create pipeline layout + const pipelineLayout = device.createPipelineLayout({ + bindGroupLayouts: [bindGroupLayout] + }); + + // Create render pipeline + const pipeline = device.createRenderPipeline({ + layout: pipelineLayout, + vertex: { + module: device.createShaderModule({ + code: ` + @vertex + fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4<f32> { + var pos = array<vec2<f32>, 6>( + vec2<f32>(-1.0, -1.0), + vec2<f32>(1.0, -1.0), + vec2<f32>(-1.0, 1.0), + vec2<f32>(-1.0, 1.0), + vec2<f32>(1.0, -1.0), + vec2<f32>(1.0, 1.0) + ); + return vec4<f32>(pos[VertexIndex], 0.0, 1.0); + } + ` + }), + entryPoint: 'main' + }, + fragment: { + module: device.createShaderModule({ + code: ` + @group(0) @binding(0) var extTex: texture_external; + @group(0) @binding(1) var mySampler: sampler; + + @fragment + fn main(@builtin(position) fragCoord: vec4<f32>) -> @location(0) vec4<f32> { + let texCoord = fragCoord.xy / vec2<f32>(${canvas.width}.0, ${canvas.height}.0); + return textureSampleBaseClampToEdge(extTex, mySampler, texCoord); + } + ` + }), + entryPoint: 'main', + targets: [{ format }] + }, + primitive: { topology: 'triangle-list' } + }); + + // Create bind group + const bindGroup = device.createBindGroup({ + layout: bindGroupLayout, + entries: [ + { + binding: 0, + resource: externalTexture + }, + { + binding: 1, + resource: device.createSampler() + } + ] + }); + + // Create command encoder and render pass + const commandEncoder = device.createCommandEncoder(); + const textureView = context.getCurrentTexture().createView(); + const renderPass = commandEncoder.beginRenderPass({ + colorAttachments: [ + { + view: textureView, + clearValue: { r: 0.0, g: 0.0, b: 0.0, a: 1.0 }, + loadOp: 'clear', + storeOp: 'store' + } + ] + }); + + // Set pipeline and bind group + renderPass.setPipeline(pipeline); + renderPass.setBindGroup(0, bindGroup); + renderPass.draw(6); // Draw a rectangle composed of two triangles + renderPass.end(); + + // Submit commands + device.queue.submit([commandEncoder.finish()]); + } catch (error) { + console.error('Rendering error:', error); + } + }; +}; diff --git a/spec/fixtures/api/shared-texture/image.png b/spec/fixtures/api/shared-texture/image.png new file mode 100644 index 0000000000000000000000000000000000000000..3f2e16dd64ff994d14d0e96d4ff88ce4bcea5549 GIT binary patch literal 873 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85qP=L734qNaX`iLwjaOL`j6Nk5zJhu3lnFep0GlMQ#C5H3Nf< zeMLcHa&~HoLQ-maW}dD3``!E16*5z7)x%AF4SWlnQ!_F>s)|yBtNcQetFn_VQ`GJ4 zc)4sUtbiuurj{fsROII56<bx<DuE5Q0<uBE`bu^-MJZ`kK`w4k6+oV?QbtKhft9{~ zd3m{Bxv^e;QM$gNrKP35fswwEkuFe$ZgFK^Nn(X=Ua>ON0GHI_<f6=ilFa-(1(1P> zN%^HEwo0X?nJHFjiD{-uDJiD9Nr}cOx`u`+iMoj?#)i5n#>Oe;riK<qX@*HkQ0q%F z(-8LO6+?po7$Eu}8GS=N1CWzJY%Bkw%v7K&Kvvor+JNOz#BB6I4ncC59Yh4^S0D=> zGN53Bhi+;fFi6XRVW%@?1~)KDvOQfKLn`9lUNIDHc3^NhD4;pRW2PA^--HG$nI-B> zkDk3af9Q|q_J8@)zuq~<TqgU!a*@q*#c50jL>bmG6tFgEGsG}H;9>}8*fG#T)4o49 oe-`+u_U&hvmyCnTWzgWcyJk7Z`Aw?xc|qyj)78&qol`;+0O?>3$^ZZW literal 0 HcmV?d00001 diff --git a/spec/fixtures/api/shared-texture/managed/frame.html b/spec/fixtures/api/shared-texture/managed/frame.html new file mode 100644 index 0000000000000..08da2e384f275 --- /dev/null +++ b/spec/fixtures/api/shared-texture/managed/frame.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html lang="en"> + +<head> + <meta charset="UTF-8"> +</head> + +<body style="margin: 0;"> + <iframe src="index.html" style="width: 100%; height: 100%; border: none;"></iframe> +</body> + +</html> \ No newline at end of file diff --git a/spec/fixtures/api/shared-texture/managed/index.html b/spec/fixtures/api/shared-texture/managed/index.html new file mode 100644 index 0000000000000..db6184c5235d2 --- /dev/null +++ b/spec/fixtures/api/shared-texture/managed/index.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html lang="en"> + +<head> + <meta charset="UTF-8"> + <title>Hello World! + + + + + + + + \ No newline at end of file diff --git a/spec/fixtures/api/shared-texture/managed/preload.js b/spec/fixtures/api/shared-texture/managed/preload.js new file mode 100644 index 0000000000000..c26070140d53b --- /dev/null +++ b/spec/fixtures/api/shared-texture/managed/preload.js @@ -0,0 +1,28 @@ +const { sharedTexture } = require('electron'); +const { ipcRenderer, contextBridge } = require('electron/renderer'); + +contextBridge.exposeInMainWorld('textures', { + onSharedTexture: (cb) => { + // Step 0: Register the receiver for transferred shared texture + sharedTexture.setSharedTextureReceiver(async (data) => { + // Step 5: Receive the imported shared texture + const { importedSharedTexture: imported } = data; + await cb(imported); + + // Release the imported shared texture since we're done. + // No need to use the callback here, as the util function automatically + // managed the lifetime via sync token. + imported.release(); + }); + }, + webGpuUnavailable: () => { + ipcRenderer.send('webgpu-unavailable'); + }, + verifyCapturedImage: (verify) => { + ipcRenderer.on('verify-captured-image', (e, images) => { + verify(images, (result) => { + ipcRenderer.send('verify-captured-image-done', result); + }); + }); + } +}); diff --git a/spec/fixtures/api/shared-texture/managed/renderer.js b/spec/fixtures/api/shared-texture/managed/renderer.js new file mode 100644 index 0000000000000..e1c3ac11ce84a --- /dev/null +++ b/spec/fixtures/api/shared-texture/managed/renderer.js @@ -0,0 +1,21 @@ +window.initWebGpu().catch((err) => { + console.error('Failed to initialize WebGPU:', err); + window.textures.webGpuUnavailable(); +}); + +window.textures.onSharedTexture(async (imported) => { + try { + // Step 6: Get VideoFrame from the imported texture + const frame = imported.getVideoFrame(); + + // Step 7: Render using WebGPU + await window.renderFrame(frame); + + // Step 8: Release the VideoFrame as we no longer need it + frame.close(); + } catch (error) { + console.error('Error getting VideoFrame:', error); + } +}); + +window.textures.verifyCapturedImage(window.verifyCapturedImage); diff --git a/spec/fixtures/api/shared-texture/osr.html b/spec/fixtures/api/shared-texture/osr.html new file mode 100644 index 0000000000000..1f69a2dc67a07 --- /dev/null +++ b/spec/fixtures/api/shared-texture/osr.html @@ -0,0 +1,13 @@ + + + +
+ + Hello World! +
+ + + + + + \ No newline at end of file diff --git a/spec/fixtures/api/shared-texture/subtle/index.html b/spec/fixtures/api/shared-texture/subtle/index.html new file mode 100644 index 0000000000000..db6184c5235d2 --- /dev/null +++ b/spec/fixtures/api/shared-texture/subtle/index.html @@ -0,0 +1,14 @@ + + + + + + Hello World! + + + + + + + + \ No newline at end of file diff --git a/spec/fixtures/api/shared-texture/subtle/preload.js b/spec/fixtures/api/shared-texture/subtle/preload.js new file mode 100644 index 0000000000000..d369b4e93ebdd --- /dev/null +++ b/spec/fixtures/api/shared-texture/subtle/preload.js @@ -0,0 +1,30 @@ +const { sharedTexture } = require('electron'); +const { ipcRenderer, contextBridge } = require('electron/renderer'); + +contextBridge.exposeInMainWorld('textures', { + onSharedTexture: (cb) => { + ipcRenderer.on('shared-texture', async (e, id, transfer) => { + // Step 5: Get the shared texture from the transfer + const importedSubtle = sharedTexture.subtle.finishTransferSharedTexture(transfer); + + // Step 6: Let the renderer render using WebGPU + await cb(id, importedSubtle); + + // Step 10: Release the shared texture with a callback + importedSubtle.release(() => { + // Step 11: When GPU command buffer is done, we can notify the main process to release + ipcRenderer.send('shared-texture-done', id); + }); + }); + }, + webGpuUnavailable: () => { + ipcRenderer.send('webgpu-unavailable'); + }, + verifyCapturedImage: (verify) => { + ipcRenderer.on('verify-captured-image', (e, images) => { + verify(images, (result) => { + ipcRenderer.send('verify-captured-image-done', result); + }); + }); + } +}); diff --git a/spec/fixtures/api/shared-texture/subtle/renderer.js b/spec/fixtures/api/shared-texture/subtle/renderer.js new file mode 100644 index 0000000000000..83ab96c640fea --- /dev/null +++ b/spec/fixtures/api/shared-texture/subtle/renderer.js @@ -0,0 +1,21 @@ +window.initWebGpu().catch((err) => { + console.error('Failed to initialize WebGPU:', err); + window.textures.webGpuUnavailable(); +}); + +window.textures.onSharedTexture(async (id, importedSubtle) => { + try { + // Step 7: Get VideoFrame from the imported texture + const frame = importedSubtle.getVideoFrame(); + + // Step 8: Render using WebGPU + await window.renderFrame(frame); + + // Step 9: Release the VideoFrame as we no longer need it + frame.close(); + } catch (error) { + console.error('Error getting VideoFrame:', error); + } +}); + +window.textures.verifyCapturedImage(window.verifyCapturedImage); diff --git a/typings/internal-ambient.d.ts b/typings/internal-ambient.d.ts index e0835799f2f19..f0c4dd4444562 100644 --- a/typings/internal-ambient.d.ts +++ b/typings/internal-ambient.d.ts @@ -223,6 +223,7 @@ declare namespace NodeJS { _linkedBinding(name: 'electron_common_environment'): EnvironmentBinding; _linkedBinding(name: 'electron_common_features'): FeaturesBinding; _linkedBinding(name: 'electron_common_native_image'): { nativeImage: typeof Electron.NativeImage }; + _linkedBinding(name: 'electron_common_shared_texture'): Electron.SharedTextureSubtle; _linkedBinding(name: 'electron_common_net'): NetBinding; _linkedBinding(name: 'electron_common_shell'): Electron.Shell; _linkedBinding(name: 'electron_common_v8_util'): V8UtilBinding; From 2bc80147591490ca6f86b3d8c321d731ab6cd24e Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Fri, 7 Nov 2025 11:23:52 +0100 Subject: [PATCH 214/268] refactor: remove `allow_unsafe_buffers` pragma from `FD_ZERO` (#48811) refactor: remove allow_unsafe_buffers pragma from FD_ZERO --- shell/common/node_bindings_mac.cc | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/shell/common/node_bindings_mac.cc b/shell/common/node_bindings_mac.cc index 4afada977aee6..eaddf9be1f114 100644 --- a/shell/common/node_bindings_mac.cc +++ b/shell/common/node_bindings_mac.cc @@ -2,16 +2,10 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#ifdef UNSAFE_BUFFERS_BUILD -// TODO(crbug.com/351564777): Remove FD_ZERO and convert code to safer -// constructs. -#pragma allow_unsafe_buffers -#endif - #include "shell/common/node_bindings_mac.h" #include -#include +#include #include #include #include @@ -23,24 +17,18 @@ NodeBindingsMac::NodeBindingsMac(BrowserEnvironment browser_env) void NodeBindingsMac::PollEvents() { auto* const event_loop = uv_loop(); + // uv_backend_timeout returns milliseconds or -1 for infinite wait. + const int backend_fd = uv_backend_fd(event_loop); + const int timeout_ms = uv_backend_timeout(event_loop); // -1 => infinite - struct timeval tv; - int timeout = uv_backend_timeout(event_loop); - if (timeout != -1) { - tv.tv_sec = timeout / 1000; - tv.tv_usec = (timeout % 1000) * 1000; - } - - fd_set readset; - int fd = uv_backend_fd(event_loop); - FD_ZERO(&readset); - FD_SET(fd, &readset); + struct pollfd pfd; + pfd.fd = backend_fd; + pfd.events = POLLIN; + pfd.revents = 0; - // Wait for new libuv events. int r; do { - r = select(fd + 1, &readset, nullptr, nullptr, - timeout == -1 ? nullptr : &tv); + r = poll(&pfd, 1, timeout_ms); } while (r == -1 && errno == EINTR); } From d2313f60fee191dfde62479a604dde3bf9ecb1b0 Mon Sep 17 00:00:00 2001 From: Mitchell Cohen Date: Fri, 7 Nov 2025 05:24:12 -0500 Subject: [PATCH 215/268] fix: CSD window frame tiles properly on Wayland (#48765) fix: CSD window frame tiles properly on Linux --- ...electron_desktop_window_tree_host_linux.cc | 10 ++++++++-- .../ui/views/client_frame_view_linux.cc | 20 +++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/shell/browser/ui/electron_desktop_window_tree_host_linux.cc b/shell/browser/ui/electron_desktop_window_tree_host_linux.cc index 561f8034538b3..5e27038f7c958 100644 --- a/shell/browser/ui/electron_desktop_window_tree_host_linux.cc +++ b/shell/browser/ui/electron_desktop_window_tree_host_linux.cc @@ -100,13 +100,19 @@ void ElectronDesktopWindowTreeHostLinux::OnWindowStateChanged( void ElectronDesktopWindowTreeHostLinux::OnWindowTiledStateChanged( ui::WindowTiledEdges new_tiled_edges) { if (auto* const view = native_window_view_->GetClientFrameViewLinux()) { - bool maximized = new_tiled_edges.top && new_tiled_edges.left && - new_tiled_edges.bottom && new_tiled_edges.right; + // GNOME on Ubuntu reports all edges as tiled + // even if the window is only half-tiled so do not trust individual edge + // values. + bool maximized = native_window_view_->IsMaximized(); bool tiled = new_tiled_edges.top || new_tiled_edges.left || new_tiled_edges.bottom || new_tiled_edges.right; view->set_tiled(tiled && !maximized); } UpdateFrameHints(); + ScheduleRelayout(); + if (GetWidget()->non_client_view()) { + GetWidget()->non_client_view()->SchedulePaint(); + } } void ElectronDesktopWindowTreeHostLinux::UpdateWindowState( diff --git a/shell/browser/ui/views/client_frame_view_linux.cc b/shell/browser/ui/views/client_frame_view_linux.cc index d0f0657dbd2a0..7886c91f19a75 100644 --- a/shell/browser/ui/views/client_frame_view_linux.cc +++ b/shell/browser/ui/views/client_frame_view_linux.cc @@ -41,7 +41,6 @@ namespace { // These values should be the same as Chromium uses. constexpr int kResizeBorder = 10; -constexpr int kResizeInsideBoundsSize = 5; ui::NavButtonProvider::ButtonState ButtonStateToNavButtonProviderState( views::Button::ButtonState state) { @@ -152,8 +151,19 @@ gfx::Insets ClientFrameViewLinux::RestoredMirroredFrameBorderInsets() const { gfx::Insets ClientFrameViewLinux::RestoredFrameBorderInsets() const { gfx::Insets insets = GetFrameProvider()->GetFrameThicknessDip(); - insets.SetToMax(GetInputInsets()); - return insets; + const gfx::Insets input = GetInputInsets(); + + auto expand_if_visible = [](int side_thickness, int min_band) { + return side_thickness > 0 ? std::max(side_thickness, min_band) : 0; + }; + + gfx::Insets merged; + merged.set_top(expand_if_visible(insets.top(), input.top())); + merged.set_left(expand_if_visible(insets.left(), input.left())); + merged.set_bottom(expand_if_visible(insets.bottom(), input.bottom())); + merged.set_right(expand_if_visible(insets.right(), input.right())); + + return merged; } gfx::Insets ClientFrameViewLinux::GetInputInsets() const { @@ -198,9 +208,7 @@ void ClientFrameViewLinux::OnWindowButtonOrderingChange() { } int ClientFrameViewLinux::ResizingBorderHitTest(const gfx::Point& point) { - return ResizingBorderHitTestImpl(point, - RestoredMirroredFrameBorderInsets() + - gfx::Insets(kResizeInsideBoundsSize)); + return ResizingBorderHitTestImpl(point, RestoredMirroredFrameBorderInsets()); } gfx::Rect ClientFrameViewLinux::GetBoundsForClientView() const { From c1349cb18672c6bfd2347228c94a2ac1d0683432 Mon Sep 17 00:00:00 2001 From: Robo Date: Fri, 7 Nov 2025 20:56:51 +0900 Subject: [PATCH 216/268] fix: enable wasm trap handlers in all Node.js processes (#48788) * fix: enable wasm trap handlers in all Node.js processes * fix: separate registrations to account for featurelist init --- shell/browser/electron_browser_main_parts.cc | 5 ++ shell/common/v8_util.cc | 54 ++++++++++++++++++++ shell/common/v8_util.h | 2 + shell/renderer/electron_renderer_client.cc | 51 ++---------------- shell/services/node/node_service.cc | 7 +++ 5 files changed, 72 insertions(+), 47 deletions(-) diff --git a/shell/browser/electron_browser_main_parts.cc b/shell/browser/electron_browser_main_parts.cc index 139237d3a0413..2b0c122ebdb44 100644 --- a/shell/browser/electron_browser_main_parts.cc +++ b/shell/browser/electron_browser_main_parts.cc @@ -62,6 +62,7 @@ #include "shell/common/logging.h" #include "shell/common/node_bindings.h" #include "shell/common/node_includes.h" +#include "shell/common/v8_util.h" #include "ui/base/idle/idle.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/ui_base_switches.h" @@ -274,6 +275,10 @@ void ElectronBrowserMainParts::PostEarlyInitialization() { // Initialize field trials. InitializeFieldTrials(); + if (base::FeatureList::IsEnabled(features::kWebAssemblyTrapHandler)) { + electron::SetUpWebAssemblyTrapHandler(); + } + // Reinitialize logging now that the app has had a chance to set the app name // and/or user data directory. logging::InitElectronLogging(*base::CommandLine::ForCurrentProcess(), diff --git a/shell/common/v8_util.cc b/shell/common/v8_util.cc index dc01845b39803..93824b8e77dc6 100644 --- a/shell/common/v8_util.cc +++ b/shell/common/v8_util.cc @@ -8,6 +8,7 @@ #include #include +#include "base/base_switches.h" #include "base/memory/raw_ptr.h" #include "gin/converter.h" #include "shell/common/api/electron_api_native_image.h" @@ -17,6 +18,14 @@ #include "ui/gfx/image/image_skia.h" #include "v8/include/v8.h" +#if BUILDFLAG(IS_LINUX) && (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM64)) +#define ENABLE_WEB_ASSEMBLY_TRAP_HANDLER_LINUX +#include "base/command_line.h" +#include "components/crash/core/app/crashpad.h" // nogncheck +#include "content/public/common/content_switches.h" +#include "v8/include/v8-wasm-trap-handler-posix.h" +#endif + namespace electron { namespace { @@ -240,6 +249,51 @@ v8::Local DeserializeV8Value(v8::Isolate* isolate, return V8Deserializer(isolate, data).Deserialize(); } +void SetUpWebAssemblyTrapHandler() { +#if BUILDFLAG(IS_WIN) + // On Windows we use the default trap handler provided by V8. + v8::V8::EnableWebAssemblyTrapHandler(true); +#elif BUILDFLAG(IS_MAC) + // On macOS, Crashpad uses exception ports to handle signals in a + // different process. As we cannot just pass a callback to this other + // process, we ask V8 to install its own signal handler to deal with + // WebAssembly traps. + v8::V8::EnableWebAssemblyTrapHandler(true); +#elif defined(ENABLE_WEB_ASSEMBLY_TRAP_HANDLER_LINUX) + const bool crash_reporter_enabled = + crash_reporter::GetHandlerSocket(nullptr, nullptr); + + if (crash_reporter_enabled) { + // If either --enable-crash-reporter or --enable-crash-reporter-for-testing + // is enabled it should take care of signal handling for us, use the default + // implementation which doesn't register an additional handler. + v8::V8::EnableWebAssemblyTrapHandler(false); + return; + } + + const bool use_v8_default_handler = + base::CommandLine::ForCurrentProcess()->HasSwitch( + ::switches::kDisableInProcessStackTraces); + + if (use_v8_default_handler) { + // There is no signal handler yet, but it's okay if v8 registers one. + v8::V8::EnableWebAssemblyTrapHandler(/*use_v8_signal_handler=*/true); + return; + } + + if (base::debug::SetStackDumpFirstChanceCallback( + v8::TryHandleWebAssemblyTrapPosix)) { + // Crashpad and Breakpad are disabled, but the in-process stack dump + // handlers are enabled, so set the callback on the stack dump handlers. + v8::V8::EnableWebAssemblyTrapHandler(/*use_v8_signal_handler=*/false); + return; + } + + // As the registration of the callback failed, we don't enable trap + // handlers. +#endif +} + namespace util { /** diff --git a/shell/common/v8_util.h b/shell/common/v8_util.h index 59ba4c633a346..eca443eabfc1b 100644 --- a/shell/common/v8_util.h +++ b/shell/common/v8_util.h @@ -30,6 +30,8 @@ v8::Local DeserializeV8Value(v8::Isolate* isolate, v8::Local DeserializeV8Value(v8::Isolate* isolate, base::span data); +void SetUpWebAssemblyTrapHandler(); + namespace util { [[nodiscard]] base::span as_byte_span( diff --git a/shell/renderer/electron_renderer_client.cc b/shell/renderer/electron_renderer_client.cc index 74706ce9f5d23..dbb8bcebc1502 100644 --- a/shell/renderer/electron_renderer_client.cc +++ b/shell/renderer/electron_renderer_client.cc @@ -6,7 +6,6 @@ #include -#include "base/base_switches.h" #include "base/command_line.h" #include "base/containers/contains.h" #include "base/debug/stack_trace.h" @@ -19,6 +18,7 @@ #include "shell/common/node_includes.h" #include "shell/common/node_util.h" #include "shell/common/options_switches.h" +#include "shell/common/v8_util.h" #include "shell/renderer/electron_render_frame_observer.h" #include "shell/renderer/web_worker_observer.h" #include "third_party/blink/public/common/web_preferences/web_preferences.h" @@ -27,13 +27,6 @@ #include "third_party/blink/renderer/core/execution_context/execution_context.h" // nogncheck #include "third_party/blink/renderer/core/frame/web_local_frame_impl.h" // nogncheck -#if BUILDFLAG(IS_LINUX) && (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM64)) -#define ENABLE_WEB_ASSEMBLY_TRAP_HANDLER_LINUX -#include "components/crash/core/app/crashpad.h" // nogncheck -#include "content/public/common/content_switches.h" -#include "v8/include/v8-wasm-trap-handler-posix.h" -#endif - namespace electron { ElectronRendererClient::ElectronRendererClient() @@ -248,45 +241,9 @@ void ElectronRendererClient::WillDestroyWorkerContextOnWorkerThread( } void ElectronRendererClient::SetUpWebAssemblyTrapHandler() { -// See CL:5372409 - copied from ShellContentRendererClient. -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) - // Mac and Windows use the default implementation (where the default v8 trap - // handler gets set up). - ContentRendererClient::SetUpWebAssemblyTrapHandler(); - return; -#elif defined(ENABLE_WEB_ASSEMBLY_TRAP_HANDLER_LINUX) - const bool crash_reporter_enabled = - crash_reporter::GetHandlerSocket(nullptr, nullptr); - - if (crash_reporter_enabled) { - // If either --enable-crash-reporter or --enable-crash-reporter-for-testing - // is enabled it should take care of signal handling for us, use the default - // implementation which doesn't register an additional handler. - ContentRendererClient::SetUpWebAssemblyTrapHandler(); - return; - } - - const bool use_v8_default_handler = - base::CommandLine::ForCurrentProcess()->HasSwitch( - ::switches::kDisableInProcessStackTraces); - - if (use_v8_default_handler) { - // There is no signal handler yet, but it's okay if v8 registers one. - v8::V8::EnableWebAssemblyTrapHandler(/*use_v8_signal_handler=*/true); - return; - } - - if (base::debug::SetStackDumpFirstChanceCallback( - v8::TryHandleWebAssemblyTrapPosix)) { - // Crashpad and Breakpad are disabled, but the in-process stack dump - // handlers are enabled, so set the callback on the stack dump handlers. - v8::V8::EnableWebAssemblyTrapHandler(/*use_v8_signal_handler=*/false); - return; - } - - // As the registration of the callback failed, we don't enable trap - // handlers. -#endif // defined(ENABLE_WEB_ASSEMBLY_TRAP_HANDLER_LINUX) + // content/renderer layer already takes care of the feature flag detection + // so no need to check for features::kWebAssemblyTrapHandler here. + electron::SetUpWebAssemblyTrapHandler(); } node::Environment* ElectronRendererClient::GetEnvironment( diff --git a/shell/services/node/node_service.cc b/shell/services/node/node_service.cc index ffb7f3c007b96..d1cd785b943d1 100644 --- a/shell/services/node/node_service.cc +++ b/shell/services/node/node_service.cc @@ -11,6 +11,7 @@ #include "base/no_destructor.h" #include "base/process/process.h" #include "base/strings/utf_string_conversions.h" +#include "content/public/common/content_features.h" #include "electron/mas.h" #include "net/base/network_change_notifier.h" #include "services/network/public/cpp/wrapper_shared_url_loader_factory.h" @@ -22,6 +23,7 @@ #include "shell/common/gin_helper/dictionary.h" #include "shell/common/node_bindings.h" #include "shell/common/node_includes.h" +#include "shell/common/v8_util.h" #include "shell/services/node/parent_port.h" #if !IS_MAS_BUILD() @@ -130,6 +132,11 @@ void NodeService::Initialize( v8::Isolate* const isolate = js_env_->isolate(); v8::HandleScope scope{isolate}; + // Initialize after setting up the V8 isolate. + if (base::FeatureList::IsEnabled(features::kWebAssemblyTrapHandler)) { + electron::SetUpWebAssemblyTrapHandler(); + } + node_bindings_->Initialize(isolate, isolate->GetCurrentContext()); network_change_notifier_ = net::NetworkChangeNotifier::CreateIfNeeded( From 8b9af355591de53341b76b67af78a73fc256953b Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" Date: Fri, 7 Nov 2025 10:13:45 -0500 Subject: [PATCH 217/268] chore: bump chromium to 144.0.7512.1 (main) (#48768) * chore: bump chromium in DEPS to 144.0.7507.0 * chore: bump chromium in DEPS to 144.0.7508.0 * chore: update patches * 7101838: [pathbuilder] Enforce immutable SkPath APIs globally https://chromium-review.googlesource.com/c/chromium/src/+/7101838 * chore: update filenames.libcxx.gni * [pathbuilder] Enforce immutable SkPath APIs globally https://chromium-review.googlesource.com/c/chromium/src/+/7101838 * Reduce service_worker_info.h includes in headers https://chromium-review.googlesource.com/c/chromium/src/+/7108401 * chore: bump chromium in DEPS to 144.0.7510.0 * chore: update patches * Use internal popup menus for tabs in actor-controlled states https://chromium-review.googlesource.com/c/chromium/src/+/7074751 * [api] Delete deprecated fields on v8::Isolate https://chromium-review.googlesource.com/c/v8/v8/+/7081397 xref: https://github.com/nodejs/node/pull/60488/commits/98d243aea02971dfd56af02f30be44e33b74c265 * Fixup Reduce service_worker_info.h includes in headers * Promote deprecation of v8::Context and v8::Object API methods https://chromium-review.googlesource.com/c/v8/v8/+/7087956 * fixup Promote deprecation of v8::Context and v8::Object API methods * chore: bump chromium in DEPS to 144.0.7512.1 * chore: update patches * fixup [pathbuilder] Enforce immutable SkPath APIs global * chore: update filenames.hunspell.gni * fix deprecation of v8::Context and v8::Object API methods for nan https://chromium-review.googlesource.com/c/v8/v8/+/7087956 * [PDF] Implement PdfHelpBubbleHandlerFactory https://chromium-review.googlesource.com/c/chromium/src/+/7056325 also: [PDF Ink Signatures] Hook up IPH https://chromium-review.googlesource.com/c/chromium/src/+/7056207 * Remove base/hash/md5.h https://chromium-review.googlesource.com/c/chromium/src/+/7113738 * fixup for lint * Remove deprecated interceptor callback types and AccessControl enum https://chromium-review.googlesource.com/c/v8/v8/+/7112747 * fixup for lint * fixup [PDF] Implement PdfHelpBubbleHandlerFactory * use base::SHA1HashString instead of std::hash --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt --- BUILD.gn | 2 + DEPS | 2 +- chromium_src/BUILD.gn | 4 + filenames.hunspell.gni | 7 +- filenames.libcxx.gni | 1 + .../add_didinstallconditionalfeatures.patch | 12 +- ..._scheduler_throttling_per_renderview.patch | 10 +- ..._windows_to_have_different_web_prefs.patch | 10 +- ..._depend_on_packed_resource_integrity.patch | 14 +-- patches/chromium/build_gn.patch | 2 +- patches/chromium/can_create_window.patch | 30 ++--- ...ctron_objects_to_wrappablepointertag.patch | 2 +- ...ameter_in_script_lifecycle_observers.patch | 16 +-- ...fy_chromium_handling_of_mouse_events.patch | 4 +- .../chromium/chore_partial_revert_of.patch | 4 +- ...screationoverridden_with_full_params.patch | 22 ++-- .../chromium/enable_reset_aspect_ratio.patch | 2 +- ...xpose_setuseragent_on_networkcontext.patch | 6 +- .../extend_apply_webpreferences.patch | 4 +- ...t_allow_code_cache_in_custom_schemes.patch | 2 +- ...e_launch_options_for_service_process.patch | 6 +- ...moothing_css_rule_and_blink_painting.patch | 16 +-- ...g_exit_code_on_service_process_crash.patch | 4 +- ..._raw_response_headers_from_urlloader.patch | 8 +- ...dless_mode_handling_in_native_widget.patch | 2 +- ...ding_non-standard_schemes_in_iframes.patch | 4 +- ...x_harden_blink_scriptstate_maybefrom.patch | 15 +-- patches/chromium/fix_linux_tray_id.patch | 10 +- ...king_and_message_bubbling_on_windows.patch | 10 +- ...board_hides_on_input_blur_in_webview.patch | 4 +- ..._material_update_issue_on_windows_11.patch | 2 +- ...from_localframe_requestexecutescript.patch | 4 +- patches/chromium/frame_host_manager.patch | 4 +- .../chromium/gritsettings_resource_ids.patch | 4 +- ..._avoid_private_macos_api_usage.patch.patch | 14 +-- ...emote_certificate_verification_logic.patch | 6 +- .../chromium/notification_provenance.patch | 6 +- ...xture_remove_keyed_mutex_on_win_dxgi.patch | 2 +- ...r_changes_to_the_webcontentsobserver.patch | 8 +- ...efactor_unfilter_unresponsive_events.patch | 4 +- patches/chromium/resource_file_conflict.patch | 6 +- ...ean_up_stale_macwebcontentsocclusion.patch | 8 +- ...al_remove_unused_prehandlemouseevent.patch | 12 +- ...windowtreehostwin_window_enlargement.patch | 28 ++--- patches/chromium/scroll_bounce_flag.patch | 4 +- .../support_mixed_sandbox_with_zygote.patch | 4 +- patches/chromium/web_contents.patch | 12 +- patches/chromium/webview_fullscreen.patch | 10 +- .../worker_context_will_destroy.patch | 14 +-- ...feat_add_hook_to_notify_script_ready.patch | 14 +-- patches/nan/.patches | 2 + ...v8_context_and_v8_object_api_methods.patch | 95 ++++++++++++++ ...ve_accesscontrol_enum_for_v8_14_4_59.patch | 50 ++++++++ patches/node/.patches | 2 + ...lete_deprecated_fields_on_v8_isolate.patch | 20 +++ ...v8_context_and_v8_object_api_methods.patch | 119 ++++++++++++++++++ .../api/electron_api_service_worker_main.cc | 1 + .../browser/api/electron_api_web_contents.cc | 3 +- shell/browser/electron_browser_client.cc | 7 ++ .../win/notification_presenter_win.cc | 4 +- shell/browser/ui/views/win_icon_painter.cc | 12 +- shell/common/gin_helper/destroyable.cc | 9 +- shell/common/gin_helper/trackable_object.h | 6 +- shell/common/gin_helper/wrappable.cc | 25 ++-- shell/common/node_bindings.cc | 8 +- shell/renderer/electron_smooth_round_rect.cc | 12 +- shell/renderer/preload_realm_context.cc | 12 +- 67 files changed, 553 insertions(+), 235 deletions(-) create mode 100644 patches/nan/fix_deprecation_of_v8_context_and_v8_object_api_methods.patch create mode 100644 patches/nan/remove_accesscontrol_enum_for_v8_14_4_59.patch create mode 100644 patches/node/api_delete_deprecated_fields_on_v8_isolate.patch create mode 100644 patches/node/api_promote_deprecation_of_v8_context_and_v8_object_api_methods.patch diff --git a/BUILD.gn b/BUILD.gn index 9eac9b970c2be..da572f0924478 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -762,11 +762,13 @@ source_set("electron_lib") { if (enable_pdf_viewer) { deps += [ "//chrome/browser/resources/pdf:resources", + "//chrome/browser/ui:browser_element_identifiers", "//components/pdf/browser", "//components/pdf/browser:interceptors", "//components/pdf/common:constants", "//components/pdf/common:util", "//components/pdf/renderer", + "//components/user_education/webui", "//pdf", "//pdf:content_restriction", ] diff --git a/DEPS b/DEPS index 2295902161663..32e0a7c9a586e 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '144.0.7506.0', + '144.0.7512.1', 'node_version': 'v24.11.0', 'nan_version': diff --git a/chromium_src/BUILD.gn b/chromium_src/BUILD.gn index 3ae92ec6f881d..36dd0ea29d705 100644 --- a/chromium_src/BUILD.gn +++ b/chromium_src/BUILD.gn @@ -383,6 +383,8 @@ static_library("chrome") { "//chrome/browser/pdf/chrome_pdf_stream_delegate.h", "//chrome/browser/pdf/pdf_extension_util.cc", "//chrome/browser/pdf/pdf_extension_util.h", + "//chrome/browser/pdf/pdf_help_bubble_handler_factory.cc", + "//chrome/browser/pdf/pdf_help_bubble_handler_factory.h", "//chrome/browser/pdf/pdf_viewer_stream_manager.cc", "//chrome/browser/pdf/pdf_viewer_stream_manager.h", "//chrome/browser/plugins/pdf_iframe_navigation_throttle.cc", @@ -391,6 +393,8 @@ static_library("chrome") { deps += [ "//components/pdf/browser", "//components/pdf/renderer", + "//ui/base/interaction", + "//ui/webui/resources/cr_components/help_bubble:mojo_bindings", ] } } else { diff --git a/filenames.hunspell.gni b/filenames.hunspell.gni index 64574354e4244..38c2c1fc2b4f6 100644 --- a/filenames.hunspell.gni +++ b/filenames.hunspell.gni @@ -7,21 +7,17 @@ hunspell_dictionaries = [ "//third_party/hunspell_dictionaries/da-DK-3-0.bdic", "//third_party/hunspell_dictionaries/de-DE-3-0.bdic", "//third_party/hunspell_dictionaries/el-GR-3-0.bdic", - "//third_party/hunspell_dictionaries/en-AU-10-0.bdic", "//third_party/hunspell_dictionaries/en-AU-10-1.bdic", - "//third_party/hunspell_dictionaries/en-CA-10-0.bdic", "//third_party/hunspell_dictionaries/en-CA-10-1.bdic", - "//third_party/hunspell_dictionaries/en-GB-10-0.bdic", "//third_party/hunspell_dictionaries/en-GB-10-1.bdic", - "//third_party/hunspell_dictionaries/en-GB-oxendict-10-0.bdic", "//third_party/hunspell_dictionaries/en-GB-oxendict-10-1.bdic", - "//third_party/hunspell_dictionaries/en-US-10-0.bdic", "//third_party/hunspell_dictionaries/en-US-10-1.bdic", "//third_party/hunspell_dictionaries/es-ES-3-0.bdic", "//third_party/hunspell_dictionaries/et-EE-3-0.bdic", "//third_party/hunspell_dictionaries/fa-IR-9-0.bdic", "//third_party/hunspell_dictionaries/fo-FO-3-0.bdic", "//third_party/hunspell_dictionaries/fr-FR-3-0.bdic", + "//third_party/hunspell_dictionaries/gl-1-0.bdic", "//third_party/hunspell_dictionaries/he-IL-3-0.bdic", "//third_party/hunspell_dictionaries/hi-IN-3-0.bdic", "//third_party/hunspell_dictionaries/hr-HR-3-0.bdic", @@ -59,6 +55,7 @@ hunspell_dictionaries = [ hunspell_licenses = [ "//third_party/hunspell_dictionaries/COPYING", "//third_party/hunspell_dictionaries/COPYING.Apache", + "//third_party/hunspell_dictionaries/COPYING.GPL3", "//third_party/hunspell_dictionaries/COPYING.LESSER", "//third_party/hunspell_dictionaries/COPYING.LGPL", "//third_party/hunspell_dictionaries/COPYING.MIT", diff --git a/filenames.libcxx.gni b/filenames.libcxx.gni index 051b368ff3e3a..9b728cc89f8ea 100644 --- a/filenames.libcxx.gni +++ b/filenames.libcxx.gni @@ -1454,6 +1454,7 @@ libcxx_headers = [ "//third_party/libc++/src/include/__type_traits/is_valid_expansion.h", "//third_party/libc++/src/include/__type_traits/is_void.h", "//third_party/libc++/src/include/__type_traits/is_volatile.h", + "//third_party/libc++/src/include/__type_traits/is_within_lifetime.h", "//third_party/libc++/src/include/__type_traits/lazy.h", "//third_party/libc++/src/include/__type_traits/make_32_64_or_128_bit.h", "//third_party/libc++/src/include/__type_traits/make_const_lvalue_ref.h", diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index 63f9a72be6ae4..3335a277cdbe2 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -23,10 +23,10 @@ index 5196f155cdc641b66c4faa77d8b00097145a1290..bbfac47a74f989482343c222b78f187b int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 30c2972e1fbc21d382304897c542ecd7fa95b896..3f512dcaec9f1d8a1375277ab8c6649d69070a33 100644 +index 1999b88df0cf82921eb74b7167bf119ff9bbc23a..f0a6a03efe20bf674a6fb2d4ad33de4a829cef53 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4665,6 +4665,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, +@@ -4662,6 +4662,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, observer.DidCreateScriptContext(context, world_id); } @@ -40,10 +40,10 @@ index 30c2972e1fbc21d382304897c542ecd7fa95b896..3f512dcaec9f1d8a1375277ab8c6649d int world_id) { for (auto& observer : observers_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index c3c45d6a953d7c068c0d6c8bfb6855cd4403aa6d..b3fd71b237c134853f796a1d8d803e4d28519d53 100644 +index 19c5dab00dd9355736c6040868b320483b780afb..621cd9ae7f43470ed4414a48d62330b36c7058e9 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -602,6 +602,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -603,6 +603,8 @@ class CONTENT_EXPORT RenderFrameImpl void DidObserveLayoutShift(double score, bool after_input_or_scroll) override; void DidCreateScriptContext(v8::Local context, int world_id) override; @@ -123,10 +123,10 @@ index fcc0928abbc454281b022e0451d993651ecba42f..16066fe34ee0335a0dabe00b6890e584 int32_t world_id) override; diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h -index 9ec4431ed035543beb78a3311049886c6d8e03f8..d46f3b764f653c990e57fb2c67121c8fd6b1b115 100644 +index b1677488cb64d2ad83f231b4cbe74bc4f56149b4..80ee0065d1b16520389b6809402438f087430fa3 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.h +++ b/third_party/blink/renderer/core/loader/empty_clients.h -@@ -424,6 +424,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { +@@ -426,6 +426,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { void DidCreateScriptContext(v8::Local, int32_t world_id) override {} diff --git a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch index c7dd726909076..2c583a41ee8bc 100644 --- a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -116,10 +116,10 @@ index 7f995dc1fab7a1b5319f6fe9bb4d37b3851dbf87..58c93c5acf9f63eb3391fafe2904b202 // Visibility ----------------------------------------------------------- diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index 2bb50e492558f0130918717605bf48b8a61f1e14..b50e4805af36aa96c0ce69359adcf1b18d80c62a 100644 +index 48a7bc14663edceaca00a397e528c50a96f7613f..1ba451388e2c8a702a3709d82456c32e6423c9b0 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -2499,6 +2499,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( +@@ -2511,6 +2511,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( TRACE_EVENT2("navigation", "WebViewImpl::SetPageLifecycleStateInternal", "old_state", old_state, "new_state", new_state); @@ -130,7 +130,7 @@ index 2bb50e492558f0130918717605bf48b8a61f1e14..b50e4805af36aa96c0ce69359adcf1b1 bool storing_in_bfcache = new_state->is_in_back_forward_cache && !old_state->is_in_back_forward_cache; bool restoring_from_bfcache = !new_state->is_in_back_forward_cache && -@@ -4007,10 +4011,23 @@ PageScheduler* WebViewImpl::Scheduler() const { +@@ -4021,10 +4025,23 @@ PageScheduler* WebViewImpl::Scheduler() const { return GetPage()->GetPageScheduler(); } @@ -155,7 +155,7 @@ index 2bb50e492558f0130918717605bf48b8a61f1e14..b50e4805af36aa96c0ce69359adcf1b1 // Do not throttle if the page should be painting. bool is_visible = diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h -index 881e561c0b4c55e30f6b4f69bcbbe092cc449fd1..9afced261ae85244f99dac4372fb7b1c3eabfbaa 100644 +index 973f9acb6186a24aeb6343ac4d868883e98cdf52..a3860649929fc0cff9680191ed9367fc68462fd3 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h @@ -447,6 +447,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, @@ -166,7 +166,7 @@ index 881e561c0b4c55e30f6b4f69bcbbe092cc449fd1..9afced261ae85244f99dac4372fb7b1c void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state, bool is_initial_state) override; mojom::blink::PageVisibilityState GetVisibilityState() override; -@@ -939,6 +940,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, +@@ -941,6 +942,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, // If true, we send IPC messages when |preferred_size_| changes. bool send_preferred_size_changes_ = false; diff --git a/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch b/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch index 52c006a2fc873..8107e23a707ea 100644 --- a/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch +++ b/patches/chromium/allow_in-process_windows_to_have_different_web_prefs.patch @@ -8,7 +8,7 @@ WebPreferences of in-process child windows, rather than relying on process-level command line switches, as before. diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc -index 42005e4758187331909b87f82e6e008a03a14f7f..f76615d34483b3485d7729889d0a895d13961f57 100644 +index 11e6b9d984eb95adfeb8675d487002fa1ac851bd..081cf9d03cb9db13113b604af104afbe9030e5c8 100644 --- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc +++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc @@ -150,6 +150,19 @@ bool StructTraitsaccelerated_video_decode_enabled = data.accelerated_video_decode_enabled(); diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h -index c1f0a4cae029527f9ea966b53fea2faa31c4cd90..e2bfc5356fc824b79231775ad85a45c6634093f7 100644 +index 1ba0466171963503d412b8aeb37d5953b3bbda9d..34654a186c0dc1715ac217d4c1480e6c36897e93 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences.h +++ b/third_party/blink/public/common/web_preferences/web_preferences.h @@ -9,6 +9,7 @@ @@ -43,7 +43,7 @@ index c1f0a4cae029527f9ea966b53fea2faa31c4cd90..e2bfc5356fc824b79231775ad85a45c6 #include "build/build_config.h" #include "net/nqe/effective_connection_type.h" #include "third_party/blink/public/common/common_export.h" -@@ -461,6 +462,19 @@ struct BLINK_COMMON_EXPORT WebPreferences { +@@ -466,6 +467,19 @@ struct BLINK_COMMON_EXPORT WebPreferences { bool should_screenshot_on_mainframe_same_doc_navigation = true; #endif // BUILDFLAG(IS_ANDROID) @@ -64,7 +64,7 @@ index c1f0a4cae029527f9ea966b53fea2faa31c4cd90..e2bfc5356fc824b79231775ad85a45c6 // chrome, except for the cases where it would require lots of extra work for // the embedder to use the same default value. diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h -index 3ab13439f0e03d1777ca78b638b98978d972bda5..c5f6f203d1ba36c3b1bb213d44b17adc472afbc4 100644 +index 53cfdb6a2739aedef3c72fc2e43709dd5a673c79..045b43f48a619234a8c0c4c76aea1025c10f193d 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h +++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h @@ -8,6 +8,7 @@ @@ -129,7 +129,7 @@ index 3ab13439f0e03d1777ca78b638b98978d972bda5..c5f6f203d1ba36c3b1bb213d44b17adc return r.cookie_enabled; } diff --git a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom -index 8b8f9837a5efd984ea1bd7b7b0c9462f65f5ac7e..7a3ccc78fc82181e1e9da9004305a827a80ed745 100644 +index 58b674f1848a5a70d08323d6f734794218d6ea8e..7011b1b7a754bfc2be30cf4eb07a32134d218359 100644 --- a/third_party/blink/public/mojom/webpreferences/web_preferences.mojom +++ b/third_party/blink/public/mojom/webpreferences/web_preferences.mojom @@ -4,6 +4,7 @@ diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index 3659ce4883503..326f17d240413 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -11,7 +11,7 @@ if we ever align our .pak file generation with Chrome we can remove this patch. diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index c51468e6fdb46634b5458b387d1c78caf2dd083f..7236611d2a392008f43b1b83ae125e945673f31c 100644 +index 606b3bd43179a5b4179a6ec9f58e531d55c1acb5..4d503a53290b4deaea016bb6867f3c07920f4055 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn @@ -196,11 +196,16 @@ if (!is_android && !is_mac) { @@ -33,10 +33,10 @@ index c51468e6fdb46634b5458b387d1c78caf2dd083f..7236611d2a392008f43b1b83ae125e94 "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index c3e8b9a6d64f4c278fc478cbb45c9cec6897faca..03ad5a81382bb01d62bfdc2279670345b37a7089 100644 +index a41ecd9b5776f3c56b4b1e3b29edee120600bf92..2e5e007ef68de105ba458a2ff771b4316aed2817 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4816,7 +4816,7 @@ static_library("browser") { +@@ -4820,7 +4820,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index c3e8b9a6d64f4c278fc478cbb45c9cec6897faca..03ad5a81382bb01d62bfdc2279670345 # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index b1fcad8d0580e3e37036599e758a2cb84a6cf055..bcbf93a6229b6358164a0b9a3c8fee14be2e20d4 100644 +index 11b17980ae54d0e6d40b87821ff5e8831fc6315f..2be9c078fca499b63a21e0a72f498e93c2d1c6f4 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7593,9 +7593,12 @@ test("unit_tests") { +@@ -7590,9 +7590,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index b1fcad8d0580e3e37036599e758a2cb84a6cf055..bcbf93a6229b6358164a0b9a3c8fee14 "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8530,6 +8533,10 @@ test("unit_tests") { +@@ -8533,6 +8536,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index b1fcad8d0580e3e37036599e758a2cb84a6cf055..bcbf93a6229b6358164a0b9a3c8fee14 sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8586,7 +8593,6 @@ test("unit_tests") { +@@ -8589,7 +8596,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/build_gn.patch b/patches/chromium/build_gn.patch index 3f71363a80432..e13725206cf46 100644 --- a/patches/chromium/build_gn.patch +++ b/patches/chromium/build_gn.patch @@ -7,7 +7,7 @@ These are variables we add to the root BUILDCONFIG so that they're available everywhere, without having to import("//electron/.../flags.gni"). diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn -index 69f7eb1ac466fbd4e528e3cf2e4e2f96e622424f..05f540daf67de55c09befa81b487a8fb9c45e751 100644 +index 749662ebf2e8f271400f4015f5503378f42ef2b4..f974d8048ca21371865bcae56e8e687529e0be4b 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -123,6 +123,9 @@ if (current_os == "") { diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index e6e1066d5ba25..98f2944e3c59f 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,10 +9,10 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 289545aae997d5a1458a063e38832484e2f8a11e..5f973dba78748ba2aeaab377534e9866d96a44fe 100644 +index 204d1908aa403c0db48c4a40c5f2068c6453e16e..034e8a1204badd4facef51a048f12e7c18b34f5d 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -9962,6 +9962,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -9956,6 +9956,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To(), params->frame_name, params->disposition, *params->features, @@ -21,10 +21,10 @@ index 289545aae997d5a1458a063e38832484e2f8a11e..5f973dba78748ba2aeaab377534e9866 &no_javascript_access); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 5aa061cd96f291eb955892363180e412c495f1d6..f208b31c5e39cb8c4e5e50ed3dd236bdc266baa5 100644 +index 78773db5e8bbe3c24922350f23c76bcdf3467b38..4fd490cec97d5391fcf5f821e39de4ccf67b6ae7 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5356,6 +5356,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5395,6 +5395,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( create_params.initially_hidden = renderer_started_hidden; create_params.initial_popup_url = params.target_url; @@ -35,7 +35,7 @@ index 5aa061cd96f291eb955892363180e412c495f1d6..f208b31c5e39cb8c4e5e50ed3dd236bd // Even though all codepaths leading here are in response to a renderer // trying to open a new window, if the new window ends up in a different // browsing instance, then the RenderViewHost, RenderWidgetHost, -@@ -5410,6 +5414,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5449,6 +5453,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( // Sets the newly created WebContents WindowOpenDisposition. new_contents_impl->original_window_open_disposition_ = params.disposition; @@ -48,7 +48,7 @@ index 5aa061cd96f291eb955892363180e412c495f1d6..f208b31c5e39cb8c4e5e50ed3dd236bd // If the new frame has a name, make sure any SiteInstances that can find // this named frame have proxies for it. Must be called after // SetSessionStorageNamespace, since this calls CreateRenderView, which uses -@@ -5451,12 +5461,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5490,12 +5500,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( AddWebContentsDestructionObserver(new_contents_impl); } @@ -77,10 +77,10 @@ index 599077542beacefc94f9e7ce6167312c9d66aaae..389896afb982dd0fc48274857c18fcd9 // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 928667b4308ace9b6b6f7d1a9479a1107b061034..eaaa92a4b6dba03422838b8e83364dc8716ba6db 100644 +index 759d220cdd24a099cbe3080d822f24b666717b22..f7d2f76eeca29b1e48143a887fd4836db8d07872 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -883,6 +883,8 @@ bool ContentBrowserClient::CanCreateWindow( +@@ -884,6 +884,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -90,10 +90,10 @@ index 928667b4308ace9b6b6f7d1a9479a1107b061034..eaaa92a4b6dba03422838b8e83364dc8 bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 4432cd1a9b0af50398409dbbcbdad80375f429e9..87c78abf57a26c83b153f2ac978024506a32a909 100644 +index 0d0e5e0eabbcb8ce19b675dadf5580f8381fb8ce..b10f6ae7612556e2f4cff60d38a88b5f1ad1757d 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -202,6 +202,7 @@ class NetworkService; +@@ -203,6 +203,7 @@ class NetworkService; class TrustedURLLoaderHeaderClient; } // namespace mojom struct ResourceRequest; @@ -101,7 +101,7 @@ index 4432cd1a9b0af50398409dbbcbdad80375f429e9..87c78abf57a26c83b153f2ac97802450 } // namespace network namespace sandbox { -@@ -1460,6 +1461,8 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -1461,6 +1462,8 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -111,7 +111,7 @@ index 4432cd1a9b0af50398409dbbcbdad80375f429e9..87c78abf57a26c83b153f2ac97802450 bool opener_suppressed, bool* no_javascript_access); diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index edee20df7f5bb087df9c134c7892f4befe2f14b9..df972f1ce594f2d4651202b650ff2d41fe19ecd0 100644 +index be43d917f1c881e1c97ccb72860fddab4b113e3c..5a88086b6957b9addc0598d58c41288f0065b0e6 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc @@ -34,6 +34,17 @@ namespace content { @@ -133,7 +133,7 @@ index edee20df7f5bb087df9c134c7892f4befe2f14b9..df972f1ce594f2d4651202b650ff2d41 WebContents* source, const OpenURLParams& params, diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 0c3d4f8ed4df5ca8d9db5424fa2be2d26510c4c9..98492cff13c97388d001fc33cc948261990edef1 100644 +index 3d67b3751ef13c9a43e48a124aefaea24db9140c..dea523e84616527b9ac0a25e67c8664aafd3b511 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -18,6 +18,7 @@ @@ -170,10 +170,10 @@ index 0c3d4f8ed4df5ca8d9db5424fa2be2d26510c4c9..98492cff13c97388d001fc33cc948261 // typically happens when popups are created. virtual void WebContentsCreated(WebContents* source_contents, diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index ab58f018ba8e4cee5a2cea45407333902f05f438..30c2972e1fbc21d382304897c542ecd7fa95b896 100644 +index 7590015330e21c29e066bebcc9059c65f3b9b844..1999b88df0cf82921eb74b7167bf119ff9bbc23a 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -6746,6 +6746,10 @@ WebView* RenderFrameImpl::CreateNewWindow( +@@ -6727,6 +6727,10 @@ WebView* RenderFrameImpl::CreateNewWindow( request.HasUserGesture(), GetWebFrame()->IsAdFrame(), GetWebFrame()->IsAdScriptInStack()); diff --git a/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch b/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch index 6dfa065c191f9..a4c11f6c62255 100644 --- a/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch +++ b/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch @@ -8,7 +8,7 @@ electron objects that extend gin::Wrappable and gets allocated on the cpp heap diff --git a/gin/public/wrappable_pointer_tags.h b/gin/public/wrappable_pointer_tags.h -index 82fc9e311ec84b19a15818a501b3a29329eff004..1199be7426139cdc77cee2e620eb8427092c74dd 100644 +index 573bcb2e56068a2ade6d8ab28964b077487874fd..93bf3814b38f8093e39f1a0548a43dfb347e49b3 100644 --- a/gin/public/wrappable_pointer_tags.h +++ b/gin/public/wrappable_pointer_tags.h @@ -74,7 +74,13 @@ enum WrappablePointerTag : uint16_t { diff --git a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch index 078beb2b864f4..12a7b9189faa4 100644 --- a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch +++ b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch @@ -8,10 +8,10 @@ where callsites that deal with multiple contexts need to distinguish the current isolate. diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index 1c5a9e693fd3b09213118fb32e4509e1d4a59364..921b7bb4b817ed753e08c2c058a23a2ccdaef40e 100644 +index 6fa11f89ea212eabd7fdc979d2d99138b1f3c88e..a35372743ce69d7cb04c54fcb75b49c0b6fe87c7 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h -@@ -398,6 +398,7 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -389,6 +389,7 @@ class CONTENT_EXPORT ContentRendererClient { // WillDestroyServiceWorkerContextOnWorkerThread() is called. virtual void WillEvaluateServiceWorkerOnWorkerThread( blink::WebServiceWorkerContextProxy* context_proxy, @@ -34,10 +34,10 @@ index bbfac47a74f989482343c222b78f187b70297e4e..3677ca3345fbc775d139684a12fe3624 virtual void DidClearWindowObject() {} virtual void DidChangeScrollOffset() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 3f512dcaec9f1d8a1375277ab8c6649d69070a33..45c8978bf9a45c14b15436851cdab9ae3d958f25 100644 +index f0a6a03efe20bf674a6fb2d4ad33de4a829cef53..c0deee8987c60ce4cf35eac80ad17240b8f11ee0 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4671,10 +4671,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( +@@ -4668,10 +4668,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( observer.DidInstallConditionalFeatures(context, world_id); } @@ -52,10 +52,10 @@ index 3f512dcaec9f1d8a1375277ab8c6649d69070a33..45c8978bf9a45c14b15436851cdab9ae void RenderFrameImpl::DidChangeScrollOffset() { diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index b3fd71b237c134853f796a1d8d803e4d28519d53..0b74cee0213daebef1e66d0abebd23787d764997 100644 +index 621cd9ae7f43470ed4414a48d62330b36c7058e9..f0c5f4f55062c85ee1e6b8da74b8f0c6ced75e81 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -604,7 +604,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -605,7 +605,8 @@ class CONTENT_EXPORT RenderFrameImpl int world_id) override; void DidInstallConditionalFeatures(v8::Local context, int world_id) override; @@ -245,10 +245,10 @@ index 16066fe34ee0335a0dabe00b6890e5844349c0b5..cc84479f65bdbe56cb4b38bfcef0d752 // Returns true if we should allow register V8 extensions to be added. diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h -index d46f3b764f653c990e57fb2c67121c8fd6b1b115..fe30a119d9befbde7c461637cf670a4b861efe05 100644 +index 80ee0065d1b16520389b6809402438f087430fa3..3991bc8caee23bb4129eedf7213a770d19439290 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.h +++ b/third_party/blink/renderer/core/loader/empty_clients.h -@@ -426,7 +426,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { +@@ -428,7 +428,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { int32_t world_id) override {} void DidInstallConditionalFeatures(v8::Local, int32_t world_id) override {} diff --git a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch index 4177114ec79f5..cb612ff00f716 100644 --- a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch +++ b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch @@ -34,10 +34,10 @@ index 2dc44d4787d5198cff7be2cf98ad5acf2d3a9a0b..27a0335aac2bd4239616cf71f5d015c9 class ScrollEvent; diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index d2651f4fcbb7991e9ec8f164e5bee51dab405c5a..d58b59288d881a2d74ea357f1e9e27870d24ac72 100644 +index 3b2fbefaeec2bac725d46bcfeea488122c873d76..fd23b8036c7f2d8bf3ed1bba126f8ee813f688a8 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -@@ -1378,6 +1378,10 @@ HBRUSH DesktopWindowTreeHostWin::GetBackgroundPaintBrush() { +@@ -1375,6 +1375,10 @@ HBRUSH DesktopWindowTreeHostWin::GetBackgroundPaintBrush() { return background_paint_brush_; } diff --git a/patches/chromium/chore_partial_revert_of.patch b/patches/chromium/chore_partial_revert_of.patch index 5431df59ddf21..b5eda7580defa 100644 --- a/patches/chromium/chore_partial_revert_of.patch +++ b/patches/chromium/chore_partial_revert_of.patch @@ -14,10 +14,10 @@ track down the source of this problem & figure out if we can fix it by changing something in Electron. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 808e961195a435e747236ce982dea722267a30dc..2798b165fcd0909f7329caa1cb4c8fcbe0934ef9 100644 +index 226b05d62edc0dae87aa76cd6b766250cb0856d6..540b0adfcc65c95327ec269e75681469f4c36847 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5327,7 +5327,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5366,7 +5366,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( : IsGuest(); // While some guest types do not have a guest SiteInstance, the ones that // don't all override WebContents creation above. diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index 5f88a07df2f0b..27b5fd983b889 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -80,10 +80,10 @@ index 39fa45f0a0f9076bd7ac0be6f455dd540a276512..3d0381d463eed73470b28085830f2a23 content::WebContents* source, const content::OpenURLParams& params, diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index d27effbf90aba2a888f479b6999fd16e58fdbcbf..1fd7f6166efd55ccc74a91763c87b1fe7987aaff 100644 +index 31f64282d734bda5c0f3aa592fbf3a5ca53d2ac8..cb2aec88f4bfecbecf085684780686afd5d91da4 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc -@@ -2376,7 +2376,8 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2369,7 +2369,8 @@ bool Browser::IsWebContentsCreationOverridden( content::mojom::WindowContainerType window_container_type, const GURL& opener_url, const std::string& frame_name, @@ -93,7 +93,7 @@ index d27effbf90aba2a888f479b6999fd16e58fdbcbf..1fd7f6166efd55ccc74a91763c87b1fe if (HasActorTask(profile(), opener)) { // If an ExecutionEngine is acting on the opener, prevent it from creating a // new WebContents. We'll instead force the navigation to happen in the same -@@ -2389,7 +2390,7 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2382,7 +2383,7 @@ bool Browser::IsWebContentsCreationOverridden( return (window_container_type == content::mojom::WindowContainerType::BACKGROUND && ShouldCreateBackgroundContents(source_site_instance, opener_url, @@ -103,10 +103,10 @@ index d27effbf90aba2a888f479b6999fd16e58fdbcbf..1fd7f6166efd55ccc74a91763c87b1fe WebContents* Browser::CreateCustomWebContents( diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h -index 46715de09311e36046c9d49e6eb0a6444532f49f..0883f12668347f76d20517df95885b2c73d98598 100644 +index 870b47d1a4212b7ec8dde4d0b13266c6ddca4ac6..40d9ee3e7472f15a60eaa8039f2cf8c12c47e324 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h -@@ -935,8 +935,7 @@ class Browser : public TabStripModelObserver, +@@ -930,8 +930,7 @@ class Browser : public TabStripModelObserver, content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -159,7 +159,7 @@ index 3bbd4e568ba99245622a96f0801d2b6cd203025f..1e0b7d16b33daed980961dd49c667a3b } content::WebContents* CreateCustomWebContents( diff --git a/components/embedder_support/android/delegate/web_contents_delegate_android.cc b/components/embedder_support/android/delegate/web_contents_delegate_android.cc -index 24f78a1c6b439c2f66683bb43b784f696f9a7419..7a5b6eccffe451787101042673d6efe4456237b4 100644 +index 97a429245bfc15aa321d73c142e1ba7cc8c60dec..43a907ff56743580fda414570e6bce5a00b1f247 100644 --- a/components/embedder_support/android/delegate/web_contents_delegate_android.cc +++ b/components/embedder_support/android/delegate/web_contents_delegate_android.cc @@ -210,15 +210,14 @@ bool WebContentsDelegateAndroid::IsWebContentsCreationOverridden( @@ -223,10 +223,10 @@ index b969f1d97b7e3396119b579cfbe61e19ff7d2dd4..b8d6169652da28266a514938b45b39c5 content::WebContents* AddNewContents( content::WebContents* source, diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index c47fe83984ca1c592138acafc354651ce1b559fc..c6f031e408768a31198f7e875d03d59cacaef9a7 100644 +index eebcf3d97557d5a95c00b483910a23717d1775c5..1cc8474a5f369cd0b13c328179c9be560b167468 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5290,8 +5290,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5329,8 +5329,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( if (delegate_ && delegate_->IsWebContentsCreationOverridden( opener, source_site_instance, params.window_container_type, @@ -237,7 +237,7 @@ index c47fe83984ca1c592138acafc354651ce1b559fc..c6f031e408768a31198f7e875d03d59c static_cast(delegate_->CreateCustomWebContents( opener, source_site_instance, is_new_browsing_instance, diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index df972f1ce594f2d4651202b650ff2d41fe19ecd0..a92305042eef86fbabeae6fe02b48668a349be99 100644 +index 5a88086b6957b9addc0598d58c41288f0065b0e6..54ab4e1426eaa19bfe71b5fdd52e115aae4f0c45 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc @@ -160,8 +160,7 @@ bool WebContentsDelegate::IsWebContentsCreationOverridden( @@ -251,7 +251,7 @@ index df972f1ce594f2d4651202b650ff2d41fe19ecd0..a92305042eef86fbabeae6fe02b48668 } diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 98492cff13c97388d001fc33cc948261990edef1..88b4810d3b91df0dd6b932412edd4ff249bedde0 100644 +index dea523e84616527b9ac0a25e67c8664aafd3b511..816b53d21e568a3d7a6f5902d87c5315ffedeee2 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -365,8 +365,7 @@ class CONTENT_EXPORT WebContentsDelegate { @@ -385,7 +385,7 @@ index 756d4192271d6a65cfe8e1511737c565b543cb1f..5688f6f745056565c3c01947f741c4d1 int opener_render_process_id, int opener_render_frame_id, diff --git a/headless/lib/browser/headless_web_contents_impl.cc b/headless/lib/browser/headless_web_contents_impl.cc -index d02d9468560eb451753fd56aa46bc4f191535e95..6e5c10f94a16039dc90cb2bdf90c4c854afc8a53 100644 +index 3af22f9e041996cedebc1d9ffd402e9fcccceaea..e488b8d4d8f81ad2a0b8a6a1cc13fb886fd26e62 100644 --- a/headless/lib/browser/headless_web_contents_impl.cc +++ b/headless/lib/browser/headless_web_contents_impl.cc @@ -208,8 +208,7 @@ class HeadlessWebContentsImpl::Delegate : public content::WebContentsDelegate { diff --git a/patches/chromium/enable_reset_aspect_ratio.patch b/patches/chromium/enable_reset_aspect_ratio.patch index 1bda66453a2d6..b25176e0399ee 100644 --- a/patches/chromium/enable_reset_aspect_ratio.patch +++ b/patches/chromium/enable_reset_aspect_ratio.patch @@ -6,7 +6,7 @@ Subject: feat: enable setting aspect ratio to 0 Make SetAspectRatio accept 0 as valid input, which would reset to null. diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 35469ecb01a680315b2f92e2599a3b56b5fc7549..d2651f4fcbb7991e9ec8f164e5bee51dab405c5a 100644 +index cb704a865eb1b748163a7c25b0a571585c2497b4..3b2fbefaeec2bac725d46bcfeea488122c873d76 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -614,7 +614,7 @@ void DesktopWindowTreeHostWin::SetOpacity(float opacity) { diff --git a/patches/chromium/expose_setuseragent_on_networkcontext.patch b/patches/chromium/expose_setuseragent_on_networkcontext.patch index e041f545be599..5793d3a202057 100644 --- a/patches/chromium/expose_setuseragent_on_networkcontext.patch +++ b/patches/chromium/expose_setuseragent_on_networkcontext.patch @@ -33,7 +33,7 @@ index 0ab8187b0db8ae6db46d81738f653a2bc4c566f6..de3d55e85c22317f7f9375eb94d0d5d4 } // namespace net diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index 3598823a6400c4e5045621950433d2688cfbba89..66379714141b83a2ded90f88ce8b89bf900ca5a6 100644 +index 61c7bd716e2ed78c8f71cba50d34e80d6effad4f..68ec7012adbdb1ac65fe784f4a928474a8894a70 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc @@ -1911,6 +1911,13 @@ void NetworkContext::EnableDurableMessageCollector( @@ -63,10 +63,10 @@ index 90cf1a70c068771ac98b2d5a283cba5e54c05ff4..0dc8de8d4e37e48cb28d8112c0233ac8 void SetEnableReferrers(bool enable_referrers) override; #if BUILDFLAG(IS_CT_SUPPORTED) diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index 58c53f7bab65af0b797f502a4633ca47933e26f0..474baf5e969c4397c9f61c9dea7ec2a466510dd8 100644 +index 8f1e7e517104a4849c96b19d8bedd57ac9a88ec6..6c7d5d8fd7a62c7d0484ae43664a36da6ef9b9ba 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -1352,6 +1352,9 @@ interface NetworkContext { +@@ -1345,6 +1345,9 @@ interface NetworkContext { mojo_base.mojom.UnguessableToken throttling_profile_id, pending_receiver receiver); diff --git a/patches/chromium/extend_apply_webpreferences.patch b/patches/chromium/extend_apply_webpreferences.patch index a1dc40335316d..2392b5e4ad7da 100644 --- a/patches/chromium/extend_apply_webpreferences.patch +++ b/patches/chromium/extend_apply_webpreferences.patch @@ -15,14 +15,14 @@ Ideally we could add an embedder observer pattern here but that can be done in future work. diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index b50e4805af36aa96c0ce69359adcf1b18d80c62a..5379c42a81f231592bd8a0dc02b05c67960bcb86 100644 +index 1ba451388e2c8a702a3709d82456c32e6423c9b0..e4f04cd84388bbf2bde68080cfb20267a29c50b3 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc @@ -1899,6 +1899,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, #if BUILDFLAG(IS_MAC) web_view_impl->SetMaximumLegibleScale( prefs.default_maximum_page_scale_factor); -+ web_view_impl->GetChromeClient().SetUseExternalPopupMenusForTesting( ++ web_view_impl->GetChromeClient().SetUseExternalPopupMenus( + !prefs.offscreen); #endif diff --git a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch index 726346f3033cd..ec00fd692b604 100644 --- a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch +++ b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch @@ -405,7 +405,7 @@ index c81434acc7cad0f6aa2e807c3c4037052863179e..d0da89f78308fc95778a5ce705a43f03 std::vector extension_schemes; // Registers a URL scheme with a predefined default custom handler. diff --git a/url/url_util.cc b/url/url_util.cc -index 039d39d55ff6984df478d62c40e852d60ab35c21..175abe714683841f046c7516c11e17ed24b225ab 100644 +index 87894c72227acdd951d61e3985d97215750a9748..5f270d100e76b441b1bfde0aed6ab850b843d8f6 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -136,6 +136,9 @@ struct SchemeRegistry { diff --git a/patches/chromium/feat_configure_launch_options_for_service_process.patch b/patches/chromium/feat_configure_launch_options_for_service_process.patch index fa6bab52636a3..74b5c390382a1 100644 --- a/patches/chromium/feat_configure_launch_options_for_service_process.patch +++ b/patches/chromium/feat_configure_launch_options_for_service_process.patch @@ -19,7 +19,7 @@ to STDOUT_FILENO/STD_OUTPUT_HANDLE and STDERR_FILENO/STD_ERROR_HANDLE allowing t parent process to read from the pipe. diff --git a/content/browser/child_process_launcher.h b/content/browser/child_process_launcher.h -index 6ca293e617f98b814484a012d74e3529e670ec01..d472adb01f934c12670d96b99cd4fbe8aaa16c21 100644 +index 0a47fb58e86d57d6cec3784d3b163c59592b585e..d2877fdd3bcff75248bad6a0462233cde82a104c 100644 --- a/content/browser/child_process_launcher.h +++ b/content/browser/child_process_launcher.h @@ -33,6 +33,7 @@ @@ -187,7 +187,7 @@ index d9c14f91747bde0e76056d7f2f2ada166e67f994..53be16879777a3b9bef58ead5f7e420c UtilityProcessHost::Start(std::move(utility_options), diff --git a/content/browser/service_host/utility_process_host.cc b/content/browser/service_host/utility_process_host.cc -index ad963436db4e854f8caf388a2d11f2f45bd66094..1cb1195980915098ca5c44a013158e9d91a45774 100644 +index c798b3394db7638e38613a016c2dbb0bfcf54d03..1298ea85a176db2150a4101afc205745f32eb8f5 100644 --- a/content/browser/service_host/utility_process_host.cc +++ b/content/browser/service_host/utility_process_host.cc @@ -241,13 +241,13 @@ UtilityProcessHost::Options& UtilityProcessHost::Options::WithFileToPreload( @@ -244,7 +244,7 @@ index ad963436db4e854f8caf388a2d11f2f45bd66094..1cb1195980915098ca5c44a013158e9d UtilityProcessHost::Options& UtilityProcessHost::Options::WithBoundReceiverOnChildProcessForTesting( mojo::GenericPendingReceiver receiver) { -@@ -521,9 +551,26 @@ bool UtilityProcessHost::StartProcess() { +@@ -520,9 +550,26 @@ bool UtilityProcessHost::StartProcess() { } #endif // BUILDFLAG(ENABLE_GPU_CHANNEL_MEDIA_CAPTURE) && !BUILDFLAG(IS_WIN) diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index 4d7cec2a24a8f..fad5d580f13e8 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -45,10 +45,10 @@ index e189d584f05f2ce6354c03a9b19f56985df8a15e..41b430e8f2416be098494f5c49fb97ca 'internal-forced-visited-'): internal_visited_order = 0 diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 -index b22689b90a99b843e5d44738a7f434c958086867..4ee7e10c46ddf11cb665c54a3addf5e17ff72a7f 100644 +index 86adddbca5900d86db526dc5c700ecbe56575d7d..7495443cf85408fced315c407c322bf27f328638 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5 -@@ -9163,6 +9163,26 @@ +@@ -9153,6 +9153,26 @@ property_methods: ["ParseShorthand", "CSSValueFromComputedStyleInternal"], }, @@ -76,7 +76,7 @@ index b22689b90a99b843e5d44738a7f434c958086867..4ee7e10c46ddf11cb665c54a3addf5e1 { name: "-internal-visited-color", diff --git a/third_party/blink/renderer/core/css/css_property_equality.cc b/third_party/blink/renderer/core/css/css_property_equality.cc -index 75ca85adcfaab9d64aa98d539a886bf76ee45727..4f96e8638f254fb493a026984a43869d5ac3485c 100644 +index aaf56976e7ac7a4efe904a5275722fdc02172bae..670d3f91ec556e415a80bb01341c4047745455f2 100644 --- a/third_party/blink/renderer/core/css/css_property_equality.cc +++ b/third_party/blink/renderer/core/css/css_property_equality.cc @@ -354,6 +354,8 @@ bool CSSPropertyEquality::PropertiesEqual(const PropertyHandle& property, @@ -89,10 +89,10 @@ index 75ca85adcfaab9d64aa98d539a886bf76ee45727..4f96e8638f254fb493a026984a43869d return a.EmptyCells() == b.EmptyCells(); case CSSPropertyID::kFill: diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -index 3a793e1450ec1df6e6d9c86c9973a93c62fc3452..5147753fb6ddb43a4218eeb1243e70efea190618 100644 +index 4e79b356bd2fc7721fca6caf0004d76841216aad..510f7915185f488c8e98514c011bb4250a220a2b 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -@@ -12674,5 +12674,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( +@@ -12640,5 +12640,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( CSSValueID::kNone>(stream); } @@ -201,10 +201,10 @@ index 0802c73aa4aaf4e1fb5efd367758f19c36691f71..5f06c0af277a7c937e694470beac707a return result; } diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn -index b8c29abdeb33dc26de820d5eaa78eced73f83921..ae154954c7b5e6f7c492a9d5eaef4b67e4dc97e9 100644 +index 0fb769875acfe214407159e689f6190a5feba7c3..d764a52863dfa46dd828682cb9c8501fdc95a0c0 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn -@@ -1669,6 +1669,8 @@ component("platform") { +@@ -1671,6 +1671,8 @@ component("platform") { "widget/widget_base.h", "widget/widget_base_client.h", "windows_keyboard_codes.h", @@ -312,7 +312,7 @@ index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index 973b8fbfe2d7ceb8953ce52a0d1013197026f613..885ea984ee2c148d056e0f4354b03a3855ba1f3a 100644 +index 0c3ea906c3bca432f49835848519922bdd17e6ac..b18903a4f8e7f8cdcd7d5165ff25cd7fba3f7a5c 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/feat_enable_passing_exit_code_on_service_process_crash.patch b/patches/chromium/feat_enable_passing_exit_code_on_service_process_crash.patch index 1f24721ab2a09..a231dd82a3777 100644 --- a/patches/chromium/feat_enable_passing_exit_code_on_service_process_crash.patch +++ b/patches/chromium/feat_enable_passing_exit_code_on_service_process_crash.patch @@ -84,10 +84,10 @@ index 2648adb1cf38ab557b66ffd0e3034b26b04d76d6..98eab587f343f6ca472efc3d4e7b31b2 private: const std::string service_interface_name_; diff --git a/content/browser/service_host/utility_process_host.cc b/content/browser/service_host/utility_process_host.cc -index 1cb1195980915098ca5c44a013158e9d91a45774..f09946a3c74e974d2234695841c56107a9ee9246 100644 +index 1298ea85a176db2150a4101afc205745f32eb8f5..1668345fb66b5a150b01dc3cce2e7262890a9c66 100644 --- a/content/browser/service_host/utility_process_host.cc +++ b/content/browser/service_host/utility_process_host.cc -@@ -625,7 +625,7 @@ void UtilityProcessHost::OnProcessCrashed(int exit_code) { +@@ -624,7 +624,7 @@ void UtilityProcessHost::OnProcessCrashed(int exit_code) { : Client::CrashType::kPreIpcInitialization; } #endif // BUILDFLAG(IS_WIN) diff --git a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch index 0cd45ec55b8f7..33d1f9d565dd9 100644 --- a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch +++ b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch @@ -112,10 +112,10 @@ index 13a211107294e856616d1626fa1dc9c79eb5646c..549a36886d665c1a8100f09b7a86c8dc string mime_type; diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc -index 132a0cf07682e68b8f188c265dd7e11fe66f2641..cd73879c90c20c225f7c178c6c7f2aff22648dfb 100644 +index e30252c08f9f82594ecd455c9db77e22fbd64296..4cf20063a2621575513f74257e1ea1a101420889 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc -@@ -406,6 +406,9 @@ URLLoader::URLLoader( +@@ -385,6 +385,9 @@ URLLoader::URLLoader( mojo::SimpleWatcher::ArmingPolicy::MANUAL, TaskRunner(request.priority)), per_factory_orb_state_(context.GetMutableOrbState()), @@ -125,7 +125,7 @@ index 132a0cf07682e68b8f188c265dd7e11fe66f2641..cd73879c90c20c225f7c178c6c7f2aff devtools_request_id_(request.devtools_request_id), options_(PopulateOptions(options, factory_params_->is_orb_enabled, -@@ -545,7 +548,7 @@ void URLLoader::SetUpUrlRequestCallbacks( +@@ -524,7 +527,7 @@ void URLLoader::SetUpUrlRequestCallbacks( &URLLoader::IsSharedDictionaryReadAllowed, base::Unretained(this))); } @@ -134,7 +134,7 @@ index 132a0cf07682e68b8f188c265dd7e11fe66f2641..cd73879c90c20c225f7c178c6c7f2aff url_request_->SetResponseHeadersCallback(base::BindRepeating( &URLLoader::SetRawResponseHeaders, base::Unretained(this))); } -@@ -1157,6 +1160,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) { +@@ -1121,6 +1124,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) { } response_ = BuildResponseHead(); diff --git a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch index dd68d9bfeb562..a7be415abddf2 100644 --- a/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch +++ b/patches/chromium/fix_adjust_headless_mode_handling_in_native_widget.patch @@ -121,7 +121,7 @@ index c44058711170316552ea05f97b8b8af694da8ca3..2895f8d17e7d045a3fae3f83e4dc117d if (params.opacity == views::Widget::InitParams::WindowOpacity::kInferred && diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h -index 40bba1d16a37f0b3c563faef86402641418dd994..bad7f48f50d5cd1c716963f660f63c7ec0d6449a 100644 +index 64d07b209f72fc593c861d84d2baf0ca52ce9aed..1569f9115371d4eaa18bb34eb4d91a1380d257d5 100644 --- a/ui/views/widget/widget.h +++ b/ui/views/widget/widget.h @@ -324,6 +324,11 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, diff --git a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch index 292fef0cb1547..f4f6fbe7ed4ab 100644 --- a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch +++ b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch @@ -28,10 +28,10 @@ The patch should be removed in favor of either: Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397. diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index c4a2394c13e549d6997222910f1a8d150434c11d..68da5f9629d071b9ef70341592ea50830dd8a6a0 100644 +index 1182d246f0f32d75fc02cd5ce17e0dd1be936bc4..8f7117987e8e3e97cbd76f0c0fd9e6e52e0da459 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc -@@ -11453,6 +11453,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { +@@ -11461,6 +11461,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { target_rph_id); } diff --git a/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch b/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch index ae12112f6a908..414ef004c2861 100644 --- a/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch +++ b/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch @@ -56,7 +56,7 @@ index cecf528475cb832ed1876381878eade582bc83d6..71308b2d963c2d083328aad6be356dc5 enum EmbedderDataTag : uint16_t { diff --git a/third_party/blink/renderer/platform/bindings/script_state.cc b/third_party/blink/renderer/platform/bindings/script_state.cc -index 8b6522c9299bef5ab766795b64a1ba30bc382a12..54d981405df5edab4695dfd01bb6a7b7dd8b7b3a 100644 +index 8b6522c9299bef5ab766795b64a1ba30bc382a12..a714aeb8a62886bedb3820b33b49b1ebdb9c7cc0 100644 --- a/third_party/blink/renderer/platform/bindings/script_state.cc +++ b/third_party/blink/renderer/platform/bindings/script_state.cc @@ -14,6 +14,12 @@ namespace blink { @@ -78,7 +78,7 @@ index 8b6522c9299bef5ab766795b64a1ba30bc382a12..54d981405df5edab4695dfd01bb6a7b7 gin::kBlinkScriptState); +#if defined(ARCH_CPU_32_BITS) + context->SetAlignedPointerInEmbedderData( -+ kV8ContextPerContextDataTagIndex, ScriptState::kScriptStateTagPtr); ++ kV8ContextPerContextDataTagIndex, ScriptState::kScriptStateTagPtr, v8::kEmbedderDataTypeTagDefault); +#endif // defined(ARCH_CPU_32_BITS) RendererResourceCoordinator::Get()->OnScriptStateCreated(this, execution_context); @@ -89,13 +89,13 @@ index 8b6522c9299bef5ab766795b64a1ba30bc382a12..54d981405df5edab4695dfd01bb6a7b7 kV8ContextPerContextDataIndex, nullptr, gin::kBlinkScriptState); +#if defined(ARCH_CPU_32_BITS) + GetContext()->SetAlignedPointerInEmbedderData( -+ kV8ContextPerContextDataTagIndex, nullptr); ++ kV8ContextPerContextDataTagIndex, nullptr, v8::kEmbedderDataTypeTagDefault); +#endif // defined(ARCH_CPU_32_BITS) reference_from_v8_context_.Clear(); // Cut the reference from ScriptState to V8 context. diff --git a/third_party/blink/renderer/platform/bindings/script_state.h b/third_party/blink/renderer/platform/bindings/script_state.h -index 5ccdf26cead17031d510589b74288cbe79692779..0bc2fdbf8e70d53a49794defe8b4a3d1d5a501cd 100644 +index 5ccdf26cead17031d510589b74288cbe79692779..bf3023d5305c05c5d92953b5bf5f655f964e5c28 100644 --- a/third_party/blink/renderer/platform/bindings/script_state.h +++ b/third_party/blink/renderer/platform/bindings/script_state.h @@ -6,6 +6,7 @@ @@ -106,7 +106,7 @@ index 5ccdf26cead17031d510589b74288cbe79692779..0bc2fdbf8e70d53a49794defe8b4a3d1 #include "gin/public/context_holder.h" #include "gin/public/gin_embedders.h" #include "third_party/blink/public/common/tokens/tokens.h" -@@ -188,6 +189,15 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected { +@@ -188,6 +189,16 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected { kV8ContextPerContextDataIndex) { return nullptr; } @@ -114,7 +114,8 @@ index 5ccdf26cead17031d510589b74288cbe79692779..0bc2fdbf8e70d53a49794defe8b4a3d1 + if (context->GetNumberOfEmbedderDataFields() <= + kV8ContextPerContextDataTagIndex || + context->GetAlignedPointerFromEmbedderData( -+ kV8ContextPerContextDataTagIndex) != ++ kV8ContextPerContextDataTagIndex, ++ v8::kEmbedderDataTypeTagDefault) != + ScriptState::kScriptStateTagPtr) { + return nullptr; + } @@ -122,7 +123,7 @@ index 5ccdf26cead17031d510589b74288cbe79692779..0bc2fdbf8e70d53a49794defe8b4a3d1 ScriptState* script_state = static_cast(context->GetAlignedPointerFromEmbedderData( isolate, kV8ContextPerContextDataIndex, gin::kBlinkScriptState)); -@@ -270,6 +280,14 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected { +@@ -270,6 +281,14 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected { static_cast(gin::kPerContextDataStartIndex) + static_cast(gin::kEmbedderBlink); diff --git a/patches/chromium/fix_linux_tray_id.patch b/patches/chromium/fix_linux_tray_id.patch index 0b54aa61e3aeb..8a265eaae70de 100644 --- a/patches/chromium/fix_linux_tray_id.patch +++ b/patches/chromium/fix_linux_tray_id.patch @@ -13,7 +13,7 @@ https://github.com/electron/electron/pull/48675#issuecomment-3452781711 for more info. diff --git a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc -index e268573d360b1744c739bc516e81261c3869cd23..cf69e72a1a391451a31e28356cb6b86fc6010646 100644 +index 27b65721dc9f127b15f92821d3f3ea4ce0a2f19c..ff69b5cab40156a30872ee1793f4e72a38d91b03 100644 --- a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc +++ b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc @@ -131,8 +131,8 @@ int NextServiceId() { @@ -43,7 +43,7 @@ index e268573d360b1744c739bc516e81261c3869cd23..cf69e72a1a391451a31e28356cb6b86f DCHECK_CURRENTLY_ON(content::BrowserThread::UI); CheckStatusNotifierWatcherHasOwner(); } -@@ -402,7 +403,7 @@ void StatusIconLinuxDbus::OnHostRegisteredResponse(dbus::Response* response) { +@@ -396,7 +397,7 @@ void StatusIconLinuxDbus::OnHostRegisteredResponse( properties_->SetProperty<"s">(kInterfaceStatusNotifierItem, kPropertyCategory, kPropertyValueCategory, false); properties_->SetProperty<"s">(kInterfaceStatusNotifierItem, kPropertyId, @@ -53,10 +53,10 @@ index e268573d360b1744c739bc516e81261c3869cd23..cf69e72a1a391451a31e28356cb6b86f kPropertyOverlayIconName, "", false); properties_->SetProperty<"s">(kInterfaceStatusNotifierItem, kPropertyStatus, diff --git a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h -index 78c0ddf50ae6cafed1badaeb951b1dab3110f095..984673954bb7f0b4c902677c70ab88c602201060 100644 +index 7b6b005f98e5de8b858a39e733dbf95888df3bc3..bf85004d8f42b30f12662078b24b684ea5c0c924 100644 --- a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h +++ b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h -@@ -35,7 +35,7 @@ class StatusIconLinuxDbus : public ui::StatusIconLinux, +@@ -36,7 +36,7 @@ class StatusIconLinuxDbus : public ui::StatusIconLinux, public ui::SimpleMenuModel::Delegate, public base::RefCounted { public: @@ -65,7 +65,7 @@ index 78c0ddf50ae6cafed1badaeb951b1dab3110f095..984673954bb7f0b4c902677c70ab88c6 StatusIconLinuxDbus(const StatusIconLinuxDbus&) = delete; StatusIconLinuxDbus& operator=(const StatusIconLinuxDbus&) = delete; -@@ -136,6 +136,8 @@ class StatusIconLinuxDbus : public ui::StatusIconLinux, +@@ -137,6 +137,8 @@ class StatusIconLinuxDbus : public ui::StatusIconLinux, size_t icon_file_id_ = 0; base::FilePath icon_file_; diff --git a/patches/chromium/fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch b/patches/chromium/fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch index 5ee738cfe276d..e122bee517cdb 100644 --- a/patches/chromium/fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch +++ b/patches/chromium/fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch @@ -13,10 +13,10 @@ messages in the legacy window handle layer. These conditions are regularly hit with WCO-enabled windows on Windows. diff --git a/content/browser/renderer_host/legacy_render_widget_host_win.cc b/content/browser/renderer_host/legacy_render_widget_host_win.cc -index 4723dee0cc086daac1419396b381a7298f97cebc..f76eac469e3966894430080085b2ba63740fa098 100644 +index 54ef4e8fb7dc5a942741912e1662ae132a56e984..1a7ce67dc418119b0a2b432f41ccc3b672a8da96 100644 --- a/content/browser/renderer_host/legacy_render_widget_host_win.cc +++ b/content/browser/renderer_host/legacy_render_widget_host_win.cc -@@ -368,12 +368,12 @@ LRESULT LegacyRenderWidgetHostHWND::OnKeyboardRange(UINT message, +@@ -378,12 +378,12 @@ LRESULT LegacyRenderWidgetHostHWND::OnKeyboardRange(UINT message, LRESULT LegacyRenderWidgetHostHWND::OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param) { @@ -31,7 +31,7 @@ index 4723dee0cc086daac1419396b381a7298f97cebc..f76eac469e3966894430080085b2ba63 tme.hwndTrack = hwnd(); tme.dwHoverTime = 0; TrackMouseEvent(&tme); -@@ -406,7 +406,10 @@ LRESULT LegacyRenderWidgetHostHWND::OnMouseRange(UINT message, +@@ -416,7 +416,10 @@ LRESULT LegacyRenderWidgetHostHWND::OnMouseRange(UINT message, // the picture. if (!msg_handled && (message >= WM_NCMOUSEMOVE && message <= WM_NCXBUTTONDBLCLK)) { @@ -44,10 +44,10 @@ index 4723dee0cc086daac1419396b381a7298f97cebc..f76eac469e3966894430080085b2ba63 } return ret; diff --git a/content/browser/renderer_host/legacy_render_widget_host_win.h b/content/browser/renderer_host/legacy_render_widget_host_win.h -index 28600fe212930c2b9833cb10e1fcc209a38d5a20..b004858bc2ba14cc417ed81d191d874e62bfe0fa 100644 +index ec3e5576b0b5f5c6f2ed5158a80d7816dbfbb702..ac5005fe7378ae1628db161b49fe16ea0a93b33a 100644 --- a/content/browser/renderer_host/legacy_render_widget_host_win.h +++ b/content/browser/renderer_host/legacy_render_widget_host_win.h -@@ -106,6 +106,7 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND +@@ -109,6 +109,7 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND CR_MESSAGE_HANDLER_EX(WM_NCHITTEST, OnNCHitTest) CR_MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE, WM_NCXBUTTONDBLCLK, OnMouseRange) diff --git a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch index 637e601bfabd5..d4ed747439c08 100644 --- a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch +++ b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch @@ -87,10 +87,10 @@ index 75df43e3cd2721a92c90c18154d53d5c203e2465..ce42c75c8face36d21f53f44c0201ac4 // The view with active text input state, i.e., a focused element. // It will be nullptr if no such view exists. Note that the active view diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 4a7c0480ad0e9d1f350909a14ef4e6d8d7b24581..808e961195a435e747236ce982dea722267a30dc 100644 +index d42bc3cb3e6adb2cd2c05a3ca629c84153c53663..226b05d62edc0dae87aa76cd6b766250cb0856d6 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10162,7 +10162,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( +@@ -10205,7 +10205,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( "WebContentsImpl::OnFocusedElementChangedInFrame", "render_frame_host", frame); RenderWidgetHostViewBase* root_view = diff --git a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch index ea9f46b255e31..2f5266fec9b5f 100644 --- a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch +++ b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch @@ -8,7 +8,7 @@ such as the background turning black when maximizing the window and dynamic background material settings not taking effect. diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 956dc87cb07559038a63cec0b5174cec09619bdb..68635b0c0153c3464ab6c7d317177098a7ec644c 100644 +index 392de361fe395b81b346abb477d91d495d00ba34..14b5a59b307179722f28e1cbcf1de220055d0075 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -183,6 +183,10 @@ void DesktopWindowTreeHostWin::FinishTouchDrag(gfx::Point screen_point) { diff --git a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch index 37e1e45670859..dd5c01c8c246a 100644 --- a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch +++ b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch @@ -203,10 +203,10 @@ index f2c94689450f0333a144ccf82cf147c194896e6b..1c2e9fe36c297f7d614d9ca290e4d13c const mojom::blink::UserActivationOption user_activation_option_; const mojom::blink::LoadEventBlockingOption blocking_option_; diff --git a/third_party/blink/renderer/core/frame/web_frame_test.cc b/third_party/blink/renderer/core/frame/web_frame_test.cc -index 865bb234bce920120dd8a78f701a598fe38388c7..f052ea9f89abffde2345d398eb6d683d761879f5 100644 +index 4aea5af7b5f5b389a046cbc4da42336f5987688e..317b5ec050c4221595a77f87ca320ca07e335e04 100644 --- a/third_party/blink/renderer/core/frame/web_frame_test.cc +++ b/third_party/blink/renderer/core/frame/web_frame_test.cc -@@ -295,6 +295,7 @@ void ExecuteScriptsInMainWorld( +@@ -296,6 +296,7 @@ void ExecuteScriptsInMainWorld( DOMWrapperWorld::kMainWorldId, sources, user_gesture, mojom::blink::EvaluationTiming::kSynchronous, mojom::blink::LoadEventBlockingOption::kDoNotBlock, std::move(callback), diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index 43fdc2f99f560..75e43b761650b 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -20,10 +20,10 @@ index 53bbf0174048d62b252b797b06695e6290273e80..4350b57ebf424e392c54dd2b54e62690 } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 87c78abf57a26c83b153f2ac978024506a32a909..57b120cdb13b099f3ed960a3b136446f9c7d8f69 100644 +index b10f6ae7612556e2f4cff60d38a88b5f1ad1757d..f7189f8b1f9d3299e459df26d801f86d9dff317c 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -340,6 +340,11 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -341,6 +341,11 @@ class CONTENT_EXPORT ContentBrowserClient { virtual ~ContentBrowserClient() = default; diff --git a/patches/chromium/gritsettings_resource_ids.patch b/patches/chromium/gritsettings_resource_ids.patch index 3dce6865e0031..1b3dda5516537 100644 --- a/patches/chromium/gritsettings_resource_ids.patch +++ b/patches/chromium/gritsettings_resource_ids.patch @@ -6,10 +6,10 @@ Subject: gritsettings_resource_ids.patch Add electron resources file to the list of resource ids generation. diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec -index 57ee47577331f6f424d7fa775b5dd9a0fb4b093d..22f5d6c58b80c41b805d54b0f1e4798becfe7a4d 100644 +index b137d827595addbd4e8880ee14dc3b7cd1261dbb..68a6c8f4549a9f084be94a6aa19d3312320e393f 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec -@@ -1601,6 +1601,11 @@ +@@ -1619,6 +1619,11 @@ "messages": [10120], }, diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index e17b740920c6c..fc310818d9883 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -35,7 +35,7 @@ system font by checking if it's kCTFontPriorityAttribute is set to system priority. diff --git a/base/BUILD.gn b/base/BUILD.gn -index 2a127468d8fcb1d24c2e05ce0e54528386686dff..430ceff387516f71fac947017df1e45e4929f164 100644 +index 73d636ded85feb3db6582d5eab8c713fb7304b31..9c2c027ec7c22578d10d089d624f3ec395d23f1c 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -1069,6 +1069,7 @@ component("base") { @@ -581,7 +581,7 @@ index 6f3496b2541fa21fd0bba1d95026eab30e3ab96d..ef481cd946a15f5eaba928fa4e720e6c return kAttributes; } diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index 4d4d187ad8c62c4e18454b385c8003a5c478d3ad..20c94074e61cffcf2806fa6b713b0603631f98f8 100644 +index bc58374ed9ce5c94e64742ead089de3ffd7351f4..36884dd700ed4d878b449c00da091497689074f2 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn @@ -343,6 +343,7 @@ source_set("browser") { @@ -796,7 +796,7 @@ index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbe } // namespace content diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn -index 88911eb5fe3d6e6423b12e2116704988cd032592..5852f0936d8a8de32fcce44f9833fca8aa4fcd7f 100644 +index 7c54ae91e60c7cb0b7c66d9c86b3d350d35ae34f..b4cfa7b08843c0410c5d11f46018d1f9fe89c40e 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn @@ -703,6 +703,7 @@ static_library("test_support") { @@ -816,7 +816,7 @@ index 88911eb5fe3d6e6423b12e2116704988cd032592..5852f0936d8a8de32fcce44f9833fca8 } mojom("content_test_mojo_bindings") { -@@ -2066,6 +2069,7 @@ test("content_browsertests") { +@@ -2067,6 +2070,7 @@ test("content_browsertests") { "//ui/shell_dialogs", "//ui/snapshot", "//ui/webui:test_support", @@ -824,7 +824,7 @@ index 88911eb5fe3d6e6423b12e2116704988cd032592..5852f0936d8a8de32fcce44f9833fca8 ] if (!(is_chromeos && target_cpu == "arm64" && current_cpu == "arm")) { -@@ -3403,6 +3407,7 @@ test("content_unittests") { +@@ -3408,6 +3412,7 @@ test("content_unittests") { "//ui/shell_dialogs", "//ui/webui:test_support", "//url", @@ -1395,10 +1395,10 @@ index eb81a70e4d5d5cd3e6ae9b45f8cd1c795ea76c51..9921ccb10d3455600eddd85f77f10228 } // namespace sandbox diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn -index e54ba53ed4866e568ae5c2dfe65e72adfe253e03..07d046634534efb28ee4584dd1b11678f7473e8f 100644 +index e934eb2b317f28dd91f8aa8c69d1cdd974006232..bcc9c361d427d460f0d845bea61e14f440af0a4f 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn -@@ -428,6 +428,7 @@ component("core") { +@@ -443,6 +443,7 @@ component("core") { "//ui/gfx/geometry", "//ui/gfx/geometry:geometry_skia", "//ui/strings", diff --git a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch index 95674e36cd0bd..f2c43f09a9742 100644 --- a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch +++ b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch @@ -7,7 +7,7 @@ This adds a callback from the network service that's used to implement session.setCertificateVerifyCallback. diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index 71cef856b5d4311124bc8bf30bf6c0f73b990b13..3598823a6400c4e5045621950433d2688cfbba89 100644 +index 3534a4b276fe96d56a9e7663b35b44aec44344c6..61c7bd716e2ed78c8f71cba50d34e80d6effad4f 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc @@ -166,6 +166,11 @@ @@ -190,7 +190,7 @@ index 3795ce4def719c36e1dace911be53b0103aeafc5..90cf1a70c068771ac98b2d5a283cba5e std::unique_ptr internal_host_resolver_; std::set, base::UniquePtrComparator> diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index 4a2a6525e636b4963fbaf630d497fbc5a5aa6e90..58c53f7bab65af0b797f502a4633ca47933e26f0 100644 +index bb6136990b69c61ac7e7e00e354f801be6955ff4..8f1e7e517104a4849c96b19d8bedd57ac9a88ec6 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom @@ -311,6 +311,17 @@ struct SocketBrokerRemotes { @@ -211,7 +211,7 @@ index 4a2a6525e636b4963fbaf630d497fbc5a5aa6e90..58c53f7bab65af0b797f502a4633ca47 // Parameters for constructing a network context. struct NetworkContextParams { // The user agent string. -@@ -1008,6 +1019,9 @@ interface NetworkContext { +@@ -1001,6 +1012,9 @@ interface NetworkContext { // Sets a client for this network context. SetClient(pending_remote client); diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index 38ba89a8869bc..15869368cbd9e 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -133,10 +133,10 @@ index 9bf238e64af483294ae3c3f18a4e9aed49a8658d..b9b2a4c8c387b8e8b4eb1f02fc0f891c const GURL& document_url, const WeakDocumentPtr& weak_document_ptr, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 7ee58f179c7948df29982cd3eac8beb82338391d..2601e4f7b4d236c53d29d81b7f1e418082b85121 100644 +index c6830a02a66b2b2898b40070916b29cc21c5e68c..1aabeee15e34c31a2ceeb3584c934abbb3b0e01b 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -2348,7 +2348,7 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2360,7 +2360,7 @@ void RenderProcessHostImpl::CreateNotificationService( case RenderProcessHost::NotificationServiceCreatorType::kSharedWorker: case RenderProcessHost::NotificationServiceCreatorType::kDedicatedWorker: { storage_partition_impl_->GetPlatformNotificationContext()->CreateService( @@ -145,7 +145,7 @@ index 7ee58f179c7948df29982cd3eac8beb82338391d..2601e4f7b4d236c53d29d81b7f1e4180 creator_type, std::move(receiver)); break; } -@@ -2356,7 +2356,7 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2368,7 +2368,7 @@ void RenderProcessHostImpl::CreateNotificationService( CHECK(rfh); storage_partition_impl_->GetPlatformNotificationContext()->CreateService( diff --git a/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch b/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch index 9a85a3f2aac8f..ba5a26f5ab6c0 100644 --- a/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch +++ b/patches/chromium/osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch @@ -11,7 +11,7 @@ For resolving complex conflict please pin @reitowo For more reason please see: https://crrev.com/c/5465148 diff --git a/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc b/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc -index 6fd14970d156d6c5636a3c1b04d86f79beca0e3e..a0c619264f8b6d4641813369169baa0bbe4b2b15 100644 +index 93fca64b215fb2f9170fcf5883cfed29ec3f5f69..cc95dab3bb5d4afebddb83154c47f200e282e521 100644 --- a/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc +++ b/gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc @@ -381,7 +381,8 @@ gfx::GpuMemoryBufferHandle D3DImageBackingFactory::CreateGpuMemoryBufferHandle( diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index 424e60cc3f116..78a9912905382 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -44,10 +44,10 @@ index 982b5edc933fdf1c4884dd0e0e7b957cee31c5ef..f28d6f919b5c6aca87c3feb701967a25 void RenderWidgetHostImpl::ShowContextMenuAtPoint( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index f208b31c5e39cb8c4e5e50ed3dd236bdc266baa5..c47fe83984ca1c592138acafc354651ce1b559fc 100644 +index 4fd490cec97d5391fcf5f821e39de4ccf67b6ae7..eebcf3d97557d5a95c00b483910a23717d1775c5 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -6167,6 +6167,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { +@@ -6206,6 +6206,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { return text_input_manager_.get(); } @@ -60,10 +60,10 @@ index f208b31c5e39cb8c4e5e50ed3dd236bdc266baa5..c47fe83984ca1c592138acafc354651c RenderWidgetHostImpl* render_widget_host) { return render_widget_host == GetPrimaryMainFrame()->GetRenderWidgetHost(); diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index 82c714ebe0e18cd7715e028836c396c214283d24..9b065992fc577084ef16aaef1436fd0855e32981 100644 +index ca7a0453d21f810c10e35ae447bd3b0ca615007b..2b562b8f8adaced3a87b45f04472313cee3eb479 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -1183,6 +1183,7 @@ class CONTENT_EXPORT WebContentsImpl +@@ -1188,6 +1188,7 @@ class CONTENT_EXPORT WebContentsImpl void SendScreenRects() override; void SendActiveState(bool active) override; TextInputManager* GetTextInputManager() override; diff --git a/patches/chromium/refactor_unfilter_unresponsive_events.patch b/patches/chromium/refactor_unfilter_unresponsive_events.patch index 3fc2f5a22699a..f224484222d4a 100644 --- a/patches/chromium/refactor_unfilter_unresponsive_events.patch +++ b/patches/chromium/refactor_unfilter_unresponsive_events.patch @@ -15,10 +15,10 @@ This CL removes these filters so the unresponsive event can still be accessed from our JS event. The filtering is moved into Electron's code. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 2798b165fcd0909f7329caa1cb4c8fcbe0934ef9..36d0de8de7871204162d775930960ae0434528a1 100644 +index 540b0adfcc65c95327ec269e75681469f4c36847..792c886d364f23f9888552cf9e7995624cdd3775 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10311,25 +10311,13 @@ void WebContentsImpl::RendererUnresponsive( +@@ -10354,25 +10354,13 @@ void WebContentsImpl::RendererUnresponsive( base::RepeatingClosure hang_monitor_restarter) { OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RendererUnresponsive", "render_widget_host", render_widget_host); diff --git a/patches/chromium/resource_file_conflict.patch b/patches/chromium/resource_file_conflict.patch index e2717c98c2d53..5afdc028393bc 100644 --- a/patches/chromium/resource_file_conflict.patch +++ b/patches/chromium/resource_file_conflict.patch @@ -52,10 +52,10 @@ Some alternatives to this patch: None of these options seems like a substantial maintainability win over this patch to me (@nornagon). diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index d3ca849dce4a2138e7d5edf126e70149211d4946..c51468e6fdb46634b5458b387d1c78caf2dd083f 100644 +index fa036801ce974378c5fb586bcf0609da24dd8547..606b3bd43179a5b4179a6ec9f58e531d55c1acb5 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn -@@ -1537,7 +1537,7 @@ if (is_chrome_branded && !is_android) { +@@ -1538,7 +1538,7 @@ if (is_chrome_branded && !is_android) { } } @@ -64,7 +64,7 @@ index d3ca849dce4a2138e7d5edf126e70149211d4946..c51468e6fdb46634b5458b387d1c78ca chrome_paks("packed_resources") { if (is_mac) { output_dir = "$root_gen_dir/repack" -@@ -1583,6 +1583,12 @@ repack("browser_tests_pak") { +@@ -1584,6 +1584,12 @@ repack("browser_tests_pak") { deps = [ "//chrome/test/data/webui:resources" ] } diff --git a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch index 5f5abfbcb47c0..34d049c142f2f 100644 --- a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch +++ b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch @@ -254,10 +254,10 @@ index 17d6d7d935f93afefa9123f56ef9c138c3070f93..8dfa7501a6a2998e107bf9b51f5e5c3d } diff --git a/content/common/features.cc b/content/common/features.cc -index d4ceee4abd5439ac81cbd3f33f293d4ef95d3e80..a3eea5ba266dd2b7b8e24522728711f0bc32c261 100644 +index aa548cad26cb2a552cc34ea0e415a9a4ca5e2bba..4d28affac64b3ef741e75547495218cb781fc66d 100644 --- a/content/common/features.cc +++ b/content/common/features.cc -@@ -312,6 +312,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); +@@ -317,6 +317,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kIOSurfaceCapturer, base::FEATURE_ENABLED_BY_DEFAULT); #endif @@ -273,10 +273,10 @@ index d4ceee4abd5439ac81cbd3f33f293d4ef95d3e80..a3eea5ba266dd2b7b8e24522728711f0 BASE_FEATURE(kKeepChildProcessAfterIPCReset, base::FEATURE_DISABLED_BY_DEFAULT); diff --git a/content/common/features.h b/content/common/features.h -index fbe32fbd471fbbb0e50d6956521eb13085088ba7..9d527a620e913b37a210afa514f05283b2792c7d 100644 +index 07c6ff157fd519860206cf61b41a9be0cfa65ae7..03643e2ad38906d1e540aeecf3787c3e6c9a1450 100644 --- a/content/common/features.h +++ b/content/common/features.h -@@ -111,6 +111,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); +@@ -112,6 +112,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); #if BUILDFLAG(IS_MAC) CONTENT_EXPORT BASE_DECLARE_FEATURE(kIOSurfaceCapturer); #endif diff --git a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch index 61e4456c4dcd3..713bd8a5972a5 100644 --- a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch +++ b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch @@ -54,10 +54,10 @@ index 2fa9876286ecda6a60a2c1970896cb275bbd7ab9..3f14e59de0e296b17f574aa40b879d2f if (mouse_event_callback.Run(mouse_event)) { return; diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 36d0de8de7871204162d775930960ae0434528a1..3662d82708f63f9c3d85e230d7e286693512e785 100644 +index 792c886d364f23f9888552cf9e7995624cdd3775..24c8e744669624f8f3d45fa4e8c6aa645b5205a2 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4484,6 +4484,12 @@ void WebContentsImpl::RenderWidgetWasResized( +@@ -4521,6 +4521,12 @@ void WebContentsImpl::RenderWidgetWasResized( width_changed); } @@ -71,10 +71,10 @@ index 36d0de8de7871204162d775930960ae0434528a1..3662d82708f63f9c3d85e230d7e28669 const gfx::PointF& client_pt) { if (delegate_) { diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index 9b065992fc577084ef16aaef1436fd0855e32981..0f230a7ecaa04e8050899525d606541432dada1e 100644 +index 2b562b8f8adaced3a87b45f04472313cee3eb479..e8b3edf974c6471ef72654544999e9fedf2be89d 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -1114,6 +1114,7 @@ class CONTENT_EXPORT WebContentsImpl +@@ -1119,6 +1119,7 @@ class CONTENT_EXPORT WebContentsImpl double GetPendingZoomLevel(RenderWidgetHostImpl* rwh) override; @@ -83,7 +83,7 @@ index 9b065992fc577084ef16aaef1436fd0855e32981..0f230a7ecaa04e8050899525d6065414 const gfx::PointF& client_pt); void PreHandleDragExit(); diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index a92305042eef86fbabeae6fe02b48668a349be99..5a50203f2df5724fe7bae5dc9ea211fd2cfe6171 100644 +index 54ab4e1426eaa19bfe71b5fdd52e115aae4f0c45..7f2d61d74ccdebee7310a67aaa8819eea52afa13 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc @@ -126,6 +126,12 @@ bool WebContentsDelegate::HandleContextMenu(RenderFrameHost& render_frame_host, @@ -100,7 +100,7 @@ index a92305042eef86fbabeae6fe02b48668a349be99..5a50203f2df5724fe7bae5dc9ea211fd WebContents* source, const input::NativeWebKeyboardEvent& event) { diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 88b4810d3b91df0dd6b932412edd4ff249bedde0..492efdb688af5af6691f3ef50de48103de29b138 100644 +index 816b53d21e568a3d7a6f5902d87c5315ffedeee2..bf56692686ed554214081c322aedae2df023fedc 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -311,6 +311,13 @@ class CONTENT_EXPORT WebContentsDelegate { diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index a51b8701fdb31..f58a2d0c4685b 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index d17495e674e0455ef8b487714559efd688d375a1..dada6a92c2dd8b19a2001960da570744ad027858 100644 +index dffb16c851e3b336bdd1091735a51e2086e87d2e..a9bed1920ff9b1272fd41518b27a0056f0ef1825 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25581,6 +25581,21 @@ +@@ -25633,6 +25633,21 @@ ] } ], @@ -36,7 +36,7 @@ index d17495e674e0455ef8b487714559efd688d375a1..dada6a92c2dd8b19a2001960da570744 { "platforms": [ diff --git a/ui/views/views_features.cc b/ui/views/views_features.cc -index eddb6b33f0df6f494ae9dfa63851c924e2d2350c..d74308e69e794637410597c7dd9a06b2d5fff425 100644 +index 9ecf5330bb9b3a5a7b12f3b9bb76192ea1694d07..202d3e3df60ec8d23b4cbd3e5814c3fce1b07871 100644 --- a/ui/views/views_features.cc +++ b/ui/views/views_features.cc @@ -22,6 +22,14 @@ BASE_FEATURE(kAnnounceTextAdditionalAttributes, @@ -55,7 +55,7 @@ index eddb6b33f0df6f494ae9dfa63851c924e2d2350c..d74308e69e794637410597c7dd9a06b2 // to kKeyboardAccessibleTooltip in //ui/base/ui_base_features.cc. BASE_FEATURE(kKeyboardAccessibleTooltipInViews, diff --git a/ui/views/views_features.h b/ui/views/views_features.h -index c1d8107ec3e32d31811572aa1d7a7c7a242da7d9..463abf871c7e169dc1ca9f523d74fc14d58541cc 100644 +index 5f5ea15678bd76399fdbbb8904fe155657f49335..a67c124878fb710599fed5d9714bfa723d0d67a5 100644 --- a/ui/views/views_features.h +++ b/ui/views/views_features.h @@ -14,6 +14,7 @@ namespace views::features { @@ -64,10 +64,10 @@ index c1d8107ec3e32d31811572aa1d7a7c7a242da7d9..463abf871c7e169dc1ca9f523d74fc14 VIEWS_EXPORT BASE_DECLARE_FEATURE(kEnableTouchDragCursorSync); +VIEWS_EXPORT BASE_DECLARE_FEATURE(kEnableTransparentHwndEnlargement); VIEWS_EXPORT BASE_DECLARE_FEATURE(kKeyboardAccessibleTooltipInViews); + VIEWS_EXPORT BASE_DECLARE_FEATURE(kApplyInitialUrlToWebContents); - } // namespace views::features diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index d58b59288d881a2d74ea357f1e9e27870d24ac72..956dc87cb07559038a63cec0b5174cec09619bdb 100644 +index fd23b8036c7f2d8bf3ed1bba126f8ee813f688a8..392de361fe395b81b346abb477d91d495d00ba34 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -84,6 +84,23 @@ namespace { @@ -219,7 +219,7 @@ index d58b59288d881a2d74ea357f1e9e27870d24ac72..956dc87cb07559038a63cec0b5174cec } gfx::Rect -@@ -917,21 +956,29 @@ int DesktopWindowTreeHostWin::GetNonClientComponent( +@@ -917,18 +956,26 @@ int DesktopWindowTreeHostWin::GetNonClientComponent( void DesktopWindowTreeHostWin::GetWindowMask(const gfx::Size& size_px, SkPath* path) { @@ -239,10 +239,7 @@ index d58b59288d881a2d74ea357f1e9e27870d24ac72..956dc87cb07559038a63cec0b5174cec - if (!path->isEmpty()) { - const float scale = - display::win::GetScreenWin()->GetScaleFactorForHWND(GetHWND()); -- SkScalar sk_scale = SkFloatToScalar(scale); -- SkMatrix matrix; -- matrix.setScale(sk_scale, sk_scale); -- path->transform(matrix); +- *path = path->makeTransform(SkMatrix::Scale(scale, scale)); + if (Widget* widget = GetWidget(); widget && widget->non_client_view()) { + widget->non_client_view()->GetWindowMask( + display::win::GetScreenWin()->ScreenToDIPSize(GetHWND(), @@ -252,14 +249,11 @@ index d58b59288d881a2d74ea357f1e9e27870d24ac72..956dc87cb07559038a63cec0b5174cec + if (!path->isEmpty()) { + const float scale = + display::win::GetScreenWin()->GetScaleFactorForHWND(GetHWND()); -+ SkScalar sk_scale = SkFloatToScalar(scale); -+ SkMatrix matrix; -+ matrix.setScale(sk_scale, sk_scale); -+ path->transform(matrix); ++ *path = path->makeTransform(SkMatrix::Scale(scale, scale)); + } + } else if (!window_enlargement_.IsZero()) { -+ path->addRect(SkRect::MakeXYWH(0, 0, adjusted_size_in_px.width(), -+ adjusted_size_in_px.height())); ++ *path = SkPath::Rect(SkRect::MakeXYWH(0, 0, adjusted_size_in_px.width(), ++ adjusted_size_in_px.height())); } } diff --git a/patches/chromium/scroll_bounce_flag.patch b/patches/chromium/scroll_bounce_flag.patch index 579b7c9ef188a..fecaafb174a90 100644 --- a/patches/chromium/scroll_bounce_flag.patch +++ b/patches/chromium/scroll_bounce_flag.patch @@ -6,10 +6,10 @@ Subject: scroll_bounce_flag.patch Patch to make scrollBounce option work. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc -index 0e56546b71167bf9f9ea8fba9de8a2cf50d44f4b..b76a714368f87ad8d6b92e3ea37a71ecf666d5ed 100644 +index 3740f509d3271b3397b37727fd8e90b463225b1c..0082895db7b05c162ea242446e587e2f92f341dd 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc -@@ -1208,7 +1208,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { +@@ -1215,7 +1215,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { } bool RenderThreadImpl::IsElasticOverscrollEnabled() { diff --git a/patches/chromium/support_mixed_sandbox_with_zygote.patch b/patches/chromium/support_mixed_sandbox_with_zygote.patch index a02d333b68258..5c932ada0228c 100644 --- a/patches/chromium/support_mixed_sandbox_with_zygote.patch +++ b/patches/chromium/support_mixed_sandbox_with_zygote.patch @@ -22,10 +22,10 @@ However, the patch would need to be reviewed by the security team, as it does touch a security-sensitive class. diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 2601e4f7b4d236c53d29d81b7f1e418082b85121..4b3d822c58b0224299448dbbe6caffe7081b17b6 100644 +index 1aabeee15e34c31a2ceeb3584c934abbb3b0e01b..ede92bd9fd24f5d1950e36a2204b8427b61c5451 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -1926,6 +1926,10 @@ bool RenderProcessHostImpl::Init() { +@@ -1938,6 +1938,10 @@ bool RenderProcessHostImpl::Init() { std::unique_ptr sandbox_delegate = std::make_unique( *cmd_line, IsPdf(), IsJitDisabled()); diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index da9969901d9cf..2e46a60e51f65 100644 --- a/patches/chromium/web_contents.patch +++ b/patches/chromium/web_contents.patch @@ -9,10 +9,10 @@ is needed for OSR. Originally landed in https://github.com/electron/libchromiumcontent/pull/226. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index c6f031e408768a31198f7e875d03d59cacaef9a7..66c603cfa5916e377a5d978a5d8e0f0e63ddb2a3 100644 +index 1cc8474a5f369cd0b13c328179c9be560b167468..003cd53d8d658351fa88cbc7f1dc33169c36b61b 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4215,6 +4215,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -4252,6 +4252,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, params.main_frame_name, GetOpener(), primary_main_frame_policy, base::UnguessableToken::Create()); @@ -26,7 +26,7 @@ index c6f031e408768a31198f7e875d03d59cacaef9a7..66c603cfa5916e377a5d978a5d8e0f0e std::unique_ptr delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -4225,6 +4232,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -4262,6 +4269,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, view_ = CreateWebContentsView(this, std::move(delegate), &render_view_host_delegate_view_); } @@ -35,10 +35,10 @@ index c6f031e408768a31198f7e875d03d59cacaef9a7..66c603cfa5916e377a5d978a5d8e0f0e CHECK(view_.get()); diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index 221839a555727d62e5d6546377baa9aa08ef52bb..ab55df1817cb0c0213c3db7102c8c6d561dd1b87 100644 +index 3255b4c9a3efe35850f3c5de5137524091b6235c..121fba14cd65bc84f8d724885311f0927766c8b0 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h -@@ -130,11 +130,14 @@ class PrerenderHandle; +@@ -131,11 +131,14 @@ class PrerenderHandle; class RenderFrameHost; class RenderViewHost; class RenderWidgetHost; @@ -53,7 +53,7 @@ index 221839a555727d62e5d6546377baa9aa08ef52bb..ab55df1817cb0c0213c3db7102c8c6d5 class WebUI; struct DropData; struct GlobalRenderFrameHostId; -@@ -292,6 +295,10 @@ class WebContents : public PageNavigator, public base::SupportsUserData { +@@ -293,6 +296,10 @@ class WebContents : public PageNavigator, public base::SupportsUserData { network::mojom::WebSandboxFlags starting_sandbox_flags = network::mojom::WebSandboxFlags::kNone; diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index 481b611b1920f..0c34d5dd9e404 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,10 +15,10 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 5f973dba78748ba2aeaab377534e9866d96a44fe..d66a52d58cc9daf00a785cd9654fd453fd958a5e 100644 +index 034e8a1204badd4facef51a048f12e7c18b34f5d..2688af93f5ba31ece987b94f2e40d7f76a866bcc 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -9057,6 +9057,17 @@ void RenderFrameHostImpl::EnterFullscreen( +@@ -9051,6 +9051,17 @@ void RenderFrameHostImpl::EnterFullscreen( } } @@ -37,10 +37,10 @@ index 5f973dba78748ba2aeaab377534e9866d96a44fe..d66a52d58cc9daf00a785cd9654fd453 if (had_fullscreen_token && !GetView()->HasFocus()) { GetView()->Focus(); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 66c603cfa5916e377a5d978a5d8e0f0e63ddb2a3..4a7c0480ad0e9d1f350909a14ef4e6d8d7b24581 100644 +index 003cd53d8d658351fa88cbc7f1dc33169c36b61b..d42bc3cb3e6adb2cd2c05a3ca629c84153c53663 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4501,21 +4501,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( +@@ -4538,21 +4538,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( const input::NativeWebKeyboardEvent& event) { OPTIONAL_TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("content.verbose"), "WebContentsImpl::PreHandleKeyboardEvent"); @@ -80,7 +80,7 @@ index 66c603cfa5916e377a5d978a5d8e0f0e63ddb2a3..4a7c0480ad0e9d1f350909a14ef4e6d8 } bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) { -@@ -4674,7 +4678,7 @@ void WebContentsImpl::EnterFullscreenMode( +@@ -4711,7 +4715,7 @@ void WebContentsImpl::EnterFullscreenMode( OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::EnterFullscreenMode"); DCHECK(CanEnterFullscreenMode(requesting_frame)); DCHECK(requesting_frame->IsActive()); diff --git a/patches/chromium/worker_context_will_destroy.patch b/patches/chromium/worker_context_will_destroy.patch index 421adf8bb5c3f..ecc6ada86dd2a 100644 --- a/patches/chromium/worker_context_will_destroy.patch +++ b/patches/chromium/worker_context_will_destroy.patch @@ -10,10 +10,10 @@ An attempt to upstream this was made, but rejected: https://chromium-review.googlesource.com/c/chromium/src/+/1954347 diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index fbf4212b0aa58467a404ce146c59e8a7d2e55461..e27271000fdcb9f155467923db74b5da4df3e989 100644 +index d63a25362fbfa35677de03fd09da535780feb1c9..c2fa875848478bca9115fc94271fde920e6b62fa 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h -@@ -428,6 +428,11 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -419,6 +419,11 @@ class CONTENT_EXPORT ContentRendererClient { virtual void DidInitializeWorkerContextOnWorkerThread( v8::Local context) {} @@ -26,10 +26,10 @@ index fbf4212b0aa58467a404ce146c59e8a7d2e55461..e27271000fdcb9f155467923db74b5da // An empty URL is returned if the URL is not overriden. virtual GURL OverrideFlashEmbedWithHTML(const GURL& url); diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index 93bb9ba86074d5105cca072d08588ff6e58caa6f..c3c795042c611b3ceb99d25dc255fbbe46ee9fcc 100644 +index 62b062d95ea9356d9d1ac7e86533e4b72e257c38..796dd5ccbcf6cc9e29a9aa6c6ca32f084dbefb49 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -902,6 +902,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { +@@ -903,6 +903,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread(); } @@ -43,7 +43,7 @@ index 93bb9ba86074d5105cca072d08588ff6e58caa6f..c3c795042c611b3ceb99d25dc255fbbe const v8::Local& worker) { GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h -index 451dd8f53764d02906cdfdd42d4a09f676857280..82d9b2f234101aeddc9c20ffae0d8793a5902ced 100644 +index e6180f6f86163130a63a2dd057799b54379efd4e..f53a619169a5cc82b7ae8ac13c4263ddcd432369 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h @@ -206,6 +206,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { @@ -55,10 +55,10 @@ index 451dd8f53764d02906cdfdd42d4a09f676857280..82d9b2f234101aeddc9c20ffae0d8793 const blink::WebSecurityOrigin& script_origin) override; blink::ProtocolHandlerSecurityLevel GetProtocolHandlerSecurityLevel( diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h -index ee07da0b3073fa15f66058bdd06cd8bce6f46c6e..dc188f2ac6cdd718eb058af834ca8fdf5ae3c753 100644 +index d182d973c5ae089b5c7919427c4bc822ef742d69..21da7570508b6929b8dd57957454d280119f7463 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -673,6 +673,7 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -674,6 +674,7 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void DidStartWorkerThread() {} virtual void WillStopWorkerThread() {} virtual void WorkerContextCreated(const v8::Local& worker) {} diff --git a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch index 06376920f7cdf..48377c0067eb0 100644 --- a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch +++ b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch @@ -19,10 +19,10 @@ that clearly establishes the worker script is ready for evaluation with the scop initialized. diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index e27271000fdcb9f155467923db74b5da4df3e989..1c5a9e693fd3b09213118fb32e4509e1d4a59364 100644 +index c2fa875848478bca9115fc94271fde920e6b62fa..6fa11f89ea212eabd7fdc979d2d99138b1f3c88e 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h -@@ -428,6 +428,11 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -419,6 +419,11 @@ class CONTENT_EXPORT ContentRendererClient { virtual void DidInitializeWorkerContextOnWorkerThread( v8::Local context) {} @@ -35,10 +35,10 @@ index e27271000fdcb9f155467923db74b5da4df3e989..1c5a9e693fd3b09213118fb32e4509e1 // from the worker thread. virtual void WillDestroyWorkerContextOnWorkerThread( diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index c3c795042c611b3ceb99d25dc255fbbe46ee9fcc..f9d5d5c633e35f562c9bfd83e90490737f48f563 100644 +index 796dd5ccbcf6cc9e29a9aa6c6ca32f084dbefb49..f51996a391c996ee711aa076933346de8e772645 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -914,6 +914,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated( +@@ -915,6 +915,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated( worker); } @@ -52,7 +52,7 @@ index c3c795042c611b3ceb99d25dc255fbbe46ee9fcc..f9d5d5c633e35f562c9bfd83e9049073 const blink::WebSecurityOrigin& script_origin) { return GetContentClient()->renderer()->AllowScriptExtensionForServiceWorker( diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h -index 82d9b2f234101aeddc9c20ffae0d8793a5902ced..f266958af5641064fac8995f1e3786f178f2f7bd 100644 +index f53a619169a5cc82b7ae8ac13c4263ddcd432369..586167d5984d0163f17e3bbacca34f51ae48e8d5 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h @@ -206,6 +206,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { @@ -65,10 +65,10 @@ index 82d9b2f234101aeddc9c20ffae0d8793a5902ced..f266958af5641064fac8995f1e3786f1 bool AllowScriptExtensionForServiceWorker( const blink::WebSecurityOrigin& script_origin) override; diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h -index dc188f2ac6cdd718eb058af834ca8fdf5ae3c753..072a55c9c40c6cc1a44a2939e614950dceb1bb27 100644 +index 21da7570508b6929b8dd57957454d280119f7463..459ea5c34c3c09099f064fff2684de1228658739 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -673,6 +673,8 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -674,6 +674,8 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void DidStartWorkerThread() {} virtual void WillStopWorkerThread() {} virtual void WorkerContextCreated(const v8::Local& worker) {} diff --git a/patches/nan/.patches b/patches/nan/.patches index 4b609c1fec7b5..281c837d33824 100644 --- a/patches/nan/.patches +++ b/patches/nan/.patches @@ -3,3 +3,5 @@ fix_replace_deprecated_get_setprototype.patch fix_replace_usage_of_removed_writeutf8_with_writeutf8v2.patch test_use_v8_version_check_instead_of_node_version_check.patch fix_remove_deprecated_propertycallbackinfo_holder.patch +fix_deprecation_of_v8_context_and_v8_object_api_methods.patch +remove_accesscontrol_enum_for_v8_14_4_59.patch diff --git a/patches/nan/fix_deprecation_of_v8_context_and_v8_object_api_methods.patch b/patches/nan/fix_deprecation_of_v8_context_and_v8_object_api_methods.patch new file mode 100644 index 0000000000000..e866bbf3f4d6d --- /dev/null +++ b/patches/nan/fix_deprecation_of_v8_context_and_v8_object_api_methods.patch @@ -0,0 +1,95 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: John Kleinschmidt +Date: Thu, 6 Nov 2025 11:47:29 -0500 +Subject: fix deprecation of v8::Context and v8::Object API methods + +ref: https://chromium-review.googlesource.com/c/v8/v8/+/7087956 + +diff --git a/nan.h b/nan.h +index 0f120365630e7e2a37964f09cc129d05c6648c90..20ec9daca6befd0ff2bf7eff6a164d4e47a545aa 100644 +--- a/nan.h ++++ b/nan.h +@@ -823,14 +823,14 @@ inline uv_loop_t* GetCurrentEventLoop() { + inline void* GetInternalFieldPointer( + v8::Local object + , int index) { +- return object->GetAlignedPointerFromInternalField(index); ++ return object->GetAlignedPointerFromInternalField(index, v8::kEmbedderDataTypeTagDefault); + } + + inline void SetInternalFieldPointer( + v8::Local object + , int index + , void* value) { +- object->SetAlignedPointerInInternalField(index, value); ++ object->SetAlignedPointerInInternalField(index, value, v8::kEmbedderDataTypeTagDefault); + } + + # define NAN_GC_CALLBACK(name) \ +diff --git a/nan_weak.h b/nan_weak.h +index 7e7ab07b8512dbbcc1f09c498e221032d2cd345f..968ecee9e95b4c841406d900cf177a37564561d5 100644 +--- a/nan_weak.h ++++ b/nan_weak.h +@@ -276,7 +276,7 @@ inline void Persistent::SetWeak( + int count = self->InternalFieldCount(); + void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; + for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { +- internal_fields[i] = self->GetAlignedPointerFromInternalField(i); ++ internal_fields[i] = self->GetAlignedPointerFromInternalField(i, v8::kEmbedderDataTypeTagDefault); + } + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) +@@ -284,7 +284,7 @@ inline void Persistent::SetWeak( + , 0 + , internal_fields[0] + , internal_fields[1]); +- self->SetAlignedPointerInInternalField(0, wcbd); ++ self->SetAlignedPointerInInternalField(0, wcbd, v8::kEmbedderDataTypeTagDefault); + v8::PersistentBase::SetWeak( + static_cast*>(0) + , WeakCallbackInfo

::template invoketwofield +@@ -314,7 +314,7 @@ inline void Persistent::SetWeak( + int count = self->InternalFieldCount(); + void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; + for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { +- internal_fields[i] = self->GetAlignedPointerFromInternalField(i); ++ internal_fields[i] = self->GetAlignedPointerFromInternalField(i, v8::kEmbedderDataTypeTagDefault); + } + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) +@@ -322,7 +322,7 @@ inline void Persistent::SetWeak( + , 0 + , internal_fields[0] + , internal_fields[1]); +- self->SetAlignedPointerInInternalField(0, wcbd); ++ self->SetAlignedPointerInInternalField(0, wcbd, v8::kEmbedderDataTypeTagDefault); + v8::PersistentBase::SetPhantom( + static_cast*>(0) + , WeakCallbackInfo

::invoketwofield +@@ -353,7 +353,7 @@ inline void Persistent::SetWeak( + int count = self->InternalFieldCount(); + void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; + for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { +- internal_fields[i] = self->GetAlignedPointerFromInternalField(i); ++ internal_fields[i] = self->GetAlignedPointerFromInternalField(i, v8::kEmbedderDataTypeTagDefault); + } + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) +@@ -361,7 +361,7 @@ inline void Persistent::SetWeak( + , 0 + , internal_fields[0] + , internal_fields[1]); +- self->SetAlignedPointerInInternalField(0, wcbd); ++ self->SetAlignedPointerInInternalField(0, wcbd, v8::kEmbedderDataTypeTagDefault); + v8::PersistentBase::SetPhantom( + WeakCallbackInfo

::invoketwofield + , 0 +@@ -389,7 +389,7 @@ inline void Persistent::SetWeak( + int count = self->InternalFieldCount(); + void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; + for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { +- internal_fields[i] = self->GetAlignedPointerFromInternalField(i); ++ internal_fields[i] = self->GetAlignedPointerFromInternalField(i, v8::kEmbedderDataTypeTagDefault); + } + wcbd = new WeakCallbackInfo

( + reinterpret_cast*>(this) diff --git a/patches/nan/remove_accesscontrol_enum_for_v8_14_4_59.patch b/patches/nan/remove_accesscontrol_enum_for_v8_14_4_59.patch new file mode 100644 index 0000000000000..b03769225ccea --- /dev/null +++ b/patches/nan/remove_accesscontrol_enum_for_v8_14_4_59.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: John Kleinschmidt +Date: Thu, 6 Nov 2025 15:17:50 -0500 +Subject: Remove AccessControl enum for v8 14.4.59 + +xref: [api] Remove deprecated interceptor callback types +and AccessControl enum. + +https://chromium-review.googlesource.com/c/v8/v8/+/7112747 + +diff --git a/nan.h b/nan.h +index 20ec9daca6befd0ff2bf7eff6a164d4e47a545aa..c6187a9e428e744baa2941f4f5a0ed589cdd3440 100644 +--- a/nan.h ++++ b/nan.h +@@ -2596,7 +2596,11 @@ NAN_DEPRECATED inline void SetAccessor( + , GetterCallback getter + , SetterCallback setter + , v8::Local data ++#if !defined(V8_MAJOR_VERSION) || V8_MAJOR_VERSION < 14 || \ ++ (V8_MAJOR_VERSION == 14 && (!defined(V8_MINOR_VERSION) || V8_MINOR_VERSION < 4)) || \ ++ (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION == 4 && (!defined(V8_BUILD_NUMBER) || V8_BUILD_NUMBER < 59)) + , v8::AccessControl settings ++#endif + , v8::PropertyAttribute attribute + , imp::Sig signature) { + HandleScope scope; +@@ -2651,7 +2655,11 @@ inline void SetAccessor( + , GetterCallback getter + , SetterCallback setter = 0 + , v8::Local data = v8::Local() ++#if !defined(V8_MAJOR_VERSION) || V8_MAJOR_VERSION < 14 || \ ++ (V8_MAJOR_VERSION == 14 && (!defined(V8_MINOR_VERSION) || V8_MINOR_VERSION < 4)) || \ ++ (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION == 4 && (!defined(V8_BUILD_NUMBER) || V8_BUILD_NUMBER < 59)) + , v8::AccessControl settings = v8::DEFAULT ++#endif + , v8::PropertyAttribute attribute = v8::None) { + HandleScope scope; + +@@ -2702,7 +2710,11 @@ inline bool SetAccessor( + , GetterCallback getter + , SetterCallback setter = 0 + , v8::Local data = v8::Local() ++#if !defined(V8_MAJOR_VERSION) || V8_MAJOR_VERSION < 14 || \ ++ (V8_MAJOR_VERSION == 14 && (!defined(V8_MINOR_VERSION) || V8_MINOR_VERSION < 4)) || \ ++ (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION == 4 && (!defined(V8_BUILD_NUMBER) || V8_BUILD_NUMBER < 59)) + , v8::AccessControl settings = v8::DEFAULT ++#endif + , v8::PropertyAttribute attribute = v8::None) { + HandleScope scope; + diff --git a/patches/node/.patches b/patches/node/.patches index e080e149e485f..94da36c4af6de 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -39,3 +39,5 @@ feat_disable_js_source_phase_imports_by_default.patch fix_avoid_external_memory_leak_on_invalid_tls_protocol_versions.patch lib_check_sharedarraybuffer_existence_in_fast-utf8-stream.patch chore_handle_support_for_import_defer_as_ns_and_import_defer.patch +api_delete_deprecated_fields_on_v8_isolate.patch +api_promote_deprecation_of_v8_context_and_v8_object_api_methods.patch diff --git a/patches/node/api_delete_deprecated_fields_on_v8_isolate.patch b/patches/node/api_delete_deprecated_fields_on_v8_isolate.patch new file mode 100644 index 0000000000000..c8896e87c5305 --- /dev/null +++ b/patches/node/api_delete_deprecated_fields_on_v8_isolate.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: John Kleinschmidt +Date: Wed, 5 Nov 2025 12:50:16 -0500 +Subject: Delete deprecated fields on v8::Isolate + +https://chromium-review.googlesource.com/c/v8/v8/+/7081397 + +diff --git a/src/api/environment.cc b/src/api/environment.cc +index 14be033113bfb13c64e5f99446afaf0cb2aa16a9..3eccf4ce7fcd13091186086456e60334f95f643e 100644 +--- a/src/api/environment.cc ++++ b/src/api/environment.cc +@@ -225,8 +225,6 @@ void SetIsolateCreateParamsForNode(Isolate::CreateParams* params) { + // heap based on the actual physical memory. + params->constraints.ConfigureDefaults(total_memory, 0); + } +- params->embedder_wrapper_object_index = BaseObject::InternalFields::kSlot; +- params->embedder_wrapper_type_index = std::numeric_limits::max(); + + #ifdef NODE_ENABLE_VTUNE_PROFILING + params->code_event_handler = vTune::GetVtuneCodeEventHandler(); diff --git a/patches/node/api_promote_deprecation_of_v8_context_and_v8_object_api_methods.patch b/patches/node/api_promote_deprecation_of_v8_context_and_v8_object_api_methods.patch new file mode 100644 index 0000000000000..f66e6a80385db --- /dev/null +++ b/patches/node/api_promote_deprecation_of_v8_context_and_v8_object_api_methods.patch @@ -0,0 +1,119 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: John Kleinschmidt +Date: Wed, 5 Nov 2025 16:41:23 -0500 +Subject: Promote deprecation of v8::Context and v8::Object API methods + +https://chromium-review.googlesource.com/c/v8/v8/+/7087956 + +diff --git a/src/base_object-inl.h b/src/base_object-inl.h +index 37d83e41b618a07aca98118260abe9618f11256d..26d5c1bd3c8191fce1d22b969996b6bf35ef6d3b 100644 +--- a/src/base_object-inl.h ++++ b/src/base_object-inl.h +@@ -75,7 +75,7 @@ bool BaseObject::IsBaseObject(IsolateData* isolate_data, + } + + uint16_t* ptr = static_cast( +- obj->GetAlignedPointerFromInternalField(BaseObject::kEmbedderType)); ++ obj->GetAlignedPointerFromInternalField(BaseObject::kEmbedderType, v8::kEmbedderDataTypeTagDefault)); + return ptr == isolate_data->embedder_id_for_non_cppgc(); + } + +@@ -83,21 +83,21 @@ void BaseObject::TagBaseObject(IsolateData* isolate_data, + v8::Local object) { + DCHECK_GE(object->InternalFieldCount(), BaseObject::kInternalFieldCount); + object->SetAlignedPointerInInternalField( +- BaseObject::kEmbedderType, isolate_data->embedder_id_for_non_cppgc()); ++ BaseObject::kEmbedderType, isolate_data->embedder_id_for_non_cppgc(), v8::kEmbedderDataTypeTagDefault); + } + + void BaseObject::SetInternalFields(IsolateData* isolate_data, + v8::Local object, + void* slot) { + TagBaseObject(isolate_data, object); +- object->SetAlignedPointerInInternalField(BaseObject::kSlot, slot); ++ object->SetAlignedPointerInInternalField(BaseObject::kSlot, slot, v8::kEmbedderDataTypeTagDefault); + } + + BaseObject* BaseObject::FromJSObject(v8::Local value) { + v8::Local obj = value.As(); + DCHECK_GE(obj->InternalFieldCount(), BaseObject::kInternalFieldCount); + return static_cast( +- obj->GetAlignedPointerFromInternalField(BaseObject::kSlot)); ++ obj->GetAlignedPointerFromInternalField(BaseObject::kSlot, v8::kEmbedderDataTypeTagDefault)); + } + + template +diff --git a/src/env-inl.h b/src/env-inl.h +index 5dfbd564d5bbd22ebf3b529a07b73e85cbe51986..b0c3c52cab63c6ae67079aa752bd58dd4f162451 100644 +--- a/src/env-inl.h ++++ b/src/env-inl.h +@@ -199,7 +199,8 @@ inline Environment* Environment::GetCurrent(v8::Local context) { + } + return static_cast( + context->GetAlignedPointerFromEmbedderData( +- ContextEmbedderIndex::kEnvironment)); ++ ContextEmbedderIndex::kEnvironment, ++ v8::kEmbedderDataTypeTagDefault)); + } + + inline Environment* Environment::GetCurrent( +diff --git a/src/node_context_data.h b/src/node_context_data.h +index d81c75daaae47b8b0b489cf357a32e437e7a6cf7..b0aab2f7b2538b6e2cacc9ffd52473b7b4ffff38 100644 +--- a/src/node_context_data.h ++++ b/src/node_context_data.h +@@ -135,7 +135,8 @@ class ContextEmbedderTag { + // context. + context->SetAlignedPointerInEmbedderData( + ContextEmbedderIndex::kContextTag, +- ContextEmbedderTag::kNodeContextTagPtr); ++ ContextEmbedderTag::kNodeContextTagPtr, ++ v8::kEmbedderDataTypeTagDefault); + } + + static inline bool IsNodeContext(v8::Local context) { +@@ -147,7 +148,8 @@ class ContextEmbedderTag { + return false; + } + if (context->GetAlignedPointerFromEmbedderData( +- ContextEmbedderIndex::kContextTag) != ++ ContextEmbedderIndex::kContextTag, ++ v8::kEmbedderDataTypeTagDefault) != + ContextEmbedderTag::kNodeContextTagPtr) [[unlikely]] { + return false; + } +diff --git a/src/node_object_wrap.h b/src/node_object_wrap.h +index cb13d84388bcc6806d3b038a51e1cc2d1feccda1..687b2cf3e63b2a3306e2cbac67e3e216dac49aa6 100644 +--- a/src/node_object_wrap.h ++++ b/src/node_object_wrap.h +@@ -49,7 +49,7 @@ class ObjectWrap { + assert(handle->InternalFieldCount() > 0); + // Cast to ObjectWrap before casting to T. A direct cast from void + // to T won't work right when T has more than one base class. +- void* ptr = handle->GetAlignedPointerFromInternalField(0); ++ void* ptr = handle->GetAlignedPointerFromInternalField(0, v8::kEmbedderDataTypeTagDefault); + ObjectWrap* wrap = static_cast(ptr); + return static_cast(wrap); + } +@@ -75,7 +75,7 @@ class ObjectWrap { + inline void Wrap(v8::Local handle) { + assert(persistent().IsEmpty()); + assert(handle->InternalFieldCount() > 0); +- handle->SetAlignedPointerInInternalField(0, this); ++ handle->SetAlignedPointerInInternalField(0, this, v8::kEmbedderDataTypeTagDefault); + persistent().Reset(v8::Isolate::GetCurrent(), handle); + MakeWeak(); + } +diff --git a/src/node_realm-inl.h b/src/node_realm-inl.h +index f162d1506c990a5fe578be6f1324427e3f9023f4..b57bb0b42e98b954c0c8662c667e589d6c68a5d3 100644 +--- a/src/node_realm-inl.h ++++ b/src/node_realm-inl.h +@@ -21,7 +21,8 @@ inline Realm* Realm::GetCurrent(v8::Local context) { + return nullptr; + } + return static_cast( +- context->GetAlignedPointerFromEmbedderData(ContextEmbedderIndex::kRealm)); ++ context->GetAlignedPointerFromEmbedderData(ContextEmbedderIndex::kRealm, ++ v8::kEmbedderDataTypeTagDefault)); + } + + inline Realm* Realm::GetCurrent( diff --git a/shell/browser/api/electron_api_service_worker_main.cc b/shell/browser/api/electron_api_service_worker_main.cc index f239466893e5f..a0e6978803837 100644 --- a/shell/browser/api/electron_api_service_worker_main.cc +++ b/shell/browser/api/electron_api_service_worker_main.cc @@ -10,6 +10,7 @@ #include "base/logging.h" #include "base/no_destructor.h" #include "content/browser/service_worker/service_worker_context_wrapper.h" // nogncheck +#include "content/browser/service_worker/service_worker_info.h" // nogncheck #include "content/browser/service_worker/service_worker_version.h" // nogncheck #include "gin/object_template_builder.h" #include "services/service_manager/public/cpp/interface_provider.h" diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 984154b8c7877..5263259beb99d 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -2261,7 +2261,8 @@ void WebContents::WebContentsDestroyed() { v8::Local wrapper; if (!GetWrapper(isolate).ToLocal(&wrapper)) return; - wrapper->SetAlignedPointerInInternalField(0, nullptr); + wrapper->SetAlignedPointerInInternalField(0, nullptr, + v8::kEmbedderDataTypeTagDefault); // Tell WebViewGuestDelegate that the WebContents has been destroyed. if (guest_delegate_) diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index 054d5e89a47c9..b5620f9fc692a 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -216,12 +216,14 @@ #if BUILDFLAG(ENABLE_PDF_VIEWER) #include "chrome/browser/pdf/chrome_pdf_stream_delegate.h" +#include "chrome/browser/pdf/pdf_help_bubble_handler_factory.h" #include "chrome/browser/plugins/pdf_iframe_navigation_throttle.h" // nogncheck #include "components/pdf/browser/pdf_document_helper.h" // nogncheck #include "components/pdf/browser/pdf_navigation_throttle.h" #include "components/pdf/browser/pdf_url_loader_request_interceptor.h" #include "components/pdf/common/constants.h" // nogncheck #include "shell/browser/electron_pdf_document_helper_client.h" +#include "ui/webui/resources/cr_components/help_bubble/help_bubble.mojom.h" // nogncheck #endif using content::BrowserThread; @@ -1676,6 +1678,11 @@ void ElectronBrowserClient::RegisterBrowserInterfaceBindersForFrame( ->RegisterBrowserInterfaceBindersForFrame(map, render_frame_host, extension); #endif + +#if BUILDFLAG(ENABLE_PDF_VIEWER) + map->Add( + &pdf::PdfHelpBubbleHandlerFactory::Create); +#endif } #if BUILDFLAG(IS_LINUX) diff --git a/shell/browser/notifications/win/notification_presenter_win.cc b/shell/browser/notifications/win/notification_presenter_win.cc index 7bf69ec2838d2..2649ce40a917a 100644 --- a/shell/browser/notifications/win/notification_presenter_win.cc +++ b/shell/browser/notifications/win/notification_presenter_win.cc @@ -11,7 +11,7 @@ #include #include "base/files/file_util.h" -#include "base/hash/md5.h" +#include "base/hash/sha1.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" @@ -68,7 +68,7 @@ std::wstring NotificationPresenterWin::SaveIconToFilesystem( std::string filename; if (origin.is_valid()) { - filename = base::MD5String(origin.spec()) + ".png"; + filename = base::SHA1HashString(origin.spec()) + ".png"; } else { const int64_t now_usec = base::Time::Now().since_origin().InMicroseconds(); filename = base::NumberToString(now_usec) + ".png"; diff --git a/shell/browser/ui/views/win_icon_painter.cc b/shell/browser/ui/views/win_icon_painter.cc index 798e02d04b41a..7f102f75eda9d 100644 --- a/shell/browser/ui/views/win_icon_painter.cc +++ b/shell/browser/ui/views/win_icon_painter.cc @@ -7,6 +7,7 @@ #include "base/numerics/safe_conversions.h" #include "cc/paint/paint_flags.h" #include "third_party/skia/include/core/SkPath.h" +#include "third_party/skia/include/core/SkPathBuilder.h" #include "ui/gfx/canvas.h" #include "ui/gfx/geometry/rrect_f.h" @@ -75,11 +76,12 @@ void WinIconPainter::PaintCloseIcon(gfx::Canvas* canvas, paint_flags.setAntiAlias(true); canvas->ClipRect(symbol_rect); - SkPath path; - path.moveTo(symbol_rect.x(), symbol_rect.y()); - path.lineTo(symbol_rect.right(), symbol_rect.bottom()); - path.moveTo(symbol_rect.right(), symbol_rect.y()); - path.lineTo(symbol_rect.x(), symbol_rect.bottom()); + const SkPath path = SkPathBuilder() + .moveTo(symbol_rect.x(), symbol_rect.y()) + .lineTo(symbol_rect.right(), symbol_rect.bottom()) + .moveTo(symbol_rect.right(), symbol_rect.y()) + .lineTo(symbol_rect.x(), symbol_rect.bottom()) + .detach(); canvas->DrawPath(path, flags); } diff --git a/shell/common/gin_helper/destroyable.cc b/shell/common/gin_helper/destroyable.cc index 51758bf3e8d6d..63f9516f02857 100644 --- a/shell/common/gin_helper/destroyable.cc +++ b/shell/common/gin_helper/destroyable.cc @@ -30,8 +30,10 @@ void DestroyFunc(const v8::FunctionCallbackInfo& info) { // TODO(zcbenz): gin_helper::Wrappable will be removed. delete static_cast( - holder->GetAlignedPointerFromInternalField(0)); - holder->SetAlignedPointerInInternalField(0, nullptr); + holder->GetAlignedPointerFromInternalField( + 0, v8::kEmbedderDataTypeTagDefault)); + holder->SetAlignedPointerInInternalField(0, nullptr, + v8::kEmbedderDataTypeTagDefault); } void IsDestroyedFunc(const v8::FunctionCallbackInfo& info) { @@ -46,7 +48,8 @@ bool Destroyable::IsDestroyed(v8::Local object) { // An object is considered destroyed if it has no internal pointer or its // internal has been destroyed. return object->InternalFieldCount() == 0 || - object->GetAlignedPointerFromInternalField(0) == nullptr; + object->GetAlignedPointerFromInternalField( + 0, v8::kEmbedderDataTypeTagDefault) == nullptr; } // static diff --git a/shell/common/gin_helper/trackable_object.h b/shell/common/gin_helper/trackable_object.h index bedd6352ab2f2..41e5406327f3b 100644 --- a/shell/common/gin_helper/trackable_object.h +++ b/shell/common/gin_helper/trackable_object.h @@ -61,7 +61,8 @@ class TrackableObject : public TrackableObjectBase, public EventEmitter { v8::HandleScope scope(gin_helper::Wrappable::isolate()); v8::Local wrapper = gin_helper::Wrappable::GetWrapper(); if (!wrapper.IsEmpty()) { - wrapper->SetAlignedPointerInInternalField(0, nullptr); + wrapper->SetAlignedPointerInInternalField( + 0, nullptr, v8::kEmbedderDataTypeTagDefault); gin_helper::WrappableBase::wrapper_.ClearWeak(); } } @@ -70,7 +71,8 @@ class TrackableObject : public TrackableObjectBase, public EventEmitter { v8::HandleScope scope(gin_helper::Wrappable::isolate()); v8::Local wrapper = gin_helper::Wrappable::GetWrapper(); return wrapper->InternalFieldCount() == 0 || - wrapper->GetAlignedPointerFromInternalField(0) == nullptr; + wrapper->GetAlignedPointerFromInternalField( + 0, v8::kEmbedderDataTypeTagDefault) == nullptr; } // Finds out the TrackableObject from its ID in weak map. diff --git a/shell/common/gin_helper/wrappable.cc b/shell/common/gin_helper/wrappable.cc index 2549fe8af60de..a8a6f4ad0c1c0 100644 --- a/shell/common/gin_helper/wrappable.cc +++ b/shell/common/gin_helper/wrappable.cc @@ -22,7 +22,8 @@ bool IsValidWrappable(const v8::Local& val, const gin::DeprecatedWrapperInfo* info = static_cast( - port->GetAlignedPointerFromInternalField(gin::kWrapperInfoIndex)); + port->GetAlignedPointerFromInternalField( + gin::kWrapperInfoIndex, v8::kEmbedderDataTypeTagDefault)); if (info != wrapper_info) return false; @@ -36,7 +37,8 @@ WrappableBase::~WrappableBase() { return; v8::HandleScope scope(isolate()); - GetWrapper()->SetAlignedPointerInInternalField(0, nullptr); + GetWrapper()->SetAlignedPointerInInternalField( + 0, nullptr, v8::kEmbedderDataTypeTagDefault); wrapper_.ClearWeak(); wrapper_.Reset(); } @@ -58,7 +60,8 @@ void WrappableBase::InitWith(v8::Isolate* isolate, v8::Local wrapper) { CHECK(wrapper_.IsEmpty()); isolate_ = isolate; - wrapper->SetAlignedPointerInInternalField(0, this); + wrapper->SetAlignedPointerInInternalField(0, this, + v8::kEmbedderDataTypeTagDefault); wrapper_.Reset(isolate, wrapper); wrapper_.SetWeak(this, FirstWeakCallback, v8::WeakCallbackType::kInternalFields); @@ -158,9 +161,10 @@ v8::MaybeLocal DeprecatedWrappableBase::GetWrapperImpl( return v8::MaybeLocal(wrapper); } - int indices[] = {gin::kWrapperInfoIndex, gin::kEncodedValueIndex}; - void* values[] = {info, this}; - wrapper->SetAlignedPointerInInternalFields(2, indices, values); + wrapper->SetAlignedPointerInInternalField(gin::kWrapperInfoIndex, info, + v8::kEmbedderDataTypeTagDefault); + wrapper->SetAlignedPointerInInternalField(gin::kEncodedValueIndex, this, + v8::kEmbedderDataTypeTagDefault); wrapper_.Reset(isolate, wrapper); wrapper_.SetWeak(this, FirstWeakCallback, v8::WeakCallbackType::kInternalFields); @@ -180,7 +184,8 @@ void* FromV8Impl(v8::Isolate* isolate, v8::Local val) { v8::Local obj = val.As(); if (obj->InternalFieldCount() != 1) return nullptr; - return obj->GetAlignedPointerFromInternalField(0); + return obj->GetAlignedPointerFromInternalField( + 0, v8::kEmbedderDataTypeTagDefault); } void* FromV8Impl(v8::Isolate* isolate, @@ -205,7 +210,8 @@ void* FromV8Impl(v8::Isolate* isolate, return nullptr; } - return obj->GetAlignedPointerFromInternalField(gin::kEncodedValueIndex); + return obj->GetAlignedPointerFromInternalField( + gin::kEncodedValueIndex, v8::kEmbedderDataTypeTagDefault); } } // namespace internal @@ -219,7 +225,8 @@ DeprecatedWrapperInfo* DeprecatedWrapperInfo::From( if (object->InternalFieldCount() != kNumberOfInternalFields) return NULL; DeprecatedWrapperInfo* info = static_cast( - object->GetAlignedPointerFromInternalField(kWrapperInfoIndex)); + object->GetAlignedPointerFromInternalField( + kWrapperInfoIndex, v8::kEmbedderDataTypeTagDefault)); return info->embedder == kEmbedderNativeGin ? info : NULL; } diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc index 450069cffd7fe..3b887fa6ab303 100644 --- a/shell/common/node_bindings.cc +++ b/shell/common/node_bindings.cc @@ -552,7 +552,7 @@ node::IsolateData* NodeBindings::isolate_data( } auto* isolate_data = static_cast( context->GetAlignedPointerFromEmbedderData( - kElectronContextEmbedderDataIndex)); + kElectronContextEmbedderDataIndex, v8::kEmbedderDataTypeTagDefault)); CHECK(isolate_data); CHECK(isolate_data->event_loop()); return isolate_data; @@ -767,7 +767,8 @@ std::shared_ptr NodeBindings::CreateEnvironment( auto* isolate_data = node::CreateIsolateData(isolate, uv_loop_, platform); isolate_data->max_young_gen_size = max_young_generation_size; context->SetAlignedPointerInEmbedderData(kElectronContextEmbedderDataIndex, - static_cast(isolate_data)); + static_cast(isolate_data), + v8::kEmbedderDataTypeTagDefault); uint64_t env_flags = node::EnvironmentFlags::kDefaultFlags | node::EnvironmentFlags::kHideConsoleWindows | @@ -892,7 +893,8 @@ std::shared_ptr NodeBindings::CreateEnvironment( // Since we're about to free `isolate_data`, clear that entry v8::HandleScope handle_scope{isolate}; context.Get(isolate)->SetAlignedPointerInEmbedderData( - kElectronContextEmbedderDataIndex, nullptr); + kElectronContextEmbedderDataIndex, nullptr, + v8::kEmbedderDataTypeTagDefault); context.Reset(); node::FreeEnvironment(nenv); diff --git a/shell/renderer/electron_smooth_round_rect.cc b/shell/renderer/electron_smooth_round_rect.cc index 08d8f93cb34ab..015f815756d09 100644 --- a/shell/renderer/electron_smooth_round_rect.cc +++ b/shell/renderer/electron_smooth_round_rect.cc @@ -7,6 +7,7 @@ #include #include "base/check.h" #include "base/check_op.h" +#include "third_party/skia/include/core/SkPathBuilder.h" namespace electron { @@ -99,7 +100,7 @@ constexpr CurveGeometry::CurveGeometry(float radius, float smoothness) { ((edge_connecting_offset - arc_curve_offset) * EDGE_CURVE_POINT_RATIO); } -void DrawCorner(SkPath& path, +void DrawCorner(SkPathBuilder& path, float radius, float smoothness1, float smoothness2, @@ -148,8 +149,9 @@ void DrawCorner(SkPath& path, { SkPoint arc_connecting_point = corner + QuarterRotate(curve2.arc_connecting_vector, quarter_rotations); - path.arcTo(SkPoint::Make(radius, radius), 0.0f, SkPath::kSmall_ArcSize, - SkPathDirection::kCW, arc_connecting_point); + path.arcTo(SkPoint::Make(radius, radius), 0.0f, + SkPathBuilder::kSmall_ArcSize, SkPathDirection::kCW, + arc_connecting_point); } // Draw the second smoothing curve @@ -287,7 +289,7 @@ SkPath DrawSmoothRoundRect(float x, auto [left_top_smoothness, left_bottom_smoothness] = ConstrainSmoothness( height, smoothness, top_left_radius, bottom_left_radius); - SkPath path; + SkPathBuilder path; // Top left corner DrawCorner(path, top_left_radius, left_top_smoothness, top_left_smoothness, @@ -306,7 +308,7 @@ SkPath DrawSmoothRoundRect(float x, left_bottom_smoothness, SkPoint::Make(x, y + height), 3); path.close(); - return path; + return path.detach(); } } // namespace electron diff --git a/shell/renderer/preload_realm_context.cc b/shell/renderer/preload_realm_context.cc index ad6c96a305938..da11d25018cbd 100644 --- a/shell/renderer/preload_realm_context.cc +++ b/shell/renderer/preload_realm_context.cc @@ -59,9 +59,11 @@ class PreloadRealmLifetimeController RegisterDebugger(initiator_execution_context); initiator_context()->SetAlignedPointerInEmbedderData( - kElectronContextEmbedderDataIndex, static_cast(this)); + kElectronContextEmbedderDataIndex, static_cast(this), + v8::kEmbedderDataTypeTagDefault); realm_context()->SetAlignedPointerInEmbedderData( - kElectronContextEmbedderDataIndex, static_cast(this)); + kElectronContextEmbedderDataIndex, static_cast(this), + v8::kEmbedderDataTypeTagDefault); metrics_ = base::ProcessMetrics::CreateCurrentProcessMetrics(); RunInitScript(); @@ -74,7 +76,8 @@ class PreloadRealmLifetimeController } auto* controller = static_cast( context->GetAlignedPointerFromEmbedderData( - kElectronContextEmbedderDataIndex)); + kElectronContextEmbedderDataIndex, + v8::kEmbedderDataTypeTagDefault)); CHECK(controller); return controller; } @@ -112,7 +115,8 @@ class PreloadRealmLifetimeController void ContextDestroyed() override { v8::HandleScope handle_scope(realm_isolate()); realm_context()->SetAlignedPointerInEmbedderData( - kElectronContextEmbedderDataIndex, nullptr); + kElectronContextEmbedderDataIndex, nullptr, + v8::kEmbedderDataTypeTagDefault); // See ShadowRealmGlobalScope::ContextDestroyed shadow_realm_script_state_->DisposePerContextData(); From 4099d8d75d2ae392f44897ba6e40b03ba9332633 Mon Sep 17 00:00:00 2001 From: Ryota Murakami Date: Sat, 8 Nov 2025 00:32:33 +0900 Subject: [PATCH 218/268] docs: Update 404 devtools extension documentation link (#48813) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: Update 404 devtools extension documentation link https://developer.chrome.com/extensions/devtools ↑Current link is not exists. So update to most relevant developer.chrome.com page. https://developer.chrome.com/docs/extensions/how-to/devtools/extend-devtools#creating * docs: remove unnecessary anchor link Co-authored-by: Erick Zhao --------- Co-authored-by: Erick Zhao --- docs/tutorial/devtools-extension.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/devtools-extension.md b/docs/tutorial/devtools-extension.md index 679e3e749a77c..27902dfe7dafb 100644 --- a/docs/tutorial/devtools-extension.md +++ b/docs/tutorial/devtools-extension.md @@ -94,7 +94,7 @@ If the extension works on Chrome but not on Electron, file a bug in Electron's [issue tracker][issue-tracker] and describe which part of the extension is not working as expected. -[devtools-extension]: https://developer.chrome.com/extensions/devtools +[devtools-extension]: https://developer.chrome.com/docs/extensions/how-to/devtools/extend-devtools [session]: ../api/session.md [react-devtools]: https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi [load-extension]: ../api/extensions-api.md#extensionsloadextensionpath-options From 6ba0e0cd41f3fed8b0a352ba66497146f41e1c09 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Fri, 7 Nov 2025 17:12:51 -0500 Subject: [PATCH 219/268] chore: update patches (#48847) --- patches/v8/.patches | 1 - ...avoid_introducing_too_many_variables.patch | 475 ------------------ 2 files changed, 476 deletions(-) delete mode 100644 patches/v8/turboshaft_avoid_introducing_too_many_variables.patch diff --git a/patches/v8/.patches b/patches/v8/.patches index 671c7bed3ddaf..dc98544242e85 100644 --- a/patches/v8/.patches +++ b/patches/v8/.patches @@ -1,2 +1 @@ chore_allow_customizing_microtask_policy_per_context.patch -turboshaft_avoid_introducing_too_many_variables.patch diff --git a/patches/v8/turboshaft_avoid_introducing_too_many_variables.patch b/patches/v8/turboshaft_avoid_introducing_too_many_variables.patch deleted file mode 100644 index 78cd272ca5ab0..0000000000000 --- a/patches/v8/turboshaft_avoid_introducing_too_many_variables.patch +++ /dev/null @@ -1,475 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Darius Mercadier -Date: Wed, 5 Nov 2025 14:06:54 +0100 -Subject: [turboshaft] Avoid introducing too many Variables - -.... if we have very large merges. - -Cf https://crbug.com/418027512#comment5 for explanations of why this -is necessary (and the following comment for why I don't see a good -alternative to this CL). - -I've locally confirmed that this fixes the OOM from -https://crbug.com/457625181, and it reduces memory consumption on -binaries/crbug-40219016-zelda/zelda.wasm (from -https://crbug.com/418027512) by 20+%. - -Bug: 418027512, 457625181 -Change-Id: If55af659667723ce85ff71bcac66a43aff863e05 -Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7119378 -Commit-Queue: Darius Mercadier -Auto-Submit: Darius Mercadier -Reviewed-by: Matthias Liedtke -Cr-Commit-Position: refs/heads/main@{#103534} - -diff --git a/src/compiler/turboshaft/branch-elimination-reducer.h b/src/compiler/turboshaft/branch-elimination-reducer.h -index c1862c2f1eeb2f4c8d8f1198d41e1f6113adb258..bf15cd9efc16fddaf99f959344c54257d6dfe21c 100644 ---- a/src/compiler/turboshaft/branch-elimination-reducer.h -+++ b/src/compiler/turboshaft/branch-elimination-reducer.h -@@ -371,6 +371,10 @@ class BranchEliminationReducer : public Next { - goto no_change; - } - -+ if (!__ CanCreateNVariables(destination_origin->OpCountUpperBound())) { -+ goto no_change; -+ } -+ - if (const BranchOp* branch = last_op.template TryCast()) { - V condition = - __ template MapToNewGraph(branch->condition()); -diff --git a/src/compiler/turboshaft/copying-phase.h b/src/compiler/turboshaft/copying-phase.h -index ae9a67b8406214246cc13780d3b79ddbe7789cb8..14f31ad867f292d7a00ed8b596cd747ac7764c7e 100644 ---- a/src/compiler/turboshaft/copying-phase.h -+++ b/src/compiler/turboshaft/copying-phase.h -@@ -714,9 +714,23 @@ class GraphVisitor : public OutputGraphAssembler, - if (Asm().CanAutoInlineBlocksWithSinglePredecessor() && - terminator.Is()) { - Block* destination = terminator.Cast().destination; -- if (destination->PredecessorCount() == 1) { -- block_to_inline_now_ = destination; -- return; -+ // Inlining the destination will require setting it in needs_variables_ -+ // mode; we thus check that we can actually create enough variables to do -+ // this. -+ // TODO(dmercadier): in practice, the only reason we need variables for -+ // the destination is because we could be currently in a phase that cloned -+ // the current block, which could lead to {destination} being cloned as -+ // well. No all phases can do this, so we could check that we're not in -+ // such a phase, and if so, not use variables for the destination. One way -+ // to do this would be to have a DisallowCloningReducer which would -+ // static_assert that LoopUnrolling/LoopPeeling/BranchElimination aren't -+ // on the stack and would also prevent using CloneSubGraph, -+ // CloneAndInlineBlock and CloneBlockAndGoto. -+ if (Asm().CanCreateNVariables(destination->OpCountUpperBound())) { -+ if (destination->PredecessorCount() == 1) { -+ block_to_inline_now_ = destination; -+ return; -+ } - } - } - // Just going through the regular VisitOp function. -diff --git a/src/compiler/turboshaft/graph.h b/src/compiler/turboshaft/graph.h -index 936c8b0269a9b87a4ffa20c40bbd908fb8c69010..a3c1c40e4e7097f518e107d85786c7cc5466e595 100644 ---- a/src/compiler/turboshaft/graph.h -+++ b/src/compiler/turboshaft/graph.h -@@ -608,6 +608,7 @@ class Graph { - operation_origins_.Reset(); - operation_types_.Reset(); - dominator_tree_depth_ = 0; -+ max_merge_pred_count_ = 0; - #ifdef DEBUG - block_type_refinement_.Reset(); - // Do not reset of graph_created_from_turbofan_ as it is propagated along -@@ -791,6 +792,8 @@ class Graph { - bound_blocks_.push_back(block); - uint32_t depth = block->ComputeDominator(); - dominator_tree_depth_ = std::max(dominator_tree_depth_, depth); -+ max_merge_pred_count_ = -+ std::max(max_merge_pred_count_, block->PredecessorCount()); - - #ifdef DEBUG - if (v8_flags.turboshaft_trace_emitted) { -@@ -1016,6 +1019,8 @@ class Graph { - - uint32_t DominatorTreeDepth() const { return dominator_tree_depth_; } - -+ uint32_t max_merge_pred_count() const { return max_merge_pred_count_; } -+ - const GrowingOpIndexSidetable& operation_types() const { - return operation_types_; - } -@@ -1068,6 +1073,7 @@ class Graph { - std::swap(next_block_, companion.next_block_); - std::swap(block_permutation_, companion.block_permutation_); - std::swap(graph_zone_, companion.graph_zone_); -+ std::swap(max_merge_pred_count_, companion.max_merge_pred_count_); - op_to_block_.SwapData(companion.op_to_block_); - source_positions_.SwapData(companion.source_positions_); - operation_origins_.SwapData(companion.operation_origins_); -@@ -1206,6 +1212,9 @@ class Graph { - GrowingOpIndexSidetable source_positions_; - GrowingOpIndexSidetable operation_origins_; - uint32_t dominator_tree_depth_ = 0; -+ // {max_merge_pred_count_} stores the maximum number of predecessors that any -+ // Merge in the graph has. -+ uint32_t max_merge_pred_count_ = 0; - GrowingOpIndexSidetable operation_types_; - #ifdef DEBUG - GrowingBlockSidetable block_type_refinement_; -diff --git a/src/compiler/turboshaft/loop-peeling-reducer.h b/src/compiler/turboshaft/loop-peeling-reducer.h -index a9b5eaaf4c88354164b3a5833d4bd6b2760b12a0..b7df7acb61d048669a2cacfbc4e2156df69788dc 100644 ---- a/src/compiler/turboshaft/loop-peeling-reducer.h -+++ b/src/compiler/turboshaft/loop-peeling-reducer.h -@@ -57,8 +57,7 @@ class LoopPeelingReducer : public Next { - const Block* dst = gto.destination; - if (dst->IsLoop() && !gto.is_backedge && CanPeelLoop(dst)) { - if (ShouldSkipOptimizationStep()) goto no_change; -- PeelFirstIteration(dst); -- return {}; -+ if (PeelFirstIteration(dst)) return {}; - } else if (IsEmittingPeeledIteration() && dst == current_loop_header_) { - // We skip the backedge of the loop: PeelFirstIeration will instead emit a - // forward edge to the non-peeled header. -@@ -111,13 +110,21 @@ class LoopPeelingReducer : public Next { - kEmittingUnpeeledBody - }; - -- void PeelFirstIteration(const Block* header) { -+ bool PeelFirstIteration(const Block* header) { - TRACE("LoopPeeling: peeling loop at " << header->index()); - DCHECK_EQ(peeling_, PeelingStatus::kNotPeeling); - ScopedModification scope(&peeling_, - PeelingStatus::kEmittingPeeledLoop); - current_loop_header_ = header; - -+ constexpr int kNumberOfLoopCopies = 2; // peeled + unpeeled -+ size_t op_count_upper_bound = -+ loop_finder_.GetLoopInfo(header).op_count * kNumberOfLoopCopies; -+ if (!__ CanCreateNVariables(op_count_upper_bound)) { -+ TRACE("> Too many variables, skipping peeling"); -+ return false; -+ } -+ - // Emitting the peeled iteration. - auto loop_body = loop_finder_.GetLoopBody(header); - // Note that this call to CloneSubGraph will not emit the backedge because -@@ -133,7 +140,7 @@ class LoopPeelingReducer : public Next { - // While peeling, we realized that the 2nd iteration of the loop is not - // reachable. - TRACE("> Second iteration is not reachable, stopping now"); -- return; -+ return true; - } - - // We now emit the regular unpeeled loop. -@@ -141,6 +148,7 @@ class LoopPeelingReducer : public Next { - TRACE("> Emitting unpeeled loop body"); - __ CloneSubGraph(loop_body, /* keep_loop_kinds */ true, - /* is_loop_after_peeling */ true); -+ return true; - } - - bool CanPeelLoop(const Block* header) { -diff --git a/src/compiler/turboshaft/loop-unrolling-reducer.h b/src/compiler/turboshaft/loop-unrolling-reducer.h -index 181d298bfa27d21f013016b34a586078d12f8a58..92d6f7b36d4c5c0a64723f7d18427a62347bad9f 100644 ---- a/src/compiler/turboshaft/loop-unrolling-reducer.h -+++ b/src/compiler/turboshaft/loop-unrolling-reducer.h -@@ -211,6 +211,11 @@ class V8_EXPORT_PRIVATE LoopUnrollingAnalyzer { - info.op_count < kMaxLoopSizeForPartialUnrolling; - } - -+ size_t GetLoopOpCount(const Block* loop_header) { -+ DCHECK(loop_header->IsLoop()); -+ return loop_finder_.GetLoopInfo(loop_header).op_count; -+ } -+ - // The returned unroll count is the total number of copies of the loop body - // in the resulting graph, i.e., an unroll count of N means N-1 copies of the - // body which were partially unrolled, and 1 for the original/remaining body. -@@ -383,14 +388,12 @@ class LoopUnrollingReducer : public Next { - // header (note that loop headers only have 2 predecessor, including the - // backedge), and that isn't the backedge. - if (ShouldSkipOptimizationStep()) goto no_change; -- if (analyzer_.ShouldRemoveLoop(dst)) { -- RemoveLoop(dst); -+ if (analyzer_.ShouldRemoveLoop(dst) && RemoveLoop(dst)) { - return {}; -- } else if (analyzer_.ShouldFullyUnrollLoop(dst)) { -- FullyUnrollLoop(dst); -+ } else if (analyzer_.ShouldFullyUnrollLoop(dst) && FullyUnrollLoop(dst)) { - return {}; -- } else if (analyzer_.ShouldPartiallyUnrollLoop(dst)) { -- PartiallyUnrollLoop(dst); -+ } else if (analyzer_.ShouldPartiallyUnrollLoop(dst) && -+ PartiallyUnrollLoop(dst)) { - return {}; - } - } else if ((unrolling_ == UnrollingStatus::kUnrolling) && -@@ -467,9 +470,9 @@ class LoopUnrollingReducer : public Next { - // and would like to not emit the loop body that follows. - kRemoveLoop, - }; -- void RemoveLoop(const Block* header); -- void FullyUnrollLoop(const Block* header); -- void PartiallyUnrollLoop(const Block* header); -+ bool RemoveLoop(const Block* header); -+ bool FullyUnrollLoop(const Block* header); -+ bool PartiallyUnrollLoop(const Block* header); - void FixLoopPhis(const Block* input_graph_loop, Block* output_graph_loop, - const Block* backedge_block); - bool IsRunningBuiltinPipeline() { -@@ -508,10 +511,16 @@ class LoopUnrollingReducer : public Next { - }; - - template --void LoopUnrollingReducer::PartiallyUnrollLoop(const Block* header) { -+bool LoopUnrollingReducer::PartiallyUnrollLoop(const Block* header) { - TRACE("LoopUnrolling: partially unrolling loop at " << header->index().id()); - DCHECK_EQ(unrolling_, UnrollingStatus::kNotUnrolling); - DCHECK(!skip_next_stack_check_); -+ -+ if (!__ CanCreateNVariables(analyzer_.GetLoopOpCount(header))) { -+ TRACE("> Too many variables, skipping unrolling"); -+ return false; -+ } -+ - unrolling_ = UnrollingStatus::kUnrolling; - - auto loop_body = analyzer_.GetLoopBody(header); -@@ -533,7 +542,7 @@ void LoopUnrollingReducer::PartiallyUnrollLoop(const Block* header) { - __ CloneSubGraph(loop_body, /* keep_loop_kinds */ true); - if (StopUnrollingIfUnreachable(output_graph_header)) { - TRACE("> Next iteration is unreachable, stopping unrolling"); -- return; -+ return true; - } - - // Emitting the subsequent folded iterations. We set `unrolling_` to -@@ -549,7 +558,7 @@ void LoopUnrollingReducer::PartiallyUnrollLoop(const Block* header) { - __ CloneSubGraph(loop_body, /* keep_loop_kinds */ false); - if (StopUnrollingIfUnreachable(output_graph_header)) { - TRACE("> Next iteration is unreachable, stopping unrolling"); -- return; -+ return true; - } - } - -@@ -567,6 +576,7 @@ void LoopUnrollingReducer::PartiallyUnrollLoop(const Block* header) { - - unrolling_ = UnrollingStatus::kNotUnrolling; - TRACE("> Finished partially unrolling loop " << header->index().id()); -+ return true; - } - - template -@@ -622,10 +632,20 @@ void LoopUnrollingReducer::FixLoopPhis(const Block* input_graph_loop, - } - - template --void LoopUnrollingReducer::RemoveLoop(const Block* header) { -+bool LoopUnrollingReducer::RemoveLoop(const Block* header) { - TRACE("LoopUnrolling: removing loop at " << header->index().id()); - DCHECK_EQ(unrolling_, UnrollingStatus::kNotUnrolling); - DCHECK(!skip_next_stack_check_); -+ -+ if (!__ CanCreateNVariables(analyzer_.GetLoopOpCount(header))) { -+ TRACE("> Too many variables, skipping removal"); -+ // TODO(dmercadier): in theory, RemoveLoop shouldn't need Variables, since -+ // it cannot be called while unrolling an outer loop, since we only unroll -+ // innermost loops. We should teach CloneAndInlineBlock that it doesn't -+ // always need to introduce Variables, and then remove this bailout. -+ return false; -+ } -+ - // When removing a loop, we still need to emit the header (since it has to - // always be executed before the 1st iteration anyways), but by setting - // {unrolling_} to `kRemoveLoop`, the final Branch of the loop will become a -@@ -633,15 +653,21 @@ void LoopUnrollingReducer::RemoveLoop(const Block* header) { - unrolling_ = UnrollingStatus::kRemoveLoop; - __ CloneAndInlineBlock(header); - unrolling_ = UnrollingStatus::kNotUnrolling; -+ return true; - } - - template --void LoopUnrollingReducer::FullyUnrollLoop(const Block* header) { -+bool LoopUnrollingReducer::FullyUnrollLoop(const Block* header) { - TRACE("LoopUnrolling: fully unrolling loop at " << header->index().id()); - DCHECK_EQ(unrolling_, UnrollingStatus::kNotUnrolling); - DCHECK(!skip_next_stack_check_); - ScopedModification skip_stack_checks(&skip_next_stack_check_, true); - -+ if (!__ CanCreateNVariables(analyzer_.GetLoopOpCount(header))) { -+ TRACE("> Too many variables, skipping unrolling"); -+ return false; -+ } -+ - size_t iter_count = analyzer_.GetIterationCount(header).exact_count(); - TRACE("> iter_count: " << iter_count); - -@@ -654,7 +680,7 @@ void LoopUnrollingReducer::FullyUnrollLoop(const Block* header) { - __ CloneSubGraph(loop_body, /* keep_loop_kinds */ false); - if (StopUnrollingIfUnreachable()) { - TRACE("> Next iteration is unreachable, stopping unrolling"); -- return; -+ return true; - } - } - -@@ -667,6 +693,7 @@ void LoopUnrollingReducer::FullyUnrollLoop(const Block* header) { - - unrolling_ = UnrollingStatus::kNotUnrolling; - TRACE("> Finished fully unrolling loop " << header->index().id()); -+ return true; - } - - #undef TRACE -diff --git a/src/compiler/turboshaft/turbolev-graph-builder.cc b/src/compiler/turboshaft/turbolev-graph-builder.cc -index a716474214131adfcfd95af7e492ec1d83c99893..9fe6313137c97847750b2c3362eb114f5671d0dc 100644 ---- a/src/compiler/turboshaft/turbolev-graph-builder.cc -+++ b/src/compiler/turboshaft/turbolev-graph-builder.cc -@@ -115,12 +115,7 @@ class BlockOriginTrackingReducer : public Next { - } - void Bind(Block* block) { - Next::Bind(block); -- // The 1st block we bind doesn't exist in Maglev and is meant to hold -- // Constants (which in Maglev are not in any block), and thus -- // {maglev_input_block_} should still be nullptr. In all other cases, -- // {maglev_input_block_} should not be nullptr. -- DCHECK_EQ(maglev_input_block_ == nullptr, -- block == &__ output_graph().StartBlock()); -+ DCHECK_NOT_NULL(maglev_input_block_); - turboshaft_block_origins_[block->index()] = maglev_input_block_; - } - -@@ -516,9 +511,11 @@ class GraphBuildingNodeProcessor { - block_mapping_[block] = - block->is_loop() ? __ NewLoopHeader() : __ NewBlock(); - } -- // Constants are not in a block in Maglev but are in Turboshaft. We bind a -- // block now, so that Constants can then be emitted. -- __ Bind(__ NewBlock()); -+ // Constants are not in a block in Maglev but are in Turboshaft. We bind the -+ // 1st block now, so that Constants can then be emitted. -+ const maglev::BasicBlock* first_maglev_block = graph->blocks().front(); -+ __ SetMaglevInputBlock(first_maglev_block); -+ __ Bind(block_mapping_[first_maglev_block]); - - // Initializing undefined constant so that we don't need to recreate it too - // often. -@@ -604,9 +601,20 @@ class GraphBuildingNodeProcessor { - Block* turboshaft_block = Map(maglev_block); - - if (__ current_block() != nullptr) { -- // The first block for Constants doesn't end with a Jump, so we add one -- // now. -- __ Goto(turboshaft_block); -+ // We must be in the first block of the graph, inserted by Turboshaft in -+ // PreProcessGraph so that constants can be bound in a block. No need to -+ // do anything else: we don't emit a Goto so that the actual 1st block of -+ // the Maglev graph gets inlined into this first block of the Turboshaft -+ // graph, which, in addition to saving a Goto, saves the need to clone the -+ // destination into the current block later, and also ensures that -+ // Parameters are always in the 1st block. -+ DCHECK_EQ(__ output_graph().block_count(), 1); -+ DCHECK_EQ(maglev_block->id(), 0); -+ DCHECK_EQ(__ current_block(), block_mapping_[maglev_block]); -+ // maglev_input_block should have been set by calling SetMaglevInputBlock -+ // in PreProcessGraph. -+ DCHECK_EQ(__ maglev_input_block(), maglev_block); -+ return maglev::BlockProcessResult::kContinue; - } - - #ifdef DEBUG -diff --git a/src/compiler/turboshaft/variable-reducer.h b/src/compiler/turboshaft/variable-reducer.h -index ccc19512d40bbc06071d499b012b5a6fa059d706..f4c75010845bc86c5b79d3a2429dac77835e32f8 100644 ---- a/src/compiler/turboshaft/variable-reducer.h -+++ b/src/compiler/turboshaft/variable-reducer.h -@@ -9,6 +9,7 @@ - #include - - #include "src/base/logging.h" -+#include "src/base/macros.h" - #include "src/codegen/machine-type.h" - #include "src/compiler/turboshaft/assembler.h" - #include "src/compiler/turboshaft/graph.h" -@@ -91,6 +92,15 @@ class VariableReducer : public RequiredOptimizationReducer { - public: - TURBOSHAFT_REDUCER_BOILERPLATE(VariableReducer) - -+ ~VariableReducer() { -+ if (too_many_variables_bailouts_count_ != 0 && -+ V8_UNLIKELY(v8_flags.trace_turbo_bailouts)) { -+ std::cout << "Bailing out from block cloning " -+ << too_many_variables_bailouts_count_ << " time" -+ << (too_many_variables_bailouts_count_ > 1 ? "s" : "") << "\n"; -+ } -+ } -+ - void Bind(Block* new_block) { - Next::Bind(new_block); - -@@ -191,6 +201,26 @@ class VariableReducer : public RequiredOptimizationReducer { - return table_.GetPredecessorValue(var, predecessor_index); - } - -+ bool CanCreateNVariables(size_t n) { -+ // Merges with many predecessors combined with many variables can quickly -+ // blow up memory since the SnapshotTable needs to create a state whose -+ // size can be up to number_of_predecessor*variable_count (note: in -+ // practice, it's often not quite variable_count but less since only -+ // variables that are live in at least one predecessor are counted). To -+ // avoid OOM or otherwise huge memory consumption, we thus stop creating -+ // variables (and bail out on optimizations that need variables) when this -+ // number becomes too large. I somewhat arbitrarily selected 100K here, -+ // which sounds high, but in terms of memory, it's just 100K*8=800KB, which -+ // is less than 1MB, which isn't going to amount for much in a function -+ // that is probably very large if it managed to reach this limit. -+ constexpr uint32_t kMaxAllowedMergeStateSize = 100'000; -+ bool can_create = -+ __ input_graph().max_merge_pred_count() * (variable_count_ + n) < -+ kMaxAllowedMergeStateSize; -+ if (!can_create) too_many_variables_bailouts_count_++; -+ return can_create; -+ } -+ - void SetVariable(Variable var, OpIndex new_index) { - DCHECK(!is_temporary_); - if (V8_UNLIKELY(__ generating_unreachable_operations())) return; -@@ -207,10 +237,12 @@ class VariableReducer : public RequiredOptimizationReducer { - - Variable NewLoopInvariantVariable(MaybeRegisterRepresentation rep) { - DCHECK(!is_temporary_); -+ variable_count_++; - return table_.NewKey(VariableData{rep, true}, OpIndex::Invalid()); - } - Variable NewVariable(MaybeRegisterRepresentation rep) { - DCHECK(!is_temporary_); -+ variable_count_++; - return table_.NewKey(VariableData{rep, false}, OpIndex::Invalid()); - } - -@@ -316,6 +348,10 @@ class VariableReducer : public RequiredOptimizationReducer { - __ input_graph().block_count(), std::nullopt, __ phase_zone()}; - bool is_temporary_ = false; - -+ // Tracks the number of variables that have been created. -+ uint32_t variable_count_ = 0; -+ uint32_t too_many_variables_bailouts_count_ = 0; -+ - // {predecessors_} is used during merging, but we use an instance variable for - // it, in order to save memory and not reallocate it for each merge. - ZoneVector predecessors_{__ phase_zone()}; -diff --git a/test/unittests/compiler/turboshaft/control-flow-unittest.cc b/test/unittests/compiler/turboshaft/control-flow-unittest.cc -index 204ef0f0676511a31e79e5ecff32d53018fa1ea8..1d23775d8c0cd8f2591db997501acc799d7d4dd6 100644 ---- a/test/unittests/compiler/turboshaft/control-flow-unittest.cc -+++ b/test/unittests/compiler/turboshaft/control-flow-unittest.cc -@@ -55,7 +55,7 @@ TEST_F(ControlFlowTest, DefaultBlockInlining) { - // BranchElimination should remove such branches by cloning the block with the - // branch. In the end, the graph should contain (almost) no branches anymore. - TEST_F(ControlFlowTest, BranchElimination) { -- static constexpr int kSize = 10000; -+ static constexpr int kSize = 200; - - auto test = CreateFromGraph(1, [](auto& Asm) { - V cond = From e567d1277949c5f8b57e6dfc4d92c07ec028788c Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Sat, 8 Nov 2025 17:26:06 +0100 Subject: [PATCH 220/268] refactor: remove `spellcheck::kWinDelaySpellcheckServiceInit` patch (#48843) refactor: remove spellcheck::kWinDelaySpellcheckServiceInit patch --- patches/chromium/.patches | 1 - ...eature_windelayspellcheckserviceinit.patch | 765 ------------------ shell/browser/api/electron_api_session.cc | 1 + shell/browser/feature_list.cc | 4 - 4 files changed, 1 insertion(+), 770 deletions(-) delete mode 100644 patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 0c203ab91cbcb..5881ab1840bd4 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -141,5 +141,4 @@ allow_electron_to_depend_on_components_os_crypt_sync.patch expose_referrerscriptinfo_hostdefinedoptionsindex.patch chore_disable_protocol_handler_dcheck.patch fix_check_for_file_existence_before_setting_mtime.patch -revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch fix_linux_tray_id.patch diff --git a/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch b/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch deleted file mode 100644 index b71eca6167607..0000000000000 --- a/patches/chromium/revert_cleanup_remove_feature_windelayspellcheckserviceinit.patch +++ /dev/null @@ -1,765 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Charles Kerr -Date: Tue, 21 Oct 2025 21:45:33 -0500 -Subject: Revert "[cleanup] Remove feature WinDelaySpellcheckServiceInit" - -This reverts commit 5fe1e59226f59c4d6fb70e7410d1a0ab83688ae2. - -Our codebase currently needs the ability to delay this service. -It was added in c2d7164 (#38248) to fix a crash originally -described in 97b353a (#34993): - -> Delaying spell check initialization is causing specs for -> 'custom dictionary word list API' to fail in Electron. - -This patch can be removed when we fix that crash. - -diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc -index 2034b961d99225ebe9b606af915f5d90fdae913e..a7ee864ae4d14d36bdf5f7f4fb0ba86255dc9c6f 100644 ---- a/chrome/browser/chrome_browser_main.cc -+++ b/chrome/browser/chrome_browser_main.cc -@@ -1475,6 +1475,17 @@ void ChromeBrowserMainParts::PostProfileInit(Profile* profile, - profile->GetPath())); - } - -+#if BUILDFLAG(USE_BROWSER_SPELLCHECKER) -+ // Create the spellcheck service. This will asynchronously retrieve the -+ // Windows platform spellcheck dictionary language tags used to populate the -+ // context menu for editable content. -+ if (spellcheck::UseBrowserSpellChecker() && -+ profile->GetPrefs()->GetBoolean(spellcheck::prefs::kSpellCheckEnable) && -+ !base::FeatureList::IsEnabled( -+ spellcheck::kWinDelaySpellcheckServiceInit)) { -+ SpellcheckServiceFactory::GetForContext(profile); -+ } -+#endif - #endif // BUILDFLAG(IS_WIN) - - #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || \ -diff --git a/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc b/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc -index 3e617c9bf924e089e27784f960f08a21b98fee0a..8fd91821d588b5d70d1b320b64cc640c77be8d7d 100644 ---- a/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc -+++ b/chrome/browser/extensions/api/language_settings_private/language_settings_private_api.cc -@@ -275,15 +275,21 @@ LanguageSettingsPrivateGetLanguageListFunction::Run() { - - #if BUILDFLAG(IS_WIN) - if (spellcheck::UseBrowserSpellChecker()) { -- // Asynchronously load the dictionaries to determine platform support. -- SpellcheckService* service = -- SpellcheckServiceFactory::GetForContext(browser_context()); -- AddRef(); // Balanced in OnDictionariesInitialized -- service->InitializeDictionaries( -- base::BindOnce(&LanguageSettingsPrivateGetLanguageListFunction:: -- OnDictionariesInitialized, -- base::Unretained(this))); -- return RespondLater(); -+ if (!base::FeatureList::IsEnabled( -+ spellcheck::kWinDelaySpellcheckServiceInit)) { -+ // Platform dictionary support already determined at browser startup. -+ UpdateSupportedPlatformDictionaries(); -+ } else { -+ // Asynchronously load the dictionaries to determine platform support. -+ SpellcheckService* service = -+ SpellcheckServiceFactory::GetForContext(browser_context()); -+ AddRef(); // Balanced in OnDictionariesInitialized -+ service->InitializeDictionaries( -+ base::BindOnce(&LanguageSettingsPrivateGetLanguageListFunction:: -+ OnDictionariesInitialized, -+ base::Unretained(this))); -+ return RespondLater(); -+ } - } - #endif // BUILDFLAG(IS_WIN) - -diff --git a/chrome/browser/extensions/api/language_settings_private/language_settings_private_api_unittest.cc b/chrome/browser/extensions/api/language_settings_private/language_settings_private_api_unittest.cc -index 272d50c9b060a8984a15d2dfbf2297e931482b57..e74b37ed7e596ea57728694eab9a398e94bde08c 100644 ---- a/chrome/browser/extensions/api/language_settings_private/language_settings_private_api_unittest.cc -+++ b/chrome/browser/extensions/api/language_settings_private/language_settings_private_api_unittest.cc -@@ -116,6 +116,8 @@ class LanguageSettingsPrivateApiTest : public ExtensionServiceTestBase { - protected: - void RunGetLanguageListTest(); - -+ virtual void InitFeatures() {} -+ - #if BUILDFLAG(IS_WIN) - virtual void AddSpellcheckLanguagesForTesting( - const std::vector& spellcheck_languages_for_testing) { -@@ -134,6 +136,8 @@ class LanguageSettingsPrivateApiTest : public ExtensionServiceTestBase { - EventRouterFactory::GetInstance()->SetTestingFactory( - profile(), base::BindRepeating(&BuildEventRouter)); - -+ InitFeatures(); -+ - LanguageSettingsPrivateDelegateFactory::GetInstance()->SetTestingFactory( - profile(), base::BindRepeating(&BuildLanguageSettingsPrivateDelegate)); - -@@ -291,6 +295,28 @@ TEST_F(LanguageSettingsPrivateApiTest, GetNeverTranslateLanguagesListTest) { - } - } - -+class LanguageSettingsPrivateApiGetLanguageListTest -+ : public LanguageSettingsPrivateApiTest { -+ public: -+ LanguageSettingsPrivateApiGetLanguageListTest() = default; -+ ~LanguageSettingsPrivateApiGetLanguageListTest() override = default; -+ -+ protected: -+ void InitFeatures() override { -+#if BUILDFLAG(IS_WIN) -+ // Disable the delayed init feature since that case is tested in -+ // LanguageSettingsPrivateApiTestDelayInit below. -+ feature_list_.InitAndDisableFeature( -+ spellcheck::kWinDelaySpellcheckServiceInit); -+#endif // BUILDFLAG(IS_WIN) -+ } -+}; -+ -+TEST_F(LanguageSettingsPrivateApiGetLanguageListTest, GetLanguageList) { -+ translate::TranslateDownloadManager::GetInstance()->ResetForTesting(); -+ RunGetLanguageListTest(); -+} -+ - void LanguageSettingsPrivateApiTest::RunGetLanguageListTest() { - struct LanguageToTest { - std::string accept_language; -@@ -700,6 +726,13 @@ class LanguageSettingsPrivateApiTestDelayInit - LanguageSettingsPrivateApiTestDelayInit() = default; - - protected: -+ void InitFeatures() override { -+ // Force Windows hybrid spellcheck and delayed initialization of the -+ // spellcheck service to be enabled. -+ feature_list_.InitAndEnableFeature( -+ spellcheck::kWinDelaySpellcheckServiceInit); -+ } -+ - void AddSpellcheckLanguagesForTesting( - const std::vector& spellcheck_languages_for_testing) - override { -diff --git a/chrome/browser/renderer_context_menu/spelling_menu_observer_browsertest.cc b/chrome/browser/renderer_context_menu/spelling_menu_observer_browsertest.cc -index bd0d77323277ee422ec4f75cee9f7d4e9bf198b3..d0ed451fe104b9671d6002ca72e8ca3a620cb111 100644 ---- a/chrome/browser/renderer_context_menu/spelling_menu_observer_browsertest.cc -+++ b/chrome/browser/renderer_context_menu/spelling_menu_observer_browsertest.cc -@@ -30,7 +30,7 @@ namespace { - // accesses resources. - class SpellingMenuObserverTest : public InProcessBrowserTest { - public: -- SpellingMenuObserverTest() = default; -+ SpellingMenuObserverTest(); - - void SetUpOnMainThread() override { - Reset(false); -@@ -54,12 +54,6 @@ class SpellingMenuObserverTest : public InProcessBrowserTest { - content::BrowserContext* context) { - auto spellcheck_service = std::make_unique(context); - -- // With delayed initialization, we need to initialize dictionaries. -- spellcheck_service->InitializeDictionaries( -- base::BindOnce(&SpellingMenuObserverTest::OnSuggestionsComplete, -- base::Unretained(this))); -- RunUntilCallbackReceived(); -- - // Call SetLanguage to assure that the platform spellchecker is initialized. - spellcheck_platform::SetLanguage( - spellcheck_service->platform_spell_checker(), "en-US", -@@ -173,6 +167,16 @@ class SpellingMenuObserverTest : public InProcessBrowserTest { - #endif // BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) - }; - -+#if BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) -+SpellingMenuObserverTest::SpellingMenuObserverTest() { -+ feature_list_.InitWithFeatures( -+ /*enabled_features=*/{}, -+ /*disabled_features=*/{spellcheck::kWinDelaySpellcheckServiceInit}); -+} -+#else -+SpellingMenuObserverTest::SpellingMenuObserverTest() = default; -+#endif // BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) -+ - SpellingMenuObserverTest::~SpellingMenuObserverTest() = default; - - } // namespace -diff --git a/chrome/browser/site_isolation/spellcheck_per_process_browsertest.cc b/chrome/browser/site_isolation/spellcheck_per_process_browsertest.cc -index 081e422f9a29fc36eea19ed730b430ba5ceb2861..7817bc7a6f9f2c7fdeb08c9b185d2dd3c8cc61f7 100644 ---- a/chrome/browser/site_isolation/spellcheck_per_process_browsertest.cc -+++ b/chrome/browser/site_isolation/spellcheck_per_process_browsertest.cc -@@ -134,21 +134,26 @@ class MockSpellCheckHost : spellcheck::mojom::SpellCheckHost { - #if BUILDFLAG(IS_WIN) - void InitializeDictionaries( - InitializeDictionariesCallback callback) override { -- SpellcheckService* spellcheck = SpellcheckServiceFactory::GetForContext( -- process_host()->GetBrowserContext()); -- -- if (!spellcheck) { // Teardown. -- std::move(callback).Run(/*dictionaries=*/{}, /*custom_words=*/{}, -- /*enable=*/false); -+ if (base::FeatureList::IsEnabled( -+ spellcheck::kWinDelaySpellcheckServiceInit)) { -+ SpellcheckService* spellcheck = SpellcheckServiceFactory::GetForContext( -+ process_host()->GetBrowserContext()); -+ -+ if (!spellcheck) { // Teardown. -+ std::move(callback).Run(/*dictionaries=*/{}, /*custom_words=*/{}, -+ /*enable=*/false); -+ return; -+ } -+ -+ dictionaries_loaded_callback_ = std::move(callback); -+ -+ spellcheck->InitializeDictionaries( -+ base::BindOnce(&MockSpellCheckHost::OnDictionariesInitialized, -+ base::Unretained(this))); - return; - } - -- dictionaries_loaded_callback_ = std::move(callback); -- -- spellcheck->InitializeDictionaries( -- base::BindOnce(&MockSpellCheckHost::OnDictionariesInitialized, -- base::Unretained(this))); -- return; -+ NOTREACHED(); - } - - void OnDictionariesInitialized() { -@@ -263,7 +268,17 @@ class ChromeSitePerProcessSpellCheckTest : public ChromeSitePerProcessTest { - blink::features::kRestrictSpellingAndGrammarHighlights); - } - -- void SetUp() override { ChromeSitePerProcessTest::SetUp(); } -+ void SetUp() override { -+#if BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) -+ // When delayed initialization of the spellcheck service is enabled by -+ // default, want to maintain test coverage for the older code path that -+ // initializes spellcheck on browser startup. -+ feature_list_.InitAndDisableFeature( -+ spellcheck::kWinDelaySpellcheckServiceInit); -+#endif // BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) -+ -+ ChromeSitePerProcessTest::SetUp(); -+ } - - protected: - // Tests that spelling in out-of-process subframes is checked. -@@ -370,3 +385,29 @@ IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessSpellCheckTest, - EXPECT_TRUE(host->SpellingPanelVisible()); - } - #endif // BUILDFLAG(HAS_SPELLCHECK_PANEL) -+ -+#if BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) -+class ChromeSitePerProcessSpellCheckTestDelayInit -+ : public ChromeSitePerProcessSpellCheckTest { -+ public: -+ ChromeSitePerProcessSpellCheckTestDelayInit() = default; -+ -+ void SetUp() override { -+ // Don't initialize the SpellcheckService on browser launch. -+ feature_list_.InitAndEnableFeature( -+ spellcheck::kWinDelaySpellcheckServiceInit); -+ -+ ChromeSitePerProcessTest::SetUp(); -+ } -+}; -+ -+IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessSpellCheckTestDelayInit, -+ OOPIFSpellCheckTest) { -+ RunOOPIFSpellCheckTest(); -+} -+ -+IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessSpellCheckTestDelayInit, -+ OOPIFDisabledSpellCheckTest) { -+ RunOOPIFDisabledSpellCheckTest(); -+} -+#endif // BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER) -diff --git a/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc b/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc -index 4eda6aba66af11df4e8719e075e807564d54baac..29d9399c78fc6b4d597ab1f0dc53571131bffd95 100644 ---- a/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc -+++ b/chrome/browser/spellchecker/spell_check_host_chrome_impl.cc -@@ -186,21 +186,27 @@ void SpellCheckHostChromeImpl::InitializeDictionaries( - InitializeDictionariesCallback callback) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - -- // Initialize the spellcheck service if needed. Initialization must -- // happen on UI thread. -- SpellcheckService* spellcheck = GetSpellcheckService(); -+ if (base::FeatureList::IsEnabled( -+ spellcheck::kWinDelaySpellcheckServiceInit)) { -+ // Initialize the spellcheck service if needed. Initialization must -+ // happen on UI thread. -+ SpellcheckService* spellcheck = GetSpellcheckService(); -+ -+ if (!spellcheck) { // Teardown. -+ std::move(callback).Run(/*dictionaries=*/{}, /*custom_words=*/{}, -+ /*enable=*/false); -+ return; -+ } - -- if (!spellcheck) { // Teardown. -- std::move(callback).Run(/*dictionaries=*/{}, /*custom_words=*/{}, -- /*enable=*/false); -+ dictionaries_loaded_callback_ = std::move(callback); -+ -+ spellcheck->InitializeDictionaries( -+ base::BindOnce(&SpellCheckHostChromeImpl::OnDictionariesInitialized, -+ weak_factory_.GetWeakPtr())); - return; - } - -- dictionaries_loaded_callback_ = std::move(callback); -- -- spellcheck->InitializeDictionaries( -- base::BindOnce(&SpellCheckHostChromeImpl::OnDictionariesInitialized, -- weak_factory_.GetWeakPtr())); -+ NOTREACHED(); - } - - void SpellCheckHostChromeImpl::OnDictionariesInitialized() { -diff --git a/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc b/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc -index 31ab441aedd69c08c6f1beefa2129e60bd44a7f3..308c90516a9881b82da5cedec5d80208dbccdced 100644 ---- a/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc -+++ b/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc -@@ -32,7 +32,12 @@ class SpellCheckHostChromeImplWinBrowserTest : public InProcessBrowserTest { - public: - SpellCheckHostChromeImplWinBrowserTest() = default; - -- void SetUp() override { InProcessBrowserTest::SetUp(); } -+ void SetUp() override { -+ // Don't delay initialization of the SpellcheckService on browser launch. -+ feature_list_.InitAndDisableFeature( -+ spellcheck::kWinDelaySpellcheckServiceInit); -+ InProcessBrowserTest::SetUp(); -+ } - - void SetUpOnMainThread() override { - content::BrowserContext* context = browser()->profile(); -@@ -50,22 +55,7 @@ class SpellCheckHostChromeImplWinBrowserTest : public InProcessBrowserTest { - - void TearDownOnMainThread() override { renderer_.reset(); } - -- void InitializeSpellcheckService() { -- spell_check_host_->InitializeDictionaries(base::BindOnce( -- &SpellCheckHostChromeImplWinBrowserTest::InitializeDictionariesCallback, -- base::Unretained(this))); -- RunUntilResultReceived(); -- } -- -- void InitializeDictionariesCallback( -- std::vector dictionaries, -- const std::vector& custom_words, -- bool enable) { -- received_result_ = true; -- if (quit_) { -- std::move(quit_).Run(); -- } -- } -+ virtual void InitializeSpellcheckService() {} - - void OnSpellcheckResult(const std::vector& result) { - received_result_ = true; -@@ -139,3 +129,41 @@ void SpellCheckHostChromeImplWinBrowserTest::RunSpellCheckReturnMessageTest() { - EXPECT_EQ(result_[0].length, 2); - EXPECT_EQ(result_[0].decoration, SpellCheckResult::SPELLING); - } -+ -+class SpellCheckHostChromeImplWinBrowserTestDelayInit -+ : public SpellCheckHostChromeImplWinBrowserTest { -+ public: -+ SpellCheckHostChromeImplWinBrowserTestDelayInit() = default; -+ -+ void SetUp() override { -+ // Don't initialize the SpellcheckService on browser launch. -+ feature_list_.InitAndEnableFeature( -+ spellcheck::kWinDelaySpellcheckServiceInit); -+ InProcessBrowserTest::SetUp(); -+ } -+ -+ void InitializeSpellcheckService() override { -+ // With the kWinDelaySpellcheckServiceInit feature flag set, the spellcheck -+ // service is not initialized when instantiated. Call InitializeDictionaries -+ // to load the dictionaries. -+ spell_check_host_->InitializeDictionaries( -+ base::BindOnce(&SpellCheckHostChromeImplWinBrowserTestDelayInit:: -+ InitializeDictionariesCallback, -+ base::Unretained(this))); -+ RunUntilResultReceived(); -+ } -+ -+ void InitializeDictionariesCallback( -+ std::vector dictionaries, -+ const std::vector& custom_words, -+ bool enable) { -+ received_result_ = true; -+ if (quit_) -+ std::move(quit_).Run(); -+ } -+}; -+ -+IN_PROC_BROWSER_TEST_F(SpellCheckHostChromeImplWinBrowserTestDelayInit, -+ SpellCheckReturnMessage) { -+ RunSpellCheckReturnMessageTest(); -+} -diff --git a/chrome/browser/spellchecker/spellcheck_service.cc b/chrome/browser/spellchecker/spellcheck_service.cc -index 97b8fc0f38650e816bcae00e074543766f71e0d0..83d9e177e9b5e13587655915b9fbbddf5f9f275d 100644 ---- a/chrome/browser/spellchecker/spellcheck_service.cc -+++ b/chrome/browser/spellchecker/spellcheck_service.cc -@@ -170,7 +170,9 @@ SpellcheckService::SpellcheckService(content::BrowserContext* context) - custom_dictionary_->Load(); - - #if BUILDFLAG(IS_WIN) -- if (spellcheck::UseBrowserSpellChecker()) { -+ if (spellcheck::UseBrowserSpellChecker() && -+ base::FeatureList::IsEnabled( -+ spellcheck::kWinDelaySpellcheckServiceInit)) { - // If initialization of the spellcheck service is on-demand, it is up to the - // instantiator of the spellcheck service to call InitializeDictionaries - // with a callback. -@@ -493,7 +495,9 @@ void SpellcheckService::LoadDictionaries() { - } - - #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) -- if (spellcheck::UseBrowserSpellChecker()) { -+ if (base::FeatureList::IsEnabled( -+ spellcheck::kWinDelaySpellcheckServiceInit) && -+ spellcheck::UseBrowserSpellChecker()) { - // Only want to fire the callback on first call to LoadDictionaries - // originating from InitializeDictionaries, since supported platform - // dictionaries are cached throughout the browser session and not -@@ -521,7 +525,9 @@ bool SpellcheckService::IsSpellcheckEnabled() const { - - bool enable_if_uninitialized = false; - #if BUILDFLAG(IS_WIN) -- if (spellcheck::UseBrowserSpellChecker()) { -+ if (spellcheck::UseBrowserSpellChecker() && -+ base::FeatureList::IsEnabled( -+ spellcheck::kWinDelaySpellcheckServiceInit)) { - // If initialization of the spellcheck service is on-demand, the - // renderer-side SpellCheck object needs to start out as enabled in order - // for a click on editable content to initialize the spellcheck service. -diff --git a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc -index d99667b86795215717dbb25dfefdf0a32f7cd089..5a6dd4dcc4467601a3197f5b273231b2c95d8cdf 100644 ---- a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc -+++ b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc -@@ -712,6 +712,32 @@ class SpellcheckServiceWindowsHybridBrowserTest - : SpellcheckServiceBrowserTest(/* use_browser_spell_checker=*/true) {} - }; - -+IN_PROC_BROWSER_TEST_F(SpellcheckServiceWindowsHybridBrowserTest, -+ WindowsHybridSpellcheck) { -+ // This test specifically covers the case where spellcheck delayed -+ // initialization is not enabled, so return early if it is. Other tests -+ // cover the case where delayed initialization is enabled. -+ if (base::FeatureList::IsEnabled(spellcheck::kWinDelaySpellcheckServiceInit)) -+ return; -+ -+ ASSERT_TRUE(spellcheck::UseBrowserSpellChecker()); -+ -+ // Note that the base class forces dictionary sync to not be performed, which -+ // on its own would have created a SpellcheckService object. So testing here -+ // that we are still instantiating the SpellcheckService as a browser startup -+ // task to support hybrid spellchecking. -+ SpellcheckService* service = static_cast( -+ SpellcheckServiceFactory::GetInstance()->GetServiceForBrowserContext( -+ GetContext(), /* create */ false)); -+ ASSERT_NE(nullptr, service); -+ -+ // The list of Windows spellcheck languages should have been populated by at -+ // least one language. This assures that the spellcheck context menu will -+ // include Windows spellcheck languages that lack Hunspell support. -+ EXPECT_TRUE(service->dictionaries_loaded()); -+ EXPECT_FALSE(service->windows_spellcheck_dictionary_map_.empty()); -+} -+ - class SpellcheckServiceWindowsHybridBrowserTestDelayInit - : public SpellcheckServiceBrowserTest { - public: -@@ -719,6 +745,10 @@ class SpellcheckServiceWindowsHybridBrowserTestDelayInit - : SpellcheckServiceBrowserTest(/* use_browser_spell_checker=*/true) {} - - void SetUp() override { -+ // Don't initialize the SpellcheckService on browser launch. -+ feature_list_.InitAndEnableFeature( -+ spellcheck::kWinDelaySpellcheckServiceInit); -+ - // Add command line switch that forces first run state, to test whether - // primary preferred language has its spellcheck dictionary enabled by - // default for non-Hunspell languages. -@@ -808,9 +838,10 @@ IN_PROC_BROWSER_TEST_F(SpellcheckServiceWindowsHybridBrowserTestDelayInit, - WindowsHybridSpellcheckDelayInit) { - ASSERT_TRUE(spellcheck::UseBrowserSpellChecker()); - -- // The base class forces dictionary sync to be skipped, so the -- // SpellcheckService object should not have been created on browser startup -- // because. Verify this is the case. -+ // Note that the base class forces dictionary sync to not be performed, and -+ // the kWinDelaySpellcheckServiceInit flag is set, which together should -+ // prevent creation of a SpellcheckService object on browser startup. So -+ // testing here that this is indeed the case. - SpellcheckService* service = static_cast( - SpellcheckServiceFactory::GetInstance()->GetServiceForBrowserContext( - GetContext(), /* create */ false)); -diff --git a/chrome/browser/spellchecker/spellcheck_service_unittest.cc b/chrome/browser/spellchecker/spellcheck_service_unittest.cc -index be073ddd362c6a8e9b93961eba2c5a7d4a978b5e..68c479ca1e8fd93ef661258823122cbc6277ad95 100644 ---- a/chrome/browser/spellchecker/spellcheck_service_unittest.cc -+++ b/chrome/browser/spellchecker/spellcheck_service_unittest.cc -@@ -181,11 +181,15 @@ class SpellcheckServiceHybridUnitTestBase - - protected: - void SetUp() override { -+ InitFeatures(); -+ - // Use SetTestingFactoryAndUse to force creation and initialization. - SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse( - &profile_, base::BindRepeating(&BuildSpellcheckService)); - } - -+ virtual void InitFeatures() {} -+ - virtual void InitializeSpellcheckService( - const std::vector& spellcheck_languages_for_testing) { - // Fake the presence of Windows spellcheck dictionaries. -@@ -215,6 +219,8 @@ class SpellcheckServiceHybridUnitTestBase - static const std::vector - windows_spellcheck_languages_for_testing_; - -+ base::test::ScopedFeatureList feature_list_; -+ - raw_ptr spellcheck_service_; - }; - -@@ -327,6 +333,18 @@ const std::vector SpellcheckServiceHybridUnitTestBase:: - // dictionaries. - }; - -+class GetDictionariesHybridUnitTestNoDelayInit -+ : public SpellcheckServiceHybridUnitTestBase, -+ public testing::WithParamInterface { -+ protected: -+ void InitFeatures() override { -+ // Disable kWinDelaySpellcheckServiceInit, as the case where it's enabled -+ // is tested in SpellcheckServiceWindowsDictionaryMappingUnitTestDelayInit. -+ feature_list_.InitAndDisableFeature( -+ spellcheck::kWinDelaySpellcheckServiceInit); -+ } -+}; -+ - static const TestCase kHybridGetDictionariesParams[] = { - // Galician (gl) has only Windows support, no Hunspell dictionary. Croatian - // (hr) has only Hunspell support, no local Windows dictionary. First -@@ -379,6 +397,16 @@ static const TestCase kHybridGetDictionariesParams[] = { - TestCase("it,it-IT", {"it", "it-IT"}, {"it", "it-IT"}, {"it", "it-IT"}), - }; - -+INSTANTIATE_TEST_SUITE_P(TestCases, -+ GetDictionariesHybridUnitTestNoDelayInit, -+ testing::ValuesIn(kHybridGetDictionariesParams)); -+ -+TEST_P(GetDictionariesHybridUnitTestNoDelayInit, GetDictionaries) { -+ RunGetDictionariesTest(GetParam().accept_languages, -+ GetParam().spellcheck_dictionaries, -+ GetParam().expected_dictionaries); -+} -+ - struct DictionaryMappingTestCase { - std::string full_tag; - std::string expected_accept_language; -@@ -401,6 +429,18 @@ std::ostream& operator<<(std::ostream& out, - return out; - } - -+class SpellcheckServiceWindowsDictionaryMappingUnitTest -+ : public SpellcheckServiceHybridUnitTestBase, -+ public testing::WithParamInterface { -+ protected: -+ void InitFeatures() override { -+ // Disable kWinDelaySpellcheckServiceInit, as the case where it's enabled -+ // is tested in SpellcheckServiceWindowsDictionaryMappingUnitTestDelayInit. -+ feature_list_.InitAndDisableFeature( -+ spellcheck::kWinDelaySpellcheckServiceInit); -+ } -+}; -+ - static const DictionaryMappingTestCase kHybridDictionaryMappingsParams[] = { - DictionaryMappingTestCase({"en-CA", "en-CA", "en-CA", "en", "en"}), - DictionaryMappingTestCase({"en-PH", "en", "en", "", ""}), -@@ -423,6 +463,18 @@ static const DictionaryMappingTestCase kHybridDictionaryMappingsParams[] = { - DictionaryMappingTestCase({"pt-BR", "pt-BR", "pt-BR", "pt", "pt"}), - }; - -+INSTANTIATE_TEST_SUITE_P(TestCases, -+ SpellcheckServiceWindowsDictionaryMappingUnitTest, -+ testing::ValuesIn(kHybridDictionaryMappingsParams)); -+ -+TEST_P(SpellcheckServiceWindowsDictionaryMappingUnitTest, CheckMappings) { -+ RunDictionaryMappingTest( -+ GetParam().full_tag, GetParam().expected_accept_language, -+ GetParam().expected_tag_passed_to_spellcheck, -+ GetParam().expected_accept_language_generic, -+ GetParam().expected_tag_passed_to_spellcheck_generic); -+} -+ - class SpellcheckServiceHybridUnitTestDelayInitBase - : public SpellcheckServiceHybridUnitTestBase { - public: -@@ -435,6 +487,12 @@ class SpellcheckServiceHybridUnitTestDelayInitBase - } - - protected: -+ void InitFeatures() override { -+ // Don't initialize the SpellcheckService on browser launch. -+ feature_list_.InitAndEnableFeature( -+ spellcheck::kWinDelaySpellcheckServiceInit); -+ } -+ - void InitializeSpellcheckService( - const std::vector& spellcheck_languages_for_testing) - override { -diff --git a/components/spellcheck/common/spellcheck_features.cc b/components/spellcheck/common/spellcheck_features.cc -index ab07d966779449efcb0bad95ebe05e6018300048..527fa5d72369bb1194684527312eb093946d41c0 100644 ---- a/components/spellcheck/common/spellcheck_features.cc -+++ b/components/spellcheck/common/spellcheck_features.cc -@@ -41,6 +41,8 @@ ScopedDisableBrowserSpellCheckerForTesting:: - g_browser_spell_checker_enabled = previous_value_; - } - -+BASE_FEATURE(kWinDelaySpellcheckServiceInit, base::FEATURE_ENABLED_BY_DEFAULT); -+ - #endif // BUILDFLAG(IS_WIN) - - #if BUILDFLAG(IS_ANDROID) -diff --git a/components/spellcheck/common/spellcheck_features.h b/components/spellcheck/common/spellcheck_features.h -index 01e193221c74f0e0bd8620627455f92741448075..7929156c59d078b3d4299bb44ea28bc61bbe0086 100644 ---- a/components/spellcheck/common/spellcheck_features.h -+++ b/components/spellcheck/common/spellcheck_features.h -@@ -30,6 +30,25 @@ class ScopedDisableBrowserSpellCheckerForTesting { - const bool previous_value_; - }; - -+// If the kWinDelaySpellcheckServiceInit feature flag is enabled, don't -+// initialize the spellcheck dictionaries when the SpellcheckService is -+// instantiated. With this flag set: (1) Completing the initialization of the -+// spellcheck service is on-demand, invoked by calling -+// SpellcheckService::InitializeDictionaries with a callback to indicate when -+// the operation completes. (2) The call to create the spellcheck service in -+// ChromeBrowserMainParts::PreMainMessageLoopRunImpl will be skipped. Chromium -+// will still by default instantiate the spellcheck service on startup for -+// custom dictionary synchronization, but will not load Windows spellcheck -+// dictionaries. The command line for launching the browser with Windows hybrid -+// spellchecking enabled but no initialization of the spellcheck service is: -+// chrome -+// --enable-features=WinDelaySpellcheckServiceInit -+// and if instantiation of the spellcheck service needs to be completely -+// disabled: -+// chrome -+// --enable-features=WinDelaySpellcheckServiceInit -+// --disable-sync-types="Dictionary" -+BASE_DECLARE_FEATURE(kWinDelaySpellcheckServiceInit); - #endif // BUILDFLAG(IS_WIN) - - #if BUILDFLAG(IS_ANDROID) -diff --git a/components/spellcheck/renderer/spellcheck_provider.cc b/components/spellcheck/renderer/spellcheck_provider.cc -index 20e73dd66865f1d7573adc092d8747e3b3252cfd..0bec57f9a7276c3623edd4fcf009d7b35e453df4 100644 ---- a/components/spellcheck/renderer/spellcheck_provider.cc -+++ b/components/spellcheck/renderer/spellcheck_provider.cc -@@ -126,7 +126,9 @@ void SpellCheckProvider::RequestTextChecking( - #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) - if (spellcheck::UseBrowserSpellChecker()) { - #if BUILDFLAG(IS_WIN) -- if (!dictionaries_loaded_) { -+ if (base::FeatureList::IsEnabled( -+ spellcheck::kWinDelaySpellcheckServiceInit) && -+ !dictionaries_loaded_) { - // Initialize the spellcheck service on demand (this spellcheck request - // could be the result of the first click in editable content), then - // complete the text check request when the dictionaries are loaded. -diff --git a/components/spellcheck/renderer/spellcheck_provider_test.cc b/components/spellcheck/renderer/spellcheck_provider_test.cc -index 04dcb599f5dd93d3e381c243e5ba81fbec8a3790..12c32fd631ff93f1d1ff3c7d2a19924e8909c099 100644 ---- a/components/spellcheck/renderer/spellcheck_provider_test.cc -+++ b/components/spellcheck/renderer/spellcheck_provider_test.cc -@@ -188,8 +188,14 @@ void TestingSpellCheckProvider::FillSuggestionList(const std::u16string&, - #if BUILDFLAG(IS_WIN) - void TestingSpellCheckProvider::InitializeDictionaries( - InitializeDictionariesCallback callback) { -- std::move(callback).Run(/*dictionaries=*/{}, /*custom_words=*/{}, -- /*enable=*/false); -+ if (base::FeatureList::IsEnabled( -+ spellcheck::kWinDelaySpellcheckServiceInit)) { -+ std::move(callback).Run(/*dictionaries=*/{}, /*custom_words=*/{}, -+ /*enable=*/false); -+ return; -+ } -+ -+ NOTREACHED(); - } - #endif // BUILDFLAG(IS_WIN) - #endif // BUILDFLAG(USE_BROWSER_SPELLCHECKER) -diff --git a/components/spellcheck/renderer/spellcheck_provider_unittest.cc b/components/spellcheck/renderer/spellcheck_provider_unittest.cc -index 487cdb1f871868a7fed8ae2ba1adc816c581d0e2..6e1da0564754063e78ad69997be71bbc95e27b39 100644 ---- a/components/spellcheck/renderer/spellcheck_provider_unittest.cc -+++ b/components/spellcheck/renderer/spellcheck_provider_unittest.cc -@@ -65,12 +65,34 @@ class HybridSpellCheckTest - HybridSpellCheckTest() : provider_(&embedder_provider_) {} - ~HybridSpellCheckTest() override = default; - -+ void SetUp() override { -+ // Don't delay initialization of the SpellcheckService on browser launch. -+ feature_list_.InitAndDisableFeature( -+ spellcheck::kWinDelaySpellcheckServiceInit); -+ } -+ -+ void RunShouldUseBrowserSpellCheckOnlyWhenNeededTest(); -+ - protected: -+ base::test::ScopedFeatureList feature_list_; - base::test::SingleThreadTaskEnvironment task_environment_; - spellcheck::EmptyLocalInterfaceProvider embedder_provider_; - TestingSpellCheckProvider provider_; - }; - -+// Test fixture for testing hybrid check cases with delayed initialization of -+// the spellcheck service. -+class HybridSpellCheckTestDelayInit : public HybridSpellCheckTest { -+ public: -+ HybridSpellCheckTestDelayInit() = default; -+ -+ void SetUp() override { -+ // Don't initialize the SpellcheckService on browser launch. -+ feature_list_.InitAndEnableFeature( -+ spellcheck::kWinDelaySpellcheckServiceInit); -+ } -+}; -+ - // Test fixture for testing combining results from both the native spell checker - // and Hunspell. - class CombineSpellCheckResultsTest -@@ -173,6 +195,10 @@ INSTANTIATE_TEST_SUITE_P( - testing::ValuesIn(kSpellCheckProviderHybridTestsParams)); - - TEST_P(HybridSpellCheckTest, ShouldUseBrowserSpellCheckOnlyWhenNeeded) { -+ RunShouldUseBrowserSpellCheckOnlyWhenNeededTest(); -+} -+ -+void HybridSpellCheckTest::RunShouldUseBrowserSpellCheckOnlyWhenNeededTest() { - const auto& test_case = GetParam(); - - FakeTextCheckingResult completion; -@@ -191,6 +217,20 @@ TEST_P(HybridSpellCheckTest, ShouldUseBrowserSpellCheckOnlyWhenNeeded) { - EXPECT_EQ(completion.cancellation_count_, 0U); - } - -+// Tests that the SpellCheckProvider calls into the native spell checker only -+// when needed when the code path through -+// SpellCheckProvider::RequestTextChecking is that used when the spellcheck -+// service is initialized on demand. -+INSTANTIATE_TEST_SUITE_P( -+ SpellCheckProviderHybridTests, -+ HybridSpellCheckTestDelayInit, -+ testing::ValuesIn(kSpellCheckProviderHybridTestsParams)); -+ -+TEST_P(HybridSpellCheckTestDelayInit, -+ ShouldUseBrowserSpellCheckOnlyWhenNeeded) { -+ RunShouldUseBrowserSpellCheckOnlyWhenNeededTest(); -+} -+ - // Tests that the SpellCheckProvider can correctly combine results from the - // native spell checker and Hunspell. - INSTANTIATE_TEST_SUITE_P( diff --git a/shell/browser/api/electron_api_session.cc b/shell/browser/api/electron_api_session.cc index e96a8962cb0b3..229bd23d741d1 100644 --- a/shell/browser/api/electron_api_session.cc +++ b/shell/browser/api/electron_api_session.cc @@ -586,6 +586,7 @@ Session::Session(v8::Isolate* isolate, ElectronBrowserContext* browser_context) if (auto* service = SpellcheckServiceFactory::GetForContext(browser_context)) { service->SetHunspellObserver(this); + service->InitializeDictionaries(base::DoNothing()); } #endif } diff --git a/shell/browser/feature_list.cc b/shell/browser/feature_list.cc index 178c101336cae..e5c5c957f5537 100644 --- a/shell/browser/feature_list.cc +++ b/shell/browser/feature_list.cc @@ -64,10 +64,6 @@ void InitializeFeatureList() { std::string(",") + network::features::kLocalNetworkAccessChecks.name; #if BUILDFLAG(IS_WIN) - disable_features += - // Delayed spellcheck initialization is causing the - // 'custom dictionary word list API' spec to crash. - std::string(",") + spellcheck::kWinDelaySpellcheckServiceInit.name; // Refs https://issues.chromium.org/issues/401996981 // TODO(deepak1556): Remove this once test added in // https://github.com/electron/electron/pull/12904 From 430536e5f47e9d0da5f496b45e058fb5f912782c Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 9 Nov 2025 08:07:25 -0600 Subject: [PATCH 221/268] refactor: decouple `api::WebRequest` from `api::BrowserContext` (#48848) * refactor: rename api::Session::CreateFrom() to api::Session::FromOrCreate() This is both clearer and more consistent with other classes * refactor: add Session::FromOrCreate(content::BrowserContext*) * refactor: reimplement api::WebRequest::FromOrCreate() using api::Session::FromOrCreate() * refactor: use base::PassKey to ensure WebRequest is only instantiated by Session * refactor: remove WebRequest::From() no longer needed; Session already guarantees uniqueness * refactor: remove unused isolate arg from WebRequest ctor * refactor: do not attach WebRequest to BrowserContext no longer needed now that access goes through Session --- shell/browser/api/electron_api_session.cc | 20 +++++-- shell/browser/api/electron_api_session.h | 10 +++- .../browser/api/electron_api_web_contents.cc | 4 +- shell/browser/api/electron_api_web_request.cc | 54 ++++--------------- shell/browser/api/electron_api_web_request.h | 28 ++++------ 5 files changed, 44 insertions(+), 72 deletions(-) diff --git a/shell/browser/api/electron_api_session.cc b/shell/browser/api/electron_api_session.cc index 229bd23d741d1..5a25cef4bbe4d 100644 --- a/shell/browser/api/electron_api_session.cc +++ b/shell/browser/api/electron_api_session.cc @@ -19,6 +19,7 @@ #include "base/files/file_util.h" #include "base/scoped_observation.h" #include "base/strings/string_util.h" +#include "base/types/pass_key.h" #include "base/uuid.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/predictors/predictors_traffic_annotations.h" // nogncheck @@ -1361,7 +1362,7 @@ v8::Local Session::ServiceWorkerContext(v8::Isolate* isolate) { v8::Local Session::WebRequest(v8::Isolate* isolate) { if (web_request_.IsEmptyThreadSafe()) { - auto handle = WebRequest::Create(isolate, browser_context()); + auto handle = WebRequest::Create(base::PassKey{}, isolate); web_request_.Reset(isolate, handle.ToV8()); } return web_request_.Get(isolate); @@ -1689,8 +1690,17 @@ gin::WeakCell* Session::FromBrowserContext( } // static -Session* Session::CreateFrom(v8::Isolate* isolate, - ElectronBrowserContext* browser_context) { +Session* Session::FromOrCreate(v8::Isolate* isolate, + content::BrowserContext* context) { + if (ElectronBrowserContext::IsValidContext(context)) + return FromOrCreate(isolate, static_cast(context)); + DCHECK(false); + return {}; +} + +// static +Session* Session::FromOrCreate(v8::Isolate* isolate, + ElectronBrowserContext* browser_context) { gin::WeakCell* existing = FromBrowserContext(browser_context); if (existing && existing->Get()) { return existing->Get(); @@ -1731,7 +1741,7 @@ Session* Session::FromPartition(v8::Isolate* isolate, browser_context = ElectronBrowserContext::From(partition, true, std::move(options)); } - return CreateFrom(isolate, browser_context); + return FromOrCreate(isolate, browser_context); } // static @@ -1752,7 +1762,7 @@ Session* Session::FromPath(gin::Arguments* args, browser_context = ElectronBrowserContext::FromPath(std::move(path), std::move(options)); - return CreateFrom(args->isolate(), browser_context); + return FromOrCreate(args->isolate(), browser_context); } // static diff --git a/shell/browser/api/electron_api_session.h b/shell/browser/api/electron_api_session.h index da7b64be912f2..5dacd5172fc98 100644 --- a/shell/browser/api/electron_api_session.h +++ b/shell/browser/api/electron_api_session.h @@ -73,8 +73,14 @@ class Session final : public gin::Wrappable, private content::DownloadManager::Observer { public: // Gets or creates Session from the |browser_context|. - static Session* CreateFrom(v8::Isolate* isolate, - ElectronBrowserContext* browser_context); + static Session* FromOrCreate(v8::Isolate* isolate, + ElectronBrowserContext* browser_context); + + // Convenience wrapper around the previous method: Checks that + // |browser_context| is an ElectronBrowserContext before downcasting. + static Session* FromOrCreate(v8::Isolate* isolate, + content::BrowserContext* browser_context); + static void New(); // Dummy, do not use! static gin::WeakCell* FromBrowserContext( diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 5263259beb99d..d886665a51c3a 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -754,7 +754,7 @@ WebContents::WebContents(v8::Isolate* isolate, script_executor_ = std::make_unique(web_contents); #endif - session_ = Session::CreateFrom(isolate, GetBrowserContext()); + session_ = Session::FromOrCreate(isolate, GetBrowserContext()); SetUserAgent(GetBrowserContext()->GetUserAgent()); @@ -776,7 +776,7 @@ WebContents::WebContents(v8::Isolate* isolate, { DCHECK(type != Type::kRemote) << "Can't take ownership of a remote WebContents"; - session_ = Session::CreateFrom(isolate, GetBrowserContext()); + session_ = Session::FromOrCreate(isolate, GetBrowserContext()); InitWithSessionAndOptions(isolate, std::move(web_contents), session_->browser_context(), gin::Dictionary::CreateEmpty(isolate)); diff --git a/shell/browser/api/electron_api_web_request.cc b/shell/browser/api/electron_api_web_request.cc index b2b0a7f405aa9..04bee91da3e25 100644 --- a/shell/browser/api/electron_api_web_request.cc +++ b/shell/browser/api/electron_api_web_request.cc @@ -72,14 +72,6 @@ namespace electron::api { namespace { -const char kUserDataKey[] = "WebRequest"; - -// BrowserContext <=> WebRequest relationship. -struct UserData : public base::SupportsUserData::Data { - explicit UserData(WebRequest* data) : data(data) {} - raw_ptr data; -}; - extensions::WebRequestResourceType ParseResourceType(std::string_view value) { if (auto iter = ResourceTypes.find(value); iter != ResourceTypes.end()) return iter->second; @@ -312,15 +304,8 @@ WebRequest::ResponseListenerInfo::ResponseListenerInfo( WebRequest::ResponseListenerInfo::ResponseListenerInfo() = default; WebRequest::ResponseListenerInfo::~ResponseListenerInfo() = default; -WebRequest::WebRequest(v8::Isolate* isolate, - content::BrowserContext* browser_context) - : browser_context_(browser_context) { - browser_context_->SetUserData(kUserDataKey, std::make_unique(this)); -} - -WebRequest::~WebRequest() { - browser_context_->RemoveUserData(kUserDataKey); -} +WebRequest::WebRequest(base::PassKey) {} +WebRequest::~WebRequest() = default; gin::ObjectTemplateBuilder WebRequest::GetObjectTemplateBuilder( v8::Isolate* isolate) { @@ -736,40 +721,19 @@ void WebRequest::HandleSimpleEvent(SimpleEvent event, gin_helper::Handle WebRequest::FromOrCreate( v8::Isolate* isolate, content::BrowserContext* browser_context) { - gin_helper::Handle handle = From(isolate, browser_context); - if (handle.IsEmpty()) { - // Make sure the |Session| object has the |webRequest| property created. - v8::Local web_request = - Session::CreateFrom( - isolate, static_cast(browser_context)) - ->WebRequest(isolate); - gin::ConvertFromV8(isolate, web_request, &handle); - } + v8::Local web_request = + Session::FromOrCreate(isolate, browser_context)->WebRequest(isolate); + gin_helper::Handle handle; + gin::ConvertFromV8(isolate, web_request, &handle); DCHECK(!handle.IsEmpty()); return handle; } // static gin_helper::Handle WebRequest::Create( - v8::Isolate* isolate, - content::BrowserContext* browser_context) { - DCHECK(From(isolate, browser_context).IsEmpty()) - << "WebRequest already created"; - return gin_helper::CreateHandle(isolate, - new WebRequest(isolate, browser_context)); -} - -// static -gin_helper::Handle WebRequest::From( - v8::Isolate* isolate, - content::BrowserContext* browser_context) { - if (!browser_context) - return {}; - auto* user_data = - static_cast(browser_context->GetUserData(kUserDataKey)); - if (!user_data) - return {}; - return gin_helper::CreateHandle(isolate, user_data->data.get()); + base::PassKey passkey, + v8::Isolate* isolate) { + return gin_helper::CreateHandle(isolate, new WebRequest{std::move(passkey)}); } } // namespace electron::api diff --git a/shell/browser/api/electron_api_web_request.h b/shell/browser/api/electron_api_web_request.h index 258e2ec21071c..1caa2efe2eed9 100644 --- a/shell/browser/api/electron_api_web_request.h +++ b/shell/browser/api/electron_api_web_request.h @@ -9,7 +9,7 @@ #include #include -#include "base/memory/raw_ptr.h" +#include "base/types/pass_key.h" #include "net/base/completion_once_callback.h" #include "services/network/public/cpp/resource_request.h" #include "shell/common/gin_helper/wrappable.h" @@ -36,6 +36,8 @@ class Handle; namespace electron::api { +class Session; + class WebRequest final : public gin_helper::DeprecatedWrappable { public: using BeforeSendHeadersCallback = @@ -43,23 +45,16 @@ class WebRequest final : public gin_helper::DeprecatedWrappable { const std::set& set_headers, int error_code)>; - // Return the WebRequest object attached to |browser_context|, create if there - // is no one. - // Note that the lifetime of WebRequest object is managed by Session, instead - // of the caller. + // Convenience wrapper around api::Session::FromOrCreate()->WebRequest(). + // Creates the Session and WebRequest if they don't already exist. + // Note that the WebRequest is owned by the session, not by the caller. static gin_helper::Handle FromOrCreate( v8::Isolate* isolate, content::BrowserContext* browser_context); - // Return a new WebRequest object, this should only be called by Session. - static gin_helper::Handle Create( - v8::Isolate* isolate, - content::BrowserContext* browser_context); - - // Find the WebRequest object attached to |browser_context|. - static gin_helper::Handle From( - v8::Isolate* isolate, - content::BrowserContext* browser_context); + // Return a new WebRequest object. This can only be called by api::Session. + static gin_helper::Handle Create(base::PassKey, + v8::Isolate* isolate); static const char* GetClassName() { return "WebRequest"; } @@ -102,7 +97,7 @@ class WebRequest final : public gin_helper::DeprecatedWrappable { void OnRequestWillBeDestroyed(extensions::WebRequestInfo* info); private: - WebRequest(v8::Isolate* isolate, content::BrowserContext* browser_context); + explicit WebRequest(base::PassKey); ~WebRequest() override; // Contains info about requests that are blocked waiting for a response from @@ -213,9 +208,6 @@ class WebRequest final : public gin_helper::DeprecatedWrappable { std::map simple_listeners_; std::map response_listeners_; std::map blocked_requests_; - - // Weak-ref, it manages us. - raw_ptr browser_context_; }; } // namespace electron::api From 283736cdb8d795eaed5aba4e19d847b6e3998b3d Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Mon, 10 Nov 2025 00:51:56 -0800 Subject: [PATCH 222/268] fix: ESM-from-CJS import when CJK is in path (#48855) Upstream fix: https://github.com/nodejs/node/pull/60575 --- patches/node/.patches | 1 + ...cp_utf8_for_wide_file_names_on_win32.patch | 312 ++++++++++++++++++ 2 files changed, 313 insertions(+) create mode 100644 patches/node/src_use_cp_utf8_for_wide_file_names_on_win32.patch diff --git a/patches/node/.patches b/patches/node/.patches index 94da36c4af6de..b5162077835f6 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -41,3 +41,4 @@ lib_check_sharedarraybuffer_existence_in_fast-utf8-stream.patch chore_handle_support_for_import_defer_as_ns_and_import_defer.patch api_delete_deprecated_fields_on_v8_isolate.patch api_promote_deprecation_of_v8_context_and_v8_object_api_methods.patch +src_use_cp_utf8_for_wide_file_names_on_win32.patch diff --git a/patches/node/src_use_cp_utf8_for_wide_file_names_on_win32.patch b/patches/node/src_use_cp_utf8_for_wide_file_names_on_win32.patch new file mode 100644 index 0000000000000..b3e93de8af202 --- /dev/null +++ b/patches/node/src_use_cp_utf8_for_wide_file_names_on_win32.patch @@ -0,0 +1,312 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Fedor Indutny <238531+indutny@users.noreply.github.com> +Date: Fri, 7 Nov 2025 19:41:44 -0800 +Subject: src: use CP_UTF8 for wide file names on win32 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +`src/node_modules.cc` needs to be consistent with `src/node_file.cc` in +how it translates the utf8 strings to `std::wstring` otherwise we might +end up in situation where we can read the source code of imported +package from disk, but fail to recognize that it is an ESM (or CJS) and +cause runtime errors. This type of error is possible on Windows when the +path contains unicode characters and "Language for non-Unicode programs" +is set to "Chinese (Traditional, Taiwan)". + +See: #58768 +PR-URL: https://github.com/nodejs/node/pull/60575 +Reviewed-By: Anna Henningsen +Reviewed-By: Darshan Sen +Reviewed-By: Stefan Stojanovic +Reviewed-By: Juan José Arboleda +Reviewed-By: Joyee Cheung +Reviewed-By: Rafael Gonzaga + +diff --git a/src/node_file.cc b/src/node_file.cc +index 969e7d08086f8442bed476feaf15599b8c79db7c..e7459654401c275dfb86207831016ed71060bcc9 100644 +--- a/src/node_file.cc ++++ b/src/node_file.cc +@@ -3175,42 +3175,6 @@ static void GetFormatOfExtensionlessFile( + return args.GetReturnValue().Set(EXTENSIONLESS_FORMAT_JAVASCRIPT); + } + +-#ifdef _WIN32 +-#define BufferValueToPath(str) \ +- std::filesystem::path(ConvertToWideString(str.ToString(), CP_UTF8)) +- +-std::string ConvertWideToUTF8(const std::wstring& wstr) { +- if (wstr.empty()) return std::string(); +- +- int size_needed = WideCharToMultiByte(CP_UTF8, +- 0, +- &wstr[0], +- static_cast(wstr.size()), +- nullptr, +- 0, +- nullptr, +- nullptr); +- std::string strTo(size_needed, 0); +- WideCharToMultiByte(CP_UTF8, +- 0, +- &wstr[0], +- static_cast(wstr.size()), +- &strTo[0], +- size_needed, +- nullptr, +- nullptr); +- return strTo; +-} +- +-#define PathToString(path) ConvertWideToUTF8(path.wstring()); +- +-#else // _WIN32 +- +-#define BufferValueToPath(str) std::filesystem::path(str.ToStringView()); +-#define PathToString(path) path.native(); +- +-#endif // _WIN32 +- + static void CpSyncCheckPaths(const FunctionCallbackInfo& args) { + Environment* env = Environment::GetCurrent(args); + Isolate* isolate = env->isolate(); +@@ -3223,7 +3187,7 @@ static void CpSyncCheckPaths(const FunctionCallbackInfo& args) { + THROW_IF_INSUFFICIENT_PERMISSIONS( + env, permission::PermissionScope::kFileSystemRead, src.ToStringView()); + +- auto src_path = BufferValueToPath(src); ++ auto src_path = src.ToPath(); + + BufferValue dest(isolate, args[1]); + CHECK_NOT_NULL(*dest); +@@ -3231,7 +3195,7 @@ static void CpSyncCheckPaths(const FunctionCallbackInfo& args) { + THROW_IF_INSUFFICIENT_PERMISSIONS( + env, permission::PermissionScope::kFileSystemWrite, dest.ToStringView()); + +- auto dest_path = BufferValueToPath(dest); ++ auto dest_path = dest.ToPath(); + bool dereference = args[2]->IsTrue(); + bool recursive = args[3]->IsTrue(); + +@@ -3260,8 +3224,8 @@ static void CpSyncCheckPaths(const FunctionCallbackInfo& args) { + (src_status.type() == std::filesystem::file_type::directory) || + (dereference && src_status.type() == std::filesystem::file_type::symlink); + +- auto src_path_str = PathToString(src_path); +- auto dest_path_str = PathToString(dest_path); ++ auto src_path_str = ConvertPathToUTF8(src_path); ++ auto dest_path_str = ConvertPathToUTF8(dest_path); + + if (!error_code) { + // Check if src and dest are identical. +@@ -3356,7 +3320,7 @@ static bool CopyUtimes(const std::filesystem::path& src, + uv_fs_t req; + auto cleanup = OnScopeLeave([&req]() { uv_fs_req_cleanup(&req); }); + +- auto src_path_str = PathToString(src); ++ auto src_path_str = ConvertPathToUTF8(src); + int result = uv_fs_stat(nullptr, &req, src_path_str.c_str(), nullptr); + if (is_uv_error(result)) { + env->ThrowUVException(result, "stat", nullptr, src_path_str.c_str()); +@@ -3367,7 +3331,7 @@ static bool CopyUtimes(const std::filesystem::path& src, + const double source_atime = s->st_atim.tv_sec + s->st_atim.tv_nsec / 1e9; + const double source_mtime = s->st_mtim.tv_sec + s->st_mtim.tv_nsec / 1e9; + +- auto dest_file_path_str = PathToString(dest); ++ auto dest_file_path_str = ConvertPathToUTF8(dest); + int utime_result = uv_fs_utime(nullptr, + &req, + dest_file_path_str.c_str(), +@@ -3502,7 +3466,7 @@ static void CpSyncCopyDir(const FunctionCallbackInfo& args) { + std::error_code error; + for (auto dir_entry : std::filesystem::directory_iterator(src)) { + auto dest_file_path = dest / dir_entry.path().filename(); +- auto dest_str = PathToString(dest); ++ auto dest_str = ConvertPathToUTF8(dest); + + if (dir_entry.is_symlink()) { + if (verbatim_symlinks) { +@@ -3565,7 +3529,7 @@ static void CpSyncCopyDir(const FunctionCallbackInfo& args) { + } + } else if (std::filesystem::is_regular_file(dest_file_path)) { + if (!dereference || (!force && error_on_exist)) { +- auto dest_file_path_str = PathToString(dest_file_path); ++ auto dest_file_path_str = ConvertPathToUTF8(dest_file_path); + env->ThrowStdErrException( + std::make_error_code(std::errc::file_exists), + "cp", +diff --git a/src/node_modules.cc b/src/node_modules.cc +index d8477191efafba3c41c06d765f4b03bd00b8573c..5444e556b89ba5b71739753eaafa706cd9727013 100644 +--- a/src/node_modules.cc ++++ b/src/node_modules.cc +@@ -365,12 +365,13 @@ const BindingData::PackageConfig* BindingData::TraverseParent( + + // Stop the search when the process doesn't have permissions + // to walk upwards +- if (is_permissions_enabled && +- !env->permission()->is_granted( +- env, +- permission::PermissionScope::kFileSystemRead, +- current_path.generic_string())) [[unlikely]] { +- return nullptr; ++ if (is_permissions_enabled) { ++ if (!env->permission()->is_granted( ++ env, ++ permission::PermissionScope::kFileSystemRead, ++ ConvertGenericPathToUTF8(current_path))) [[unlikely]] { ++ return nullptr; ++ } + } + + // If current path is outside the resources path, bail. +@@ -380,13 +381,14 @@ const BindingData::PackageConfig* BindingData::TraverseParent( + } + + // Check if the path ends with `/node_modules` +- if (current_path.generic_string().ends_with("/node_modules")) { ++ if (current_path.filename() == "node_modules") { + return nullptr; + } + + auto package_json_path = current_path / "package.json"; ++ + auto package_json = +- GetPackageJSON(realm, package_json_path.string(), nullptr); ++ GetPackageJSON(realm, ConvertPathToUTF8(package_json_path), nullptr); + if (package_json != nullptr) { + return package_json; + } +@@ -408,20 +410,12 @@ void BindingData::GetNearestParentPackageJSONType( + + ToNamespacedPath(realm->env(), &path_value); + +- std::string path_value_str = path_value.ToString(); ++ auto path = path_value.ToPath(); ++ + if (slashCheck) { +- path_value_str.push_back(kPathSeparator); ++ path /= ""; + } + +- std::filesystem::path path; +- +-#ifdef _WIN32 +- std::wstring wide_path = ConvertToWideString(path_value_str, GetACP()); +- path = std::filesystem::path(wide_path); +-#else +- path = std::filesystem::path(path_value_str); +-#endif +- + auto package_json = TraverseParent(realm, path); + + if (package_json == nullptr) { +diff --git a/src/util-inl.h b/src/util-inl.h +index da9268dcf2ff432ddeec7c0f61a147b73f3130e2..82b2760f535345d126bc3dcf3890573d36dbb497 100644 +--- a/src/util-inl.h ++++ b/src/util-inl.h +@@ -698,12 +698,11 @@ inline bool IsWindowsBatchFile(const char* filename) { + return !extension.empty() && (extension == "cmd" || extension == "bat"); + } + +-inline std::wstring ConvertToWideString(const std::string& str, +- UINT code_page) { ++inline std::wstring ConvertUTF8ToWideString(const std::string& str) { + int size_needed = MultiByteToWideChar( +- code_page, 0, &str[0], static_cast(str.size()), nullptr, 0); ++ CP_UTF8, 0, &str[0], static_cast(str.size()), nullptr, 0); + std::wstring wstrTo(size_needed, 0); +- MultiByteToWideChar(code_page, ++ MultiByteToWideChar(CP_UTF8, + 0, + &str[0], + static_cast(str.size()), +@@ -711,6 +710,59 @@ inline std::wstring ConvertToWideString(const std::string& str, + size_needed); + return wstrTo; + } ++ ++std::string ConvertWideStringToUTF8(const std::wstring& wstr) { ++ if (wstr.empty()) return std::string(); ++ ++ int size_needed = WideCharToMultiByte(CP_UTF8, ++ 0, ++ &wstr[0], ++ static_cast(wstr.size()), ++ nullptr, ++ 0, ++ nullptr, ++ nullptr); ++ std::string strTo(size_needed, 0); ++ WideCharToMultiByte(CP_UTF8, ++ 0, ++ &wstr[0], ++ static_cast(wstr.size()), ++ &strTo[0], ++ size_needed, ++ nullptr, ++ nullptr); ++ return strTo; ++} ++ ++template ++std::filesystem::path MaybeStackBuffer::ToPath() const { ++ std::wstring wide_path = ConvertUTF8ToWideString(ToString()); ++ return std::filesystem::path(wide_path); ++} ++ ++std::string ConvertPathToUTF8(const std::filesystem::path& path) { ++ return ConvertWideStringToUTF8(path.wstring()); ++} ++ ++std::string ConvertGenericPathToUTF8(const std::filesystem::path& path) { ++ return ConvertWideStringToUTF8(path.generic_wstring()); ++} ++ ++#else // _WIN32 ++ ++template ++std::filesystem::path MaybeStackBuffer::ToPath() const { ++ return std::filesystem::path(ToStringView()); ++} ++ ++std::string ConvertPathToUTF8(const std::filesystem::path& path) { ++ return path.native(); ++} ++ ++std::string ConvertGenericPathToUTF8(const std::filesystem::path& path) { ++ return path.generic_string(); ++} ++ + #endif // _WIN32 + + inline v8::MaybeLocal NewDictionaryInstance( +diff --git a/src/util.h b/src/util.h +index 6da57f95165bbdedb65dab6eaae8c39b815ee4e5..e65d6dbf359f61d051efe4e129c9035ed90cc8f6 100644 +--- a/src/util.h ++++ b/src/util.h +@@ -507,6 +507,8 @@ class MaybeStackBuffer { + inline std::basic_string_view ToStringView() const { + return {out(), length()}; + } ++ // This can only be used if the buffer contains path data in UTF8 ++ inline std::filesystem::path ToPath() const; + + private: + size_t length_; +@@ -1026,9 +1028,15 @@ class JSONOutputStream final : public v8::OutputStream { + // Returns true if OS==Windows and filename ends in .bat or .cmd, + // case insensitive. + inline bool IsWindowsBatchFile(const char* filename); +-inline std::wstring ConvertToWideString(const std::string& str, UINT code_page); ++inline std::wstring ConvertUTF8ToWideString(const std::string& str); ++inline std::string ConvertWideStringToUTF8(const std::wstring& wstr); ++ + #endif // _WIN32 + ++inline std::filesystem::path ConvertUTF8ToPath(const std::string& str); ++inline std::string ConvertPathToUTF8(const std::filesystem::path& path); ++inline std::string ConvertGenericPathToUTF8(const std::filesystem::path& path); ++ + // A helper to create a new instance of the dictionary template. + // Unlike v8::DictionaryTemplate::NewInstance, this method will + // check that all properties have been set (are not empty MaybeLocals) From 1f6e2dc474653f49cec2b904eac6a01ae80374e3 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 10 Nov 2025 02:52:11 -0600 Subject: [PATCH 223/268] refactor: remove unused `ExtensionActionAPI` methods & fields (#48850) refactor: remove unused method ExtensionActionAPI::GetExtensionPrefs() refactor: remove unused field ExtensionActionAPI::browser_context_ refactor: remove unused field ExtensionActionAPI::browser_context_ looks like these were added in 5b105f91 but never used --- .../api/extension_action/extension_action_api.cc | 7 +------ .../extensions/api/extension_action/extension_action_api.h | 7 ------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/shell/browser/extensions/api/extension_action/extension_action_api.cc b/shell/browser/extensions/api/extension_action/extension_action_api.cc index a57fef8aee609..a28a136b2524c 100644 --- a/shell/browser/extensions/api/extension_action/extension_action_api.cc +++ b/shell/browser/extensions/api/extension_action/extension_action_api.cc @@ -33,8 +33,7 @@ void ExtensionActionAPI::Observer::OnExtensionActionAPIShuttingDown() {} // ExtensionActionAPI // -ExtensionActionAPI::ExtensionActionAPI(content::BrowserContext* context) - : browser_context_(context), extension_prefs_(nullptr) {} +ExtensionActionAPI::ExtensionActionAPI(content::BrowserContext*) {} // static BrowserContextKeyedAPIFactory* @@ -49,10 +48,6 @@ ExtensionActionAPI* ExtensionActionAPI::Get(content::BrowserContext* context) { return BrowserContextKeyedAPIFactory::Get(context); } -ExtensionPrefs* ExtensionActionAPI::GetExtensionPrefs() { - return nullptr; -} - void ExtensionActionAPI::Shutdown() {} // diff --git a/shell/browser/extensions/api/extension_action/extension_action_api.h b/shell/browser/extensions/api/extension_action/extension_action_api.h index 4f4a557de0f65..16388b79f8111 100644 --- a/shell/browser/extensions/api/extension_action/extension_action_api.h +++ b/shell/browser/extensions/api/extension_action/extension_action_api.h @@ -5,7 +5,6 @@ #ifndef SHELL_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H_ #define SHELL_BROWSER_EXTENSIONS_API_EXTENSION_ACTION_EXTENSION_ACTION_API_H_ -#include "base/memory/raw_ptr.h" #include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/extension_action.h" #include "extensions/browser/extension_function.h" @@ -70,16 +69,10 @@ class ExtensionActionAPI : public BrowserContextKeyedAPI { private: friend class BrowserContextKeyedAPIFactory; - ExtensionPrefs* GetExtensionPrefs(); - // BrowserContextKeyedAPI implementation. void Shutdown() override; static const char* service_name() { return "ExtensionActionAPI"; } static const bool kServiceRedirectedInIncognito = true; - - raw_ptr browser_context_; - - raw_ptr extension_prefs_; }; // Implementation of the browserAction and pageAction APIs. From 0712e552e7231392517865d4612c4e9ca23ab332 Mon Sep 17 00:00:00 2001 From: Robo Date: Mon, 10 Nov 2025 18:12:02 +0900 Subject: [PATCH 224/268] build: add missing header for SetStackDumpFirstChanceCallback (#48860) --- shell/common/v8_util.cc | 1 + shell/renderer/electron_renderer_client.cc | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/common/v8_util.cc b/shell/common/v8_util.cc index 93824b8e77dc6..9574b4085aef0 100644 --- a/shell/common/v8_util.cc +++ b/shell/common/v8_util.cc @@ -21,6 +21,7 @@ #if BUILDFLAG(IS_LINUX) && (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM64)) #define ENABLE_WEB_ASSEMBLY_TRAP_HANDLER_LINUX #include "base/command_line.h" +#include "base/debug/stack_trace.h" #include "components/crash/core/app/crashpad.h" // nogncheck #include "content/public/common/content_switches.h" #include "v8/include/v8-wasm-trap-handler-posix.h" diff --git a/shell/renderer/electron_renderer_client.cc b/shell/renderer/electron_renderer_client.cc index dbb8bcebc1502..9a0f507951bbb 100644 --- a/shell/renderer/electron_renderer_client.cc +++ b/shell/renderer/electron_renderer_client.cc @@ -8,7 +8,6 @@ #include "base/command_line.h" #include "base/containers/contains.h" -#include "base/debug/stack_trace.h" #include "content/public/renderer/render_frame.h" #include "net/http/http_request_headers.h" #include "shell/common/api/electron_bindings.h" From 5e9bf3de31cc1e84bf91f759159b5ae7b5920cc8 Mon Sep 17 00:00:00 2001 From: BILL SHEN Date: Mon, 10 Nov 2025 19:06:28 +0800 Subject: [PATCH 225/268] fix: the parent window remained interactive after the modal window was opened (#48770) fix: fix the issue where the parent window remained interactive after the modal window was opened in somecases. --- shell/browser/native_window.cc | 3 ++- shell/browser/native_window_views.cc | 2 +- shell/common/options_switches.h | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index f69be2feb6051..5e02ef25c60a8 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -104,7 +104,8 @@ NativeWindow::NativeWindow(const gin_helper::Dictionary& options, transparent_{options.ValueOrDefault(options::kTransparent, false)}, enable_larger_than_screen_{ options.ValueOrDefault(options::kEnableLargerThanScreen, false)}, - is_modal_{parent != nullptr && options.ValueOrDefault("modal", false)}, + is_modal_{parent != nullptr && + options.ValueOrDefault(options::kModal, false)}, has_frame_{options.ValueOrDefault(options::kFrame, true) && title_bar_style_ == TitleBarStyle::kNormal}, parent_{parent} { diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index d1c742fad85ce..56507a30c0438 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -553,7 +553,7 @@ bool NativeWindowViews::IsFocused() const { } void NativeWindowViews::Show() { - if (is_modal() && NativeWindow::parent() && !widget()->IsVisible()) + if (is_modal() && NativeWindow::parent()) static_cast(parent())->IncrementChildModals(); widget()->native_widget_private()->Show(GetRestoredState(), gfx::Rect()); diff --git a/shell/common/options_switches.h b/shell/common/options_switches.h index 6cffc099c6999..a6410bef401e9 100644 --- a/shell/common/options_switches.h +++ b/shell/common/options_switches.h @@ -222,6 +222,8 @@ inline constexpr std::string_view kSpellcheck = "spellcheck"; inline constexpr std::string_view kEnableDeprecatedPaste = "enableDeprecatedPaste"; +inline constexpr std::string_view kModal = "modal"; + } // namespace options // Following are actually command line switches, should be moved to other files. From 85ea29981b948e0dfebbc6552a457b67546fdc9b Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" Date: Mon, 10 Nov 2025 13:27:35 +0100 Subject: [PATCH 226/268] chore: bump chromium to 144.0.7514.0 (main) (#48840) * chore: bump chromium in DEPS to 144.0.7514.0 * chore: update patches * 7119882: Reorganize //ui/gfx GN build target https://chromium-review.googlesource.com/c/chromium/src/+/7119882 * Replace includes with forward declares in rect_conversions.h https://chromium-review.googlesource.com/c/chromium/src/+/7127098 * Add ssl info to TrustedHeaderClient https://chromium-review.googlesource.com/c/chromium/src/+/7106780 * Replace ContentPluginInfo with WebPluginInfo https://chromium-review.googlesource.com/c/chromium/src/+/7127893 * Reland "[temporal] Unflag Temporal" https://chromium-review.googlesource.com/c/v8/v8/+/7123876 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt --- DEPS | 2 +- ..._mojom_interfaces_to_depend_on_blink.patch | 4 ++-- ..._depend_on_packed_resource_integrity.patch | 12 +++++----- patches/chromium/can_create_window.patch | 8 +++---- ...fy_chromium_handling_of_mouse_events.patch | 8 +++---- ...screationoverridden_with_full_params.patch | 6 ++--- .../chromium/enable_reset_aspect_ratio.patch | 4 ++-- ...xpose_setuseragent_on_networkcontext.patch | 2 +- ...t_allow_code_cache_in_custom_schemes.patch | 2 +- ...moothing_css_rule_and_blink_painting.patch | 2 +- ...screen_rendering_with_viz_compositor.patch | 2 +- ..._raw_response_headers_from_urlloader.patch | 12 +++++----- .../fix_aspect_ratio_with_max_size.patch | 4 ++-- ..._file_existence_before_setting_mtime.patch | 2 +- ...x_remove_caption-removing_style_call.patch | 4 ++-- ..._material_update_issue_on_windows_11.patch | 10 ++++---- ..._avoid_private_macos_api_usage.patch.patch | 24 ++++++++----------- ...emote_certificate_verification_logic.patch | 2 +- .../render_widget_host_view_mac.patch | 2 +- ...ean_up_stale_macwebcontentsocclusion.patch | 8 +++---- ...al_remove_unused_prehandlemouseevent.patch | 6 ++--- ...windowtreehostwin_window_enlargement.patch | 4 ++-- patches/chromium/scroll_bounce_flag.patch | 4 ++-- patches/node/.patches | 1 + .../reland_temporal_unflag_temporal.patch | 19 +++++++++++++++ shell/app/electron_content_client.cc | 23 ++++++++++-------- shell/app/electron_content_client.h | 2 +- .../net/proxying_url_loader_factory.cc | 1 + .../browser/net/proxying_url_loader_factory.h | 2 ++ shell/browser/net/proxying_websocket.cc | 8 ++++--- shell/browser/net/proxying_websocket.h | 2 ++ shell/common/electron_constants.h | 2 -- shell/common/gin_converters/gfx_converter.cc | 1 + shell/common/plugin_info.h | 2 +- 34 files changed, 111 insertions(+), 86 deletions(-) create mode 100644 patches/node/reland_temporal_unflag_temporal.patch diff --git a/DEPS b/DEPS index 32e0a7c9a586e..fa17c75c918a0 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '144.0.7512.1', + '144.0.7514.0', 'node_version': 'v24.11.0', 'nan_version': diff --git a/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch b/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch index ce3658f7696aa..dcd3fd78916bb 100644 --- a/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch +++ b/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch @@ -10,10 +10,10 @@ Needed for: 2) //electron/shell/common:web_contents_utility diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn -index e463b4c63105d021da2467844c8371eec6b8a836..bd81d75d735f997bf6aa9133e142b50759084b47 100644 +index 33440fbace3d6d9cbbe74c4ce0ccf7b6137b43e5..e92dac385501107848e9937cdc145ed0d2ec3bb7 100644 --- a/content/public/common/BUILD.gn +++ b/content/public/common/BUILD.gn -@@ -371,6 +371,8 @@ mojom("interfaces") { +@@ -363,6 +363,8 @@ mojom("interfaces") { "//content/common/*", "//extensions/common:mojom", "//extensions/common:mojom_blink", diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index 326f17d240413..ddbb47feef620 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -33,10 +33,10 @@ index 606b3bd43179a5b4179a6ec9f58e531d55c1acb5..4d503a53290b4deaea016bb6867f3c07 "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index a41ecd9b5776f3c56b4b1e3b29edee120600bf92..2e5e007ef68de105ba458a2ff771b4316aed2817 100644 +index 8875f14e87d62c5934612b635039265e8fe3fe60..eba5f45104d9837a6ab8c4aee2f6742ab4383a46 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4820,7 +4820,7 @@ static_library("browser") { +@@ -4822,7 +4822,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index a41ecd9b5776f3c56b4b1e3b29edee120600bf92..2e5e007ef68de105ba458a2ff771b431 # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 11b17980ae54d0e6d40b87821ff5e8831fc6315f..2be9c078fca499b63a21e0a72f498e93c2d1c6f4 100644 +index 1aa0ffd684c95f0c7818997b10dfabe61a055a64..24f733c03f5cdb376c4004841e86ddd5bba690e3 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7590,9 +7590,12 @@ test("unit_tests") { +@@ -7592,9 +7592,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index 11b17980ae54d0e6d40b87821ff5e8831fc6315f..2be9c078fca499b63a21e0a72f498e93 "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8533,6 +8536,10 @@ test("unit_tests") { +@@ -8535,6 +8538,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index 11b17980ae54d0e6d40b87821ff5e8831fc6315f..2be9c078fca499b63a21e0a72f498e93 sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8589,7 +8596,6 @@ test("unit_tests") { +@@ -8591,7 +8598,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 98f2944e3c59f..600abf5a40476 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -111,10 +111,10 @@ index 0d0e5e0eabbcb8ce19b675dadf5580f8381fb8ce..b10f6ae7612556e2f4cff60d38a88b5f bool opener_suppressed, bool* no_javascript_access); diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index be43d917f1c881e1c97ccb72860fddab4b113e3c..5a88086b6957b9addc0598d58c41288f0065b0e6 100644 +index 822aa432131b68722307c3d57a73bc0e5bd589ff..541a17144b2d906865a025711dee0be776712a93 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc -@@ -34,6 +34,17 @@ namespace content { +@@ -35,6 +35,17 @@ namespace content { WebContentsDelegate::WebContentsDelegate() = default; @@ -133,7 +133,7 @@ index be43d917f1c881e1c97ccb72860fddab4b113e3c..5a88086b6957b9addc0598d58c41288f WebContents* source, const OpenURLParams& params, diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 3d67b3751ef13c9a43e48a124aefaea24db9140c..dea523e84616527b9ac0a25e67c8664aafd3b511 100644 +index 31f7b81c176f8011e370c03b9f9d5016b12f6def..5780c53b97d983652a4e08009533a33abee228c8 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -18,6 +18,7 @@ @@ -151,7 +151,7 @@ index 3d67b3751ef13c9a43e48a124aefaea24db9140c..dea523e84616527b9ac0a25e67c8664a +#include "content/public/browser/web_contents.h" #include "content/public/common/window_container_type.mojom-forward.h" #include "third_party/blink/public/common/input/web_mouse_event.h" - #include "third_party/blink/public/common/mediastream/media_stream_request.h" + #include "third_party/blink/public/common/page/drag_operation.h" @@ -385,6 +387,16 @@ class CONTENT_EXPORT WebContentsDelegate { const StoragePartitionConfig& partition_config, SessionStorageNamespace* session_storage_namespace); diff --git a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch index cb612ff00f716..c257a1eaa798d 100644 --- a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch +++ b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch @@ -61,10 +61,10 @@ index b65ced55f997d5064b9d9338190567f8c264fce8..e8acd2828ed05deefa335ce2bb461f0c Widget* GetWidget(); const Widget* GetWidget() const; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 75a21333701b3501f785229ae9a358c5cac685df..579becb9a32704d932b8dfba477515af8529a2d4 100644 +index 1826e096e258004471ce2bd0c01bcdaff9d60022..faa7972cd2fb60bc9d20506309ce65ef4cafd233 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -3243,15 +3243,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -3247,15 +3247,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, } // We must let Windows handle the caption buttons if it's drawing them, or // they won't work. @@ -86,7 +86,7 @@ index 75a21333701b3501f785229ae9a358c5cac685df..579becb9a32704d932b8dfba477515af return 0; } } -@@ -3274,6 +3278,7 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -3278,6 +3282,7 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, // handle alt-space, or in the frame itself. is_right_mouse_pressed_on_caption_ = false; ReleaseCapture(); @@ -94,7 +94,7 @@ index 75a21333701b3501f785229ae9a358c5cac685df..579becb9a32704d932b8dfba477515af // |point| is in window coordinates, but WM_NCHITTEST and TrackPopupMenu() // expect screen coordinates. POINT screen_point = CR_POINT_INITIALIZER_FROM_LPARAM(l_param); -@@ -3281,7 +3286,17 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -3285,7 +3290,17 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, w_param = static_cast(SendMessage( hwnd(), WM_NCHITTEST, 0, MAKELPARAM(screen_point.x, screen_point.y))); if (w_param == HTCAPTION || w_param == HTSYSMENU) { diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index 27b5fd983b889..504fb2b580ada 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -237,10 +237,10 @@ index eebcf3d97557d5a95c00b483910a23717d1775c5..1cc8474a5f369cd0b13c328179c9be56 static_cast(delegate_->CreateCustomWebContents( opener, source_site_instance, is_new_browsing_instance, diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index 5a88086b6957b9addc0598d58c41288f0065b0e6..54ab4e1426eaa19bfe71b5fdd52e115aae4f0c45 100644 +index 541a17144b2d906865a025711dee0be776712a93..9223d7355402f07c666df7ac4c19e9eab7d90e99 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc -@@ -160,8 +160,7 @@ bool WebContentsDelegate::IsWebContentsCreationOverridden( +@@ -161,8 +161,7 @@ bool WebContentsDelegate::IsWebContentsCreationOverridden( SiteInstance* source_site_instance, mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -251,7 +251,7 @@ index 5a88086b6957b9addc0598d58c41288f0065b0e6..54ab4e1426eaa19bfe71b5fdd52e115a } diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index dea523e84616527b9ac0a25e67c8664aafd3b511..816b53d21e568a3d7a6f5902d87c5315ffedeee2 100644 +index 5780c53b97d983652a4e08009533a33abee228c8..1a73f726ac1cf55b2834cf8db57b84add376cf7a 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -365,8 +365,7 @@ class CONTENT_EXPORT WebContentsDelegate { diff --git a/patches/chromium/enable_reset_aspect_ratio.patch b/patches/chromium/enable_reset_aspect_ratio.patch index b25176e0399ee..7843bf5b3915c 100644 --- a/patches/chromium/enable_reset_aspect_ratio.patch +++ b/patches/chromium/enable_reset_aspect_ratio.patch @@ -19,10 +19,10 @@ index cb704a865eb1b748163a7c25b0a571585c2497b4..3b2fbefaeec2bac725d46bcfeea48812 excluded_margin); } diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 86aa7d062e6bfc4ceb79f8852bef34998538a338..14c6a37e16d66967a229c08de83c54192ccdc3c5 100644 +index a919d3bbafc1a16d66c647c2a1b7819af9d0dd1d..acd69eb0a38241db8ae5a3a1d7009366383d1817 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -1050,8 +1050,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen, +@@ -1054,8 +1054,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen, void HWNDMessageHandler::SetAspectRatio(float aspect_ratio, const gfx::Size& excluded_margin) { diff --git a/patches/chromium/expose_setuseragent_on_networkcontext.patch b/patches/chromium/expose_setuseragent_on_networkcontext.patch index 5793d3a202057..b65432f6f15d6 100644 --- a/patches/chromium/expose_setuseragent_on_networkcontext.patch +++ b/patches/chromium/expose_setuseragent_on_networkcontext.patch @@ -63,7 +63,7 @@ index 90cf1a70c068771ac98b2d5a283cba5e54c05ff4..0dc8de8d4e37e48cb28d8112c0233ac8 void SetEnableReferrers(bool enable_referrers) override; #if BUILDFLAG(IS_CT_SUPPORTED) diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index 8f1e7e517104a4849c96b19d8bedd57ac9a88ec6..6c7d5d8fd7a62c7d0484ae43664a36da6ef9b9ba 100644 +index 269b95a51029b2a2e42d663988f2c1b8a74f91a8..b819cd38ab8921d494caff3d2ae0ab86c9860d9c 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom @@ -1345,6 +1345,9 @@ interface NetworkContext { diff --git a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch index ec00fd692b604..d2febc523d98b 100644 --- a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch +++ b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch @@ -391,7 +391,7 @@ index 225e017909b8869231b870eaaf161a0b5e93e2a0..846a5251429630b8528a84a3d67ed56c if (schemes.allow_non_standard_schemes_in_origins) url::EnableNonStandardSchemesForAndroidWebView(); diff --git a/content/public/common/content_client.h b/content/public/common/content_client.h -index c81434acc7cad0f6aa2e807c3c4037052863179e..d0da89f78308fc95778a5ce705a43f03c9c5813f 100644 +index 33e2ff42e4d9da442d522b959a4a21c2f7032b6b..a0d81212327fc17e1f4704e78803c1d7d82b2016 100644 --- a/content/public/common/content_client.h +++ b/content/public/common/content_client.h @@ -139,6 +139,9 @@ class CONTENT_EXPORT ContentClient { diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index fad5d580f13e8..b8148ddbc7405 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -312,7 +312,7 @@ index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index 0c3ea906c3bca432f49835848519922bdd17e6ac..b18903a4f8e7f8cdcd7d5165ff25cd7fba3f7a5c 100644 +index 675877eb7d2f99ca4da455065dcf3a8e0a3eb5d5..d803d333f15d5b9426b44ad6d39bcb41f64a4591 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch index 82a5e49fffcc1..b5fd39f44be9a 100644 --- a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch +++ b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch @@ -563,7 +563,7 @@ index 399fba1a3d4e601dc2cdd5f1f4def8b7fd7a3011..8bcbe0d26c80323155d536c0d3a177a1 gpu::SyncPointManager* GetSyncPointManager() override; gpu::Scheduler* GetGpuScheduler() override; diff --git a/content/browser/compositor/viz_process_transport_factory.cc b/content/browser/compositor/viz_process_transport_factory.cc -index d8f825a29c50f47a35ef2ff4dc03c0a8d27d877d..4dba804d04626183c749b75b317fd26ee6d57f54 100644 +index 43d29976d8bd42d3ee6857db7d61f31c26795848..1d5852b1e4f1e628bd9b24b381ff3b17a4dd9165 100644 --- a/content/browser/compositor/viz_process_transport_factory.cc +++ b/content/browser/compositor/viz_process_transport_factory.cc @@ -381,8 +381,14 @@ void VizProcessTransportFactory::OnEstablishedGpuChannel( diff --git a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch index 33d1f9d565dd9..b44f9d05266ec 100644 --- a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch +++ b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch @@ -112,10 +112,10 @@ index 13a211107294e856616d1626fa1dc9c79eb5646c..549a36886d665c1a8100f09b7a86c8dc string mime_type; diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc -index e30252c08f9f82594ecd455c9db77e22fbd64296..4cf20063a2621575513f74257e1ea1a101420889 100644 +index a28a4bfc26a797dc862c59a337b4ed43b76eb06d..4da33fa9eef14b76f06d2741942fc387b2cde37d 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc -@@ -385,6 +385,9 @@ URLLoader::URLLoader( +@@ -386,6 +386,9 @@ URLLoader::URLLoader( mojo::SimpleWatcher::ArmingPolicy::MANUAL, TaskRunner(request.priority)), per_factory_orb_state_(context.GetMutableOrbState()), @@ -125,7 +125,7 @@ index e30252c08f9f82594ecd455c9db77e22fbd64296..4cf20063a2621575513f74257e1ea1a1 devtools_request_id_(request.devtools_request_id), options_(PopulateOptions(options, factory_params_->is_orb_enabled, -@@ -524,7 +527,7 @@ void URLLoader::SetUpUrlRequestCallbacks( +@@ -525,7 +528,7 @@ void URLLoader::SetUpUrlRequestCallbacks( &URLLoader::IsSharedDictionaryReadAllowed, base::Unretained(this))); } @@ -134,7 +134,7 @@ index e30252c08f9f82594ecd455c9db77e22fbd64296..4cf20063a2621575513f74257e1ea1a1 url_request_->SetResponseHeadersCallback(base::BindRepeating( &URLLoader::SetRawResponseHeaders, base::Unretained(this))); } -@@ -1121,6 +1124,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) { +@@ -1122,6 +1125,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) { } response_ = BuildResponseHead(); @@ -155,10 +155,10 @@ index e30252c08f9f82594ecd455c9db77e22fbd64296..4cf20063a2621575513f74257e1ea1a1 ad_auction_event_record_request_helper_.HandleResponse( diff --git a/services/network/url_loader.h b/services/network/url_loader.h -index d78b426e45a805ce03ec9ad6e160995f18d6ff24..26d998bdf534c5aa85dcef75f2df0a4f39296bfb 100644 +index f437df6e20b7d4e28f5e57e2134c5c7fa9da2bdc..661fef04f6b76abef852ba8eef63b1f78b01652c 100644 --- a/services/network/url_loader.h +++ b/services/network/url_loader.h -@@ -623,6 +623,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader +@@ -624,6 +624,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader std::unique_ptr resource_scheduler_request_handle_; diff --git a/patches/chromium/fix_aspect_ratio_with_max_size.patch b/patches/chromium/fix_aspect_ratio_with_max_size.patch index bbbb88a7985e4..f463042424617 100644 --- a/patches/chromium/fix_aspect_ratio_with_max_size.patch +++ b/patches/chromium/fix_aspect_ratio_with_max_size.patch @@ -11,10 +11,10 @@ enlarge window above dimensions set during creation of the BrowserWindow. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 14c6a37e16d66967a229c08de83c54192ccdc3c5..75a21333701b3501f785229ae9a358c5cac685df 100644 +index acd69eb0a38241db8ae5a3a1d7009366383d1817..1826e096e258004471ce2bd0c01bcdaff9d60022 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -3831,17 +3831,30 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param, +@@ -3835,17 +3835,30 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param, delegate_->GetMinMaxSize(&min_window_size, &max_window_size); min_window_size = delegate_->DIPToScreenSize(min_window_size); max_window_size = delegate_->DIPToScreenSize(max_window_size); diff --git a/patches/chromium/fix_check_for_file_existence_before_setting_mtime.patch b/patches/chromium/fix_check_for_file_existence_before_setting_mtime.patch index 33ca2f1da217c..194fb15119955 100644 --- a/patches/chromium/fix_check_for_file_existence_before_setting_mtime.patch +++ b/patches/chromium/fix_check_for_file_existence_before_setting_mtime.patch @@ -8,7 +8,7 @@ Check for broken links by confirming the file exists before setting its utime. This patch should be upstreamed & removed. diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py -index f2a9172815d80e6a9a70d7775eec6fdddd925461..54f78924eb09abf19d19c698e4c37f5ec3dc8249 100755 +index 1a35e992913acae102adc3faf0065ef13e6dbd1b..39e0d541e228e71108fa23717a906a0c543fe268 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py @@ -201,10 +201,9 @@ def DownloadAndUnpack(url, output_dir, path_prefixes=None, is_known_zip=False): diff --git a/patches/chromium/fix_remove_caption-removing_style_call.patch b/patches/chromium/fix_remove_caption-removing_style_call.patch index 8de69c9bfe130..d2d69ee08fa19 100644 --- a/patches/chromium/fix_remove_caption-removing_style_call.patch +++ b/patches/chromium/fix_remove_caption-removing_style_call.patch @@ -18,10 +18,10 @@ or resizing, but Electron does not seem to run into that issue for opaque frameless windows even with that block commented out. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 579becb9a32704d932b8dfba477515af8529a2d4..9e7e2740481af8e6a63e02e6c8ca4e448c25b0be 100644 +index faa7972cd2fb60bc9d20506309ce65ef4cafd233..ec43fba03d329ed4d8ec0ebc0bef23d31bfb9440 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -1857,7 +1857,23 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) { +@@ -1861,7 +1861,23 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) { SendMessage(hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0); diff --git a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch index 2f5266fec9b5f..df84f04bb6ec2 100644 --- a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch +++ b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch @@ -36,10 +36,10 @@ index 0cd07fd5fb55dcc0d972de4c027fcb895d156592..0f4d335e1d54b5e92fc217080d86513d // Overridden from DesktopWindowTreeHost: void Init(const Widget::InitParams& params) override; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 9e7e2740481af8e6a63e02e6c8ca4e448c25b0be..8449383866c668ffac830852b894c8fa525d5814 100644 +index ec43fba03d329ed4d8ec0ebc0bef23d31bfb9440..86cbf8cfdf10bc84c85724cd370cc0322e13b418 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -994,13 +994,13 @@ void HWNDMessageHandler::FrameTypeChanged() { +@@ -998,13 +998,13 @@ void HWNDMessageHandler::FrameTypeChanged() { void HWNDMessageHandler::PaintAsActiveChanged() { if (!delegate_->HasNonClientView() || !delegate_->CanActivate() || @@ -55,7 +55,7 @@ index 9e7e2740481af8e6a63e02e6c8ca4e448c25b0be..8449383866c668ffac830852b894c8fa } void HWNDMessageHandler::SetWindowIcons(const gfx::ImageSkia& window_icon, -@@ -1081,7 +1081,14 @@ void HWNDMessageHandler::SizeConstraintsChanged() { +@@ -1085,7 +1085,14 @@ void HWNDMessageHandler::SizeConstraintsChanged() { // allowing ui::GetResizableFrameThickness() to be used consistently when // removing the visible system frame. const bool had_caption_on_init = window_style() & WS_CAPTION; @@ -71,7 +71,7 @@ index 9e7e2740481af8e6a63e02e6c8ca4e448c25b0be..8449383866c668ffac830852b894c8fa const bool can_maximize = can_resize && delegate_->CanMaximize(); auto set_style_func = [&style](LONG bit, bool should_set) { -@@ -1679,11 +1686,16 @@ void HWNDMessageHandler::ResetWindowRegion(bool force, bool redraw) { +@@ -1683,11 +1690,16 @@ void HWNDMessageHandler::ResetWindowRegion(bool force, bool redraw) { // through, but that isn't the case when using Direct3D to draw transparent // windows. So we route translucent windows throught to the delegate to // allow for a custom hit mask. @@ -89,7 +89,7 @@ index 9e7e2740481af8e6a63e02e6c8ca4e448c25b0be..8449383866c668ffac830852b894c8fa return; } -@@ -2416,17 +2428,18 @@ LRESULT HWNDMessageHandler::OnNCActivate(UINT message, +@@ -2420,17 +2432,18 @@ LRESULT HWNDMessageHandler::OnNCActivate(UINT message, delegate_->SchedulePaint(); } diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index fc310818d9883..4dacc96e306ac 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -547,7 +547,7 @@ index 010c713090e5038dc90db131c8f621422d30c03b..20c35e887a0496ee609c077e3b0494bd void ForwardKeyboardEvent(const input::NativeWebKeyboardEvent& key_event, diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -index 6f3496b2541fa21fd0bba1d95026eab30e3ab96d..ef481cd946a15f5eaba928fa4e720e6c42556a93 100644 +index f69cd6100f2ac5ccb6f185e0d0bf186073ed5953..29a40923a55287b608c2ffae63a1dbbc2a7e7c1d 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -34,6 +34,7 @@ @@ -558,7 +558,7 @@ index 6f3496b2541fa21fd0bba1d95026eab30e3ab96d..ef481cd946a15f5eaba928fa4e720e6c #include "skia/ext/skia_utils_mac.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/mojom/input/input_handler.mojom.h" -@@ -2085,15 +2086,21 @@ - (NSAccessibilityRole)accessibilityRole { +@@ -2090,15 +2091,21 @@ - (NSAccessibilityRole)accessibilityRole { // Since this implementation doesn't have to wait any IPC calls, this doesn't // make any key-typing jank. --hbono 7/23/09 // @@ -1804,22 +1804,18 @@ index 890d86acb0e92760590b4d0860dd41eaa70486c7..2e9e16cb47606f627b1473a479a6e8ae // Query the display's refresh rate. double refresh_rate = 1.0 / screen.minimumRefreshInterval; diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn -index f29089286f4848400a67c3b7eaf21a1ba291cc1e..fa92acfa219f82cf53207e3a7479e44b223e9050 100644 +index 35e9149e221721c6d4332de530877588022bc7c7..2910455828b7d5025daa8e62071a68a67bed46d5 100644 --- a/ui/gfx/BUILD.gn +++ b/ui/gfx/BUILD.gn -@@ -333,6 +333,12 @@ component("gfx") { - "//ui/base:ui_data_pack", - ] - -+ if (is_mac) { -+ deps += [ -+ "//electron/build/config:generate_mas_config" -+ ] -+ } +@@ -277,6 +277,8 @@ component("gfx") { + "CoreGraphics.framework", + "CoreText.framework", + ] + - if (!is_apple) { ++ deps += ["//electron/build/config:generate_mas_config"] + } + if (is_ios) { sources += [ - "platform_font_skia.cc", diff --git a/ui/gfx/platform_font_mac.mm b/ui/gfx/platform_font_mac.mm index bbe355cf69f160866188216cc274d75bd35603db..06ee100d7ea2e892dbf3c0b1adc96c5013ef678a 100644 --- a/ui/gfx/platform_font_mac.mm diff --git a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch index f2c43f09a9742..4a7165124f5cb 100644 --- a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch +++ b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch @@ -190,7 +190,7 @@ index 3795ce4def719c36e1dace911be53b0103aeafc5..90cf1a70c068771ac98b2d5a283cba5e std::unique_ptr internal_host_resolver_; std::set, base::UniquePtrComparator> diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index bb6136990b69c61ac7e7e00e354f801be6955ff4..8f1e7e517104a4849c96b19d8bedd57ac9a88ec6 100644 +index f2de77f154f4290f4bbf60f6b5697fdc9383427a..269b95a51029b2a2e42d663988f2c1b8a74f91a8 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom @@ -311,6 +311,17 @@ struct SocketBrokerRemotes { diff --git a/patches/chromium/render_widget_host_view_mac.patch b/patches/chromium/render_widget_host_view_mac.patch index b1a9f80b6f599..9e7254cbb6954 100644 --- a/patches/chromium/render_widget_host_view_mac.patch +++ b/patches/chromium/render_widget_host_view_mac.patch @@ -8,7 +8,7 @@ respond to the first mouse click in their window, which is desirable for some kinds of utility windows. Similarly for `disableAutoHideCursor`. diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -index 84fabfc88085ab5c4d3e19db4bc472316e56f2f1..6f3496b2541fa21fd0bba1d95026eab30e3ab96d 100644 +index b17bc8928cc86536fa01bd85b921020a2c656ca3..f69cd6100f2ac5ccb6f185e0d0bf186073ed5953 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -167,6 +167,15 @@ void ExtractUnderlines(NSAttributedString* string, diff --git a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch index 34d049c142f2f..250843c98e0e1 100644 --- a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch +++ b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch @@ -254,10 +254,10 @@ index 17d6d7d935f93afefa9123f56ef9c138c3070f93..8dfa7501a6a2998e107bf9b51f5e5c3d } diff --git a/content/common/features.cc b/content/common/features.cc -index aa548cad26cb2a552cc34ea0e415a9a4ca5e2bba..4d28affac64b3ef741e75547495218cb781fc66d 100644 +index 67beba0ac7763c162eb105ecf3df3ca0c2ca4827..3742f8823ba1399b63b72145f12dbdfa02b4524d 100644 --- a/content/common/features.cc +++ b/content/common/features.cc -@@ -317,6 +317,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); +@@ -322,6 +322,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kIOSurfaceCapturer, base::FEATURE_ENABLED_BY_DEFAULT); #endif @@ -273,10 +273,10 @@ index aa548cad26cb2a552cc34ea0e415a9a4ca5e2bba..4d28affac64b3ef741e75547495218cb BASE_FEATURE(kKeepChildProcessAfterIPCReset, base::FEATURE_DISABLED_BY_DEFAULT); diff --git a/content/common/features.h b/content/common/features.h -index 07c6ff157fd519860206cf61b41a9be0cfa65ae7..03643e2ad38906d1e540aeecf3787c3e6c9a1450 100644 +index 9063ec69d6129e80c5679e3ccaf729adcfa85a58..5ccf4999afb697864a54284a7c5b0cb17ea4efdd 100644 --- a/content/common/features.h +++ b/content/common/features.h -@@ -112,6 +112,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); +@@ -115,6 +115,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); #if BUILDFLAG(IS_MAC) CONTENT_EXPORT BASE_DECLARE_FEATURE(kIOSurfaceCapturer); #endif diff --git a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch index 713bd8a5972a5..3d7e34e166cf5 100644 --- a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch +++ b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch @@ -83,10 +83,10 @@ index 2b562b8f8adaced3a87b45f04472313cee3eb479..e8b3edf974c6471ef72654544999e9fe const gfx::PointF& client_pt); void PreHandleDragExit(); diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index 54ab4e1426eaa19bfe71b5fdd52e115aae4f0c45..7f2d61d74ccdebee7310a67aaa8819eea52afa13 100644 +index 9223d7355402f07c666df7ac4c19e9eab7d90e99..2bd315eadaf1790d5e3fe104f18c20ffb20de99f 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc -@@ -126,6 +126,12 @@ bool WebContentsDelegate::HandleContextMenu(RenderFrameHost& render_frame_host, +@@ -127,6 +127,12 @@ bool WebContentsDelegate::HandleContextMenu(RenderFrameHost& render_frame_host, return false; } @@ -100,7 +100,7 @@ index 54ab4e1426eaa19bfe71b5fdd52e115aae4f0c45..7f2d61d74ccdebee7310a67aaa8819ee WebContents* source, const input::NativeWebKeyboardEvent& event) { diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 816b53d21e568a3d7a6f5902d87c5315ffedeee2..bf56692686ed554214081c322aedae2df023fedc 100644 +index 1a73f726ac1cf55b2834cf8db57b84add376cf7a..8115f86ee33c56080ff472fb0f0f227ce2c01e0c 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -311,6 +311,13 @@ class CONTENT_EXPORT WebContentsDelegate { diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index f58a2d0c4685b..e4ddeea1dee12 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index dffb16c851e3b336bdd1091735a51e2086e87d2e..a9bed1920ff9b1272fd41518b27a0056f0ef1825 100644 +index 7fbdf75c78249414e89828679c69f44573b44942..f8694b63f2c565990b7700059f226204a9559b10 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25633,6 +25633,21 @@ +@@ -25694,6 +25694,21 @@ ] } ], diff --git a/patches/chromium/scroll_bounce_flag.patch b/patches/chromium/scroll_bounce_flag.patch index fecaafb174a90..1ec9b59f5ccf6 100644 --- a/patches/chromium/scroll_bounce_flag.patch +++ b/patches/chromium/scroll_bounce_flag.patch @@ -6,10 +6,10 @@ Subject: scroll_bounce_flag.patch Patch to make scrollBounce option work. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc -index 3740f509d3271b3397b37727fd8e90b463225b1c..0082895db7b05c162ea242446e587e2f92f341dd 100644 +index f36413e02fae33f9d4ebdc1770674f422464577f..d881c99876918379ebc7f11956f2a64b91f50de4 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc -@@ -1215,7 +1215,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { +@@ -1213,7 +1213,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { } bool RenderThreadImpl::IsElasticOverscrollEnabled() { diff --git a/patches/node/.patches b/patches/node/.patches index b5162077835f6..172ea7c7e3ff6 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -42,3 +42,4 @@ chore_handle_support_for_import_defer_as_ns_and_import_defer.patch api_delete_deprecated_fields_on_v8_isolate.patch api_promote_deprecation_of_v8_context_and_v8_object_api_methods.patch src_use_cp_utf8_for_wide_file_names_on_win32.patch +reland_temporal_unflag_temporal.patch diff --git a/patches/node/reland_temporal_unflag_temporal.patch b/patches/node/reland_temporal_unflag_temporal.patch new file mode 100644 index 0000000000000..46f666064a170 --- /dev/null +++ b/patches/node/reland_temporal_unflag_temporal.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: John Kleinschmidt +Date: Fri, 7 Nov 2025 16:36:35 -0500 +Subject: Reland "[temporal] Unflag Temporal" + +https://chromium-review.googlesource.com/c/v8/v8/+/7123876 + +diff --git a/test/common/globals.js b/test/common/globals.js +index 34563b304f0e708ae066f8303a09e37b6bf123d6..cffba7d5f1936c4459b5afd91b8bc45b9038436d 100644 +--- a/test/common/globals.js ++++ b/test/common/globals.js +@@ -69,6 +69,7 @@ const intrinsics = new Set([ + 'SuppressedError', + 'DisposableStack', + 'AsyncDisposableStack', ++ 'Temporal' + ]); + + if (global.gc) { diff --git a/shell/app/electron_content_client.cc b/shell/app/electron_content_client.cc index c5740f769b353..e6fb2f3f7b315 100644 --- a/shell/app/electron_content_client.cc +++ b/shell/app/electron_content_client.cc @@ -13,7 +13,6 @@ #include "base/files/file_util.h" #include "base/strings/string_split.h" #include "content/public/common/buildflags.h" -#include "content/public/common/content_constants.h" #include "electron/buildflags/buildflags.h" #include "electron/fuses.h" #include "extensions/common/constants.h" @@ -37,7 +36,7 @@ #endif // BUILDFLAG(ENABLE_PDF_VIEWER) #if BUILDFLAG(ENABLE_PLUGINS) -#include "content/public/common/content_plugin_info.h" +#include "content/public/common/webplugininfo.h" #endif // BUILDFLAG(ENABLE_PLUGINS) namespace electron { @@ -162,21 +161,25 @@ void ElectronContentClient::AddAdditionalSchemes(Schemes* schemes) { } void ElectronContentClient::AddPlugins( - std::vector* plugins) { + std::vector* plugins) { #if BUILDFLAG(ENABLE_PDF_VIEWER) + static constexpr char16_t kPDFPluginName[] = u"Chromium PDF Plugin"; + static constexpr char16_t kPDFPluginDescription[] = u"Built-in PDF viewer"; static constexpr char kPDFPluginExtension[] = "pdf"; - static constexpr char kPDFPluginDescription[] = "Portable Document Format"; + static constexpr char kPDFPluginExtensionDescription[] = + "Portable Document Format"; - content::ContentPluginInfo pdf_info; - pdf_info.is_internal = true; - pdf_info.name = kPDFInternalPluginName; - pdf_info.description = kPDFPluginDescription; + content::WebPluginInfo pdf_info; + pdf_info.name = kPDFPluginName; // This isn't a real file path; it's just used as a unique identifier. static constexpr std::string_view kPdfPluginPath = "internal-pdf-viewer"; pdf_info.path = base::FilePath::FromASCII(kPdfPluginPath); - content::WebPluginMimeType pdf_mime_type( - pdf::kInternalPluginMimeType, kPDFPluginExtension, kPDFPluginDescription); + pdf_info.desc = kPDFPluginDescription; + content::WebPluginMimeType pdf_mime_type(pdf::kInternalPluginMimeType, + kPDFPluginExtension, + kPDFPluginExtensionDescription); pdf_info.mime_types.push_back(pdf_mime_type); + pdf_info.type = content::WebPluginInfo::PLUGIN_TYPE_BROWSER_INTERNAL_PLUGIN; plugins->push_back(pdf_info); #endif // BUILDFLAG(ENABLE_PDF_VIEWER) } diff --git a/shell/app/electron_content_client.h b/shell/app/electron_content_client.h index ffaab188bcfcf..f833881b77b86 100644 --- a/shell/app/electron_content_client.h +++ b/shell/app/electron_content_client.h @@ -29,7 +29,7 @@ class ElectronContentClient : public content::ContentClient { gfx::Image& GetNativeImageNamed(int resource_id) override; base::RefCountedMemory* GetDataResourceBytes(int resource_id) override; void AddAdditionalSchemes(Schemes* schemes) override; - void AddPlugins(std::vector* plugins) override; + void AddPlugins(std::vector* plugins) override; void AddContentDecryptionModules( std::vector* cdms, std::vector* cdm_host_file_paths) override; diff --git a/shell/browser/net/proxying_url_loader_factory.cc b/shell/browser/net/proxying_url_loader_factory.cc index c0c9d676491e0..6ea5536c9f706 100644 --- a/shell/browser/net/proxying_url_loader_factory.cc +++ b/shell/browser/net/proxying_url_loader_factory.cc @@ -343,6 +343,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnBeforeSendHeaders( void ProxyingURLLoaderFactory::InProgressRequest::OnHeadersReceived( const std::string& headers, const net::IPEndPoint& remote_endpoint, + const std::optional& ssl_info, OnHeadersReceivedCallback callback) { if (!current_request_uses_header_client_) { std::move(callback).Run(net::OK, std::nullopt, GURL()); diff --git a/shell/browser/net/proxying_url_loader_factory.h b/shell/browser/net/proxying_url_loader_factory.h index 0623946cf528e..e4b49d1820d69 100644 --- a/shell/browser/net/proxying_url_loader_factory.h +++ b/shell/browser/net/proxying_url_loader_factory.h @@ -23,6 +23,7 @@ #include "mojo/public/cpp/bindings/receiver_set.h" #include "mojo/public/cpp/bindings/remote.h" #include "net/base/completion_once_callback.h" +#include "net/ssl/ssl_info.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "services/network/public/cpp/resource_request.h" #include "services/network/public/mojom/network_context.mojom.h" @@ -115,6 +116,7 @@ class ProxyingURLLoaderFactory OnBeforeSendHeadersCallback callback) override; void OnHeadersReceived(const std::string& headers, const net::IPEndPoint& endpoint, + const std::optional& ssl_info, OnHeadersReceivedCallback callback) override; private: diff --git a/shell/browser/net/proxying_websocket.cc b/shell/browser/net/proxying_websocket.cc index 109250b271d2e..9b4a4358a79b7 100644 --- a/shell/browser/net/proxying_websocket.cc +++ b/shell/browser/net/proxying_websocket.cc @@ -207,9 +207,11 @@ void ProxyingWebSocket::OnBeforeSendHeaders( OnBeforeRequestComplete(net::OK); } -void ProxyingWebSocket::OnHeadersReceived(const std::string& headers, - const net::IPEndPoint& endpoint, - OnHeadersReceivedCallback callback) { +void ProxyingWebSocket::OnHeadersReceived( + const std::string& headers, + const net::IPEndPoint& endpoint, + const std::optional& ssl_info, + OnHeadersReceivedCallback callback) { DCHECK(receiver_as_header_client_.is_bound()); on_headers_received_callback_ = std::move(callback); diff --git a/shell/browser/net/proxying_websocket.h b/shell/browser/net/proxying_websocket.h index 4ce67b658e1a7..ef035c305a4b0 100644 --- a/shell/browser/net/proxying_websocket.h +++ b/shell/browser/net/proxying_websocket.h @@ -16,6 +16,7 @@ #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" +#include "net/ssl/ssl_info.h" #include "services/network/public/cpp/resource_request.h" #include "services/network/public/mojom/network_context.mojom.h" #include "services/network/public/mojom/websocket.mojom.h" @@ -94,6 +95,7 @@ class ProxyingWebSocket : public network::mojom::WebSocketHandshakeClient, OnBeforeSendHeadersCallback callback) override; void OnHeadersReceived(const std::string& headers, const net::IPEndPoint& endpoint, + const std::optional& ssl_info, OnHeadersReceivedCallback callback) override; static void StartProxying( diff --git a/shell/common/electron_constants.h b/shell/common/electron_constants.h index 2ddf98d25acf4..7456addb372f8 100644 --- a/shell/common/electron_constants.h +++ b/shell/common/electron_constants.h @@ -33,8 +33,6 @@ inline constexpr char kElectronGlobalShortcutsUuid[] = #if BUILDFLAG(ENABLE_PDF_VIEWER) inline constexpr std::string_view kPDFExtensionPluginName = "Chromium PDF Viewer"; -inline constexpr std::string_view kPDFInternalPluginName = - "Chromium PDF Plugin"; #endif // BUILDFLAG(ENABLE_PDF_VIEWER) } // namespace electron diff --git a/shell/common/gin_converters/gfx_converter.cc b/shell/common/gin_converters/gfx_converter.cc index 9f2787eaad3ef..19f3d49180d4f 100644 --- a/shell/common/gin_converters/gfx_converter.cc +++ b/shell/common/gin_converters/gfx_converter.cc @@ -16,6 +16,7 @@ #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/point_f.h" #include "ui/gfx/geometry/rect_conversions.h" +#include "ui/gfx/geometry/rect_f.h" #include "ui/gfx/geometry/resize_utils.h" #include "ui/gfx/geometry/size.h" diff --git a/shell/common/plugin_info.h b/shell/common/plugin_info.h index 94b5f009e08e8..fddfca63c3a04 100644 --- a/shell/common/plugin_info.h +++ b/shell/common/plugin_info.h @@ -7,7 +7,7 @@ #include -#include "content/public/common/content_plugin_info.h" +#include "content/public/common/webplugininfo.h" #include "electron/buildflags/buildflags.h" namespace electron { From fbf26efec488e047cdae66bf351bf873defe1175 Mon Sep 17 00:00:00 2001 From: Foad Lind Date: Mon, 10 Nov 2025 13:57:34 +0100 Subject: [PATCH 227/268] docs: update macOS version support in README (#48785) Update macOS version support in README Support for macOS 11 (BigSur) was removed from v38: https://www.electronjs.org/blog/electron-38-0#removed-macos-11-support --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 11e07d80a7df7..cf69aaa75182d 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ For more installation options and troubleshooting tips, see Each Electron release provides binaries for macOS, Windows, and Linux. -* macOS (Big Sur and up): Electron provides 64-bit Intel and Apple Silicon / ARM binaries for macOS. +* macOS (Monterey and up): Electron provides 64-bit Intel and Apple Silicon / ARM binaries for macOS. * Windows (Windows 10 and up): Electron provides `ia32` (`x86`), `x64` (`amd64`), and `arm64` binaries for Windows. Windows on ARM support was added in Electron 5.0.8. Support for Windows 7, 8 and 8.1 was [removed in Electron 23, in line with Chromium's Windows deprecation policy](https://www.electronjs.org/blog/windows-7-to-8-1-deprecation-notice). * Linux: The prebuilt binaries of Electron are built on Ubuntu 22.04. They have also been verified to work on: * Ubuntu 18.04 and newer From 028187159b5f0397022de1406f28a2dcc33a9867 Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" Date: Mon, 10 Nov 2025 18:44:49 +0100 Subject: [PATCH 228/268] chore: bump chromium to 144.0.7520.0 (main) (#48869) * chore: bump chromium in DEPS to 144.0.7520.0 * chore: fixup patch indices --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr --- DEPS | 2 +- ...xpose_several_extra_cipher_functions.patch | 4 ++-- ..._scheduler_throttling_per_renderview.patch | 4 ++-- ..._mojom_interfaces_to_depend_on_blink.patch | 4 ++-- ..._depend_on_packed_resource_integrity.patch | 12 +++++----- patches/chromium/can_create_window.patch | 14 ++++++------ ...hore_add_electron_deps_to_gitignores.patch | 2 +- ...ther_in_electron_views_and_delegates.patch | 8 +++---- ...fy_chromium_handling_of_mouse_events.patch | 8 +++---- ...screationoverridden_with_full_params.patch | 10 ++++----- .../chromium/enable_reset_aspect_ratio.patch | 4 ++-- ...t_allow_code_cache_in_custom_schemes.patch | 4 ++-- ...sharingpicker_on_supported_platforms.patch | 2 +- ...moothing_css_rule_and_blink_painting.patch | 6 ++--- ...screen_rendering_with_viz_compositor.patch | 6 ++--- .../fix_aspect_ratio_with_max_size.patch | 4 ++-- ...ingshelper_behind_branding_buildflag.patch | 14 ++++++------ ...x_remove_caption-removing_style_call.patch | 4 ++-- ..._material_update_issue_on_windows_11.patch | 10 ++++----- patches/chromium/frame_host_manager.patch | 4 ++-- ..._avoid_private_macos_api_usage.patch.patch | 22 +++++++++---------- ...ean_up_stale_macwebcontentsocclusion.patch | 8 +++---- ...windowtreehostwin_window_enlargement.patch | 4 ++-- patches/chromium/scroll_bounce_flag.patch | 4 ++-- patches/chromium/webview_fullscreen.patch | 2 +- .../worker_context_will_destroy.patch | 2 +- ...feat_add_hook_to_notify_script_ready.patch | 2 +- ...i_to_allow_electron_to_set_dock_side.patch | 4 ++-- 28 files changed, 87 insertions(+), 87 deletions(-) diff --git a/DEPS b/DEPS index fa17c75c918a0..93cdfb9a97d7e 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '144.0.7514.0', + '144.0.7520.0', 'node_version': 'v24.11.0', 'nan_version': diff --git a/patches/boringssl/feat_expose_several_extra_cipher_functions.patch b/patches/boringssl/feat_expose_several_extra_cipher_functions.patch index 3ea9fb6531fbc..c0f3497ce7835 100644 --- a/patches/boringssl/feat_expose_several_extra_cipher_functions.patch +++ b/patches/boringssl/feat_expose_several_extra_cipher_functions.patch @@ -118,10 +118,10 @@ index 891a73f229e3f0838cb2fa99b8fb24fdeac1962b..f7d0c5dc66f016eb9338c15e7f5ef59e callback(EVP_des_ede3_cbc(), "des-ede3-cbc", nullptr, arg); callback(EVP_rc2_cbc(), "rc2-cbc", nullptr, arg); diff --git a/include/openssl/cipher.h b/include/openssl/cipher.h -index a5533caf45eaacc4baef4a73d97e9bc2b6e3a942..35f24c1b22ea2c6b4766c0d87e75b6fc6b459f79 100644 +index 8b473699eb502cdd151a641d9ff242a7edcb42e8..a0a26d7c984a3d0f18d9fdf0424ced22580784a9 100644 --- a/include/openssl/cipher.h +++ b/include/openssl/cipher.h -@@ -461,6 +461,7 @@ OPENSSL_EXPORT const EVP_CIPHER *EVP_des_ede3_ecb(void); +@@ -552,6 +552,7 @@ OPENSSL_EXPORT const EVP_CIPHER *EVP_des_ede3_ecb(void); // EVP_aes_128_cfb128 is only available in decrepit. OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_cfb128(void); diff --git a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch index 2c583a41ee8bc..b209365c70401 100644 --- a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -6,10 +6,10 @@ Subject: allow disabling blink scheduler throttling per RenderView This allows us to disable throttling for hidden windows. diff --git a/content/browser/renderer_host/navigation_controller_impl_unittest.cc b/content/browser/renderer_host/navigation_controller_impl_unittest.cc -index 5765fe8264ecf117d68cdc2c95517f2fcc22715f..37a734f120427571cf5f4f7b6b6eabb881ba59cb 100644 +index ab916b56116e911af3cf6655cdd68ce139e260b9..f148ce57ae6c75f6635fca487d9493199b79a9f3 100644 --- a/content/browser/renderer_host/navigation_controller_impl_unittest.cc +++ b/content/browser/renderer_host/navigation_controller_impl_unittest.cc -@@ -168,6 +168,12 @@ class MockPageBroadcast : public blink::mojom::PageBroadcast { +@@ -167,6 +167,12 @@ class MockPageBroadcast : public blink::mojom::PageBroadcast { (bool supports_draggable_regions), (override)); diff --git a/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch b/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch index dcd3fd78916bb..5f9550a820635 100644 --- a/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch +++ b/patches/chromium/build_allow_electron_mojom_interfaces_to_depend_on_blink.patch @@ -10,10 +10,10 @@ Needed for: 2) //electron/shell/common:web_contents_utility diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn -index 33440fbace3d6d9cbbe74c4ce0ccf7b6137b43e5..e92dac385501107848e9937cdc145ed0d2ec3bb7 100644 +index 49f3360c3d5ff66ebbc7d6164de3f7ff7244b1fe..ec9018d38520dfca461e9dbb041566b0b3400133 100644 --- a/content/public/common/BUILD.gn +++ b/content/public/common/BUILD.gn -@@ -363,6 +363,8 @@ mojom("interfaces") { +@@ -362,6 +362,8 @@ mojom("interfaces") { "//content/common/*", "//extensions/common:mojom", "//extensions/common:mojom_blink", diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index ddbb47feef620..d26a27a3fb59d 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -33,10 +33,10 @@ index 606b3bd43179a5b4179a6ec9f58e531d55c1acb5..4d503a53290b4deaea016bb6867f3c07 "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 8875f14e87d62c5934612b635039265e8fe3fe60..eba5f45104d9837a6ab8c4aee2f6742ab4383a46 100644 +index 1b6ba974b641ba9f352cf15e311fa93e1268b06c..f26b6e92617a6df6f8adb1bce51f26f06e66c701 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4822,7 +4822,7 @@ static_library("browser") { +@@ -4825,7 +4825,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index 8875f14e87d62c5934612b635039265e8fe3fe60..eba5f45104d9837a6ab8c4aee2f6742a # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 1aa0ffd684c95f0c7818997b10dfabe61a055a64..24f733c03f5cdb376c4004841e86ddd5bba690e3 100644 +index 28283d8cf5763bcbb46f341cb32ba0ef420ae7ba..a726da764f742d9f867b1a02e86d6b5ace61511d 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7592,9 +7592,12 @@ test("unit_tests") { +@@ -7595,9 +7595,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index 1aa0ffd684c95f0c7818997b10dfabe61a055a64..24f733c03f5cdb376c4004841e86ddd5 "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8535,6 +8538,10 @@ test("unit_tests") { +@@ -8539,6 +8542,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index 1aa0ffd684c95f0c7818997b10dfabe61a055a64..24f733c03f5cdb376c4004841e86ddd5 sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8591,7 +8598,6 @@ test("unit_tests") { +@@ -8595,7 +8602,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 600abf5a40476..cd1033a3ac124 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,10 +9,10 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 204d1908aa403c0db48c4a40c5f2068c6453e16e..034e8a1204badd4facef51a048f12e7c18b34f5d 100644 +index 6e79165d538668580a1061857dfdefd4b3d5906c..469cfce5b48987268f7e95ea0e5edd75623558e8 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -9956,6 +9956,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -9965,6 +9965,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To(), params->frame_name, params->disposition, *params->features, @@ -77,10 +77,10 @@ index 599077542beacefc94f9e7ce6167312c9d66aaae..389896afb982dd0fc48274857c18fcd9 // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 759d220cdd24a099cbe3080d822f24b666717b22..f7d2f76eeca29b1e48143a887fd4836db8d07872 100644 +index 36b83126680292a9606203837b7e20e039e2e705..98c73c5530e17f88aaa4ea089196e7cf277c52f1 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -884,6 +884,8 @@ bool ContentBrowserClient::CanCreateWindow( +@@ -885,6 +885,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -90,7 +90,7 @@ index 759d220cdd24a099cbe3080d822f24b666717b22..f7d2f76eeca29b1e48143a887fd4836d bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 0d0e5e0eabbcb8ce19b675dadf5580f8381fb8ce..b10f6ae7612556e2f4cff60d38a88b5f1ad1757d 100644 +index d47725f4a53e4338443afcdea66ea34b73afac1a..fae2d2f743c6798340438dcc8b9ad0a38e6b1617 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -203,6 +203,7 @@ class NetworkService; @@ -101,7 +101,7 @@ index 0d0e5e0eabbcb8ce19b675dadf5580f8381fb8ce..b10f6ae7612556e2f4cff60d38a88b5f } // namespace network namespace sandbox { -@@ -1461,6 +1462,8 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -1462,6 +1463,8 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -232,7 +232,7 @@ index 82e9d3dfb5f7da76d89fe15ae61d379fa46e177d..fd035512099a54dff6cc951a2226c23a } // namespace blink diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc -index 04c6dad1650273f15d60f8ad6bf51ca771f77923..ae64f6f689bdaa1221634b2b434e62c52aa9084f 100644 +index c583c10c0f3d6e0a7e02bcd54bc8237e932914fe..139c4f7f39d5d43bd4ddae4afedf7e60ac8437c7 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc @@ -2340,6 +2340,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, diff --git a/patches/chromium/chore_add_electron_deps_to_gitignores.patch b/patches/chromium/chore_add_electron_deps_to_gitignores.patch index 0989313d3805b..f0e9f46157706 100644 --- a/patches/chromium/chore_add_electron_deps_to_gitignores.patch +++ b/patches/chromium/chore_add_electron_deps_to_gitignores.patch @@ -6,7 +6,7 @@ Subject: chore: add electron deps to gitignores Makes things like "git status" quicker when developing electron locally diff --git a/.gitignore b/.gitignore -index 22985d0edf211adc576c14ddb0fb21192a636d99..210132f7864c04ac7ffab70875b1c8905bd00e62 100644 +index e3b01b0a2b878681a861f76cb10f5b40bbc29a3d..277b05e37dadfd32fbcbbe1e596508aafd4313ba 100644 --- a/.gitignore +++ b/.gitignore @@ -228,6 +228,7 @@ vs-chromium-project.txt diff --git a/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch b/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch index 2d5394b17148a..a940a178926ed 100644 --- a/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch +++ b/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch @@ -49,7 +49,7 @@ index a6d23b384136e27eeb8d864af154aa020cab0fb1..bdc88396c84b0cccc2933a19a7772c14 // These existing cases are "grandfathered in", but there shouldn't be more. // See comments atop class. diff --git a/ui/views/widget/widget_delegate.h b/ui/views/widget/widget_delegate.h -index 1f9c24adbdbe5d2bbd72099d234569c9fdbf863d..b437dd07f15f99cfaa35874f69fd4f19a1b343ba 100644 +index 7695f926b19cc81dfce9995a4ebac9dd50782ec0..c73616912049615c269be47ef733a6b15546c8c6 100644 --- a/ui/views/widget/widget_delegate.h +++ b/ui/views/widget/widget_delegate.h @@ -168,6 +168,12 @@ namespace crostini { @@ -65,7 +65,7 @@ index 1f9c24adbdbe5d2bbd72099d234569c9fdbf863d..b437dd07f15f99cfaa35874f69fd4f19 namespace exo { class ShellSurfaceBase; } -@@ -371,6 +377,7 @@ class VIEWS_EXPORT WidgetDelegate { +@@ -372,6 +378,7 @@ class VIEWS_EXPORT WidgetDelegate { class OwnedByWidgetPassKey { private: @@ -73,7 +73,7 @@ index 1f9c24adbdbe5d2bbd72099d234569c9fdbf863d..b437dd07f15f99cfaa35874f69fd4f19 // DO NOT ADD TO THIS LIST! // These existing cases are "grandfathered in", but there shouldn't be more. // See comments atop `SetOwnedByWidget()`. -@@ -464,6 +471,7 @@ class VIEWS_EXPORT WidgetDelegate { +@@ -465,6 +472,7 @@ class VIEWS_EXPORT WidgetDelegate { }; class RegisterDeleteCallbackPassKey { private: @@ -81,7 +81,7 @@ index 1f9c24adbdbe5d2bbd72099d234569c9fdbf863d..b437dd07f15f99cfaa35874f69fd4f19 // DO NOT ADD TO THIS LIST! // These existing cases are "grandfathered in", but there shouldn't be more. // See comments atop `RegisterDeleteDelegateCallback()`. -@@ -920,6 +928,7 @@ class VIEWS_EXPORT WidgetDelegateView : public WidgetDelegate, public View { +@@ -921,6 +929,7 @@ class VIEWS_EXPORT WidgetDelegateView : public WidgetDelegate, public View { View* GetContentsView() override; private: diff --git a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch index c257a1eaa798d..043de11892396 100644 --- a/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch +++ b/patches/chromium/chore_modify_chromium_handling_of_mouse_events.patch @@ -61,10 +61,10 @@ index b65ced55f997d5064b9d9338190567f8c264fce8..e8acd2828ed05deefa335ce2bb461f0c Widget* GetWidget(); const Widget* GetWidget() const; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 1826e096e258004471ce2bd0c01bcdaff9d60022..faa7972cd2fb60bc9d20506309ce65ef4cafd233 100644 +index a71630354ee345224371980675d09dc16fdcff16..a834cc49a3a02acdcd127f3f0fb084fa806435e5 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -3247,15 +3247,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -3250,15 +3250,19 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, } // We must let Windows handle the caption buttons if it's drawing them, or // they won't work. @@ -86,7 +86,7 @@ index 1826e096e258004471ce2bd0c01bcdaff9d60022..faa7972cd2fb60bc9d20506309ce65ef return 0; } } -@@ -3278,6 +3282,7 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -3281,6 +3285,7 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, // handle alt-space, or in the frame itself. is_right_mouse_pressed_on_caption_ = false; ReleaseCapture(); @@ -94,7 +94,7 @@ index 1826e096e258004471ce2bd0c01bcdaff9d60022..faa7972cd2fb60bc9d20506309ce65ef // |point| is in window coordinates, but WM_NCHITTEST and TrackPopupMenu() // expect screen coordinates. POINT screen_point = CR_POINT_INITIALIZER_FROM_LPARAM(l_param); -@@ -3285,7 +3290,17 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -3288,7 +3293,17 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, w_param = static_cast(SendMessage( hwnd(), WM_NCHITTEST, 0, MAKELPARAM(screen_point.x, screen_point.y))); if (w_param == HTCAPTION || w_param == HTSYSMENU) { diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index 504fb2b580ada..1638d42d2c1b7 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -80,10 +80,10 @@ index 39fa45f0a0f9076bd7ac0be6f455dd540a276512..3d0381d463eed73470b28085830f2a23 content::WebContents* source, const content::OpenURLParams& params, diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index 31f64282d734bda5c0f3aa592fbf3a5ca53d2ac8..cb2aec88f4bfecbecf085684780686afd5d91da4 100644 +index b3eb633c290c5385a58b66a97b1a57b3fe080ab2..faf64b12913aac5cef8a614a0baabb16771dbb3c 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc -@@ -2369,7 +2369,8 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2373,7 +2373,8 @@ bool Browser::IsWebContentsCreationOverridden( content::mojom::WindowContainerType window_container_type, const GURL& opener_url, const std::string& frame_name, @@ -93,7 +93,7 @@ index 31f64282d734bda5c0f3aa592fbf3a5ca53d2ac8..cb2aec88f4bfecbecf085684780686af if (HasActorTask(profile(), opener)) { // If an ExecutionEngine is acting on the opener, prevent it from creating a // new WebContents. We'll instead force the navigation to happen in the same -@@ -2382,7 +2383,7 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -2386,7 +2387,7 @@ bool Browser::IsWebContentsCreationOverridden( return (window_container_type == content::mojom::WindowContainerType::BACKGROUND && ShouldCreateBackgroundContents(source_site_instance, opener_url, @@ -103,10 +103,10 @@ index 31f64282d734bda5c0f3aa592fbf3a5ca53d2ac8..cb2aec88f4bfecbecf085684780686af WebContents* Browser::CreateCustomWebContents( diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h -index 870b47d1a4212b7ec8dde4d0b13266c6ddca4ac6..40d9ee3e7472f15a60eaa8039f2cf8c12c47e324 100644 +index 0c296e8bf3b055b8e6f07adcc9b088febd489f14..533041e1948726eef266625e541f65735dc81e8f 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h -@@ -930,8 +930,7 @@ class Browser : public TabStripModelObserver, +@@ -942,8 +942,7 @@ class Browser : public TabStripModelObserver, content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, diff --git a/patches/chromium/enable_reset_aspect_ratio.patch b/patches/chromium/enable_reset_aspect_ratio.patch index 7843bf5b3915c..180416e36944f 100644 --- a/patches/chromium/enable_reset_aspect_ratio.patch +++ b/patches/chromium/enable_reset_aspect_ratio.patch @@ -19,10 +19,10 @@ index cb704a865eb1b748163a7c25b0a571585c2497b4..3b2fbefaeec2bac725d46bcfeea48812 excluded_margin); } diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index a919d3bbafc1a16d66c647c2a1b7819af9d0dd1d..acd69eb0a38241db8ae5a3a1d7009366383d1817 100644 +index e9197d95aa22f92007045537b004ea2e38a5d4f5..80683ec77cdc77d624254c19708f12acd47316a1 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -1054,8 +1054,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen, +@@ -1057,8 +1057,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen, void HWNDMessageHandler::SetAspectRatio(float aspect_ratio, const gfx::Size& excluded_margin) { diff --git a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch index d2febc523d98b..b4ed891f56323 100644 --- a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch +++ b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch @@ -405,7 +405,7 @@ index 33e2ff42e4d9da442d522b959a4a21c2f7032b6b..a0d81212327fc17e1f4704e78803c1d7 std::vector extension_schemes; // Registers a URL scheme with a predefined default custom handler. diff --git a/url/url_util.cc b/url/url_util.cc -index 87894c72227acdd951d61e3985d97215750a9748..5f270d100e76b441b1bfde0aed6ab850b843d8f6 100644 +index 40d4419dbc658d91ff9dd40318d3ff1476a6c86c..ecfa10f4d09cf0d67a33538d4fa38dd5f1306b7e 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -136,6 +136,9 @@ struct SchemeRegistry { @@ -418,7 +418,7 @@ index 87894c72227acdd951d61e3985d97215750a9748..5f270d100e76b441b1bfde0aed6ab850 // Schemes with a predefined default custom handler. std::vector predefined_handler_schemes; -@@ -676,6 +679,15 @@ const std::vector& GetEmptyDocumentSchemes() { +@@ -677,6 +680,15 @@ const std::vector& GetEmptyDocumentSchemes() { return GetSchemeRegistry().empty_document_schemes; } diff --git a/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch b/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch index d2ff23afa20aa..98118597066f3 100644 --- a/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch +++ b/patches/chromium/feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch @@ -311,7 +311,7 @@ index c2d8bbafa39c05f25641f2fd3491ef7f84f4f6a1..5506583824e10d664f32c71d63fda1aa // Although ScreenCaptureKit is available in 12.3 there were some bugs that diff --git a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc -index 2b58244d3d8ca03d900a8c4450ded607861b45f6..1c5b2650c7a1193fd9af74b3826e363a43b676ad 100644 +index 2f871f0ef51e49d1f78e56b125bbf721dd3562e2..02da1596d4f1251f8e8a8bcba0b9372feb066647 100644 --- a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc +++ b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc @@ -316,8 +316,16 @@ void InProcessVideoCaptureDeviceLauncher::LaunchDeviceAsync( diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index b8148ddbc7405..8a55da352de83 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -89,10 +89,10 @@ index aaf56976e7ac7a4efe904a5275722fdc02172bae..670d3f91ec556e415a80bb01341c4047 return a.EmptyCells() == b.EmptyCells(); case CSSPropertyID::kFill: diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -index 4e79b356bd2fc7721fca6caf0004d76841216aad..510f7915185f488c8e98514c011bb4250a220a2b 100644 +index 739fdb04466eb5b4d29e3f642fe96c622c4bf5bf..f5aa8d719a54554f0798290475a3d4bd000beca5 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -@@ -12640,5 +12640,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( +@@ -12629,5 +12629,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( CSSValueID::kNone>(stream); } @@ -312,7 +312,7 @@ index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index 675877eb7d2f99ca4da455065dcf3a8e0a3eb5d5..d803d333f15d5b9426b44ad6d39bcb41f64a4591 100644 +index b34a71d7dce7297387d0fbb4b8f4e4429366515a..2c006f993c328b6e71654b548ec841e369becb7e 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch index b5fd39f44be9a..d8a38996d00b9 100644 --- a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch +++ b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch @@ -90,7 +90,7 @@ index 8af69cac78b7488d28f1f05ccb174793fe5148cd..9f74e511c263d147b5fbe81fe100d217 private: const HWND hwnd_; diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn -index 89f08e2693d9101e89dd007df80881ff726195ad..1becf5ba595e60d1fb270ca2596b474c24682952 100644 +index 9af007dfc14e442d34ebe82fc678ea9f32782cdf..850f8627170b4de652b2975f47d7bc48458d8ed7 100644 --- a/components/viz/service/BUILD.gn +++ b/components/viz/service/BUILD.gn @@ -176,6 +176,8 @@ viz_component("service") { @@ -596,10 +596,10 @@ index 78a96bff9ba9e24dababf758ba38f9b430b39a14..7b46e68f52e3c13f731ce48670600442 // Sends the created child window to the browser process so that it can be diff --git a/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom b/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom -index ad6f66db209484678e74807f091f03683307e7ce..73a5100e4e2f321f88829ba9a311f1c2f04823c6 100644 +index e440ae1c216333afe1d90114d48a3bf7f39cf41f..4b3aba1c87e2e0fe1628681fb8b5cf19bfc54f80 100644 --- a/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom +++ b/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom -@@ -39,6 +39,7 @@ struct RootCompositorFrameSinkParams { +@@ -40,6 +40,7 @@ struct RootCompositorFrameSinkParams { bool send_swap_size_notifications = false; // Disables begin frame rate limiting for the display compositor. bool disable_frame_rate_limit = false; diff --git a/patches/chromium/fix_aspect_ratio_with_max_size.patch b/patches/chromium/fix_aspect_ratio_with_max_size.patch index f463042424617..e05675df51c7d 100644 --- a/patches/chromium/fix_aspect_ratio_with_max_size.patch +++ b/patches/chromium/fix_aspect_ratio_with_max_size.patch @@ -11,10 +11,10 @@ enlarge window above dimensions set during creation of the BrowserWindow. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index acd69eb0a38241db8ae5a3a1d7009366383d1817..1826e096e258004471ce2bd0c01bcdaff9d60022 100644 +index 80683ec77cdc77d624254c19708f12acd47316a1..a71630354ee345224371980675d09dc16fdcff16 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -3835,17 +3835,30 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param, +@@ -3838,17 +3838,30 @@ void HWNDMessageHandler::SizeWindowToAspectRatio(UINT param, delegate_->GetMinMaxSize(&min_window_size, &max_window_size); min_window_size = delegate_->DIPToScreenSize(min_window_size); max_window_size = delegate_->DIPToScreenSize(max_window_size); diff --git a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch index 45f794fb675a8..d89f9b19a5f85 100644 --- a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch +++ b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch @@ -9,7 +9,7 @@ to support content settings UI. The support pulls in chrome content settings and UI code which are not valid in the scope of Electron. diff --git a/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc b/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc -index 0447540c064d7234775e8faf13718d9b786c9395..2a41ce63b49e905128a804da579cf1749cc17c37 100644 +index a8a1ec300d9286f641f4676be54121eddc9c0ba1..b25a7fe369207f24b52cf1c98abe70f403b95ded 100644 --- a/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc +++ b/chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc @@ -6,6 +6,7 @@ @@ -31,7 +31,7 @@ index 0447540c064d7234775e8faf13718d9b786c9395..2a41ce63b49e905128a804da579cf174 #include "chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker.h" #include "chrome/browser/picture_in_picture/picture_in_picture_window.h" #include "media/base/media_switches.h" -@@ -68,6 +71,7 @@ constexpr double kMaxWindowSizeRatio = 0.8; +@@ -67,6 +70,7 @@ constexpr double kMaxWindowSizeRatio = 0.8; // `kMaxWindowSizeRatio`. constexpr double kMaxSiteRequestedWindowSizeRatio = 0.25; @@ -39,7 +39,7 @@ index 0447540c064d7234775e8faf13718d9b786c9395..2a41ce63b49e905128a804da579cf174 // Returns true if a document picture-in-picture window should be focused upon // opening it. bool ShouldFocusPictureInPictureWindow(const NavigateParams& params) { -@@ -84,6 +88,7 @@ bool ShouldFocusPictureInPictureWindow(const NavigateParams& params) { +@@ -83,6 +87,7 @@ bool ShouldFocusPictureInPictureWindow(const NavigateParams& params) { // AutoPictureInPictureTabHelper. return !auto_picture_in_picture_tab_helper->IsInAutoPictureInPicture(); } @@ -47,7 +47,7 @@ index 0447540c064d7234775e8faf13718d9b786c9395..2a41ce63b49e905128a804da579cf174 // Returns the maximum area in pixels that the site can request a // picture-in-picture window to be. -@@ -221,7 +226,7 @@ bool PictureInPictureWindowManager::ExitPictureInPictureViaWindowUi( +@@ -220,7 +225,7 @@ bool PictureInPictureWindowManager::ExitPictureInPictureViaWindowUi( return false; } @@ -56,7 +56,7 @@ index 0447540c064d7234775e8faf13718d9b786c9395..2a41ce63b49e905128a804da579cf174 // The user manually closed the pip window, so let the tab helper know in case // the auto-pip permission dialog was visible. if (auto* tab_helper = AutoPictureInPictureTabHelper::FromWebContents( -@@ -572,7 +577,7 @@ gfx::Size PictureInPictureWindowManager::GetMaximumWindowSize( +@@ -571,7 +576,7 @@ gfx::Size PictureInPictureWindowManager::GetMaximumWindowSize( // static void PictureInPictureWindowManager::SetWindowParams(NavigateParams& params) { @@ -65,7 +65,7 @@ index 0447540c064d7234775e8faf13718d9b786c9395..2a41ce63b49e905128a804da579cf174 // Always show document picture-in-picture in a new window. When this is // not opened via the AutoPictureInPictureTabHelper, focus the window. params.window_action = -@@ -680,6 +685,7 @@ PictureInPictureWindowManager::GetOverlayView( +@@ -672,6 +677,7 @@ PictureInPictureWindowManager::GetOverlayView( return nullptr; } @@ -73,7 +73,7 @@ index 0447540c064d7234775e8faf13718d9b786c9395..2a41ce63b49e905128a804da579cf174 // It would be nice to create this in `EnterPictureInPicture*`, but detecting // auto-pip while pip is in the process of opening doesn't work. // -@@ -718,6 +724,8 @@ PictureInPictureWindowManager::GetOverlayView( +@@ -710,6 +716,8 @@ PictureInPictureWindowManager::GetOverlayView( } return overlay_view; diff --git a/patches/chromium/fix_remove_caption-removing_style_call.patch b/patches/chromium/fix_remove_caption-removing_style_call.patch index d2d69ee08fa19..48214c6be71e2 100644 --- a/patches/chromium/fix_remove_caption-removing_style_call.patch +++ b/patches/chromium/fix_remove_caption-removing_style_call.patch @@ -18,10 +18,10 @@ or resizing, but Electron does not seem to run into that issue for opaque frameless windows even with that block commented out. diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index faa7972cd2fb60bc9d20506309ce65ef4cafd233..ec43fba03d329ed4d8ec0ebc0bef23d31bfb9440 100644 +index a834cc49a3a02acdcd127f3f0fb084fa806435e5..1633d495f43d34f71e8238dca0b30e990f96b459 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -1861,7 +1861,23 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) { +@@ -1864,7 +1864,23 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) { SendMessage(hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0); diff --git a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch index df84f04bb6ec2..b02b34ac72df0 100644 --- a/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch +++ b/patches/chromium/fix_resolve_dynamic_background_material_update_issue_on_windows_11.patch @@ -36,10 +36,10 @@ index 0cd07fd5fb55dcc0d972de4c027fcb895d156592..0f4d335e1d54b5e92fc217080d86513d // Overridden from DesktopWindowTreeHost: void Init(const Widget::InitParams& params) override; diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index ec43fba03d329ed4d8ec0ebc0bef23d31bfb9440..86cbf8cfdf10bc84c85724cd370cc0322e13b418 100644 +index 1633d495f43d34f71e8238dca0b30e990f96b459..60d952d3d0ebf99c6b22bd35b952cea39cdd82ef 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -998,13 +998,13 @@ void HWNDMessageHandler::FrameTypeChanged() { +@@ -1001,13 +1001,13 @@ void HWNDMessageHandler::FrameTypeChanged() { void HWNDMessageHandler::PaintAsActiveChanged() { if (!delegate_->HasNonClientView() || !delegate_->CanActivate() || @@ -55,7 +55,7 @@ index ec43fba03d329ed4d8ec0ebc0bef23d31bfb9440..86cbf8cfdf10bc84c85724cd370cc032 } void HWNDMessageHandler::SetWindowIcons(const gfx::ImageSkia& window_icon, -@@ -1085,7 +1085,14 @@ void HWNDMessageHandler::SizeConstraintsChanged() { +@@ -1088,7 +1088,14 @@ void HWNDMessageHandler::SizeConstraintsChanged() { // allowing ui::GetResizableFrameThickness() to be used consistently when // removing the visible system frame. const bool had_caption_on_init = window_style() & WS_CAPTION; @@ -71,7 +71,7 @@ index ec43fba03d329ed4d8ec0ebc0bef23d31bfb9440..86cbf8cfdf10bc84c85724cd370cc032 const bool can_maximize = can_resize && delegate_->CanMaximize(); auto set_style_func = [&style](LONG bit, bool should_set) { -@@ -1683,11 +1690,16 @@ void HWNDMessageHandler::ResetWindowRegion(bool force, bool redraw) { +@@ -1686,11 +1693,16 @@ void HWNDMessageHandler::ResetWindowRegion(bool force, bool redraw) { // through, but that isn't the case when using Direct3D to draw transparent // windows. So we route translucent windows throught to the delegate to // allow for a custom hit mask. @@ -89,7 +89,7 @@ index ec43fba03d329ed4d8ec0ebc0bef23d31bfb9440..86cbf8cfdf10bc84c85724cd370cc032 return; } -@@ -2420,17 +2432,18 @@ LRESULT HWNDMessageHandler::OnNCActivate(UINT message, +@@ -2423,17 +2435,18 @@ LRESULT HWNDMessageHandler::OnNCActivate(UINT message, delegate_->SchedulePaint(); } diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index 75e43b761650b..ac03ae9ead1a9 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -20,10 +20,10 @@ index 53bbf0174048d62b252b797b06695e6290273e80..4350b57ebf424e392c54dd2b54e62690 } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index b10f6ae7612556e2f4cff60d38a88b5f1ad1757d..f7189f8b1f9d3299e459df26d801f86d9dff317c 100644 +index fae2d2f743c6798340438dcc8b9ad0a38e6b1617..07d9e9073a6fbc5a864373b8f5665f0ca3ec1a0c 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -341,6 +341,11 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -342,6 +342,11 @@ class CONTENT_EXPORT ContentBrowserClient { virtual ~ContentBrowserClient() = default; diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index 4dacc96e306ac..d1391f1f0d7bb 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -476,7 +476,7 @@ index f3ea2bf2d15d815a2409441a9033a92d5d8967c1..ce52245628c72018da8ec4a3155dafa7 // Beware: This view was briefly removed (in favor of a bare CALayer) in // https://crrev.com/c/1236675. The ordering of unassociated layers relative diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn -index 40718df4d3d7092309ea7027ae6c59a7963fd03c..89f08e2693d9101e89dd007df80881ff726195ad 100644 +index da33fa857f85484853d14f24d0601f4c284fd67a..9af007dfc14e442d34ebe82fc678ea9f32782cdf 100644 --- a/components/viz/service/BUILD.gn +++ b/components/viz/service/BUILD.gn @@ -387,6 +387,7 @@ viz_component("service") { @@ -487,7 +487,7 @@ index 40718df4d3d7092309ea7027ae6c59a7963fd03c..89f08e2693d9101e89dd007df80881ff } if (is_ios) { -@@ -710,6 +711,7 @@ viz_source_set("unit_tests") { +@@ -712,6 +713,7 @@ viz_source_set("unit_tests") { "display_embedder/software_output_device_mac_unittest.mm", ] frameworks = [ "IOSurface.framework" ] @@ -581,7 +581,7 @@ index f69cd6100f2ac5ccb6f185e0d0bf186073ed5953..29a40923a55287b608c2ffae63a1dbbc return kAttributes; } diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index bc58374ed9ce5c94e64742ead089de3ffd7351f4..36884dd700ed4d878b449c00da091497689074f2 100644 +index 1ffce9951a2f82c1052cfa8c434f43bd7d32d604..e44e635927026a2d3dd0627668b5e89aa7104050 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn @@ -343,6 +343,7 @@ source_set("browser") { @@ -714,11 +714,11 @@ index f57ce1a0430df7692be55685e79121ed604daf2a..3fbc26fb179a64a2f1eab027a05b1624 defines = [] diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn -index 8404e4d6b8b2fc2d5f1597d5cbfcbcea2e692091..678121670b4977853e6fa1515f37d1ad21a3bd33 100644 +index 844867f9d4f52e0d591c674238f99cec42cd9ac8..f02673ec1f36f83c2aea9642e2fd1a3fde5da3a0 100644 --- a/content/renderer/BUILD.gn +++ b/content/renderer/BUILD.gn -@@ -322,6 +322,7 @@ target(link_target_type, "renderer") { - "//ui/surface", +@@ -323,6 +323,7 @@ target(link_target_type, "renderer") { + "//ui/strings:auto_image_annotation_strings_grit", "//url", "//v8", + "//electron/build/config:generate_mas_config", @@ -796,10 +796,10 @@ index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbe } // namespace content diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn -index 7c54ae91e60c7cb0b7c66d9c86b3d350d35ae34f..b4cfa7b08843c0410c5d11f46018d1f9fe89c40e 100644 +index 795c9054faa75b3c20d091e6fe56f0a865f293ff..bacde6a543504003064ee42642d20973d0e6492a 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn -@@ -703,6 +703,7 @@ static_library("test_support") { +@@ -702,6 +702,7 @@ static_library("test_support") { "//url", "//url/mojom:url_mojom_gurl", "//v8", @@ -807,7 +807,7 @@ index 7c54ae91e60c7cb0b7c66d9c86b3d350d35ae34f..b4cfa7b08843c0410c5d11f46018d1f9 ] data_deps = [ -@@ -1178,6 +1179,8 @@ static_library("browsertest_support") { +@@ -1177,6 +1178,8 @@ static_library("browsertest_support") { # TODO(crbug.com/40031409): Fix code that adds exit-time destructors and # enable the diagnostic by removing this line. configs += [ "//build/config/compiler:no_exit_time_destructors" ] @@ -816,7 +816,7 @@ index 7c54ae91e60c7cb0b7c66d9c86b3d350d35ae34f..b4cfa7b08843c0410c5d11f46018d1f9 } mojom("content_test_mojo_bindings") { -@@ -2067,6 +2070,7 @@ test("content_browsertests") { +@@ -2066,6 +2069,7 @@ test("content_browsertests") { "//ui/shell_dialogs", "//ui/snapshot", "//ui/webui:test_support", @@ -1395,7 +1395,7 @@ index eb81a70e4d5d5cd3e6ae9b45f8cd1c795ea76c51..9921ccb10d3455600eddd85f77f10228 } // namespace sandbox diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn -index e934eb2b317f28dd91f8aa8c69d1cdd974006232..bcc9c361d427d460f0d845bea61e14f440af0a4f 100644 +index aa7ca96851b87c8b32fd22a1388e8dba8973d3e7..2998555b064d91a9f1f2df9fc1a913d00c2d61d4 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn @@ -443,6 +443,7 @@ component("core") { diff --git a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch index 250843c98e0e1..00d6995ff2fce 100644 --- a/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch +++ b/patches/chromium/revert_code_health_clean_up_stale_macwebcontentsocclusion.patch @@ -254,10 +254,10 @@ index 17d6d7d935f93afefa9123f56ef9c138c3070f93..8dfa7501a6a2998e107bf9b51f5e5c3d } diff --git a/content/common/features.cc b/content/common/features.cc -index 67beba0ac7763c162eb105ecf3df3ca0c2ca4827..3742f8823ba1399b63b72145f12dbdfa02b4524d 100644 +index d9fdcd11f23449e22e17df833140c1f80d503486..18d3c146ec38ada48dc1c32904fe170a0a53a6f2 100644 --- a/content/common/features.cc +++ b/content/common/features.cc -@@ -322,6 +322,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); +@@ -312,6 +312,14 @@ BASE_FEATURE(kInterestGroupUpdateIfOlderThan, base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kIOSurfaceCapturer, base::FEATURE_ENABLED_BY_DEFAULT); #endif @@ -273,10 +273,10 @@ index 67beba0ac7763c162eb105ecf3df3ca0c2ca4827..3742f8823ba1399b63b72145f12dbdfa BASE_FEATURE(kKeepChildProcessAfterIPCReset, base::FEATURE_DISABLED_BY_DEFAULT); diff --git a/content/common/features.h b/content/common/features.h -index 9063ec69d6129e80c5679e3ccaf729adcfa85a58..5ccf4999afb697864a54284a7c5b0cb17ea4efdd 100644 +index 5b6d84c51b082bc80e9fd03b79a4ff4704b75eb7..b043a236891cdc83342820a38babf4cfd99b4d40 100644 --- a/content/common/features.h +++ b/content/common/features.h -@@ -115,6 +115,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); +@@ -112,6 +112,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kInterestGroupUpdateIfOlderThan); #if BUILDFLAG(IS_MAC) CONTENT_EXPORT BASE_DECLARE_FEATURE(kIOSurfaceCapturer); #endif diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index e4ddeea1dee12..b2e704d343b73 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index 7fbdf75c78249414e89828679c69f44573b44942..f8694b63f2c565990b7700059f226204a9559b10 100644 +index 0cb45c17fe3b281ef567f413f6a69698e98cc5e2..f230a961e809b58b4363b41649af1149c2d53857 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25694,6 +25694,21 @@ +@@ -25712,6 +25712,21 @@ ] } ], diff --git a/patches/chromium/scroll_bounce_flag.patch b/patches/chromium/scroll_bounce_flag.patch index 1ec9b59f5ccf6..cb426fb31c8d8 100644 --- a/patches/chromium/scroll_bounce_flag.patch +++ b/patches/chromium/scroll_bounce_flag.patch @@ -6,10 +6,10 @@ Subject: scroll_bounce_flag.patch Patch to make scrollBounce option work. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc -index f36413e02fae33f9d4ebdc1770674f422464577f..d881c99876918379ebc7f11956f2a64b91f50de4 100644 +index d378f944864e4f20e8c475a9583c38c877c1ab89..ceba31d4477b08ab97cbfe3a14a30cb919751a9c 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc -@@ -1213,7 +1213,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { +@@ -1212,7 +1212,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { } bool RenderThreadImpl::IsElasticOverscrollEnabled() { diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index 0c34d5dd9e404..6c85a975a5199 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,7 +15,7 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 034e8a1204badd4facef51a048f12e7c18b34f5d..2688af93f5ba31ece987b94f2e40d7f76a866bcc 100644 +index 469cfce5b48987268f7e95ea0e5edd75623558e8..7e48c91c75cba91ea76541634c61bdf73836474d 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc @@ -9051,6 +9051,17 @@ void RenderFrameHostImpl::EnterFullscreen( diff --git a/patches/chromium/worker_context_will_destroy.patch b/patches/chromium/worker_context_will_destroy.patch index ecc6ada86dd2a..515cb275191e4 100644 --- a/patches/chromium/worker_context_will_destroy.patch +++ b/patches/chromium/worker_context_will_destroy.patch @@ -26,7 +26,7 @@ index d63a25362fbfa35677de03fd09da535780feb1c9..c2fa875848478bca9115fc94271fde92 // An empty URL is returned if the URL is not overriden. virtual GURL OverrideFlashEmbedWithHTML(const GURL& url); diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index 62b062d95ea9356d9d1ac7e86533e4b72e257c38..796dd5ccbcf6cc9e29a9aa6c6ca32f084dbefb49 100644 +index 7a3bdc05630d997824bb6ea46fe3ad911746ca73..eb5550609ec1361cafa1770dda2a3433336a71c1 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc @@ -903,6 +903,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { diff --git a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch index 48377c0067eb0..6b2cce880a9e6 100644 --- a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch +++ b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch @@ -35,7 +35,7 @@ index c2fa875848478bca9115fc94271fde920e6b62fa..6fa11f89ea212eabd7fdc979d2d99138 // from the worker thread. virtual void WillDestroyWorkerContextOnWorkerThread( diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index 796dd5ccbcf6cc9e29a9aa6c6ca32f084dbefb49..f51996a391c996ee711aa076933346de8e772645 100644 +index eb5550609ec1361cafa1770dda2a3433336a71c1..87d3968badf815da3e2e6642f6c50d4676b1e439 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc @@ -915,6 +915,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated( diff --git a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch index 0ee44ae9ac9d5..899aba129edf9 100644 --- a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch +++ b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch @@ -10,10 +10,10 @@ to handle this without patching, but this is fairly clean for now and no longer patching legacy devtools code. diff --git a/front_end/entrypoints/main/MainImpl.ts b/front_end/entrypoints/main/MainImpl.ts -index c91ceb8c245e29db221afbf32b315620a109b735..00e6b28473cf93c75de60ffca0c980245c1dd84d 100644 +index b2a211f875fb88a4be8ed47c1b4ccae4025c34c9..f65f13d00b99f2300fbb4126eb09301a8c961b11 100644 --- a/front_end/entrypoints/main/MainImpl.ts +++ b/front_end/entrypoints/main/MainImpl.ts -@@ -760,6 +760,8 @@ export class MainImpl { +@@ -768,6 +768,8 @@ export class MainImpl { globalThis.Main = globalThis.Main || {}; // @ts-expect-error Exported for Tests.js globalThis.Main.Main = MainImpl; From 398496510c6034f51ca82f14c7d25e9e0df58cf6 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 10 Nov 2025 21:30:44 +0100 Subject: [PATCH 229/268] feat: support WebSocket authentication handling (#48512) * feat: support WebSocket authentication handling * test: add a test * refactor: route through login instead --- shell/browser/api/electron_api_web_request.cc | 63 +++++++++++++++- shell/browser/api/electron_api_web_request.h | 29 ++++++- shell/browser/login_handler.cc | 17 +++++ shell/browser/login_handler.h | 7 ++ shell/browser/net/proxying_websocket.cc | 21 ++++-- shell/browser/net/proxying_websocket.h | 17 +---- spec/api-web-request-spec.ts | 75 +++++++++++++++++++ 7 files changed, 204 insertions(+), 25 deletions(-) diff --git a/shell/browser/api/electron_api_web_request.cc b/shell/browser/api/electron_api_web_request.cc index 04bee91da3e25..722cb34816762 100644 --- a/shell/browser/api/electron_api_web_request.cc +++ b/shell/browser/api/electron_api_web_request.cc @@ -5,12 +5,14 @@ #include "shell/browser/api/electron_api_web_request.h" #include +#include #include #include #include #include "base/containers/fixed_flat_map.h" #include "base/memory/raw_ptr.h" +#include "base/strings/utf_string_conversions.h" #include "base/task/sequenced_task_runner.h" #include "base/values.h" #include "content/public/browser/web_contents.h" @@ -25,6 +27,7 @@ #include "shell/browser/api/electron_api_web_frame_main.h" #include "shell/browser/electron_browser_context.h" #include "shell/browser/javascript_environment.h" +#include "shell/browser/login_handler.h" #include "shell/common/gin_converters/callback_converter.h" #include "shell/common/gin_converters/frame_converter.h" #include "shell/common/gin_converters/gurl_converter.h" @@ -100,7 +103,7 @@ v8::Local HttpResponseHeadersToV8( // Overloaded by multiple types to fill the |details| object. void ToDictionary(gin_helper::Dictionary* details, - extensions::WebRequestInfo* info) { + const extensions::WebRequestInfo* info) { details->Set("id", info->id); details->Set("url", info->url); details->Set("method", info->method); @@ -247,7 +250,7 @@ bool WebRequest::RequestFilter::MatchesType( } bool WebRequest::RequestFilter::MatchesRequest( - extensions::WebRequestInfo* info) const { + const extensions::WebRequestInfo* info) const { // Matches URL and type, and does not match exclude URL. return MatchesURL(info->url, include_url_patterns_) && !MatchesURL(info->url, exclude_url_patterns_) && @@ -279,6 +282,10 @@ struct WebRequest::BlockedRequest { net::CompletionOnceCallback callback; // Only used for onBeforeSendHeaders. BeforeSendHeadersCallback before_send_headers_callback; + // The callback to invoke for auth. If |auth_callback.is_null()| is false, + // |callback| must be NULL. + // Only valid for OnAuthRequired. + AuthCallback auth_callback; // Only used for onBeforeSendHeaders. raw_ptr request_headers = nullptr; // Only used for onHeadersReceived. @@ -289,6 +296,8 @@ struct WebRequest::BlockedRequest { std::string status_line; // Only used for onBeforeRequest. raw_ptr new_url = nullptr; + // Owns the LoginHandler while waiting for auth credentials. + std::unique_ptr login_handler; }; WebRequest::SimpleListenerInfo::SimpleListenerInfo(RequestFilter filter_, @@ -588,6 +597,36 @@ void WebRequest::OnSendHeaders(extensions::WebRequestInfo* info, HandleSimpleEvent(SimpleEvent::kOnSendHeaders, info, request, headers); } +WebRequest::AuthRequiredResponse WebRequest::OnAuthRequired( + const extensions::WebRequestInfo* request_info, + const net::AuthChallengeInfo& auth_info, + WebRequest::AuthCallback callback, + net::AuthCredentials* credentials) { + content::RenderFrameHost* rfh = content::RenderFrameHost::FromID( + request_info->render_process_id, request_info->frame_routing_id); + content::WebContents* web_contents = nullptr; + if (rfh) + web_contents = content::WebContents::FromRenderFrameHost(rfh); + + BlockedRequest blocked_request; + blocked_request.auth_callback = std::move(callback); + blocked_requests_[request_info->id] = std::move(blocked_request); + + auto login_callback = + base::BindOnce(&WebRequest::OnLoginAuthResult, base::Unretained(this), + request_info->id, credentials); + + scoped_refptr response_headers = + request_info->response_headers; + blocked_requests_[request_info->id].login_handler = + std::make_unique( + auth_info, web_contents, + static_cast(request_info->render_process_id), + request_info->url, response_headers, std::move(login_callback)); + + return AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_IO_PENDING; +} + void WebRequest::OnBeforeRedirect(extensions::WebRequestInfo* info, const network::ResourceRequest& request, const GURL& new_location) { @@ -717,6 +756,26 @@ void WebRequest::HandleSimpleEvent(SimpleEvent event, info.listener.Run(gin::ConvertToV8(isolate, details)); } +void WebRequest::OnLoginAuthResult( + uint64_t id, + net::AuthCredentials* credentials, + const std::optional& maybe_creds) { + auto iter = blocked_requests_.find(id); + if (iter == blocked_requests_.end()) + NOTREACHED(); + + AuthRequiredResponse action = + AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_NO_ACTION; + if (maybe_creds.has_value()) { + *credentials = maybe_creds.value(); + action = AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_SET_AUTH; + } + + base::SequencedTaskRunner::GetCurrentDefault()->PostTask( + FROM_HERE, base::BindOnce(std::move(iter->second.auth_callback), action)); + blocked_requests_.erase(iter); +} + // static gin_helper::Handle WebRequest::FromOrCreate( v8::Isolate* isolate, diff --git a/shell/browser/api/electron_api_web_request.h b/shell/browser/api/electron_api_web_request.h index 1caa2efe2eed9..952357dcdd144 100644 --- a/shell/browser/api/electron_api_web_request.h +++ b/shell/browser/api/electron_api_web_request.h @@ -45,6 +45,23 @@ class WebRequest final : public gin_helper::DeprecatedWrappable { const std::set& set_headers, int error_code)>; + // AuthRequiredResponse indicates how an OnAuthRequired call is handled. + enum class AuthRequiredResponse { + // No credentials were provided. + AUTH_REQUIRED_RESPONSE_NO_ACTION, + // AuthCredentials is filled in with a username and password, which should + // be used in a response to the provided auth challenge. + AUTH_REQUIRED_RESPONSE_SET_AUTH, + // The request should be canceled. + AUTH_REQUIRED_RESPONSE_CANCEL_AUTH, + // The action will be decided asynchronously. |callback| will be invoked + // when the decision is made, and one of the other AuthRequiredResponse + // values will be passed in with the same semantics as described above. + AUTH_REQUIRED_RESPONSE_IO_PENDING, + }; + + using AuthCallback = base::OnceCallback; + // Convenience wrapper around api::Session::FromOrCreate()->WebRequest(). // Creates the Session and WebRequest if they don't already exist. // Note that the WebRequest is owned by the session, not by the caller. @@ -83,6 +100,10 @@ class WebRequest final : public gin_helper::DeprecatedWrappable { void OnSendHeaders(extensions::WebRequestInfo* info, const network::ResourceRequest& request, const net::HttpRequestHeaders& headers); + AuthRequiredResponse OnAuthRequired(const extensions::WebRequestInfo* info, + const net::AuthChallengeInfo& auth_info, + AuthCallback callback, + net::AuthCredentials* credentials); void OnBeforeRedirect(extensions::WebRequestInfo* info, const network::ResourceRequest& request, const GURL& new_location); @@ -158,6 +179,12 @@ class WebRequest final : public gin_helper::DeprecatedWrappable { v8::Local response); void OnHeadersReceivedListenerResult(uint64_t id, v8::Local response); + // Callback invoked by LoginHandler when auth credentials are supplied via + // the unified 'login' event. Bridges back into WebRequest's AuthCallback. + void OnLoginAuthResult( + uint64_t id, + net::AuthCredentials* credentials, + const std::optional& maybe_creds); class RequestFilter { public: @@ -175,7 +202,7 @@ class WebRequest final : public gin_helper::DeprecatedWrappable { bool is_match_pattern = true); void AddType(extensions::WebRequestResourceType type); - bool MatchesRequest(extensions::WebRequestInfo* info) const; + bool MatchesRequest(const extensions::WebRequestInfo* info) const; private: bool MatchesURL(const GURL& url, diff --git a/shell/browser/login_handler.cc b/shell/browser/login_handler.cc index 8813b08363fd2..00ddcafc2792d 100644 --- a/shell/browser/login_handler.cc +++ b/shell/browser/login_handler.cc @@ -42,6 +42,23 @@ LoginHandler::LoginHandler( response_headers, first_auth_attempt)); } +LoginHandler::LoginHandler( + const net::AuthChallengeInfo& auth_info, + content::WebContents* web_contents, + base::ProcessId process_id, + const GURL& url, + scoped_refptr response_headers, + content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback) + : LoginHandler(auth_info, + web_contents, + /*is_request_for_primary_main_frame=*/false, + /*is_request_for_navigation=*/false, + process_id, + url, + std::move(response_headers), + /*first_auth_attempt=*/false, + std::move(auth_required_callback)) {} + void LoginHandler::EmitEvent( net::AuthChallengeInfo auth_info, content::WebContents* web_contents, diff --git a/shell/browser/login_handler.h b/shell/browser/login_handler.h index 144b97cc00b74..ef73b259336e1 100644 --- a/shell/browser/login_handler.h +++ b/shell/browser/login_handler.h @@ -32,6 +32,13 @@ class LoginHandler : public content::LoginDelegate { scoped_refptr response_headers, bool first_auth_attempt, content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback); + LoginHandler( + const net::AuthChallengeInfo& auth_info, + content::WebContents* web_contents, + base::ProcessId process_id, + const GURL& url, + scoped_refptr response_headers, + content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback); ~LoginHandler() override; // disable copy diff --git a/shell/browser/net/proxying_websocket.cc b/shell/browser/net/proxying_websocket.cc index 9b4a4358a79b7..5a1836c427b17 100644 --- a/shell/browser/net/proxying_websocket.cc +++ b/shell/browser/net/proxying_websocket.cc @@ -374,19 +374,23 @@ void ProxyingWebSocket::OnHeadersReceivedComplete(int error_code) { ContinueToCompleted(); } -void ProxyingWebSocket::OnAuthRequiredComplete(AuthRequiredResponse rv) { +void ProxyingWebSocket::OnAuthRequiredComplete( + api::WebRequest::AuthRequiredResponse rv) { CHECK(auth_required_callback_); ResumeIncomingMethodCallProcessing(); switch (rv) { - case AuthRequiredResponse::kNoAction: - case AuthRequiredResponse::kCancelAuth: + case api::WebRequest::AuthRequiredResponse:: + AUTH_REQUIRED_RESPONSE_NO_ACTION: + case api::WebRequest::AuthRequiredResponse:: + AUTH_REQUIRED_RESPONSE_CANCEL_AUTH: std::move(auth_required_callback_).Run(std::nullopt); break; - case AuthRequiredResponse::kSetAuth: + case api::WebRequest::AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_SET_AUTH: std::move(auth_required_callback_).Run(auth_credentials_); break; - case AuthRequiredResponse::kIoPending: + case api::WebRequest::AuthRequiredResponse:: + AUTH_REQUIRED_RESPONSE_IO_PENDING: NOTREACHED(); } } @@ -403,8 +407,13 @@ void ProxyingWebSocket::OnHeadersReceivedCompleteForAuth( auto continuation = base::BindRepeating( &ProxyingWebSocket::OnAuthRequiredComplete, weak_factory_.GetWeakPtr()); - auto auth_rv = AuthRequiredResponse::kCancelAuth; + auto auth_rv = web_request_->OnAuthRequired( + &info_, auth_info, std::move(continuation), &auth_credentials_); PauseIncomingMethodCallProcessing(); + if (auth_rv == api::WebRequest::AuthRequiredResponse:: + AUTH_REQUIRED_RESPONSE_IO_PENDING) { + return; + } OnAuthRequiredComplete(auth_rv); } diff --git a/shell/browser/net/proxying_websocket.h b/shell/browser/net/proxying_websocket.h index ef035c305a4b0..bb0d7d87ffab9 100644 --- a/shell/browser/net/proxying_websocket.h +++ b/shell/browser/net/proxying_websocket.h @@ -37,21 +37,6 @@ class ProxyingWebSocket : public network::mojom::WebSocketHandshakeClient, public: using WebSocketFactory = content::ContentBrowserClient::WebSocketFactory; - // AuthRequiredResponse indicates how an OnAuthRequired call is handled. - enum class AuthRequiredResponse { - // No credentials were provided. - kNoAction, - // AuthCredentials is filled in with a username and password, which should - // be used in a response to the provided auth challenge. - kSetAuth, - // The request should be canceled. - kCancelAuth, - // The action will be decided asynchronously. |callback| will be invoked - // when the decision is made, and one of the other AuthRequiredResponse - // values will be passed in with the same semantics as described above. - kIoPending, - }; - ProxyingWebSocket( api::WebRequest* web_request, WebSocketFactory factory, @@ -121,7 +106,7 @@ class ProxyingWebSocket : public network::mojom::WebSocketHandshakeClient, void ContinueToStartRequest(int error_code); void OnHeadersReceivedComplete(int error_code); void ContinueToHeadersReceived(); - void OnAuthRequiredComplete(AuthRequiredResponse rv); + void OnAuthRequiredComplete(api::WebRequest::AuthRequiredResponse rv); void OnHeadersReceivedCompleteForAuth(const net::AuthChallengeInfo& auth_info, int rv); void ContinueToCompleted(); diff --git a/spec/api-web-request-spec.ts b/spec/api-web-request-spec.ts index b2792cf9a66d1..9000b2d2b1270 100644 --- a/spec/api-web-request-spec.ts +++ b/spec/api-web-request-spec.ts @@ -733,5 +733,80 @@ describe('webRequest module', () => { expect(reqHeaders['/websocket'].foo).to.equal('bar'); expect(reqHeaders['/'].foo).to.equal('bar'); }); + + it('authenticates a WebSocket via login event', async () => { + const authServer = http.createServer(); + const wssAuth = new WebSocket.Server({ noServer: true }); + const expected = 'Basic ' + Buffer.from('user:pass').toString('base64'); + + wssAuth.on('connection', ws => { + ws.send('Authenticated!'); + }); + + authServer.on('upgrade', (req, socket, head) => { + const auth = req.headers.authorization || ''; + if (auth !== expected) { + socket.write( + 'HTTP/1.1 401 Unauthorized\r\n' + + 'WWW-Authenticate: Basic realm="Test"\r\n' + + 'Content-Length: 0\r\n' + + '\r\n' + ); + socket.destroy(); + return; + } + + wssAuth.handleUpgrade(req, socket as Socket, head, ws => { + wssAuth.emit('connection', ws, req); + }); + }); + + const { port } = await listen(authServer); + const ses = session.fromPartition(`WebRequestWSAuth-${Date.now()}`); + + const contents = (webContents as typeof ElectronInternal.WebContents).create({ + session: ses, + sandbox: true + }); + + defer(() => { + contents.destroy(); + authServer.close(); + wssAuth.close(); + }); + + ses.webRequest.onBeforeRequest({ urls: ['ws://*/*'] }, (details, callback) => { + callback({}); + }); + + contents.on('login', (event, details: any, _: any, callback: (u: string, p: string) => void) => { + if (details?.url?.startsWith(`ws://localhost:${port}`)) { + event.preventDefault(); + callback('user', 'pass'); + } + }); + + await contents.loadFile(path.join(fixturesPath, 'blank.html')); + + const message = await contents.executeJavaScript(`new Promise((resolve, reject) => { + let attempts = 0; + function connect() { + attempts++; + const ws = new WebSocket('ws://localhost:${port}'); + ws.onmessage = e => resolve(e.data); + ws.onerror = () => { + if (attempts < 3) { + setTimeout(connect, 50); + } else { + reject(new Error('WebSocket auth failed')); + } + }; + } + connect(); + setTimeout(() => reject(new Error('timeout')), 5000); + });`); + + expect(message).to.equal('Authenticated!'); + }); }); }); From 5a5a2a1a8c4f90acf040802101a212eb812b655c Mon Sep 17 00:00:00 2001 From: Kai Date: Tue, 11 Nov 2025 05:37:29 +0800 Subject: [PATCH 230/268] feat: add bypassCustomProtocolHandlers option to net.request (#47331) * feat: add bypassCustomProtocolHandlers option to net.request * style: fix lint errors in api-protocol-spec --- docs/api/client-request.md | 5 +++++ lib/common/api/net-client-request.ts | 3 ++- spec/api-protocol-spec.ts | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/api/client-request.md b/docs/api/client-request.md index d6e27d6deb951..398290f1eef90 100644 --- a/docs/api/client-request.md +++ b/docs/api/client-request.md @@ -25,6 +25,11 @@ following properties: with which the request is associated. Defaults to the empty string. The `session` option supersedes `partition`. Thus if a `session` is explicitly specified, `partition` is ignored. + * `bypassCustomProtocolHandlers` boolean (optional) - When set to `true`, + custom protocol handlers registered for the request's URL scheme will not be + called. This allows forwarding an intercepted request to the built-in + handler. [webRequest](web-request.md) handlers will still be triggered + when bypassing custom protocols. Defaults to `false`. * `credentials` string (optional) - Can be `include`, `omit` or `same-origin`. Whether to send [credentials](https://fetch.spec.whatwg.org/#credentials) with this diff --git a/lib/common/api/net-client-request.ts b/lib/common/api/net-client-request.ts index 057f0390d7854..08533c81e6c21 100644 --- a/lib/common/api/net-client-request.ts +++ b/lib/common/api/net-client-request.ts @@ -289,7 +289,8 @@ function parseOptions (optionsIn: ClientRequestConstructorOptions | string): Nod referrerPolicy: options.referrerPolicy, cache: options.cache, allowNonHttpProtocols: Object.hasOwn(options, kAllowNonHttpProtocols), - priority: options.priority + priority: options.priority, + bypassCustomProtocolHandlers: options.bypassCustomProtocolHandlers }; if ('priorityIncremental' in options) { urlLoaderOptions.priorityIncremental = options.priorityIncremental; diff --git a/spec/api-protocol-spec.ts b/spec/api-protocol-spec.ts index 415ed5fdafe45..4a2f8b10c9c4e 100644 --- a/spec/api-protocol-spec.ts +++ b/spec/api-protocol-spec.ts @@ -15,6 +15,7 @@ import * as webStream from 'node:stream/web'; import { setTimeout } from 'node:timers/promises'; import * as url from 'node:url'; +import { collectStreamBody, getResponse } from './lib/net-helpers'; import { listen, defer, ifit } from './lib/spec-helpers'; import { WebmGenerator } from './lib/video-helpers'; import { closeAllWindows, closeWindow } from './lib/window-helpers'; @@ -1578,6 +1579,22 @@ describe('protocol module', () => { expect(await net.fetch(url, { bypassCustomProtocolHandlers: true }).then(r => r.text())).to.equal('default'); }); + it('can bypass intercepted protocol handlers with net.request', async () => { + protocol.handle('http', () => new Response('custom')); + defer(() => { protocol.unhandle('http'); }); + const server = http.createServer((req, res) => { + res.end('default'); + }); + defer(() => server.close()); + const { url } = await listen(server); + // Make a request using net.request with bypassCustomProtocolHandlers: true + const request = net.request({ method: 'GET', url, bypassCustomProtocolHandlers: true }); + const response = await getResponse(request); + const body = await collectStreamBody(response); + expect(response.statusCode).to.equal(200); + expect(body).to.equal('default'); + }); + it('bypassing custom protocol handlers also bypasses new protocols', async () => { protocol.handle('app', () => new Response('custom')); defer(() => { protocol.unhandle('app'); }); From c542512adc8285814c1a6e3ec6fe59a0150fee46 Mon Sep 17 00:00:00 2001 From: Erick Zhao Date: Mon, 10 Nov 2025 17:37:12 -0800 Subject: [PATCH 231/268] docs: remove electronegativity (#48878) --- docs/tutorial/security.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/docs/tutorial/security.md b/docs/tutorial/security.md index 81b4ce3c9eabc..8cbb262367a7a 100644 --- a/docs/tutorial/security.md +++ b/docs/tutorial/security.md @@ -118,13 +118,6 @@ You should at least follow these steps to improve the security of your applicati 19. [Check which fuses you can change](#19-check-which-fuses-you-can-change) 20. [Do not expose Electron APIs to untrusted web content](#20-do-not-expose-electron-apis-to-untrusted-web-content) -To automate the detection of misconfigurations and insecure patterns, it is -possible to use -[Electronegativity](https://github.com/doyensec/electronegativity). For -additional details on potential weaknesses and implementation bugs when -developing applications using Electron, please refer to this -[guide for developers and auditors](https://doyensec.com/resources/us-17-Carettoni-Electronegativity-A-Study-Of-Electron-Security-wp.pdf). - ### 1. Only load secure content Any resources not included with your application should be loaded using a From 8e2114d02124bc7edaf9c377e41ba5a278b2cd83 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 11 Nov 2025 00:33:25 -0600 Subject: [PATCH 232/268] refactor: use gin_helper's `gin::Wrappable`-to-`v8::Local` converter (#48885) * refactor: Session::NetLog() returns a NetLog* Use gin_helper's gin::Wrappable-to-v8::Local converter instead of rewriting it. * refactor: FromPath(base::FilePath&, gin::Arguments*) returns a Session* refactor: FromPartition(std::string&, gin::Arguments*) returns a Session* Use gin_helper's gin::Wrappable-to-v8::Local converter instead of rewriting it. --- shell/browser/api/electron_api_session.cc | 43 +++++------------------ shell/browser/api/electron_api_session.h | 2 +- 2 files changed, 9 insertions(+), 36 deletions(-) diff --git a/shell/browser/api/electron_api_session.cc b/shell/browser/api/electron_api_session.cc index 5a25cef4bbe4d..da2525aab9389 100644 --- a/shell/browser/api/electron_api_session.cc +++ b/shell/browser/api/electron_api_session.cc @@ -1368,15 +1368,11 @@ v8::Local Session::WebRequest(v8::Isolate* isolate) { return web_request_.Get(isolate); } -v8::Local Session::NetLog(v8::Isolate* isolate) { +NetLog* Session::NetLog(v8::Isolate* isolate) { if (!net_log_) { net_log_ = NetLog::Create(isolate, browser_context()); } - - v8::Local wrapper; - return net_log_->GetWrapper(isolate).ToLocal(&wrapper) - ? wrapper.As() - : v8::Null(isolate); + return net_log_; } static void StartPreconnectOnUI(ElectronBrowserContext* browser_context, @@ -1887,47 +1883,24 @@ namespace { using electron::api::Session; -v8::Local FromPartition(const std::string& partition, - gin::Arguments* args) { +Session* FromPartition(const std::string& partition, gin::Arguments* args) { if (!electron::Browser::Get()->is_ready()) { args->ThrowTypeError("Session can only be received when app is ready"); - return v8::Null(args->isolate()); + return {}; } base::Value::Dict options; args->GetNext(&options); - Session* session = - Session::FromPartition(args->isolate(), partition, std::move(options)); - - if (session) { - v8::Local wrapper; - if (!session->GetWrapper(args->isolate()).ToLocal(&wrapper)) { - return v8::Null(args->isolate()); - } - return wrapper; - } else { - return v8::Null(args->isolate()); - } + return Session::FromPartition(args->isolate(), partition, std::move(options)); } -v8::Local FromPath(const base::FilePath& path, - gin::Arguments* args) { +Session* FromPath(const base::FilePath& path, gin::Arguments* args) { if (!electron::Browser::Get()->is_ready()) { args->ThrowTypeError("Session can only be received when app is ready"); - return v8::Null(args->isolate()); + return {}; } base::Value::Dict options; args->GetNext(&options); - Session* session = Session::FromPath(args, path, std::move(options)); - - if (session) { - v8::Local wrapper; - if (!session->GetWrapper(args->isolate()).ToLocal(&wrapper)) { - return v8::Null(args->isolate()); - } - return wrapper; - } else { - return v8::Null(args->isolate()); - } + return Session::FromPath(args, path, std::move(options)); } void Initialize(v8::Local exports, diff --git a/shell/browser/api/electron_api_session.h b/shell/browser/api/electron_api_session.h index 5dacd5172fc98..29cf1eea0cfa3 100644 --- a/shell/browser/api/electron_api_session.h +++ b/shell/browser/api/electron_api_session.h @@ -170,7 +170,7 @@ class Session final : public gin::Wrappable, v8::Local Protocol(v8::Isolate* isolate); v8::Local ServiceWorkerContext(v8::Isolate* isolate); v8::Local WebRequest(v8::Isolate* isolate); - v8::Local NetLog(v8::Isolate* isolate); + api::NetLog* NetLog(v8::Isolate* isolate); void Preconnect(const gin_helper::Dictionary& options, gin::Arguments* args); v8::Local CloseAllConnections(); v8::Local GetPath(v8::Isolate* isolate); From 00f9d46c40ff9d7fe6acc23dcfbd945a568dd067 Mon Sep 17 00:00:00 2001 From: Robo Date: Tue, 11 Nov 2025 19:00:39 +0900 Subject: [PATCH 233/268] chore: delay load pdfjs-dist for pdf spec (#48888) trap handlers will be initialized once the user script starts but before app#ready. Wasm compilation before that phase will break trap handler registeration due to the check in v8::internal::wasm::UpdateComputedInformation. For some reason this issue was only visible in <= 39-x-y when pdf-reader.mjs was being loaded, maybe some module loading logic changed in >= 40-x-y which are based on Node.js v24.x. In either case, it is best to align the loading of wasm module required for the tests in light of changes to how we are registering the trap handlers for the main process. --- spec/fixtures/api/pdf-reader.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/fixtures/api/pdf-reader.mjs b/spec/fixtures/api/pdf-reader.mjs index 4b21b60102ecc..589e90042d3a7 100644 --- a/spec/fixtures/api/pdf-reader.mjs +++ b/spec/fixtures/api/pdf-reader.mjs @@ -1,7 +1,8 @@ -import * as pdfjs from 'pdfjs-dist'; +import { app } from 'electron'; async function getPDFDoc () { try { + const pdfjs = await import('pdfjs-dist'); const doc = await pdfjs.getDocument(process.argv[2]).promise; const page = await doc.getPage(1); const { items } = await page.getTextContent(); @@ -20,4 +21,4 @@ async function getPDFDoc () { } } -getPDFDoc(); +app.whenReady().then(() => getPDFDoc()); From 3e94144458aa7ef1de2c54cecf200bc7a0241fde Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" Date: Tue, 11 Nov 2025 13:16:38 +0100 Subject: [PATCH 234/268] chore: bump chromium to 144.0.7521.0 (main) (#48880) * chore: bump chromium in DEPS to 144.0.7521.0 * chore: fixup patch indices --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr --- DEPS | 2 +- .../build_do_not_depend_on_packed_resource_integrity.patch | 2 +- .../chromium/feat_allow_code_cache_in_custom_schemes.patch | 4 ++-- .../feat_corner_smoothing_css_rule_and_blink_painting.patch | 2 +- ...s_remove_desktopwindowtreehostwin_window_enlargement.patch | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/DEPS b/DEPS index 93cdfb9a97d7e..47df6264c695c 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '144.0.7520.0', + '144.0.7521.0', 'node_version': 'v24.11.0', 'nan_version': diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index d26a27a3fb59d..b0b37cb1c869e 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -46,7 +46,7 @@ index 1b6ba974b641ba9f352cf15e311fa93e1268b06c..f26b6e92617a6df6f8adb1bce51f26f0 # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 28283d8cf5763bcbb46f341cb32ba0ef420ae7ba..a726da764f742d9f867b1a02e86d6b5ace61511d 100644 +index f99c95ff5d2bab35f4976c1bb9d39fc83de2494a..f124fc3885e509df46e8d8653ffb97f8b0b25060 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn @@ -7595,9 +7595,12 @@ test("unit_tests") { diff --git a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch index b4ed891f56323..aeac732052bfe 100644 --- a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch +++ b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch @@ -405,7 +405,7 @@ index 33e2ff42e4d9da442d522b959a4a21c2f7032b6b..a0d81212327fc17e1f4704e78803c1d7 std::vector extension_schemes; // Registers a URL scheme with a predefined default custom handler. diff --git a/url/url_util.cc b/url/url_util.cc -index 40d4419dbc658d91ff9dd40318d3ff1476a6c86c..ecfa10f4d09cf0d67a33538d4fa38dd5f1306b7e 100644 +index 5eee7b4b0ffc5d8fc7c570f41ff5596d04ab77a3..beb2a5598bfbdc8a4617ee6627cf09951c64821c 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -136,6 +136,9 @@ struct SchemeRegistry { @@ -418,7 +418,7 @@ index 40d4419dbc658d91ff9dd40318d3ff1476a6c86c..ecfa10f4d09cf0d67a33538d4fa38dd5 // Schemes with a predefined default custom handler. std::vector predefined_handler_schemes; -@@ -677,6 +680,15 @@ const std::vector& GetEmptyDocumentSchemes() { +@@ -674,6 +677,15 @@ const std::vector& GetEmptyDocumentSchemes() { return GetSchemeRegistry().empty_document_schemes; } diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index 8a55da352de83..0a4b7b2970cbc 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -312,7 +312,7 @@ index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index b34a71d7dce7297387d0fbb4b8f4e4429366515a..2c006f993c328b6e71654b548ec841e369becb7e 100644 +index 065479cfd23b9a6b63a8330dd2273b00d3740b62..12c5594c569a2f1a1906059f1fbf17ab5e6babc2 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index b2e704d343b73..917dfed1da821 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index 0cb45c17fe3b281ef567f413f6a69698e98cc5e2..f230a961e809b58b4363b41649af1149c2d53857 100644 +index b808b58c1aabdf262c6ed697a64871ee870f845d..d64abbdd535c3487f6edff89df8bfeca2f5fe9e3 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25712,6 +25712,21 @@ +@@ -25694,6 +25694,21 @@ ] } ], From dff8cc210f08452b684e324d3bb3401ff2970704 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 11 Nov 2025 14:16:04 +0100 Subject: [PATCH 235/268] build: remove track `SSL_ERROR_ZERO_RETURN` explicitly patch (#48875) build: remove track SSL_ERROR_ZERO_RETURN explicitly patch --- patches/boringssl/.patches | 1 - ...ack_ssl_error_zero_return_explicitly.patch | 49 ------------------- 2 files changed, 50 deletions(-) delete mode 100644 patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch diff --git a/patches/boringssl/.patches b/patches/boringssl/.patches index 9dffabe3d9651..74b9c25484433 100644 --- a/patches/boringssl/.patches +++ b/patches/boringssl/.patches @@ -1,3 +1,2 @@ expose_ripemd160.patch -revert_track_ssl_error_zero_return_explicitly.patch feat_expose_several_extra_cipher_functions.patch diff --git a/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch b/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch deleted file mode 100644 index ab15299ae5cac..0000000000000 --- a/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Tue, 6 Sep 2022 09:42:52 +0200 -Subject: revert: track SSL_ERROR_ZERO_RETURN explicitly. - -This reverts commit ebd8b8965c74ab06bb91f7a00b23822e1f1f26ca. - -It is causing significant TLS failures in Node.js. - -diff --git a/ssl/ssl_buffer.cc b/ssl/ssl_buffer.cc -index 8c5c7bcd96229cfcfb605bd4728c52c3c03d6062..ad8f1e7a26c665fd471b62bd694aad1655500d33 100644 ---- a/ssl/ssl_buffer.cc -+++ b/ssl/ssl_buffer.cc -@@ -230,7 +230,6 @@ int ssl_handle_open_record(SSL *ssl, bool *out_retry, ssl_open_record_t ret, - return 1; - - case ssl_open_record_close_notify: -- ssl->s3->rwstate = SSL_ERROR_ZERO_RETURN; - return 0; - - case ssl_open_record_error: -diff --git a/ssl/ssl_lib.cc b/ssl/ssl_lib.cc -index f64b103fbb7a298a22fe0ff4bc95a4415c58e305..9bc3e1c3114ae67c0eb6a31de05b85e517ea6ae2 100644 ---- a/ssl/ssl_lib.cc -+++ b/ssl/ssl_lib.cc -@@ -1211,7 +1211,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) { - } - - if (ret_code == 0) { -- if (ssl->s3->rwstate == SSL_ERROR_ZERO_RETURN) { -+ if (ssl->s3->read_shutdown == ssl_shutdown_close_notify) { - return SSL_ERROR_ZERO_RETURN; - } - // An EOF was observed which violates the protocol, and the underlying -@@ -2672,13 +2672,7 @@ void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx) { - return CRYPTO_get_ex_data(&ctx->ex_data, idx); - } - --int SSL_want(const SSL *ssl) { -- // Historically, OpenSSL did not track |SSL_ERROR_ZERO_RETURN| as an |rwstate| -- // value. We do, but map it back to |SSL_ERROR_NONE| to preserve the original -- // behavior. -- return ssl->s3->rwstate == SSL_ERROR_ZERO_RETURN ? SSL_ERROR_NONE -- : ssl->s3->rwstate; --} -+int SSL_want(const SSL *ssl) { return ssl->s3->rwstate; } - - void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, - RSA *(*cb)(SSL *ssl, int is_export, From 2a4684fa45ccd8f1ab3c1e420048ddd6cf009770 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 11 Nov 2025 17:53:50 +0100 Subject: [PATCH 236/268] ci: exclude top-level docs files from full CI (#48872) --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f734ec3215126..3c41c5b1caa7d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -63,6 +63,10 @@ jobs: filters: | docs: - 'docs/**' + - README.md + - SECURITY.md + - CONTRIBUTING.md + - CODE_OF_CONDUCT.md src: - '!docs/**' - name: Set Outputs for Build Image SHA & Docs Only From 24cc05043d7fa2aee3ec82e7ea84ba31a2f652c1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 11 Nov 2025 15:01:19 -0500 Subject: [PATCH 237/268] build(deps-dev): bump @electron/asar from 3.2.13 to 4.0.1 (#48721) * build(deps-dev): bump @electron/asar from 3.2.13 to 4.0.1 Bumps [@electron/asar](https://github.com/electron/asar) from 3.2.13 to 4.0.1. - [Release notes](https://github.com/electron/asar/releases) - [Changelog](https://github.com/electron/asar/blob/main/CHANGELOG.md) - [Commits](https://github.com/electron/asar/compare/v3.2.13...v4.0.1) --- updated-dependencies: - dependency-name: "@electron/asar" dependency-version: 4.0.1 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * chore: bump Node.js to 22.21.x --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr --- .github/workflows/archaeologist-dig.yml | 2 +- .../pipeline-segment-electron-build.yml | 2 +- .../pipeline-segment-electron-test.yml | 2 +- package.json | 2 +- yarn.lock | 103 +++++++++++++----- 5 files changed, 78 insertions(+), 33 deletions(-) diff --git a/.github/workflows/archaeologist-dig.yml b/.github/workflows/archaeologist-dig.yml index 78775ecda731b..4f41c409dbf46 100644 --- a/.github/workflows/archaeologist-dig.yml +++ b/.github/workflows/archaeologist-dig.yml @@ -15,7 +15,7 @@ jobs: - name: Setup Node.js/npm uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 with: - node-version: 20.19.x + node-version: 22.21.x - name: Setting Up Dig Site run: | echo "remote: ${{ github.event.pull_request.head.repo.clone_url }}" diff --git a/.github/workflows/pipeline-segment-electron-build.yml b/.github/workflows/pipeline-segment-electron-build.yml index f29d8db8e636c..7a8d44bcf5b50 100644 --- a/.github/workflows/pipeline-segment-electron-build.yml +++ b/.github/workflows/pipeline-segment-electron-build.yml @@ -117,7 +117,7 @@ jobs: if: ${{ inputs.target-platform == 'macos' }} uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 with: - node-version: 20.19.x + node-version: 22.21.x cache: yarn cache-dependency-path: src/electron/yarn.lock - name: Install Dependencies diff --git a/.github/workflows/pipeline-segment-electron-test.yml b/.github/workflows/pipeline-segment-electron-test.yml index 80b11005b2f6e..b2ecb969a9329 100644 --- a/.github/workflows/pipeline-segment-electron-test.yml +++ b/.github/workflows/pipeline-segment-electron-test.yml @@ -73,7 +73,7 @@ jobs: if: ${{ inputs.target-platform == 'win' }} uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 with: - node-version: 20.19.x + node-version: 22.21.x - name: Add TCC permissions on macOS if: ${{ inputs.target-platform == 'macos' }} run: | diff --git a/package.json b/package.json index cb568d0ea523f..edc94129d2685 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { "@azure/storage-blob": "^12.28.0", - "@electron/asar": "^3.2.13", + "@electron/asar": "^4.0.1", "@electron/docs-parser": "^2.0.0", "@electron/fiddle-core": "^1.3.4", "@electron/github-app-auth": "^2.2.1", diff --git a/yarn.lock b/yarn.lock index 73bc265cfb0ef..d45deaab8ae35 100644 --- a/yarn.lock +++ b/yarn.lock @@ -191,15 +191,14 @@ vscode-languageserver-types "^3.17.1" vscode-uri "^3.0.3" -"@electron/asar@^3.2.13": - version "3.2.13" - resolved "https://registry.yarnpkg.com/@electron/asar/-/asar-3.2.13.tgz#56565ea423ead184465adfa72663b2c70d9835f2" - integrity sha512-pY5z2qQSwbFzJsBdgfJIzXf5ElHTVMutC2dxh0FD60njknMu3n1NnTABOcQwbb5/v5soqE79m9UjaJryBf3epg== - dependencies: - "@types/glob" "^7.1.0" - commander "^5.0.0" - glob "^7.1.6" - minimatch "^3.0.4" +"@electron/asar@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@electron/asar/-/asar-4.0.1.tgz#0f0edc51ddb5bf30acb49f706d616b11a0b90668" + integrity sha512-F4Ykm1jiBGY1WV/o8Q8oFW8Nq0u+S2/vPujzNJtdSJ6C4LHC4CiGLn7c17s7SolZ23gcvCebMncmZtNc+MkxPQ== + dependencies: + commander "^13.1.0" + glob "^11.0.1" + minimatch "^10.0.1" "@electron/docs-parser@^2.0.0": version "2.0.0" @@ -342,6 +341,18 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== +"@isaacs/balanced-match@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz#3081dadbc3460661b751e7591d7faea5df39dd29" + integrity sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ== + +"@isaacs/brace-expansion@^5.0.0": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz#4b3dabab7d8e75a429414a96bd67bf4c1d13e0f3" + integrity sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA== + dependencies: + "@isaacs/balanced-match" "^4.0.1" + "@isaacs/cliui@^8.0.2": version "8.0.2" resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" @@ -883,14 +894,6 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== -"@types/glob@^7.1.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb" - integrity sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA== - dependencies: - "@types/minimatch" "*" - "@types/node" "*" - "@types/hast@^3.0.0": version "3.0.4" resolved "https://registry.yarnpkg.com/@types/hast/-/hast-3.0.4.tgz#1d6b39993b82cea6ad783945b0508c25903e15aa" @@ -974,11 +977,6 @@ resolved "https://registry.yarnpkg.com/@types/mdurl/-/mdurl-2.0.0.tgz#d43878b5b20222682163ae6f897b20447233bdfd" integrity sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg== -"@types/minimatch@*": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" - integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== - "@types/minimist@^1.2.5": version "1.2.5" resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.5.tgz#ec10755e871497bcd83efe927e43ec46e8c0747e" @@ -2064,6 +2062,11 @@ commander@^12.1.0: resolved "https://registry.yarnpkg.com/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3" integrity sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA== +commander@^13.1.0: + version "13.1.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-13.1.0.tgz#776167db68c78f38dcce1f9b8d7b8b9a488abf46" + integrity sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw== + commander@^14.0.0: version "14.0.0" resolved "https://registry.yarnpkg.com/commander/-/commander-14.0.0.tgz#f244fc74a92343514e56229f16ef5c5e22ced5e9" @@ -2074,11 +2077,6 @@ commander@^2.20.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" - integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== - commander@^8.3.0: version "8.3.0" resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" @@ -2112,7 +2110,7 @@ core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3, cross-spawn@^7.0.6: version "7.0.6" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== @@ -3235,6 +3233,14 @@ foreground-child@^3.1.0: cross-spawn "^7.0.0" signal-exit "^4.0.1" +foreground-child@^3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.1.tgz#32e8e9ed1b68a3497befb9ac2b6adf92a638576f" + integrity sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw== + dependencies: + cross-spawn "^7.0.6" + signal-exit "^4.0.1" + fs-extra@^10.0.0: version "10.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" @@ -3455,7 +3461,19 @@ glob@^10.0.0, glob@^10.2.2, glob@^10.4.5: package-json-from-dist "^1.0.0" path-scurry "^1.11.1" -glob@^7.1.3, glob@^7.1.6: +glob@^11.0.1: + version "11.0.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-11.0.3.tgz#9d8087e6d72ddb3c4707b1d2778f80ea3eaefcd6" + integrity sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA== + dependencies: + foreground-child "^3.3.1" + jackspeak "^4.1.1" + minimatch "^10.0.3" + minipass "^7.1.2" + package-json-from-dist "^1.0.0" + path-scurry "^2.0.0" + +glob@^7.1.3: version "7.2.0" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== @@ -4321,6 +4339,13 @@ jackspeak@^3.1.2: optionalDependencies: "@pkgjs/parseargs" "^0.11.0" +jackspeak@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-4.1.1.tgz#96876030f450502047fc7e8c7fcf8ce8124e43ae" + integrity sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ== + dependencies: + "@isaacs/cliui" "^8.0.2" + jest-worker@^27.4.5: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" @@ -4663,6 +4688,11 @@ lru-cache@^10.2.0: resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.2.tgz#48206bc114c1252940c41b25b41af5b545aca878" integrity sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ== +lru-cache@^11.0.0: + version "11.2.2" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.2.2.tgz#40fd37edffcfae4b2940379c0722dc6eeaa75f24" + integrity sha512-F9ODfyqML2coTIsQpSkRHnLSZMtkU8Q+mSfcaIyKwy58u+8k5nvAYeiNhsyMARvzNcXJ9QfWVrcPsC9e9rAxtg== + lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" @@ -5272,6 +5302,13 @@ minimatch@7.4.6: dependencies: brace-expansion "^2.0.1" +minimatch@^10.0.1, minimatch@^10.0.3: + version "10.1.1" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.1.1.tgz#e6e61b9b0c1dcab116b5a7d1458e8b6ae9e73a55" + integrity sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ== + dependencies: + "@isaacs/brace-expansion" "^5.0.0" + minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" @@ -5804,6 +5841,14 @@ path-scurry@^1.6.1: lru-cache "^9.1.1" minipass "^5.0.0 || ^6.0.2" +path-scurry@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-2.0.0.tgz#9f052289f23ad8bf9397a2a0425e7b8615c58580" + integrity sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg== + dependencies: + lru-cache "^11.0.0" + minipass "^7.1.2" + path-type@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-6.0.0.tgz#2f1bb6791a91ce99194caede5d6c5920ed81eb51" From 08bbec3c5c8e444245a7036190a75c9ad1ba7424 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 11 Nov 2025 21:25:51 +0100 Subject: [PATCH 238/268] build: roll Mantle and remove patch (#38437) --- DEPS | 2 +- patches/Mantle/.patches | 1 - .../remove_mtlmanagedobjectadapter_h.patch | 22 -------- patches/config.json | 1 - .../squirrel.mac/build_add_gn_config.patch | 52 ++++++++++++------- ...stead_of_deprecated_uttypeconformsto.patch | 4 +- 6 files changed, 36 insertions(+), 46 deletions(-) delete mode 100644 patches/Mantle/.patches delete mode 100644 patches/Mantle/remove_mtlmanagedobjectadapter_h.patch diff --git a/DEPS b/DEPS index 47df6264c695c..36f4e7a1506f3 100644 --- a/DEPS +++ b/DEPS @@ -12,7 +12,7 @@ vars = { 'reactiveobjc_version': '74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76', 'mantle_version': - '78d3966b3c331292ea29ec38661b25df0a245948', + '2a8e2123a3931038179ee06105c9e6ec336b12ea', 'engflow_reclient_configs_version': '955335c30a752e9ef7bff375baab5e0819b6c00d', diff --git a/patches/Mantle/.patches b/patches/Mantle/.patches deleted file mode 100644 index 35715fd569153..0000000000000 --- a/patches/Mantle/.patches +++ /dev/null @@ -1 +0,0 @@ -remove_mtlmanagedobjectadapter_h.patch diff --git a/patches/Mantle/remove_mtlmanagedobjectadapter_h.patch b/patches/Mantle/remove_mtlmanagedobjectadapter_h.patch deleted file mode 100644 index 70c6dded28220..0000000000000 --- a/patches/Mantle/remove_mtlmanagedobjectadapter_h.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Mon, 7 Dec 2020 17:34:08 -0800 -Subject: Remove MTLManagedObjectAdapter.h - -We are using an outdated version of Mantle which leverages NSConfinementConcurrencyType, -an enum which has been deprecated with no replacement as of macOS 10.11. -The actual solution to this problem is to upgrade Mantle, but for now -we just stop building the offending adapter. - -diff --git a/Mantle/Mantle.h b/Mantle/Mantle.h -index ebd74e7e435ef008ef29e94d406246c1f7b07a12..81abff872bd597ce6d21bb43be4d19ddc7253088 100644 ---- a/Mantle/Mantle.h -+++ b/Mantle/Mantle.h -@@ -15,7 +15,6 @@ FOUNDATION_EXPORT double MantleVersionNumber; - FOUNDATION_EXPORT const unsigned char MantleVersionString[]; - - #import --#import - #import - #import - #import diff --git a/patches/config.json b/patches/config.json index 8d297c0fd3e66..e16ddfda0eaa0 100644 --- a/patches/config.json +++ b/patches/config.json @@ -8,7 +8,6 @@ { "patch_dir": "src/electron/patches/nan", "repo": "src/third_party/nan" }, { "patch_dir": "src/electron/patches/perfetto", "repo": "src/third_party/perfetto" }, { "patch_dir": "src/electron/patches/squirrel.mac", "repo": "src/third_party/squirrel.mac" }, - { "patch_dir": "src/electron/patches/Mantle", "repo": "src/third_party/squirrel.mac/vendor/Mantle" }, { "patch_dir": "src/electron/patches/ReactiveObjC", "repo": "src/third_party/squirrel.mac/vendor/ReactiveObjC" }, { "patch_dir": "src/electron/patches/webrtc", "repo": "src/third_party/webrtc" }, { "patch_dir": "src/electron/patches/reclient-configs", "repo": "src/third_party/engflow-reclient-configs" }, diff --git a/patches/squirrel.mac/build_add_gn_config.patch b/patches/squirrel.mac/build_add_gn_config.patch index d2c9ef6b4d975..afe5a0285c893 100644 --- a/patches/squirrel.mac/build_add_gn_config.patch +++ b/patches/squirrel.mac/build_add_gn_config.patch @@ -23,10 +23,10 @@ index 89c499e451ecb48655cfd42b01ffa1da56998c2e..98f80aad43a87ed75ca1660ad6a178db +vendor diff --git a/BUILD.gn b/BUILD.gn new file mode 100644 -index 0000000000000000000000000000000000000000..68beb3d10580cdb747a78407c7f5bbb205825c4b +index 0000000000000000000000000000000000000000..a02e5f54d923513fd0676e91a99b8913bad6a57e --- /dev/null +++ b/BUILD.gn -@@ -0,0 +1,242 @@ +@@ -0,0 +1,250 @@ +assert(is_mac) + +import("//build/config/mac/rules.gni") @@ -48,12 +48,16 @@ index 0000000000000000000000000000000000000000..68beb3d10580cdb747a78407c7f5bbb2 + "Resources", + ] + info_plist = "vendor/Mantle/Mantle/Info.plist" -+ extra_substitutions = [ "CURRENT_PROJECT_VERSION=0.0.0" ] ++ extra_substitutions = [ ++ "CURRENT_PROJECT_VERSION=0.0.0", ++ "PRODUCT_BUNDLE_IDENTIFIER=com.electron.mantle", ++ ] + + configs -= [ + "//build/config/compiler:chromium_code", + "//build/config/gcc:symbol_visibility_hidden", + ] ++ + configs += [ "//build/config/compiler:no_chromium_code" ] + public_deps = [ ":mantle_headers" ] + deps = [] @@ -66,6 +70,8 @@ index 0000000000000000000000000000000000000000..68beb3d10580cdb747a78407c7f5bbb2 + include_dirs = [ + "vendor/Mantle/Mantle", + "vendor/Mantle/Mantle/extobjc", ++ "vendor/Mantle/Mantle/extobjc/include", ++ "vendor/Mantle/Mantle/include", + ] + + cflags_objc = [ @@ -196,6 +202,7 @@ index 0000000000000000000000000000000000000000..68beb3d10580cdb747a78407c7f5bbb2 + cflags_objc = [ + "-fobjc-weak", + "-Wno-unknown-warning-option", ++ "-Wno-deprecated-declarations", + "-Wno-block-capture-autoreleasing", + "-fobjc-arc", + ] @@ -262,6 +269,7 @@ index 0000000000000000000000000000000000000000..68beb3d10580cdb747a78407c7f5bbb2 + cflags_objc = [ + "-fobjc-weak", + "-fobjc-arc", ++ "-Wno-deprecated-declarations", + "-Wno-block-capture-autoreleasing", + ] + @@ -534,10 +542,10 @@ index 0000000000000000000000000000000000000000..a7aeeb7d3e187bd91ef12ed860d1e37e + sys.exit(e.returncode) diff --git a/filenames.gni b/filenames.gni new file mode 100644 -index 0000000000000000000000000000000000000000..3672153140b74fe948e7102b5e1ffad49341163d +index 0000000000000000000000000000000000000000..cee305c80588ffe2234bfadd5c211a9c301fe589 --- /dev/null +++ b/filenames.gni -@@ -0,0 +1,243 @@ +@@ -0,0 +1,249 @@ +squirrel_filenames = { + headers = [ + "Squirrel/NSBundle+SQRLVersionExtensions.h", @@ -582,22 +590,25 @@ index 0000000000000000000000000000000000000000..3672153140b74fe948e7102b5e1ffad4 + +mantle_filenames = { + headers = [ -+ "vendor/Mantle/Mantle/MTLJSONAdapter.h", -+ "vendor/Mantle/Mantle/MTLModel+NSCoding.h", -+ "vendor/Mantle/Mantle/MTLModel.h", + "vendor/Mantle/Mantle/MTLReflection.h", -+ "vendor/Mantle/Mantle/MTLValueTransformer.h", -+ "vendor/Mantle/Mantle/Mantle.h", -+ "vendor/Mantle/Mantle/NSArray+MTLManipulationAdditions.h", -+ "vendor/Mantle/Mantle/NSDictionary+MTLManipulationAdditions.h", + "vendor/Mantle/Mantle/NSError+MTLModelException.h", -+ "vendor/Mantle/Mantle/NSObject+MTLComparisonAdditions.h", -+ "vendor/Mantle/Mantle/NSValueTransformer+MTLInversionAdditions.h", -+ "vendor/Mantle/Mantle/NSValueTransformer+MTLPredefinedTransformerAdditions.h", -+ "vendor/Mantle/Mantle/extobjc/MTLEXTKeyPathCoding.h", -+ "vendor/Mantle/Mantle/extobjc/MTLEXTRuntimeExtensions.h", -+ "vendor/Mantle/Mantle/extobjc/MTLEXTScope.h", -+ "vendor/Mantle/Mantle/extobjc/metamacros.h", ++ "vendor/Mantle/Mantle/NSDictionary+MTLJSONKeyPath.h", ++ "vendor/Mantle/Mantle/include/MTLJSONAdapter.h", ++ "vendor/Mantle/Mantle/include/MTLModel+NSCoding.h", ++ "vendor/Mantle/Mantle/include/MTLModel.h", ++ "vendor/Mantle/Mantle/include/MTLTransformerErrorHandling.h", ++ "vendor/Mantle/Mantle/include/MTLValueTransformer.h", ++ "vendor/Mantle/Mantle/include/Mantle.h", ++ "vendor/Mantle/Mantle/include/NSArray+MTLManipulationAdditions.h", ++ "vendor/Mantle/Mantle/include/NSDictionary+MTLMappingAdditions.h", ++ "vendor/Mantle/Mantle/include/NSDictionary+MTLManipulationAdditions.h", ++ "vendor/Mantle/Mantle/include/NSObject+MTLComparisonAdditions.h", ++ "vendor/Mantle/Mantle/include/NSValueTransformer+MTLInversionAdditions.h", ++ "vendor/Mantle/Mantle/include/NSValueTransformer+MTLPredefinedTransformerAdditions.h", ++ "vendor/Mantle/Mantle/extobjc/include/MTLEXTKeyPathCoding.h", ++ "vendor/Mantle/Mantle/extobjc/include/MTLEXTRuntimeExtensions.h", ++ "vendor/Mantle/Mantle/extobjc/include/MTLEXTScope.h", ++ "vendor/Mantle/Mantle/extobjc/include/MTLMetamacros.h", + ] + + sources = [ @@ -605,9 +616,12 @@ index 0000000000000000000000000000000000000000..3672153140b74fe948e7102b5e1ffad4 + "vendor/Mantle/Mantle/MTLModel+NSCoding.m", + "vendor/Mantle/Mantle/MTLModel.m", + "vendor/Mantle/Mantle/MTLReflection.m", ++ "vendor/Mantle/Mantle/MTLTransformerErrorHandling.m", + "vendor/Mantle/Mantle/MTLValueTransformer.m", + "vendor/Mantle/Mantle/NSArray+MTLManipulationAdditions.m", ++ "vendor/Mantle/Mantle/NSDictionary+MTLJSONKeyPath.m", + "vendor/Mantle/Mantle/NSDictionary+MTLManipulationAdditions.m", ++ "vendor/Mantle/Mantle/NSDictionary+MTLMappingAdditions.m", + "vendor/Mantle/Mantle/NSError+MTLModelException.m", + "vendor/Mantle/Mantle/NSObject+MTLComparisonAdditions.m", + "vendor/Mantle/Mantle/NSValueTransformer+MTLInversionAdditions.m", diff --git a/patches/squirrel.mac/use_uttype_class_instead_of_deprecated_uttypeconformsto.patch b/patches/squirrel.mac/use_uttype_class_instead_of_deprecated_uttypeconformsto.patch index c1966fc3370b5..6fda441fe344b 100644 --- a/patches/squirrel.mac/use_uttype_class_instead_of_deprecated_uttypeconformsto.patch +++ b/patches/squirrel.mac/use_uttype_class_instead_of_deprecated_uttypeconformsto.patch @@ -6,10 +6,10 @@ Subject: Use UTType class instead of deprecated UTTypeConformsTo macOS 12 removed support for the deprecated UTTypeConformsTo function. Its replacement is the dedicated UTType class in the Uniform Type Identifiers framework. diff --git a/BUILD.gn b/BUILD.gn -index 68beb3d10580cdb747a78407c7f5bbb205825c4b..b9e871a0292eeda1f0e738329d0b510bdc3e34a0 100644 +index a02e5f54d923513fd0676e91a99b8913bad6a57e..6f32c4b203a0efa2ccd515e3754494deef5b39f0 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -227,6 +227,7 @@ mac_framework_bundle("squirrel_framework") { +@@ -234,6 +234,7 @@ mac_framework_bundle("squirrel_framework") { "IOKit.framework", "Security.framework", "ServiceManagement.framework", From e8c1eb62035ceb829a290dab3c804e70b47c9307 Mon Sep 17 00:00:00 2001 From: BILL SHEN Date: Wed, 12 Nov 2025 04:30:04 +0800 Subject: [PATCH 239/268] fix: restore window's canHide property on macOS (#47970) * fix: restore window's canHide property on macOS * chore: empty commit to unstick CI --------- Co-authored-by: Charles Kerr --- shell/browser/browser_mac.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shell/browser/browser_mac.mm b/shell/browser/browser_mac.mm index c4fddaa05a595..4c5156ae21201 100644 --- a/shell/browser/browser_mac.mm +++ b/shell/browser/browser_mac.mm @@ -543,6 +543,9 @@ LoginItemSettings GetLoginItemSettingsDeprecated() { gin_helper::Promise promise(isolate); v8::Local handle = promise.GetHandle(); + for (auto* const& window : WindowList::GetWindows()) + [window->GetNativeWindow().GetNativeNSWindow() setCanHide:YES]; + BOOL active = [[NSRunningApplication currentApplication] isActive]; ProcessSerialNumber psn = {0, kCurrentProcess}; if (active) { From b73dbd68d6b4b5afb65687915ffc752ae6c34ac0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 11 Nov 2025 21:33:27 +0100 Subject: [PATCH 240/268] build(deps): bump actions-cool/issues-helper from 3.7.1 to 3.7.2 (#48884) Bumps [actions-cool/issues-helper](https://github.com/actions-cool/issues-helper) from 3.7.1 to 3.7.2. - [Release notes](https://github.com/actions-cool/issues-helper/releases) - [Changelog](https://github.com/actions-cool/issues-helper/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions-cool/issues-helper/compare/564cd9b1baacd7a9cd634e8039a149901ee5f600...9861779a695cf1898bd984c727f685f351cfc372) --- updated-dependencies: - dependency-name: actions-cool/issues-helper dependency-version: 3.7.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/issue-labeled.yml | 2 +- .github/workflows/issue-opened.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml index e9c4195d47060..fbc8d12b252ea 100644 --- a/.github/workflows/issue-labeled.yml +++ b/.github/workflows/issue-labeled.yml @@ -72,7 +72,7 @@ jobs: creds: ${{ secrets.ISSUE_TRIAGE_GH_APP_CREDS }} - name: Create comment if: ${{ steps.check-for-comment.outputs.SHOULD_COMMENT }} - uses: actions-cool/issues-helper@564cd9b1baacd7a9cd634e8039a149901ee5f600 # v3.7.1 + uses: actions-cool/issues-helper@9861779a695cf1898bd984c727f685f351cfc372 # v3.7.2 with: actions: 'create-comment' token: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/issue-opened.yml b/.github/workflows/issue-opened.yml index 323df66aa4c83..05fb8a3d2a106 100644 --- a/.github/workflows/issue-opened.yml +++ b/.github/workflows/issue-opened.yml @@ -134,7 +134,7 @@ jobs: } - name: Create unsupported major comment if: ${{ steps.add-labels.outputs.unsupportedMajor }} - uses: actions-cool/issues-helper@564cd9b1baacd7a9cd634e8039a149901ee5f600 # v3.7.1 + uses: actions-cool/issues-helper@9861779a695cf1898bd984c727f685f351cfc372 # v3.7.2 with: actions: 'create-comment' token: ${{ steps.generate-token.outputs.token }} From f6ffd0a2f23a121ce8bda41cc9b333119ceb2c3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=8A=B9=EA=B7=9C?= Date: Wed, 12 Nov 2025 20:59:32 +0900 Subject: [PATCH 241/268] docs: fix v40 stable release date (#48889) * docs(timelines): Correct v40.0.0 stable release date On the Electron Timelines tutorial page (/docs/latest/tutorial/electron-timelines), there is a clear typo in the release schedule for v40.0.0. The table currently lists the dates as: * Alpha: 2025-Oct-30 * Beta: 2025-Dec-03 * **Stable: 2025-Oct-28** This is logically incorrect, as the 'Stable' release date (Oct 28) is listed *before* both the 'Alpha' (Oct 30) and 'Beta' (Dec 03) dates for the same version. This appears to be a copy-paste error, as the 'Stable' date (2025-Oct-28) is identical to the 'Stable' date for the v39.0.0 release in the preceding row. This commit updates the 'Stable' date for v40.0.0 to its correct value, ensuring the timeline is accurate and logical. * docs: Update v40.0.0 stable date to 2026-Jan-13 based on Chromium schedule --- docs/tutorial/electron-timelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/electron-timelines.md b/docs/tutorial/electron-timelines.md index a01fe78e21a8b..deb2e71125e13 100644 --- a/docs/tutorial/electron-timelines.md +++ b/docs/tutorial/electron-timelines.md @@ -9,7 +9,7 @@ check out our [Electron Versioning](./electron-versioning.md) doc. | Electron | Alpha | Beta | Stable | EOL | Chrome | Node | Supported | | ------- | ----- | ------- | ------ | ------ | ---- | ---- | ---- | -| 40.0.0 | 2025-Oct-30 | 2025-Dec-03 | 2025-Oct-28 | 2026-Jun-30 | M144 | TBD | ✅ | +| 40.0.0 | 2025-Oct-30 | 2025-Dec-03 | 2026-Jan-13 | 2026-Jun-30 | M144 | TBD | ✅ | | 39.0.0 | 2025-Sep-04 | 2025-Oct-01 | 2025-Oct-28 | 2026-May-05 | M142 | v22.20 | ✅ | | 38.0.0 | 2025-Jun-26 | 2025-Aug-06 | 2025-Sep-02 | 2026-Mar-10 | M140 | v22.18 | ✅ | | 37.0.0 | 2025-May-01 | 2025-May-28 | 2025-Jun-24 | 2026-Jan-13 | M138 | v22.16 | ✅ | From 01bd9d57d90fa5d06cbed2331379464b7d404665 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Wed, 12 Nov 2025 10:16:31 -0500 Subject: [PATCH 242/268] docs: deprecate clipboard API access from renderer processes (#48877) --- docs/api/clipboard.md | 7 +++++-- docs/breaking-changes.md | 8 ++++++++ lib/renderer/api/clipboard.ts | 38 ++++++++++++++++++++++++++++------- 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/docs/api/clipboard.md b/docs/api/clipboard.md index a6e6da7592ea6..64001c8d25c09 100644 --- a/docs/api/clipboard.md +++ b/docs/api/clipboard.md @@ -2,10 +2,13 @@ > Perform copy and paste operations on the system clipboard. -Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process) (non-sandboxed only) +Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process) _Deprecated_ (non-sandboxed only) + +> [!NOTE] +> Using the `clipoard` API from the renderer process is deprecated. > [!IMPORTANT] -> If you want to call this API from a renderer process with context isolation enabled, +> If you want to call this API from a renderer process, > place the API call in your preload script and > [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the > [`contextBridge`](context-bridge.md) API. diff --git a/docs/breaking-changes.md b/docs/breaking-changes.md index 11980098d5d92..4043fa2fad8dd 100644 --- a/docs/breaking-changes.md +++ b/docs/breaking-changes.md @@ -12,6 +12,14 @@ This document uses the following convention to categorize breaking changes: * **Deprecated:** An API was marked as deprecated. The API will continue to function, but will emit a deprecation warning, and will be removed in a future release. * **Removed:** An API or feature was removed, and is no longer supported by Electron. +## Planned Breaking API Changes (40.0) + +### Deprecated: `clipboard` API access from renderer processes + +Using the `clipboard` API directly in the renderer process is deprecated. +If you want to call this API from a renderer process, place the API call in +your preload script and expose it using the [contextBridge](https://www.electronjs.org/docs/latest/api/context-bridge) API. + ## Planned Breaking API Changes (39.0) ### Deprecated: `--host-rules` command line switch diff --git a/lib/renderer/api/clipboard.ts b/lib/renderer/api/clipboard.ts index 96e77b2871e15..3b53f410da9d1 100644 --- a/lib/renderer/api/clipboard.ts +++ b/lib/renderer/api/clipboard.ts @@ -1,21 +1,45 @@ +import * as deprecate from '@electron/internal/common/deprecate'; import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages'; import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils'; -const clipboard = process._linkedBinding('electron_common_clipboard'); +const clipboard = {} as Electron.Clipboard; +const originalClipboard = process._linkedBinding('electron_common_clipboard'); + +const warnDeprecatedAccess = function (method: keyof Electron.Clipboard) { + return deprecate.warnOnceMessage(`Accessing 'clipboard.${method}' from the renderer process is + deprecated and will be removed. Please use the 'contextBridge' API to access + the clipboard API from the renderer.`); +}; + +const makeDeprecatedMethod = function (method: keyof Electron.Clipboard): any { + const warnDeprecated = warnDeprecatedAccess(method); + return (...args: any[]) => { + warnDeprecated(); + return (originalClipboard[method] as any)(...args); + }; +}; const makeRemoteMethod = function (method: keyof Electron.Clipboard): any { - return (...args: any[]) => ipcRendererUtils.invokeSync(IPC_MESSAGES.BROWSER_CLIPBOARD_SYNC, method, ...args); + const warnDeprecated = warnDeprecatedAccess(method); + return (...args: any[]) => { + warnDeprecated(); + return ipcRendererUtils.invokeSync(IPC_MESSAGES.BROWSER_CLIPBOARD_SYNC, method, ...args); + }; }; if (process.platform === 'linux') { // On Linux we could not access clipboard in renderer process. - for (const method of Object.keys(clipboard) as (keyof Electron.Clipboard)[]) { + for (const method of Object.keys(originalClipboard) as (keyof Electron.Clipboard)[]) { clipboard[method] = makeRemoteMethod(method); } -} else if (process.platform === 'darwin') { - // Read/write to find pasteboard over IPC since only main process is notified of changes - clipboard.readFindText = makeRemoteMethod('readFindText'); - clipboard.writeFindText = makeRemoteMethod('writeFindText'); +} else { + for (const method of Object.keys(originalClipboard) as (keyof Electron.Clipboard)[]) { + if (process.platform === 'darwin' && (method === 'readFindText' || method === 'writeFindText')) { + clipboard[method] = makeRemoteMethod(method); + } else { + clipboard[method] = makeDeprecatedMethod(method); + } + } } export default clipboard; From bd0a60fe8d221991e637c5fbeda743fc23c1182a Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 12 Nov 2025 12:53:00 -0600 Subject: [PATCH 243/268] refactor: make `api::WebRequest` inherit from `gin::Wrappable` (#48762) * refactor: make api::WebRequest inherit from gin::Wrappable refactor: remove unused v8::Isolate* arg from WebRequest ctor refactor: make electron::api::Session::web_request_ a cppgc::Member refactor: allocate api::WebRequest on cpp heap refactor: modify Create(), Find(), and FindOrCreate() to return a WebRequest* * refactor: ProxyingURLLoaderFactory takes a concrete api::WebRequest instead of a WebRequestAPI Experimental commit to ensure `ProxyingURLLoaderFactory::web_request_api_` won't be a dangling pointer. * chore: fix doc shear * refactor: use cppgc::WeakPersistent<> in ProxyingURLLoaderFactory * refactor: make ProxyingURLLoaderFactory::web_request_ const * refactor: make ProxyingWebSocket::web_request_ a cppgc::WeakPersistent<> * add a gin::WeakCellFactory to api::WebRequest * refactor: use a gin::WeakCell for the bound WebRequest argument in HandleOnBeforeRequestResponseEvent() * chore: update patches --- ...ctron_objects_to_wrappablepointertag.patch | 7 +-- shell/browser/api/electron_api_session.cc | 10 ++-- shell/browser/api/electron_api_session.h | 5 +- shell/browser/api/electron_api_web_request.cc | 48 +++++++++++-------- shell/browser/api/electron_api_web_request.h | 34 ++++++++----- shell/browser/electron_browser_client.cc | 30 +++++++----- .../net/proxying_url_loader_factory.cc | 32 ++++++------- .../browser/net/proxying_url_loader_factory.h | 5 +- shell/browser/net/proxying_websocket.h | 3 +- 9 files changed, 97 insertions(+), 77 deletions(-) diff --git a/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch b/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch index a4c11f6c62255..042769fc0f74e 100644 --- a/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch +++ b/patches/chromium/chore_add_electron_objects_to_wrappablepointertag.patch @@ -8,10 +8,10 @@ electron objects that extend gin::Wrappable and gets allocated on the cpp heap diff --git a/gin/public/wrappable_pointer_tags.h b/gin/public/wrappable_pointer_tags.h -index 573bcb2e56068a2ade6d8ab28964b077487874fd..93bf3814b38f8093e39f1a0548a43dfb347e49b3 100644 +index 573bcb2e56068a2ade6d8ab28964b077487874fd..0321ca6d3c7e1ed541cc1beffb20b1db3d03a0c8 100644 --- a/gin/public/wrappable_pointer_tags.h +++ b/gin/public/wrappable_pointer_tags.h -@@ -74,7 +74,13 @@ enum WrappablePointerTag : uint16_t { +@@ -74,7 +74,14 @@ enum WrappablePointerTag : uint16_t { kTextInputControllerBindings, // content::TextInputControllerBindings kWebAXObjectProxy, // content::WebAXObjectProxy kWrappedExceptionHandler, // extensions::WrappedExceptionHandler @@ -22,7 +22,8 @@ index 573bcb2e56068a2ade6d8ab28964b077487874fd..93bf3814b38f8093e39f1a0548a43dfb + kElectronMenu, // electron::api::Menu + kElectronNetLog, // electron::api::NetLog + kElectronSession, // electron::api::Session -+ kLastPointerTag = kElectronSession, ++ kElectronWebRequest, // electron::api::WebRequest ++ kLastPointerTag = kElectronWebRequest, }; static_assert(kLastPointerTag < diff --git a/shell/browser/api/electron_api_session.cc b/shell/browser/api/electron_api_session.cc index da2525aab9389..26208e8339e23 100644 --- a/shell/browser/api/electron_api_session.cc +++ b/shell/browser/api/electron_api_session.cc @@ -1360,12 +1360,10 @@ v8::Local Session::ServiceWorkerContext(v8::Isolate* isolate) { return service_worker_context_.Get(isolate); } -v8::Local Session::WebRequest(v8::Isolate* isolate) { - if (web_request_.IsEmptyThreadSafe()) { - auto handle = WebRequest::Create(base::PassKey{}, isolate); - web_request_.Reset(isolate, handle.ToV8()); - } - return web_request_.Get(isolate); +WebRequest* Session::WebRequest(v8::Isolate* isolate) { + if (!web_request_) + web_request_ = WebRequest::Create(isolate, base::PassKey{}); + return web_request_; } NetLog* Session::NetLog(v8::Isolate* isolate) { diff --git a/shell/browser/api/electron_api_session.h b/shell/browser/api/electron_api_session.h index 29cf1eea0cfa3..58c28b9dab1e0 100644 --- a/shell/browser/api/electron_api_session.h +++ b/shell/browser/api/electron_api_session.h @@ -61,6 +61,7 @@ struct PreloadScript; namespace api { class NetLog; +class WebRequest; class Session final : public gin::Wrappable, public gin_helper::Constructible, @@ -169,7 +170,7 @@ class Session final : public gin::Wrappable, v8::Local Extensions(v8::Isolate* isolate); v8::Local Protocol(v8::Isolate* isolate); v8::Local ServiceWorkerContext(v8::Isolate* isolate); - v8::Local WebRequest(v8::Isolate* isolate); + WebRequest* WebRequest(v8::Isolate* isolate); api::NetLog* NetLog(v8::Isolate* isolate); void Preconnect(const gin_helper::Dictionary& options, gin::Arguments* args); v8::Local CloseAllConnections(); @@ -217,7 +218,7 @@ class Session final : public gin::Wrappable, v8::TracedReference protocol_; cppgc::Member net_log_; v8::TracedReference service_worker_context_; - v8::TracedReference web_request_; + cppgc::Member web_request_; raw_ptr isolate_; diff --git a/shell/browser/api/electron_api_web_request.cc b/shell/browser/api/electron_api_web_request.cc index 722cb34816762..0b644a925b9a8 100644 --- a/shell/browser/api/electron_api_web_request.cc +++ b/shell/browser/api/electron_api_web_request.cc @@ -22,6 +22,7 @@ #include "gin/converter.h" #include "gin/dictionary.h" #include "gin/object_template_builder.h" +#include "gin/persistent.h" #include "shell/browser/api/electron_api_session.h" #include "shell/browser/api/electron_api_web_contents.h" #include "shell/browser/api/electron_api_web_frame_main.h" @@ -204,7 +205,8 @@ CalculateOnBeforeSendHeadersDelta(const net::HttpRequestHeaders* old_headers, } // namespace -gin::DeprecatedWrapperInfo WebRequest::kWrapperInfo = {gin::kEmbedderNativeGin}; +const gin::WrapperInfo WebRequest::kWrapperInfo = {{gin::kEmbedderNativeGin}, + gin::kElectronWebRequest}; WebRequest::RequestFilter::RequestFilter( std::set include_url_patterns, @@ -318,8 +320,7 @@ WebRequest::~WebRequest() = default; gin::ObjectTemplateBuilder WebRequest::GetObjectTemplateBuilder( v8::Isolate* isolate) { - return gin_helper::DeprecatedWrappable::GetObjectTemplateBuilder( - isolate) + return gin::Wrappable::GetObjectTemplateBuilder(isolate) .SetMethod( "onBeforeRequest", &WebRequest::SetResponseListener) @@ -342,8 +343,17 @@ gin::ObjectTemplateBuilder WebRequest::GetObjectTemplateBuilder( &WebRequest::SetSimpleListener); } -const char* WebRequest::GetTypeName() { - return GetClassName(); +const gin::WrapperInfo* WebRequest::wrapper_info() const { + return &kWrapperInfo; +} + +const char* WebRequest::GetHumanReadableName() const { + return "Electron / WebRequest"; +} + +void WebRequest::Trace(cppgc::Visitor* visitor) const { + gin::Wrappable::Trace(visitor); + visitor->Trace(weak_factory_); } bool WebRequest::HasListener() const { @@ -381,9 +391,11 @@ int WebRequest::HandleOnBeforeRequestResponseEvent( gin_helper::Dictionary details(isolate, v8::Object::New(isolate)); FillDetails(&details, request_info, request, *new_url); - ResponseCallback response = - base::BindOnce(&WebRequest::OnBeforeRequestListenerResult, - base::Unretained(this), request_info->id); + auto& allocation_handle = isolate->GetCppHeap()->GetAllocationHandle(); + ResponseCallback response = base::BindOnce( + &WebRequest::OnBeforeRequestListenerResult, + gin::WrapPersistent(weak_factory_.GetWeakCell(allocation_handle)), + request_info->id); info.listener.Run(gin::ConvertToV8(isolate, details), std::move(response)); return net::ERR_IO_PENDING; } @@ -777,22 +789,16 @@ void WebRequest::OnLoginAuthResult( } // static -gin_helper::Handle WebRequest::FromOrCreate( - v8::Isolate* isolate, - content::BrowserContext* browser_context) { - v8::Local web_request = - Session::FromOrCreate(isolate, browser_context)->WebRequest(isolate); - gin_helper::Handle handle; - gin::ConvertFromV8(isolate, web_request, &handle); - DCHECK(!handle.IsEmpty()); - return handle; +WebRequest* WebRequest::FromOrCreate(v8::Isolate* isolate, + content::BrowserContext* browser_context) { + return Session::FromOrCreate(isolate, browser_context)->WebRequest(isolate); } // static -gin_helper::Handle WebRequest::Create( - base::PassKey passkey, - v8::Isolate* isolate) { - return gin_helper::CreateHandle(isolate, new WebRequest{std::move(passkey)}); +WebRequest* WebRequest::Create(v8::Isolate* isolate, + base::PassKey passkey) { + return cppgc::MakeGarbageCollected( + isolate->GetCppHeap()->GetAllocationHandle(), std::move(passkey)); } } // namespace electron::api diff --git a/shell/browser/api/electron_api_web_request.h b/shell/browser/api/electron_api_web_request.h index 952357dcdd144..dba78e2d7821d 100644 --- a/shell/browser/api/electron_api_web_request.h +++ b/shell/browser/api/electron_api_web_request.h @@ -10,9 +10,10 @@ #include #include "base/types/pass_key.h" +#include "gin/weak_cell.h" +#include "gin/wrappable.h" #include "net/base/completion_once_callback.h" #include "services/network/public/cpp/resource_request.h" -#include "shell/common/gin_helper/wrappable.h" class URLPattern; @@ -38,7 +39,7 @@ namespace electron::api { class Session; -class WebRequest final : public gin_helper::DeprecatedWrappable { +class WebRequest final : public gin::Wrappable { public: using BeforeSendHeadersCallback = base::OnceCallback& removed_headers, @@ -65,21 +66,29 @@ class WebRequest final : public gin_helper::DeprecatedWrappable { // Convenience wrapper around api::Session::FromOrCreate()->WebRequest(). // Creates the Session and WebRequest if they don't already exist. // Note that the WebRequest is owned by the session, not by the caller. - static gin_helper::Handle FromOrCreate( - v8::Isolate* isolate, - content::BrowserContext* browser_context); + static WebRequest* FromOrCreate(v8::Isolate* isolate, + content::BrowserContext* browser_context); // Return a new WebRequest object. This can only be called by api::Session. - static gin_helper::Handle Create(base::PassKey, - v8::Isolate* isolate); + static WebRequest* Create(v8::Isolate* isolate, base::PassKey); + + // Make public for cppgc::MakeGarbageCollected. + explicit WebRequest(base::PassKey); + ~WebRequest() override; + + // disable copy + WebRequest(const WebRequest&) = delete; + WebRequest& operator=(const WebRequest&) = delete; static const char* GetClassName() { return "WebRequest"; } - // gin_helper::Wrappable: - static gin::DeprecatedWrapperInfo kWrapperInfo; + // gin::Wrappable: + static const gin::WrapperInfo kWrapperInfo; + void Trace(cppgc::Visitor*) const override; + const gin::WrapperInfo* wrapper_info() const override; + const char* GetHumanReadableName() const override; gin::ObjectTemplateBuilder GetObjectTemplateBuilder( v8::Isolate* isolate) override; - const char* GetTypeName() override; bool HasListener() const; int OnBeforeRequest(extensions::WebRequestInfo* info, @@ -118,9 +127,6 @@ class WebRequest final : public gin_helper::DeprecatedWrappable { void OnRequestWillBeDestroyed(extensions::WebRequestInfo* info); private: - explicit WebRequest(base::PassKey); - ~WebRequest() override; - // Contains info about requests that are blocked waiting for a response from // the user. struct BlockedRequest; @@ -235,6 +241,8 @@ class WebRequest final : public gin_helper::DeprecatedWrappable { std::map simple_listeners_; std::map response_listeners_; std::map blocked_requests_; + + gin::WeakCellFactory weak_factory_{this}; }; } // namespace electron::api diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index b5620f9fc692a..9fea5d0e060d2 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -1272,11 +1272,11 @@ bool ElectronBrowserClient::WillInterceptWebSocket( v8::Isolate* isolate = JavascriptEnvironment::GetIsolate(); v8::HandleScope scope(isolate); auto* browser_context = frame->GetProcess()->GetBrowserContext(); - auto web_request = api::WebRequest::FromOrCreate(isolate, browser_context); + auto* web_request = api::WebRequest::FromOrCreate(isolate, browser_context); // NOTE: Some unit test environments do not initialize // BrowserContextKeyedAPI factories for e.g. WebRequest. - if (!web_request.get()) + if (!web_request) return false; bool has_listener = web_request->HasListener(); @@ -1304,8 +1304,8 @@ void ElectronBrowserClient::CreateWebSocket( v8::HandleScope scope(isolate); auto* browser_context = frame->GetProcess()->GetBrowserContext(); - auto web_request = api::WebRequest::FromOrCreate(isolate, browser_context); - DCHECK(web_request.get()); + auto* web_request = api::WebRequest::FromOrCreate(isolate, browser_context); + DCHECK(web_request); #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) if (!web_request->HasListener()) { @@ -1322,7 +1322,7 @@ void ElectronBrowserClient::CreateWebSocket( #endif ProxyingWebSocket::StartProxying( - web_request.get(), std::move(factory), url, site_for_cookies, user_agent, + web_request, std::move(factory), url, site_for_cookies, user_agent, std::move(handshake_client), true, frame->GetProcess()->GetDeprecatedID(), frame->GetRoutingID(), frame->GetLastCommittedOrigin(), browser_context, &next_id_); @@ -1346,8 +1346,9 @@ void ElectronBrowserClient::WillCreateURLLoaderFactory( scoped_refptr navigation_response_task_runner) { v8::Isolate* isolate = JavascriptEnvironment::GetIsolate(); v8::HandleScope scope(isolate); - auto web_request = api::WebRequest::FromOrCreate(isolate, browser_context); - DCHECK(web_request.get()); + auto* const web_request = + api::WebRequest::FromOrCreate(isolate, browser_context); + DCHECK(web_request); #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) if (!web_request->HasListener()) { @@ -1388,13 +1389,18 @@ void ElectronBrowserClient::WillCreateURLLoaderFactory( auto* protocol_registry = ProtocolRegistry::FromBrowserContext(browser_context); - new ProxyingURLLoaderFactory( - web_request.get(), protocol_registry->intercept_handlers(), + new ProxyingURLLoaderFactory{ + web_request, + protocol_registry->intercept_handlers(), render_process_id, frame_host ? frame_host->GetRoutingID() : IPC::mojom::kRoutingIdNone, - &next_id_, std::move(navigation_ui_data), std::move(navigation_id), - std::move(proxied_receiver), std::move(target_factory_remote), - std::move(header_client_receiver), type); + &next_id_, + std::move(navigation_ui_data), + std::move(navigation_id), + std::move(proxied_receiver), + std::move(target_factory_remote), + std::move(header_client_receiver), + type}; } std::vector> diff --git a/shell/browser/net/proxying_url_loader_factory.cc b/shell/browser/net/proxying_url_loader_factory.cc index 6ea5536c9f706..255687b8699e4 100644 --- a/shell/browser/net/proxying_url_loader_factory.cc +++ b/shell/browser/net/proxying_url_loader_factory.cc @@ -88,7 +88,7 @@ ProxyingURLLoaderFactory::InProgressRequest::~InProgressRequest() { // This is important to ensure that no outstanding blocking requests continue // to reference state owned by this object. if (info_) { - factory_->web_request()->OnRequestWillBeDestroyed(&info_.value()); + factory_->web_request_->OnRequestWillBeDestroyed(&info_.value()); } if (on_before_send_headers_callback_) { std::move(on_before_send_headers_callback_) @@ -147,7 +147,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::RestartInternal() { weak_factory_.GetWeakPtr()); } redirect_url_ = GURL(); - int result = factory_->web_request()->OnBeforeRequest( + int result = factory_->web_request_->OnBeforeRequest( &info_.value(), request_, continuation, &redirect_url_); if (result == net::ERR_BLOCKED_BY_CLIENT) { // The request was cancelled synchronously. Dispatch an error notification @@ -293,8 +293,8 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnComplete( } target_client_->OnComplete(status); - factory_->web_request()->OnCompleted(&info_.value(), request_, - status.error_code); + factory_->web_request_->OnCompleted(&info_.value(), request_, + status.error_code); // Deletes |this|. factory_->RemoveRequest(network_service_request_id_, request_id_); @@ -442,7 +442,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::ContinueToBeforeSendHeaders( auto continuation = base::BindRepeating( &InProgressRequest::ContinueToSendHeaders, weak_factory_.GetWeakPtr()); // Note: In Electron onBeforeSendHeaders is called for all protocols. - int result = factory_->web_request()->OnBeforeSendHeaders( + int result = factory_->web_request_->OnBeforeSendHeaders( &info_.value(), request_, continuation, &request_.headers); if (result == net::ERR_BLOCKED_BY_CLIENT) { @@ -556,8 +556,8 @@ void ProxyingURLLoaderFactory::InProgressRequest::ContinueToSendHeaders( proxied_client_receiver_.Resume(); // Note: In Electron onSendHeaders is called for all protocols. - factory_->web_request()->OnSendHeaders(&info_.value(), request_, - request_.headers); + factory_->web_request_->OnSendHeaders(&info_.value(), request_, + request_.headers); if (!current_request_uses_header_client_) ContinueToStartRequest(net::OK); @@ -599,8 +599,8 @@ void ProxyingURLLoaderFactory::InProgressRequest:: if (info_->response_code == net::HTTP_PROXY_AUTHENTICATION_REQUIRED) return; // We notify the completion here, and delete |this|. - factory_->web_request()->OnResponseStarted(&info_.value(), request_); - factory_->web_request()->OnCompleted(&info_.value(), request_, net::OK); + factory_->web_request_->OnResponseStarted(&info_.value(), request_); + factory_->web_request_->OnCompleted(&info_.value(), request_, net::OK); factory_->RemoveRequest(network_service_request_id_, request_id_); return; @@ -654,7 +654,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::ContinueToResponseStarted( proxied_client_receiver_.Resume(); - factory_->web_request()->OnResponseStarted(&info_.value(), request_); + factory_->web_request_->OnResponseStarted(&info_.value(), request_); target_client_->OnReceiveResponse(current_response_.Clone(), std::move(current_body_), std::move(current_cached_metadata_)); @@ -673,8 +673,8 @@ void ProxyingURLLoaderFactory::InProgressRequest::ContinueToBeforeRedirect( if (proxied_client_receiver_.is_bound()) proxied_client_receiver_.Resume(); - factory_->web_request()->OnBeforeRedirect(&info_.value(), request_, - redirect_info.new_url); + factory_->web_request_->OnBeforeRedirect(&info_.value(), request_, + redirect_info.new_url); target_client_->OnReceiveRedirect(redirect_info, current_response_.Clone()); request_.url = redirect_info.new_url; request_.method = redirect_info.new_method; @@ -697,7 +697,7 @@ void ProxyingURLLoaderFactory::InProgressRequest:: auto callback_pair = base::SplitOnceCallback(std::move(continuation)); DCHECK(info_.has_value()); - int result = factory_->web_request()->OnHeadersReceived( + int result = factory_->web_request_->OnHeadersReceived( &info_.value(), request_, std::move(callback_pair.first), current_response_->headers.get(), &override_headers_, &redirect_url_); if (result == net::ERR_BLOCKED_BY_CLIENT) { @@ -725,8 +725,8 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnRequestError( const network::URLLoaderCompletionStatus& status) { if (target_client_) target_client_->OnComplete(status); - factory_->web_request()->OnErrorOccurred(&info_.value(), request_, - status.error_code); + factory_->web_request_->OnErrorOccurred(&info_.value(), request_, + status.error_code); // Deletes |this|. factory_->RemoveRequest(network_service_request_id_, request_id_); @@ -825,7 +825,7 @@ void ProxyingURLLoaderFactory::CreateLoaderAndStart( return; } - if (!web_request()->HasListener()) { + if (!web_request_->HasListener()) { // Pass-through to the original factory. target_factory_->CreateLoaderAndStart(std::move(loader), request_id, options, request, std::move(client), diff --git a/shell/browser/net/proxying_url_loader_factory.h b/shell/browser/net/proxying_url_loader_factory.h index e4b49d1820d69..9f488ae49afc9 100644 --- a/shell/browser/net/proxying_url_loader_factory.h +++ b/shell/browser/net/proxying_url_loader_factory.h @@ -34,6 +34,7 @@ #include "shell/browser/api/electron_api_web_request.h" #include "shell/browser/net/electron_url_loader_factory.h" #include "url/gurl.h" +#include "v8/include/cppgc/persistent.h" namespace mojo { template @@ -244,8 +245,6 @@ class ProxyingURLLoaderFactory bool IsForServiceWorkerScript() const; private: - api::WebRequest* web_request() { return web_request_; } - void OnTargetFactoryError(); void OnProxyBindingError(); void RemoveRequest(int32_t network_service_request_id, uint64_t request_id); @@ -253,7 +252,7 @@ class ProxyingURLLoaderFactory bool ShouldIgnoreConnectionsLimit(const network::ResourceRequest& request); - raw_ptr web_request_; + const cppgc::WeakPersistent web_request_; // This is passed from api::Protocol. // diff --git a/shell/browser/net/proxying_websocket.h b/shell/browser/net/proxying_websocket.h index bb0d7d87ffab9..1fb8bd8a9b4a4 100644 --- a/shell/browser/net/proxying_websocket.h +++ b/shell/browser/net/proxying_websocket.h @@ -23,6 +23,7 @@ #include "shell/browser/api/electron_api_web_request.h" #include "url/gurl.h" #include "url/origin.h" +#include "v8/include/cppgc/persistent.h" namespace electron { @@ -123,7 +124,7 @@ class ProxyingWebSocket : public network::mojom::WebSocketHandshakeClient, void OnMojoConnectionError(); // Passed from api::WebRequest. - raw_ptr web_request_; + const cppgc::WeakPersistent web_request_; // Saved to feed the api::WebRequest. network::ResourceRequest request_; From e239d0288f98b5ba3780217f6a7455041de15dfb Mon Sep 17 00:00:00 2001 From: vulture Date: Wed, 12 Nov 2025 12:15:40 -0800 Subject: [PATCH 244/268] fix: Windows: Calling window.setFocusable(true) will no longer cause a window to lose focus (#45640) Make setFocusable only deactivate a window if focusable is false. Do not deactivate a window when setting focusable to true. --- shell/browser/native_window_views.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index 56507a30c0438..9cd76be0ddb54 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -1363,7 +1363,8 @@ void NativeWindowViews::SetFocusable(bool focusable) { ex_style |= WS_EX_NOACTIVATE; ::SetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE, ex_style); SetSkipTaskbar(!focusable); - Focus(false); + if (!focusable) + Focus(false); #endif } From 001873552fcebdf73231ae6ee7fbd8b12257180e Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" Date: Thu, 13 Nov 2025 09:49:51 +0100 Subject: [PATCH 245/268] chore: bump chromium to 144.0.7522.0 (main) (#48892) * chore: bump chromium in DEPS to 144.0.7522.0 * 7131867: Remove GenericScopedHandle::IsValid in favor of is_valid https://chromium-review.googlesource.com/c/chromium/src/+/7131867 * 7078879: [video pip] Remove old controls https://chromium-review.googlesource.com/c/chromium/src/+/7078879 * chore: fixup patch indices * 7128138: Add a pref to enable Secure DNS 'automatic mode with DoH fallback'. https://chromium-review.googlesource.com/c/chromium/src/+/7128138 * chore: fixup indices * fix: pip patch --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr --- DEPS | 2 +- ...xpose_several_extra_cipher_functions.patch | 2 +- ..._depend_on_packed_resource_integrity.patch | 12 +- patches/chromium/can_create_window.patch | 8 +- ...ther_in_electron_views_and_delegates.patch | 2 +- ...d_data_parameter_to_processsingleton.patch | 2 +- ...t_allow_code_cache_in_custom_schemes.patch | 4 +- ...moothing_css_rule_and_blink_painting.patch | 12 +- ...ding_non-standard_schemes_in_iframes.patch | 4 +- patches/chromium/fix_linux_tray_id.patch | 14 +- ...ingshelper_behind_branding_buildflag.patch | 4 +- ..._avoid_private_macos_api_usage.patch.patch | 2 +- patches/chromium/picture-in-picture.patch | 153 +++++++++--------- patches/chromium/process_singleton.patch | 4 +- ...windowtreehostwin_window_enlargement.patch | 4 +- patches/chromium/webview_fullscreen.patch | 2 +- ...i_to_allow_electron_to_set_dock_side.patch | 4 +- shell/browser/api/electron_api_app.cc | 3 +- .../net/system_network_context_manager.cc | 3 +- 19 files changed, 119 insertions(+), 122 deletions(-) diff --git a/DEPS b/DEPS index 36f4e7a1506f3..1c7ff459d063d 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '144.0.7521.0', + '144.0.7522.0', 'node_version': 'v24.11.0', 'nan_version': diff --git a/patches/boringssl/feat_expose_several_extra_cipher_functions.patch b/patches/boringssl/feat_expose_several_extra_cipher_functions.patch index c0f3497ce7835..4d60a5e2e75f4 100644 --- a/patches/boringssl/feat_expose_several_extra_cipher_functions.patch +++ b/patches/boringssl/feat_expose_several_extra_cipher_functions.patch @@ -118,7 +118,7 @@ index 891a73f229e3f0838cb2fa99b8fb24fdeac1962b..f7d0c5dc66f016eb9338c15e7f5ef59e callback(EVP_des_ede3_cbc(), "des-ede3-cbc", nullptr, arg); callback(EVP_rc2_cbc(), "rc2-cbc", nullptr, arg); diff --git a/include/openssl/cipher.h b/include/openssl/cipher.h -index 8b473699eb502cdd151a641d9ff242a7edcb42e8..a0a26d7c984a3d0f18d9fdf0424ced22580784a9 100644 +index ed2eeab57779d827eb19edcd435b4664d4079859..74bb77e03b562698cb887b25cc8a779631a809fb 100644 --- a/include/openssl/cipher.h +++ b/include/openssl/cipher.h @@ -552,6 +552,7 @@ OPENSSL_EXPORT const EVP_CIPHER *EVP_des_ede3_ecb(void); diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index b0b37cb1c869e..7e0c9e2e9ad15 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -33,10 +33,10 @@ index 606b3bd43179a5b4179a6ec9f58e531d55c1acb5..4d503a53290b4deaea016bb6867f3c07 "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 1b6ba974b641ba9f352cf15e311fa93e1268b06c..f26b6e92617a6df6f8adb1bce51f26f06e66c701 100644 +index 0056e03965f8f0e00a51483f30edd461351b3a1f..333eb7958074fd4962acdbb57c089974f268c4cc 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4825,7 +4825,7 @@ static_library("browser") { +@@ -4830,7 +4830,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index 1b6ba974b641ba9f352cf15e311fa93e1268b06c..f26b6e92617a6df6f8adb1bce51f26f0 # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index f99c95ff5d2bab35f4976c1bb9d39fc83de2494a..f124fc3885e509df46e8d8653ffb97f8b0b25060 100644 +index 1ee26f9edde72481eae0557007daa21f0845c2ac..35535ab1ca79aefe514b5021966a855853b8ce06 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7595,9 +7595,12 @@ test("unit_tests") { +@@ -7596,9 +7596,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index f99c95ff5d2bab35f4976c1bb9d39fc83de2494a..f124fc3885e509df46e8d8653ffb97f8 "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8539,6 +8542,10 @@ test("unit_tests") { +@@ -8540,6 +8543,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index f99c95ff5d2bab35f4976c1bb9d39fc83de2494a..f124fc3885e509df46e8d8653ffb97f8 sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8595,7 +8602,6 @@ test("unit_tests") { +@@ -8596,7 +8603,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index cd1033a3ac124..dc63dd45b03ba 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,7 +9,7 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 6e79165d538668580a1061857dfdefd4b3d5906c..469cfce5b48987268f7e95ea0e5edd75623558e8 100644 +index 5fd88f202c3024caaee12d00f6128af96172d06e..8e1228336a141f9812b03a9a4e810c797f14446b 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc @@ -9965,6 +9965,7 @@ void RenderFrameHostImpl::CreateNewWindow( @@ -232,7 +232,7 @@ index 82e9d3dfb5f7da76d89fe15ae61d379fa46e177d..fd035512099a54dff6cc951a2226c23a } // namespace blink diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc -index c583c10c0f3d6e0a7e02bcd54bc8237e932914fe..139c4f7f39d5d43bd4ddae4afedf7e60ac8437c7 100644 +index 270f3f5e94bf2d07d44105488e2f8b02f951ae7b..0fba63098ae66f3537427132e38978aa91c992d9 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc @@ -2340,6 +2340,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, @@ -242,5 +242,5 @@ index c583c10c0f3d6e0a7e02bcd54bc8237e932914fe..139c4f7f39d5d43bd4ddae4afedf7e60 + window_features.raw_features = features; + if (window_features.is_partitioned_popin) { - UseCounter::Count(*entered_window, - WebFeature::kPartitionedPopin_OpenAttempt); + if (!IsFeatureEnabled( + network::mojom::PermissionsPolicyFeature::kPartitionedPopins, diff --git a/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch b/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch index a940a178926ed..5aa7e7763f79c 100644 --- a/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch +++ b/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch @@ -10,7 +10,7 @@ Subject: chore: "grandfather in" Electron Views and Delegates 6448510: Lock further access to View::set_owned_by_client(). | https://chromium-review.googlesource.com/c/chromium/src/+/6448510 diff --git a/ui/views/view.h b/ui/views/view.h -index a6d23b384136e27eeb8d864af154aa020cab0fb1..bdc88396c84b0cccc2933a19a7772c1483cdb63d 100644 +index 42d29651bb0985c09f04019c2970258d97ecc730..670a6ec9b859fb13f4cd0813cabf8debd33c06a1 100644 --- a/ui/views/view.h +++ b/ui/views/view.h @@ -81,6 +81,19 @@ class ArcNotificationContentView; diff --git a/patches/chromium/feat_add_data_parameter_to_processsingleton.patch b/patches/chromium/feat_add_data_parameter_to_processsingleton.patch index d0f6a882fc05d..f969439c2dccf 100644 --- a/patches/chromium/feat_add_data_parameter_to_processsingleton.patch +++ b/patches/chromium/feat_add_data_parameter_to_processsingleton.patch @@ -180,7 +180,7 @@ index 08cbe32a258bf478f1da0a07064d3e9ef14c44a5..b9f2a43cb90fac4b031a4b4da38d6435 if (!WriteToSocket(socket.fd(), to_send.data(), to_send.length())) { // Try to kill the other process, because it might have been dead. diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc -index 8bff42918d0780b3c89ad06886e0853a8e5b9052..3e89d1333e97ca3e32807a52612e0c3e83c83b88 100644 +index ae659d84a5ae2f2e87ce288477506575f8d86839..d93c7e8487ab1a2bbb5f56f2ca44868f947e6bfc 100644 --- a/chrome/browser/process_singleton_win.cc +++ b/chrome/browser/process_singleton_win.cc @@ -81,10 +81,12 @@ BOOL CALLBACK BrowserWindowEnumeration(HWND window, LPARAM param) { diff --git a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch index aeac732052bfe..5b1e716e6d484 100644 --- a/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch +++ b/patches/chromium/feat_allow_code_cache_in_custom_schemes.patch @@ -405,7 +405,7 @@ index 33e2ff42e4d9da442d522b959a4a21c2f7032b6b..a0d81212327fc17e1f4704e78803c1d7 std::vector extension_schemes; // Registers a URL scheme with a predefined default custom handler. diff --git a/url/url_util.cc b/url/url_util.cc -index 5eee7b4b0ffc5d8fc7c570f41ff5596d04ab77a3..beb2a5598bfbdc8a4617ee6627cf09951c64821c 100644 +index 94cbe0bb382b4b64db390dcd6d725e13f54b6666..5c3949c01f27cab5e4f8a56bbbf11c0f9718eed2 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -136,6 +136,9 @@ struct SchemeRegistry { @@ -418,7 +418,7 @@ index 5eee7b4b0ffc5d8fc7c570f41ff5596d04ab77a3..beb2a5598bfbdc8a4617ee6627cf0995 // Schemes with a predefined default custom handler. std::vector predefined_handler_schemes; -@@ -674,6 +677,15 @@ const std::vector& GetEmptyDocumentSchemes() { +@@ -673,6 +676,15 @@ const std::vector& GetEmptyDocumentSchemes() { return GetSchemeRegistry().empty_document_schemes; } diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index 0a4b7b2970cbc..1fdf4dc461216 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -20,7 +20,7 @@ making three primary changes to Blink: * Controls whether the CSS rule is available. diff --git a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom -index 555b4c5dfa44a40cd2c558241d030cca6d9ae9fe..ff77a0ea897d673b21ec57f443b851ec5c52c67e 100644 +index e8b4cb12e28b62f3955810e47e590cb7fcba60f0..bff96df0400accdb6738701e1c41070cca64e73f 100644 --- a/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom +++ b/third_party/blink/public/mojom/use_counter/metrics/css_property_id.mojom @@ -48,6 +48,7 @@ enum CSSSampleId { @@ -45,7 +45,7 @@ index e189d584f05f2ce6354c03a9b19f56985df8a15e..41b430e8f2416be098494f5c49fb97ca 'internal-forced-visited-'): internal_visited_order = 0 diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 -index 86adddbca5900d86db526dc5c700ecbe56575d7d..7495443cf85408fced315c407c322bf27f328638 100644 +index a163c1a0790cb8deb4b09f6605876c24a4f79b64..a9a0548173ac9c903a208e4ef142a14a8506693f 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5 @@ -9153,6 +9153,26 @@ @@ -76,7 +76,7 @@ index 86adddbca5900d86db526dc5c700ecbe56575d7d..7495443cf85408fced315c407c322bf2 { name: "-internal-visited-color", diff --git a/third_party/blink/renderer/core/css/css_property_equality.cc b/third_party/blink/renderer/core/css/css_property_equality.cc -index aaf56976e7ac7a4efe904a5275722fdc02172bae..670d3f91ec556e415a80bb01341c4047745455f2 100644 +index 1bff2c29379c4a1c1022440ce3d0048e08f63bd9..72b8c6f6c75a4c5d7455fa12180e574eb724a905 100644 --- a/third_party/blink/renderer/core/css/css_property_equality.cc +++ b/third_party/blink/renderer/core/css/css_property_equality.cc @@ -354,6 +354,8 @@ bool CSSPropertyEquality::PropertiesEqual(const PropertyHandle& property, @@ -89,10 +89,10 @@ index aaf56976e7ac7a4efe904a5275722fdc02172bae..670d3f91ec556e415a80bb01341c4047 return a.EmptyCells() == b.EmptyCells(); case CSSPropertyID::kFill: diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -index 739fdb04466eb5b4d29e3f642fe96c622c4bf5bf..f5aa8d719a54554f0798290475a3d4bd000beca5 100644 +index 4d9c0422443a98ab9226f8b0f580a67cc3e41ff3..9be2a613df6e1ab4ebe1bf6929aed767d46dd753 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc -@@ -12629,5 +12629,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( +@@ -12628,5 +12628,36 @@ const CSSValue* InternalEmptyLineHeight::ParseSingleValue( CSSValueID::kNone>(stream); } @@ -201,7 +201,7 @@ index 0802c73aa4aaf4e1fb5efd367758f19c36691f71..5f06c0af277a7c937e694470beac707a return result; } diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn -index 0fb769875acfe214407159e689f6190a5feba7c3..d764a52863dfa46dd828682cb9c8501fdc95a0c0 100644 +index 30e90d51c0f3ab884e5525471f279c410ce15d55..bb479ac88f556ae76abbb57867bddb379f4db2be 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn @@ -1671,6 +1671,8 @@ component("platform") { diff --git a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch index f4f6fbe7ed4ab..e0ee7fa3c95c9 100644 --- a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch +++ b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch @@ -28,10 +28,10 @@ The patch should be removed in favor of either: Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397. diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index 1182d246f0f32d75fc02cd5ce17e0dd1be936bc4..8f7117987e8e3e97cbd76f0c0fd9e6e52e0da459 100644 +index 310198673bf513ddaf57f37ec98e818cf3f51baf..f643131d7854845c1f77007946270790d87519f4 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc -@@ -11461,6 +11461,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { +@@ -11469,6 +11469,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { target_rph_id); } diff --git a/patches/chromium/fix_linux_tray_id.patch b/patches/chromium/fix_linux_tray_id.patch index 8a265eaae70de..44e657298b898 100644 --- a/patches/chromium/fix_linux_tray_id.patch +++ b/patches/chromium/fix_linux_tray_id.patch @@ -13,10 +13,10 @@ https://github.com/electron/electron/pull/48675#issuecomment-3452781711 for more info. diff --git a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc -index 27b65721dc9f127b15f92821d3f3ea4ce0a2f19c..ff69b5cab40156a30872ee1793f4e72a38d91b03 100644 +index 72a61f80eb5dfafe2609ec9e3f8f34c7c84f7abe..c5c3092607b4dc0e1fa7f7fc39b8f7e82d59ffd7 100644 --- a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc +++ b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.cc -@@ -131,8 +131,8 @@ int NextServiceId() { +@@ -133,8 +133,8 @@ int NextServiceId() { return ++status_icon_count; } @@ -27,7 +27,7 @@ index 27b65721dc9f127b15f92821d3f3ea4ce0a2f19c..ff69b5cab40156a30872ee1793f4e72a } using DbusImage = std::tupleSetProperty<"s">(kInterfaceStatusNotifierItem, kPropertyCategory, kPropertyValueCategory, false); properties_->SetProperty<"s">(kInterfaceStatusNotifierItem, kPropertyId, @@ -53,10 +53,10 @@ index 27b65721dc9f127b15f92821d3f3ea4ce0a2f19c..ff69b5cab40156a30872ee1793f4e72a kPropertyOverlayIconName, "", false); properties_->SetProperty<"s">(kInterfaceStatusNotifierItem, kPropertyStatus, diff --git a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h -index 7b6b005f98e5de8b858a39e733dbf95888df3bc3..bf85004d8f42b30f12662078b24b684ea5c0c924 100644 +index 5457f98158a094a5b8768352d2868e3005afd395..13ac4e51019ea68fdccd17aac8a4855bde50964b 100644 --- a/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h +++ b/chrome/browser/ui/views/status_icons/status_icon_linux_dbus.h -@@ -36,7 +36,7 @@ class StatusIconLinuxDbus : public ui::StatusIconLinux, +@@ -37,7 +37,7 @@ class StatusIconLinuxDbus : public ui::StatusIconLinux, public ui::SimpleMenuModel::Delegate, public base::RefCounted { public: @@ -65,7 +65,7 @@ index 7b6b005f98e5de8b858a39e733dbf95888df3bc3..bf85004d8f42b30f12662078b24b684e StatusIconLinuxDbus(const StatusIconLinuxDbus&) = delete; StatusIconLinuxDbus& operator=(const StatusIconLinuxDbus&) = delete; -@@ -137,6 +137,8 @@ class StatusIconLinuxDbus : public ui::StatusIconLinux, +@@ -135,6 +135,8 @@ class StatusIconLinuxDbus : public ui::StatusIconLinux, size_t icon_file_id_ = 0; base::FilePath icon_file_; diff --git a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch index d89f9b19a5f85..2123f36cd5102 100644 --- a/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch +++ b/patches/chromium/fix_move_autopipsettingshelper_behind_branding_buildflag.patch @@ -83,10 +83,10 @@ index a8a1ec300d9286f641f4676be54121eddc9c0ba1..b25a7fe369207f24b52cf1c98abe70f4 PictureInPictureOcclusionTracker* diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -index c204274499a520aeeb2aaaad12e4aafd43738d23..56afbbf55148b5077253c0189bf6444c2daaf7ba 100644 +index 601b178ef0e90753559083f506c9a62a7434c530..2a0f9f87d833504e34ad7d72c0cdd974c0318639 100644 --- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -@@ -476,11 +476,13 @@ std::unique_ptr VideoOverlayWindowViews::Create( +@@ -451,11 +451,13 @@ std::unique_ptr VideoOverlayWindowViews::Create( #endif // BUILDFLAG(IS_WIN) diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index d1391f1f0d7bb..f0bd233136f61 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -581,7 +581,7 @@ index f69cd6100f2ac5ccb6f185e0d0bf186073ed5953..29a40923a55287b608c2ffae63a1dbbc return kAttributes; } diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index 1ffce9951a2f82c1052cfa8c434f43bd7d32d604..e44e635927026a2d3dd0627668b5e89aa7104050 100644 +index 4b2d7e9ce68ad678f6f7f4b8379b6b6437967be1..10317f8dcaf990dec20a0fcc4b48af9b15934ad3 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn @@ -343,6 +343,7 @@ source_set("browser") { diff --git a/patches/chromium/picture-in-picture.patch b/patches/chromium/picture-in-picture.patch index 85390051553bb..23eb19a4eef37 100644 --- a/patches/chromium/picture-in-picture.patch +++ b/patches/chromium/picture-in-picture.patch @@ -9,13 +9,13 @@ don't get errors for Chrome's generated resources, which are non-existent because we don't generate them in our build. diff --git a/chrome/browser/ui/views/overlay/close_image_button.cc b/chrome/browser/ui/views/overlay/close_image_button.cc -index 85df555841ac0d32d2f097547c9991cecf0f4b1a..7a108339448fad3105e87c9d9af678c2f85b8ed5 100644 +index a7a637438116a1c7846194dea4412100a45c9331..bb3877d546bfea141d3d6ebb396b88faab6ee34e 100644 --- a/chrome/browser/ui/views/overlay/close_image_button.cc +++ b/chrome/browser/ui/views/overlay/close_image_button.cc -@@ -5,9 +5,12 @@ +@@ -4,9 +4,12 @@ + #include "chrome/browser/ui/views/overlay/close_image_button.h" - #include "base/feature_list.h" +#include "build/branding_buildflags.h" #include "chrome/browser/ui/color/chrome_color_id.h" #include "chrome/grit/generated_resources.h" @@ -25,7 +25,7 @@ index 85df555841ac0d32d2f097547c9991cecf0f4b1a..7a108339448fad3105e87c9d9af678c2 #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/image_model.h" -@@ -28,7 +31,10 @@ CloseImageButton::CloseImageButton(PressedCallback callback) +@@ -27,7 +30,10 @@ CloseImageButton::CloseImageButton(PressedCallback callback) : OverlayWindowImageButton(std::move(callback)) { SetSize(gfx::Size(kCloseButtonSize, kCloseButtonSize)); @@ -38,7 +38,7 @@ index 85df555841ac0d32d2f097547c9991cecf0f4b1a..7a108339448fad3105e87c9d9af678c2 ui::ImageModel::FromVectorIcon(*icon, kColorPipWindowForeground, kCloseButtonIconSize)); diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc -index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..c204274499a520aeeb2aaaad12e4aafd43738d23 100644 +index 6cfeed24487c026d13034b5ea7a8fb275bff4006..601b178ef0e90753559083f506c9a62a7434c530 100644 --- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc @@ -18,12 +18,16 @@ @@ -78,7 +78,7 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..c204274499a520aeeb2aaaad12e4aafd #include "chrome/browser/shell_integration_win.h" #include "content/public/browser/render_widget_host_view.h" #include "ui/aura/window.h" -@@ -434,7 +440,7 @@ std::unique_ptr VideoOverlayWindowViews::Create( +@@ -409,7 +415,7 @@ std::unique_ptr VideoOverlayWindowViews::Create( overlay_window->Init(std::move(params)); overlay_window->OnRootViewReady(); @@ -87,7 +87,7 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..c204274499a520aeeb2aaaad12e4aafd std::wstring app_user_model_id; Browser* browser = chrome::FindBrowserWithTab(controller->GetWebContents()); if (browser) { -@@ -734,6 +740,7 @@ void VideoOverlayWindowViews::OnMouseEvent(ui::MouseEvent* event) { +@@ -702,6 +708,7 @@ void VideoOverlayWindowViews::OnMouseEvent(ui::MouseEvent* event) { } case ui::EventType::kMousePressed: @@ -95,7 +95,7 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..c204274499a520aeeb2aaaad12e4aafd // Hide the live caption dialog if it's visible and the user clicks // outside of it. if (live_caption_dialog_ && live_caption_dialog_->GetVisible() && -@@ -742,6 +749,7 @@ void VideoOverlayWindowViews::OnMouseEvent(ui::MouseEvent* event) { +@@ -710,6 +717,7 @@ void VideoOverlayWindowViews::OnMouseEvent(ui::MouseEvent* event) { SetLiveCaptionDialogVisibility(false); return; } @@ -103,83 +103,81 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..c204274499a520aeeb2aaaad12e4aafd break; default: -@@ -1136,9 +1144,11 @@ void VideoOverlayWindowViews::SetUpViews() { - std::unique_ptr hang_up_button; - std::unique_ptr progress_view; - std::unique_ptr timestamp; -+#if 0 - std::unique_ptr live_status; - std::unique_ptr live_caption_button; - std::unique_ptr live_caption_dialog; -+#endif +@@ -1213,6 +1221,7 @@ void VideoOverlayWindowViews::SetUpViews() { + timestamp->SetBackgroundColor(SK_ColorTRANSPARENT); + timestamp->SetHorizontalAlignment(gfx::ALIGN_LEFT); - if (Use2024UI()) { - play_pause_controls_view->SetSize({kCenterButtonSize, kCenterButtonSize}); -@@ -1261,6 +1271,7 @@ void VideoOverlayWindowViews::SetUpViews() { - timestamp->SetEnabledColor(ui::kColorSysOnSurfaceSubtle); - timestamp->SetBackgroundColor(SK_ColorTRANSPARENT); - timestamp->SetHorizontalAlignment(gfx::ALIGN_LEFT); +#if 0 - live_status = std::make_unique( - l10n_util::GetStringUTF16(IDS_PICTURE_IN_PICTURE_LIVE_STATUS_TEXT), - views::style::CONTEXT_LABEL, views::style::STYLE_CAPTION_BOLD); -@@ -1279,6 +1290,7 @@ void VideoOverlayWindowViews::SetUpViews() { - Profile::FromBrowserContext( - controller_->GetWebContents()->GetBrowserContext())); - live_caption_dialog->SetVisible(false); + auto live_status = std::make_unique( + l10n_util::GetStringUTF16(IDS_PICTURE_IN_PICTURE_LIVE_STATUS_TEXT), + views::style::CONTEXT_LABEL, views::style::STYLE_CAPTION_BOLD); +@@ -1232,6 +1241,7 @@ void VideoOverlayWindowViews::SetUpViews() { + Profile::FromBrowserContext( + controller_->GetWebContents()->GetBrowserContext())); + live_caption_dialog->SetVisible(false); +#endif - toggle_microphone_button = - std::make_unique(base::BindRepeating( - [](VideoOverlayWindowViews* overlay) { -@@ -1494,6 +1506,7 @@ void VideoOverlayWindowViews::SetUpViews() { - timestamp->layer()->SetFillsBoundsOpaquely(false); - timestamp->layer()->SetName("Timestamp"); + + auto toggle_microphone_button = + std::make_unique(base::BindRepeating( +@@ -1367,6 +1377,7 @@ void VideoOverlayWindowViews::SetUpViews() { + timestamp->layer()->SetFillsBoundsOpaquely(false); + timestamp->layer()->SetName("Timestamp"); +#if 0 - live_status->SetPaintToLayer(ui::LAYER_TEXTURED); - live_status->layer()->SetFillsBoundsOpaquely(false); - live_status->layer()->SetName("LiveStatus"); -@@ -1505,6 +1518,7 @@ void VideoOverlayWindowViews::SetUpViews() { - live_caption_dialog->SetPaintToLayer(ui::LAYER_TEXTURED); - live_caption_dialog->layer()->SetFillsBoundsOpaquely(false); - live_caption_dialog->layer()->SetName("LiveCaptionDialog"); + live_status->SetPaintToLayer(ui::LAYER_TEXTURED); + live_status->layer()->SetFillsBoundsOpaquely(false); + live_status->layer()->SetName("LiveStatus"); +@@ -1378,6 +1389,7 @@ void VideoOverlayWindowViews::SetUpViews() { + live_caption_dialog->SetPaintToLayer(ui::LAYER_TEXTURED); + live_caption_dialog->layer()->SetFillsBoundsOpaquely(false); + live_caption_dialog->layer()->SetName("LiveCaptionDialog"); +#endif - } else { - // views::View that holds the skip-ad label button. - // ------------------------- -@@ -1596,13 +1610,14 @@ void VideoOverlayWindowViews::SetUpViews() { - timestamp_ = - playback_controls_container_view_->AddChildView(std::move(timestamp)); + toggle_microphone_button->SetPaintToLayer(ui::LAYER_TEXTURED); + toggle_microphone_button->layer()->SetFillsBoundsOpaquely(false); +@@ -1441,13 +1453,15 @@ void VideoOverlayWindowViews::SetUpViews() { + + timestamp_ = + playback_controls_container_view_->AddChildView(std::move(timestamp)); ++ +#if 0 - live_status_ = - playback_controls_container_view_->AddChildView(std::move(live_status)); + live_status_ = + playback_controls_container_view_->AddChildView(std::move(live_status)); - - live_caption_button_ = playback_controls_container_view_->AddChildView( - std::move(live_caption_button)); - live_caption_dialog_ = - controls_container_view->AddChildView(std::move(live_caption_dialog)); + live_caption_button_ = playback_controls_container_view_->AddChildView( + std::move(live_caption_button)); + live_caption_dialog_ = + controls_container_view->AddChildView(std::move(live_caption_dialog)); +#endif - toggle_camera_button_ = - vc_container->AddChildView(std::move(toggle_camera_button)); -@@ -1897,6 +1912,7 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() { - timestamp_->SetSize({max_timestamp_width, kTimestampHeight}); - timestamp_->SetVisible(!is_live_); + toggle_camera_button_ = vc_controls_container_view_->AddChildView( + std::move(toggle_camera_button)); +@@ -1709,6 +1723,7 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() { + timestamp_->SetSize({max_timestamp_width, kTimestampHeight}); + timestamp_->SetVisible(!is_live_); +#if 0 - live_status_->SetPosition(timestamp_position); - live_status_->SetMaximumWidthSingleLine(max_timestamp_width); - live_status_->SetSize( -@@ -1917,6 +1933,7 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() { - live_caption_dialog_->SetPosition( - {live_caption_button_bounds.right() - live_caption_dialog_->width(), - live_caption_button_bounds.y() - live_caption_dialog_->height()}); + live_status_->SetPosition(timestamp_position); + live_status_->SetMaximumWidthSingleLine(max_timestamp_width); + live_status_->SetSize( +@@ -1716,7 +1731,6 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() { + .width(), + kTimestampHeight}); + live_status_->SetVisible(is_live_); +- + gfx::Rect live_caption_button_bounds( + bottom_controls_bounds.right() - kBottomControlsHorizontalMargin - + kActionButtonSize.width(), +@@ -1729,7 +1743,7 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() { + live_caption_dialog_->SetPosition( + {live_caption_button_bounds.right() - live_caption_dialog_->width(), + live_caption_button_bounds.y() - live_caption_dialog_->height()}); +- +#endif - - // The play/pause button and replay/forward 10 seconds buttons should not be - // visible while dragging the progress bar or for live media. -@@ -2407,6 +2424,7 @@ void VideoOverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) { + // The play/pause button and replay/forward 10 seconds buttons should not be + // visible while dragging the progress bar or for live media. + const bool is_dragging_progress_bar = +@@ -2053,6 +2067,7 @@ void VideoOverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) { return; } @@ -187,7 +185,7 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..c204274499a520aeeb2aaaad12e4aafd if (live_caption_dialog_ && live_caption_dialog_->GetVisible()) { if (!GetLiveCaptionDialogBounds().Contains(event->location())) { // Hide the live caption dialog if it's visible and the user taps outside -@@ -2415,11 +2433,11 @@ void VideoOverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) { +@@ -2061,11 +2076,11 @@ void VideoOverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) { event->SetHandled(); return; } @@ -200,14 +198,11 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..c204274499a520aeeb2aaaad12e4aafd if (GetBackToTabControlsBounds().Contains(event->location())) { controller_->CloseAndFocusInitiator(); -@@ -2561,21 +2579,28 @@ gfx::Rect VideoOverlayWindowViews::GetProgressViewBounds() { +@@ -2171,18 +2186,25 @@ gfx::Rect VideoOverlayWindowViews::GetProgressViewBounds() { } gfx::Rect VideoOverlayWindowViews::GetLiveCaptionButtonBounds() { +#if 0 - if (!Use2024UI()) { - return gfx::Rect(); - } return live_caption_button_->GetMirroredBounds(); +#endif + return gfx::Rect(); @@ -215,7 +210,7 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..c204274499a520aeeb2aaaad12e4aafd gfx::Rect VideoOverlayWindowViews::GetLiveCaptionDialogBounds() { +#if 0 - if (!Use2024UI() || !live_caption_dialog_->GetVisible()) { + if (!live_caption_dialog_->GetVisible()) { return gfx::Rect(); } return live_caption_dialog_->GetMirroredBounds(); @@ -229,7 +224,7 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..c204274499a520aeeb2aaaad12e4aafd MediaEngagementService* service = MediaEngagementService::Get(Profile::FromBrowserContext( GetController()->GetWebContents()->GetBrowserContext())); -@@ -2584,6 +2609,8 @@ bool VideoOverlayWindowViews::HasHighMediaEngagement( +@@ -2191,6 +2213,8 @@ bool VideoOverlayWindowViews::HasHighMediaEngagement( } return service->HasHighEngagement(origin); @@ -238,7 +233,7 @@ index 3d9673db6bf535d3bc9518e7981ba8e84f4485bc..c204274499a520aeeb2aaaad12e4aafd } bool VideoOverlayWindowViews::IsTrustedForMediaPlayback() const { -@@ -2850,16 +2877,20 @@ void VideoOverlayWindowViews::UpdateTimestampLabel(base::TimeDelta current_time, +@@ -2447,16 +2471,20 @@ void VideoOverlayWindowViews::UpdateTimestampLabel(base::TimeDelta current_time, } void VideoOverlayWindowViews::OnLiveCaptionButtonPressed() { diff --git a/patches/chromium/process_singleton.patch b/patches/chromium/process_singleton.patch index 846b18810d5a7..03e259fc23d20 100644 --- a/patches/chromium/process_singleton.patch +++ b/patches/chromium/process_singleton.patch @@ -165,7 +165,7 @@ index 9d7be37f1d1fbde55773b4005878d8ff03cac22a..08cbe32a258bf478f1da0a07064d3e9e int dir_mode = 0; CHECK(base::GetPosixFilePermissions(socket_dir_.GetPath(), &dir_mode) && diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc -index b1c5ce01eb052989bafadd320ac662ee1129d0ad..8bff42918d0780b3c89ad06886e0853a8e5b9052 100644 +index ff44618efa8f8082b5da2c416802b781290c6cac..ae659d84a5ae2f2e87ce288477506575f8d86839 100644 --- a/chrome/browser/process_singleton_win.cc +++ b/chrome/browser/process_singleton_win.cc @@ -29,7 +29,9 @@ @@ -226,7 +226,7 @@ index b1c5ce01eb052989bafadd320ac662ee1129d0ad..8bff42918d0780b3c89ad06886e0853a // without ownership and explicitly get the ownership afterward. - base::win::ScopedHandle only_me(::CreateMutex(NULL, FALSE, kMutexName)); + base::win::ScopedHandle only_me(::CreateMutex(NULL, FALSE, mutexName.c_str())); - if (!only_me.IsValid()) { + if (!only_me.is_valid()) { DPLOG(FATAL) << "CreateMutex failed"; return false; @@ -429,6 +440,17 @@ bool ProcessSingleton::Create() { diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index 917dfed1da821..db32d9487ded2 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index b808b58c1aabdf262c6ed697a64871ee870f845d..d64abbdd535c3487f6edff89df8bfeca2f5fe9e3 100644 +index fde149ffb99e0662ccea6d2f964835960c826fea..f73c2b6e44eac62af53926322a3d5a06773f1b8a 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25694,6 +25694,21 @@ +@@ -25673,6 +25673,21 @@ ] } ], diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index 6c85a975a5199..bd16ef2db5161 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,7 +15,7 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 469cfce5b48987268f7e95ea0e5edd75623558e8..7e48c91c75cba91ea76541634c61bdf73836474d 100644 +index 8e1228336a141f9812b03a9a4e810c797f14446b..913919047d0f968bc9eac13b049618d05b222e06 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc @@ -9051,6 +9051,17 @@ void RenderFrameHostImpl::EnterFullscreen( diff --git a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch index 899aba129edf9..fe7eb54a64437 100644 --- a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch +++ b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch @@ -10,10 +10,10 @@ to handle this without patching, but this is fairly clean for now and no longer patching legacy devtools code. diff --git a/front_end/entrypoints/main/MainImpl.ts b/front_end/entrypoints/main/MainImpl.ts -index b2a211f875fb88a4be8ed47c1b4ccae4025c34c9..f65f13d00b99f2300fbb4126eb09301a8c961b11 100644 +index 064720d2c68c3f73f2d3909af7dc0c5036802769..af313a1d6b39a60763e9e0b54c0642d13a02fc91 100644 --- a/front_end/entrypoints/main/MainImpl.ts +++ b/front_end/entrypoints/main/MainImpl.ts -@@ -768,6 +768,8 @@ export class MainImpl { +@@ -771,6 +771,8 @@ export class MainImpl { globalThis.Main = globalThis.Main || {}; // @ts-expect-error Exported for Tests.js globalThis.Main.Main = MainImpl; diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc index 2632282b52f2b..b5cfbd2368178 100644 --- a/shell/browser/api/electron_api_app.cc +++ b/shell/browser/api/electron_api_app.cc @@ -1789,7 +1789,8 @@ void ConfigureHostResolver(v8::Isolate* isolate, // NetworkContext is created, but before anything has the chance to use it. content::GetNetworkService()->ConfigureStubHostResolver( enable_built_in_resolver, enable_happy_eyeballs_v3, secure_dns_mode, - doh_config, additional_dns_query_types_enabled); + doh_config, additional_dns_query_types_enabled, + {} /*fallback_doh_nameservers*/); } // static diff --git a/shell/browser/net/system_network_context_manager.cc b/shell/browser/net/system_network_context_manager.cc index 1b2819ebf441f..fe5d783c3b620 100644 --- a/shell/browser/net/system_network_context_manager.cc +++ b/shell/browser/net/system_network_context_manager.cc @@ -272,7 +272,8 @@ void SystemNetworkContextManager::OnNetworkServiceCreated( content::GetNetworkService()->ConfigureStubHostResolver( base::FeatureList::IsEnabled(net::features::kAsyncDns), base::FeatureList::IsEnabled(net::features::kHappyEyeballsV3), - default_secure_dns_mode, doh_config, additional_dns_query_types_enabled); + default_secure_dns_mode, doh_config, additional_dns_query_types_enabled, + {} /*fallback_doh_nameservers*/); // The OSCrypt keys are process bound, so if network service is out of // process, send it the required key. From 49fed7f1b933798b2b81ccd768da945d088ea7b9 Mon Sep 17 00:00:00 2001 From: Keeley Hammond Date: Thu, 13 Nov 2025 01:43:53 -0800 Subject: [PATCH 246/268] build: apply additional compression to dsym on upload (#48930) build: use tar.xz compression --- script/lib/util.py | 6 ++++++ script/zip-symbols.py | 9 ++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/script/lib/util.py b/script/lib/util.py index a65321b876586..040a144c444fe 100644 --- a/script/lib/util.py +++ b/script/lib/util.py @@ -84,6 +84,12 @@ def make_zip(zip_file_path, files, dirs): zip_file.close() +def make_tar_xz(tar_file_path, files, dirs): + safe_unlink(tar_file_path) + allfiles = files + dirs + execute(['tar', '-cJf', tar_file_path] + allfiles) + + def rm_rf(path): try: shutil.rmtree(path) diff --git a/script/zip-symbols.py b/script/zip-symbols.py index 2b365566b386c..45635a1fdcdbf 100755 --- a/script/zip-symbols.py +++ b/script/zip-symbols.py @@ -6,7 +6,7 @@ import sys from lib.config import PLATFORM -from lib.util import scoped_cwd, get_electron_version, make_zip, \ +from lib.util import scoped_cwd, get_electron_version, make_zip, make_tar_xz, \ get_electron_branding, get_out_dir, execute ELECTRON_VERSION = get_electron_version() @@ -27,16 +27,15 @@ def main(): make_zip(zip_file, licenses, dirs) if PLATFORM == 'darwin': - dsym_name = 'dsym.zip' + dsym_name = 'dsym.tar.xz' with scoped_cwd(args.build_dir): dsyms = glob.glob('*.dSYM') snapshot_dsyms = ['v8_context_snapshot_generator.dSYM'] for dsym in snapshot_dsyms: if (dsym in dsyms): dsyms.remove(dsym) - dsym_zip_file = os.path.join(args.build_dir, dsym_name) - print('Making dsym zip: ' + dsym_zip_file) - make_zip(dsym_zip_file, licenses, dsyms) + dsym_tar_file = os.path.join(args.build_dir, dsym_name) + make_tar_xz(dsym_tar_file, licenses, dsyms) dsym_snapshot_name = 'dsym-snapshot.zip' dsym_snapshot_zip_file = os.path.join(args.build_dir, dsym_snapshot_name) print('Making dsym snapshot zip: ' + dsym_snapshot_zip_file) From f7f285a0c4d2d8768aa563887d706053f67dcadc Mon Sep 17 00:00:00 2001 From: Niklas Wenzel Date: Thu, 13 Nov 2025 16:10:18 +0100 Subject: [PATCH 247/268] docs: clarify meaning of string value for menu item icon (#48919) * docs: clarify meaning of string value for menu item icon * fix: format * fix: wording --- docs/api/menu-item.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/api/menu-item.md b/docs/api/menu-item.md index 90c72fb578f15..aa3d6ce6ee216 100644 --- a/docs/api/menu-item.md +++ b/docs/api/menu-item.md @@ -34,7 +34,8 @@ See [`Menu`](menu.md) for examples. * `sublabel` string (optional) _macOS_ - Available in macOS >= 14.4 * `toolTip` string (optional) _macOS_ - Hover text for this menu item. * `accelerator` string (optional) - An [Accelerator](../tutorial/keyboard-shortcuts.md#accelerators) string. - * `icon` ([NativeImage](native-image.md) | string) (optional) + * `icon` ([NativeImage](native-image.md) | string) (optional) - Can be a + [NativeImage](native-image.md) or the file path of an icon. * `enabled` boolean (optional) - If false, the menu item will be greyed out and unclickable. * `acceleratorWorksWhenHidden` boolean (optional) _macOS_ - default is `true`, and when `false` will prevent the accelerator from triggering the item if the item is not visible. From e92a95c761f6f491c900708482cce562a296c6b7 Mon Sep 17 00:00:00 2001 From: Nilay Arya Date: Thu, 13 Nov 2025 10:39:03 -0500 Subject: [PATCH 248/268] feat: add --disable-geolocation command-line flag for macOS (#45934) * feat(macos): add --disable-geolocation-mac command-line flag * internally deny geolocation requests if flag set e * wrap PermissionRequestHandler instead * wrap custom handler and deny regardless of response * Update docs/api/command-line-switches.md Co-authored-by: Will Anderson * resolving conflicts during rebase * tests added * tests added: minor changes * move IsGeolocationDisabledViaCommandLine inside ElectronPermissionManager as a static member * test: inject fixturesPath via --boot-eval * Update shell/browser/electron_permission_manager.cc Co-authored-by: Robo * chore: Fixup after merge * fixup after merge --------- Co-authored-by: Will Anderson Co-authored-by: Robo Co-authored-by: John Kleinschmidt --- docs/api/command-line-switches.md | 4 ++ shell/browser/api/electron_api_session.cc | 18 +++++ .../electron_browser_main_parts_mac.mm | 9 ++- shell/browser/electron_permission_manager.cc | 33 +++++++++- shell/browser/electron_permission_manager.h | 2 + spec/chromium-spec.ts | 66 +++++++++++++++++++ 6 files changed, 128 insertions(+), 4 deletions(-) diff --git a/docs/api/command-line-switches.md b/docs/api/command-line-switches.md index 725144c1a4aad..5695b40d3f84f 100644 --- a/docs/api/command-line-switches.md +++ b/docs/api/command-line-switches.md @@ -49,6 +49,10 @@ Disables the disk cache for HTTP requests. Disable HTTP/2 and SPDY/3.1 protocols. +### --disable-geolocation _macOS_ + +Disables the Geolocation API. Permission requests for geolocation will be denied internally regardless of the decision made by a handler set via `session.setPermissionRequestHandler`. This functionality is currently implemented only for macOS. Has no effect on other platforms. + ### --disable-renderer-backgrounding Prevents Chromium from lowering the priority of invisible pages' renderer diff --git a/shell/browser/api/electron_api_session.cc b/shell/browser/api/electron_api_session.cc index 26208e8339e23..7514a8eca1f8a 100644 --- a/shell/browser/api/electron_api_session.cc +++ b/shell/browser/api/electron_api_session.cc @@ -886,6 +886,24 @@ void Session::SetPermissionRequestHandler(v8::Local val, blink::PermissionType permission_type, ElectronPermissionManager::StatusCallback callback, const base::Value& details) { +#if (BUILDFLAG(IS_MAC)) + if (permission_type == blink::PermissionType::GEOLOCATION) { + if (ElectronPermissionManager:: + IsGeolocationDisabledViaCommandLine()) { + auto original_callback = std::move(callback); + callback = base::BindOnce( + [](ElectronPermissionManager::StatusCallback callback, + content::PermissionResult /*ignored_result*/) { + // Always deny regardless of what + // content::PermissionResult is passed here + std::move(callback).Run(content::PermissionResult( + blink::mojom::PermissionStatus::DENIED, + content::PermissionStatusSource::UNSPECIFIED)); + }, + std::move(original_callback)); + } + } +#endif handler->Run(web_contents, permission_type, std::move(callback), details); }, diff --git a/shell/browser/electron_browser_main_parts_mac.mm b/shell/browser/electron_browser_main_parts_mac.mm index c7c093010ef0b..2a4238dec285c 100644 --- a/shell/browser/electron_browser_main_parts_mac.mm +++ b/shell/browser/electron_browser_main_parts_mac.mm @@ -11,6 +11,7 @@ #include "services/device/public/cpp/geolocation/geolocation_system_permission_manager.h" #include "services/device/public/cpp/geolocation/system_geolocation_source_apple.h" #include "shell/browser/browser_process_impl.h" +#include "shell/browser/electron_permission_manager.h" #include "shell/browser/mac/electron_application.h" #include "shell/browser/mac/electron_application_delegate.h" #include "ui/base/l10n/l10n_util_mac.h" @@ -32,7 +33,13 @@ setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; - if (!device::GeolocationSystemPermissionManager::GetInstance()) { + const bool geolocationDisabled = + ElectronPermissionManager::IsGeolocationDisabledViaCommandLine(); + + // Check if geolocation api is NOT disabled via command line before + // CreateGeolocationSystemPermissionManager is called + if (!geolocationDisabled && + !device::GeolocationSystemPermissionManager::GetInstance()) { device::GeolocationSystemPermissionManager::SetInstance( device::SystemGeolocationSourceApple:: CreateGeolocationSystemPermissionManager()); diff --git a/shell/browser/electron_permission_manager.cc b/shell/browser/electron_permission_manager.cc index a58b3a696302b..c50c76789bbc9 100644 --- a/shell/browser/electron_permission_manager.cc +++ b/shell/browser/electron_permission_manager.cc @@ -8,6 +8,7 @@ #include #include +#include "base/command_line.h" #include "base/containers/to_vector.h" #include "base/values.h" #include "content/browser/permissions/permission_util.h" // nogncheck @@ -146,6 +147,17 @@ void ElectronPermissionManager::SetBluetoothPairingHandler( bluetooth_pairing_handler_ = handler; } +// static +bool ElectronPermissionManager::IsGeolocationDisabledViaCommandLine() { +// Remove platform check once flag is extended to other platforms +#if BUILDFLAG(IS_MAC) + auto* command_line = base::CommandLine::ForCurrentProcess(); + return command_line->HasSwitch("disable-geolocation"); +#else + return false; +#endif +} + bool ElectronPermissionManager::HasPermissionRequestHandler() const { return !request_handler_.is_null(); } @@ -220,9 +232,16 @@ void ElectronPermissionManager::RequestPermissionsWithDetails( ->GrantSendMidiSysExMessage( render_frame_host->GetProcess()->GetDeprecatedID()); } else if (permission_type == blink::PermissionType::GEOLOCATION) { - ElectronBrowserMainParts::Get() - ->GetGeolocationControl() - ->UserDidOptIntoLocationServices(); + if (IsGeolocationDisabledViaCommandLine()) { + results.push_back(content::PermissionResult( + blink::mojom::PermissionStatus::DENIED, + content::PermissionStatusSource::UNSPECIFIED)); + continue; + } else { + ElectronBrowserMainParts::Get() + ->GetGeolocationControl() + ->UserDidOptIntoLocationServices(); + } } results.push_back(content::PermissionResult( blink::mojom::PermissionStatus::GRANTED, @@ -331,6 +350,10 @@ bool ElectronPermissionManager::CheckPermissionWithDetails( content::RenderFrameHost* render_frame_host, const GURL& requesting_origin, base::Value::Dict details) const { + if (permission == blink::PermissionType::GEOLOCATION && + IsGeolocationDisabledViaCommandLine()) + return false; + if (check_handler_.is_null()) { if (permission == blink::PermissionType::DEPRECATED_SYNC_CLIPBOARD_READ) { return false; @@ -368,6 +391,10 @@ bool ElectronPermissionManager::CheckDevicePermission( const url::Origin& origin, const base::Value& device, ElectronBrowserContext* browser_context) const { + if (permission == blink::PermissionType::GEOLOCATION && + IsGeolocationDisabledViaCommandLine()) + return false; + if (device_permission_handler_.is_null()) return browser_context->CheckDevicePermission(origin, device, permission); diff --git a/shell/browser/electron_permission_manager.h b/shell/browser/electron_permission_manager.h index 6bdcec371c405..9a0062ef631e5 100644 --- a/shell/browser/electron_permission_manager.h +++ b/shell/browser/electron_permission_manager.h @@ -66,6 +66,8 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate { using BluetoothPairingHandler = base::RepeatingCallback; + static bool IsGeolocationDisabledViaCommandLine(); + void RequestPermissionWithDetails( blink::mojom::PermissionDescriptorPtr permission, content::RenderFrameHost* render_frame_host, diff --git a/spec/chromium-spec.ts b/spec/chromium-spec.ts index 08a10abdae6fb..efb1797313fd4 100644 --- a/spec/chromium-spec.ts +++ b/spec/chromium-spec.ts @@ -898,6 +898,72 @@ describe('chromium features', () => { expect(position).to.have.property('coords'); expect(position).to.have.property('timestamp'); }); + + ifdescribe(process.platform === 'darwin')('with --disable-geolocation', () => { + const testSwitchBehavior = (handlerAction: 'allow' | 'deny' | 'none') => async () => { + const rc = await startRemoteControlApp([ + '--disable-geolocation', + `--boot-eval=fixturesPath=${JSON.stringify(fixturesPath)}` + ]); + + const result = await rc.remotely(async (action: typeof handlerAction) => { + const { session, BrowserWindow } = require('electron'); + const path = require('node:path'); + + // Isolate each test's permissions to prevent permission state leaks between the test variations + const testSession = session.fromPartition(`geolocation-disable-${action}`); + + if (action !== 'none') { + // Make the PermissionRequestHandler behave according to action variable passed for this test + testSession.setPermissionRequestHandler((_wc, permission, callback) => { + if (permission === 'geolocation') { + if (action === 'allow') callback(true); + else if (action === 'deny') callback(false); + else callback(false); + } + }); + } + + const w = new BrowserWindow({ + show: false, + webPreferences: { + session: testSession, + nodeIntegration: true, + contextIsolation: false + } + }); + + await w.loadFile(path.join(fixturesPath, 'pages', 'blank.html')); + + const permissionState = await w.webContents.executeJavaScript(` + navigator.permissions.query({ name: 'geolocation' }) + .then(status => status.state) + .catch(() => 'error') + `); + + const geoResult = await w.webContents.executeJavaScript(` + new Promise(resolve => { + navigator.geolocation.getCurrentPosition( + () => resolve('allowed'), + err => resolve(err.code) + ); + }) + `); + + return { permissionState, geoResult }; + }, handlerAction); + + // Always expect status to be denied regardless of the decision made by a handler set via `session.setPermissionRequestHandler` + expect(result.permissionState).to.equal('denied', `Unexpected permission state for ${handlerAction} handler`); + + // 1 = PERMISSION_DENIED + expect(result.geoResult).to.equal(1, `Unexpected API result for ${handlerAction} handler`); + }; + + it('denies geolocation when permission request handler would allow', testSwitchBehavior('allow')); + it('denies geolocation when permission request handler would deny', testSwitchBehavior('deny')); + it('denies geolocation with no permission request handler', testSwitchBehavior('none')); + }); }); describe('File System API,', () => { From 8088028da3fb54bcb4865000fdaef4a75ac03a33 Mon Sep 17 00:00:00 2001 From: Niklas Wenzel Date: Thu, 13 Nov 2025 16:41:00 +0100 Subject: [PATCH 249/268] docs: explain how to load SF Symbols with `nativeImage` (#48908) * docs: explain how to load SF Symbols with `nativeImage` * fix: use single quotes * fix: use single quotes --- docs/api/native-image.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/api/native-image.md b/docs/api/native-image.md index d9b87c0c33284..f851606ec9040 100644 --- a/docs/api/native-image.md +++ b/docs/api/native-image.md @@ -230,6 +230,15 @@ echo -e '#import \nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME); where `SYSTEM_IMAGE_NAME` should be replaced with any value from [this list](https://developer.apple.com/documentation/appkit/nsimagename?language=objc). +For SF Symbols, usage looks as follows: + +```js +const image = nativeImage.createFromNamedImage('square.and.pencil') +``` + +where `'square.and.pencil'` is the symbol name from the +[SF Symbols app](https://developer.apple.com/sf-symbols/). + ## Class: NativeImage > Natively wrap images such as tray, dock, and application icons. From c9d8781e24b71af6d667cbbcbc59ef863bcf701a Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" Date: Thu, 13 Nov 2025 11:09:51 -0500 Subject: [PATCH 250/268] chore: bump chromium to 144.0.7526.0 (main) (#48932) * chore: bump chromium in DEPS to 144.0.7526.0 * 7138583: [Partitioned Popins Removal] IPC https://chromium-review.googlesource.com/c/chromium/src/+/7138583 * chore: fixup patch indices * 7139794: Partially remove check for global handlers in plugin mime_type code https://chromium-review.googlesource.com/c/chromium/src/+/7139794 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr --- DEPS | 2 +- .../add_didinstallconditionalfeatures.patch | 2 +- ..._scheduler_throttling_per_renderview.patch | 20 ++++----- patches/chromium/blink_local_frame.patch | 6 +-- ..._depend_on_packed_resource_integrity.patch | 12 ++--- patches/chromium/can_create_window.patch | 44 +++++++++---------- ...ameter_in_script_lifecycle_observers.patch | 2 +- ...ther_in_electron_views_and_delegates.patch | 4 +- .../chromium/chore_partial_revert_of.patch | 4 +- ...screationoverridden_with_full_params.patch | 16 +++---- .../extend_apply_webpreferences.patch | 4 +- ...ing_dialog_features_to_shell_dialogs.patch | 8 ++-- ...moothing_css_rule_and_blink_painting.patch | 4 +- ..._raw_response_headers_from_urlloader.patch | 10 ++--- ...allback_for_sync_and_async_clipboard.patch | 2 +- ...ding_non-standard_schemes_in_iframes.patch | 4 +- ...board_hides_on_input_blur_in_webview.patch | 4 +- ...from_localframe_requestexecutescript.patch | 12 ++--- patches/chromium/frame_host_manager.patch | 2 +- .../chromium/gritsettings_resource_ids.patch | 2 +- ..._avoid_private_macos_api_usage.patch.patch | 20 ++++----- patches/chromium/printing.patch | 18 ++++---- ...r_changes_to_the_webcontentsobserver.patch | 8 ++-- ...efactor_unfilter_unresponsive_events.patch | 4 +- ...al_remove_unused_prehandlemouseevent.patch | 14 +++--- ...windowtreehostwin_window_enlargement.patch | 4 +- patches/chromium/scroll_bounce_flag.patch | 2 +- patches/chromium/web_contents.patch | 12 ++--- patches/chromium/webview_fullscreen.patch | 12 ++--- ...i_to_allow_electron_to_set_dock_side.patch | 4 +- .../browser/electron_plugin_info_host_impl.cc | 2 +- 31 files changed, 132 insertions(+), 132 deletions(-) diff --git a/DEPS b/DEPS index 1c7ff459d063d..32f76a74fe45b 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '144.0.7522.0', + '144.0.7526.0', 'node_version': 'v24.11.0', 'nan_version': diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index 3335a277cdbe2..0b5b7de5be949 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -23,7 +23,7 @@ index 5196f155cdc641b66c4faa77d8b00097145a1290..bbfac47a74f989482343c222b78f187b int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 1999b88df0cf82921eb74b7167bf119ff9bbc23a..f0a6a03efe20bf674a6fb2d4ad33de4a829cef53 100644 +index d4755acfd0ba3016da545de87d64046a6f5ee387..7070884305eb648c9aa0020f8161202671e1f671 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -4662,6 +4662,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, diff --git a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch index b209365c70401..e64378b32e982 100644 --- a/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -23,10 +23,10 @@ index ab916b56116e911af3cf6655cdd68ce139e260b9..f148ce57ae6c75f6635fca487d949319 return receiver_.BindNewEndpointAndPassDedicatedRemote(); } diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc -index 357dc106e4c53122e87ea09a780f7976ad37f25e..5209b85dc285f5e177377bd06e36b8b175581cbb 100644 +index 44fc40e608097797e4c2f5675bf10e5cdeb54d27..aa1d092cfc389fe81052160dc435981069a8a600 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc -@@ -767,6 +767,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) { +@@ -756,6 +756,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) { GetWidget()->GetAssociatedFrameWidget()->SetBackgroundOpaque(opaque); } @@ -104,10 +104,10 @@ index b00bc8a8a5044fbf46f627f9db56cea7f09d7ef6..114c3a4522d11c1348f681af500c487c + SetSchedulerThrottling(bool allowed); }; diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h -index 7f995dc1fab7a1b5319f6fe9bb4d37b3851dbf87..58c93c5acf9f63eb3391fafe2904b20284381a85 100644 +index 932658273154ef2e022358e493a8e7c00c86e732..57bbfb5cde62c9496c351c861880a18918e22c05 100644 --- a/third_party/blink/public/web/web_view.h +++ b/third_party/blink/public/web/web_view.h -@@ -361,6 +361,7 @@ class BLINK_EXPORT WebView { +@@ -355,6 +355,7 @@ class BLINK_EXPORT WebView { // Scheduling ----------------------------------------------------------- virtual PageScheduler* Scheduler() const = 0; @@ -116,10 +116,10 @@ index 7f995dc1fab7a1b5319f6fe9bb4d37b3851dbf87..58c93c5acf9f63eb3391fafe2904b202 // Visibility ----------------------------------------------------------- diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index 48a7bc14663edceaca00a397e528c50a96f7613f..1ba451388e2c8a702a3709d82456c32e6423c9b0 100644 +index e974581ae0c6b146b92054a56174ba8fdb666574..0d1cd0e4f502f44362fba6552080f31fe5c6b7ea 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -2511,6 +2511,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( +@@ -2505,6 +2505,10 @@ void WebViewImpl::SetPageLifecycleStateInternal( TRACE_EVENT2("navigation", "WebViewImpl::SetPageLifecycleStateInternal", "old_state", old_state, "new_state", new_state); @@ -130,7 +130,7 @@ index 48a7bc14663edceaca00a397e528c50a96f7613f..1ba451388e2c8a702a3709d82456c32e bool storing_in_bfcache = new_state->is_in_back_forward_cache && !old_state->is_in_back_forward_cache; bool restoring_from_bfcache = !new_state->is_in_back_forward_cache && -@@ -4021,10 +4025,23 @@ PageScheduler* WebViewImpl::Scheduler() const { +@@ -4013,10 +4017,23 @@ PageScheduler* WebViewImpl::Scheduler() const { return GetPage()->GetPageScheduler(); } @@ -155,10 +155,10 @@ index 48a7bc14663edceaca00a397e528c50a96f7613f..1ba451388e2c8a702a3709d82456c32e // Do not throttle if the page should be painting. bool is_visible = diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h -index 973f9acb6186a24aeb6343ac4d868883e98cdf52..a3860649929fc0cff9680191ed9367fc68462fd3 100644 +index aecdcea36ed0a502a9da68e871e0ee86040b4350..b2788642a20511f3725d045bc97bc108fba88752 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h -@@ -447,6 +447,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, +@@ -445,6 +445,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, LocalDOMWindow* PagePopupWindow() const; PageScheduler* Scheduler() const override; @@ -166,7 +166,7 @@ index 973f9acb6186a24aeb6343ac4d868883e98cdf52..a3860649929fc0cff9680191ed9367fc void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state, bool is_initial_state) override; mojom::blink::PageVisibilityState GetVisibilityState() override; -@@ -941,6 +942,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, +@@ -938,6 +939,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, // If true, we send IPC messages when |preferred_size_| changes. bool send_preferred_size_changes_ = false; diff --git a/patches/chromium/blink_local_frame.patch b/patches/chromium/blink_local_frame.patch index fe0f6150bd035..ddfe150797fc2 100644 --- a/patches/chromium/blink_local_frame.patch +++ b/patches/chromium/blink_local_frame.patch @@ -49,10 +49,10 @@ index 2670ea1361ccd8a9e3bac507e94dd25b7205ecf9..c12f78d925e4ccb4ac2fd3851a9c61e8 // its owning reference back to our owning LocalFrame. client_->Detached(type); diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index ad61f3b044e8ce7591cfe7484af8e3b0c7705673..f42b5f8c7676cda5d73ee035e18165acabb186f3 100644 +index f05c75ec4483f60ccbb4aac3c4bc322d594ab217..b299f0dbfcc23458390d2c7298cc5df33f129b2b 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc -@@ -747,10 +747,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { +@@ -750,10 +750,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { } DCHECK(!view_ || !view_->IsAttached()); @@ -63,7 +63,7 @@ index ad61f3b044e8ce7591cfe7484af8e3b0c7705673..f42b5f8c7676cda5d73ee035e18165ac if (!Client()) return false; -@@ -804,6 +800,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { +@@ -807,6 +803,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { DCHECK(!view_->IsAttached()); Client()->WillBeDetached(); diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index 7e0c9e2e9ad15..8352874a725ee 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -33,10 +33,10 @@ index 606b3bd43179a5b4179a6ec9f58e531d55c1acb5..4d503a53290b4deaea016bb6867f3c07 "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 0056e03965f8f0e00a51483f30edd461351b3a1f..333eb7958074fd4962acdbb57c089974f268c4cc 100644 +index c88784479b8d67d8a3f534b555bd6e74c46173fe..cfd9ed1e6a37b3f0034116323320958a1d962f43 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4830,7 +4830,7 @@ static_library("browser") { +@@ -4837,7 +4837,7 @@ static_library("browser") { ] } @@ -46,10 +46,10 @@ index 0056e03965f8f0e00a51483f30edd461351b3a1f..333eb7958074fd4962acdbb57c089974 # than here in :chrome_dll. deps += [ "//chrome:packed_resources_integrity_header" ] diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 1ee26f9edde72481eae0557007daa21f0845c2ac..35535ab1ca79aefe514b5021966a855853b8ce06 100644 +index 23f175d87f95562875af1e7ddd51be4f719e82b8..7488e095e0d32753dff7f5f170a4187ee6b7711e 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -7596,9 +7596,12 @@ test("unit_tests") { +@@ -7599,9 +7599,12 @@ test("unit_tests") { "//chrome/notification_helper", ] @@ -63,7 +63,7 @@ index 1ee26f9edde72481eae0557007daa21f0845c2ac..35535ab1ca79aefe514b5021966a8558 "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -8540,6 +8543,10 @@ test("unit_tests") { +@@ -8544,6 +8547,10 @@ test("unit_tests") { "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc", ] @@ -74,7 +74,7 @@ index 1ee26f9edde72481eae0557007daa21f0845c2ac..35535ab1ca79aefe514b5021966a8558 sources += [ # The importer code is not used on Android. "../common/importer/firefox_importer_utils_unittest.cc", -@@ -8596,7 +8603,6 @@ test("unit_tests") { +@@ -8600,7 +8607,6 @@ test("unit_tests") { # TODO(crbug.com/417513088): Maybe merge with the non-android `deps` declaration above? deps += [ "../browser/screen_ai:screen_ai_install_state", diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index dc63dd45b03ba..197b18e80267d 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,10 +9,10 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 5fd88f202c3024caaee12d00f6128af96172d06e..8e1228336a141f9812b03a9a4e810c797f14446b 100644 +index 5025a34f81d255c9c3f8cb8c7ba8e570297f9a06..772cff9b1a9a061645f2220fdc3003627679ac58 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -9965,6 +9965,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -9878,6 +9878,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To(), params->frame_name, params->disposition, *params->features, @@ -21,10 +21,10 @@ index 5fd88f202c3024caaee12d00f6128af96172d06e..8e1228336a141f9812b03a9a4e810c79 &no_javascript_access); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 78773db5e8bbe3c24922350f23c76bcdf3467b38..4fd490cec97d5391fcf5f821e39de4ccf67b6ae7 100644 +index b33145fdbfafd5ea1c23255a4fb8eff2088df915..e003e3a9784e3a9741283128a97f4e3bc255935b 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5395,6 +5395,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5314,6 +5314,10 @@ FrameTree* WebContentsImpl::CreateNewWindow( create_params.initially_hidden = renderer_started_hidden; create_params.initial_popup_url = params.target_url; @@ -35,7 +35,7 @@ index 78773db5e8bbe3c24922350f23c76bcdf3467b38..4fd490cec97d5391fcf5f821e39de4cc // Even though all codepaths leading here are in response to a renderer // trying to open a new window, if the new window ends up in a different // browsing instance, then the RenderViewHost, RenderWidgetHost, -@@ -5449,6 +5453,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5366,6 +5370,12 @@ FrameTree* WebContentsImpl::CreateNewWindow( // Sets the newly created WebContents WindowOpenDisposition. new_contents_impl->original_window_open_disposition_ = params.disposition; @@ -48,7 +48,7 @@ index 78773db5e8bbe3c24922350f23c76bcdf3467b38..4fd490cec97d5391fcf5f821e39de4cc // If the new frame has a name, make sure any SiteInstances that can find // this named frame have proxies for it. Must be called after // SetSessionStorageNamespace, since this calls CreateRenderView, which uses -@@ -5490,12 +5500,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5407,12 +5417,6 @@ FrameTree* WebContentsImpl::CreateNewWindow( AddWebContentsDestructionObserver(new_contents_impl); } @@ -62,10 +62,10 @@ index 78773db5e8bbe3c24922350f23c76bcdf3467b38..4fd490cec97d5391fcf5f821e39de4cc new_contents_impl, opener, params.target_url, params.referrer.To(), params.disposition, diff --git a/content/common/frame.mojom b/content/common/frame.mojom -index 599077542beacefc94f9e7ce6167312c9d66aaae..389896afb982dd0fc48274857c18fcd98337b1fc 100644 +index 4c55f0abf8df5a3408f3f90d444ceff3c23ee1bc..72bdb5b5a4c2c21a7192b34bb293bd23bafaf50c 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom -@@ -653,6 +653,10 @@ struct CreateNewWindowParams { +@@ -648,6 +648,10 @@ struct CreateNewWindowParams { pending_associated_remote widget; pending_associated_receiver frame_widget_host; pending_associated_remote frame_widget; @@ -77,7 +77,7 @@ index 599077542beacefc94f9e7ce6167312c9d66aaae..389896afb982dd0fc48274857c18fcd9 // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 36b83126680292a9606203837b7e20e039e2e705..98c73c5530e17f88aaa4ea089196e7cf277c52f1 100644 +index a0ccc5352495e75e1603fd3f90825eba85276a6a..3cf480086d77bddb3328aa02137e7bb66c2eb511 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc @@ -885,6 +885,8 @@ bool ContentBrowserClient::CanCreateWindow( @@ -90,7 +90,7 @@ index 36b83126680292a9606203837b7e20e039e2e705..98c73c5530e17f88aaa4ea089196e7cf bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index d47725f4a53e4338443afcdea66ea34b73afac1a..fae2d2f743c6798340438dcc8b9ad0a38e6b1617 100644 +index 3ca58d5630486cd378f3109b1ca59a4563608187..9f8fe55d6c360e3a709f2e5f05baf02c9ca29101 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -203,6 +203,7 @@ class NetworkService; @@ -111,7 +111,7 @@ index d47725f4a53e4338443afcdea66ea34b73afac1a..fae2d2f743c6798340438dcc8b9ad0a3 bool opener_suppressed, bool* no_javascript_access); diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index 822aa432131b68722307c3d57a73bc0e5bd589ff..541a17144b2d906865a025711dee0be776712a93 100644 +index 2bac91454385d005d8a6d14c45e63e64923310e0..4f79d90a7d30a6ce2a3720ef94c1ade264d20e16 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc @@ -35,6 +35,17 @@ namespace content { @@ -133,10 +133,10 @@ index 822aa432131b68722307c3d57a73bc0e5bd589ff..541a17144b2d906865a025711dee0be7 WebContents* source, const OpenURLParams& params, diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 31f7b81c176f8011e370c03b9f9d5016b12f6def..5780c53b97d983652a4e08009533a33abee228c8 100644 +index 2cda4986f3cdef0a01e755b57c307890b62aa4e2..1dab9cf23213d497bb6354d3b909911b014675ba 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h -@@ -18,6 +18,7 @@ +@@ -19,6 +19,7 @@ #include "base/types/expected.h" #include "build/build_config.h" #include "content/common/content_export.h" @@ -144,7 +144,7 @@ index 31f7b81c176f8011e370c03b9f9d5016b12f6def..5780c53b97d983652a4e08009533a33a #include "content/public/browser/eye_dropper.h" #include "content/public/browser/fullscreen_types.h" #include "content/public/browser/invalidate_type.h" -@@ -29,6 +30,7 @@ +@@ -30,6 +31,7 @@ #include "content/public/browser/select_audio_output_request.h" #include "content/public/browser/serial_chooser.h" #include "content/public/browser/storage_partition_config.h" @@ -152,7 +152,7 @@ index 31f7b81c176f8011e370c03b9f9d5016b12f6def..5780c53b97d983652a4e08009533a33a #include "content/public/common/window_container_type.mojom-forward.h" #include "third_party/blink/public/common/input/web_mouse_event.h" #include "third_party/blink/public/common/page/drag_operation.h" -@@ -385,6 +387,16 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -397,6 +399,16 @@ class CONTENT_EXPORT WebContentsDelegate { const StoragePartitionConfig& partition_config, SessionStorageNamespace* session_storage_namespace); @@ -170,7 +170,7 @@ index 31f7b81c176f8011e370c03b9f9d5016b12f6def..5780c53b97d983652a4e08009533a33a // typically happens when popups are created. virtual void WebContentsCreated(WebContents* source_contents, diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 7590015330e21c29e066bebcc9059c65f3b9b844..1999b88df0cf82921eb74b7167bf119ff9bbc23a 100644 +index 403ecc046ee270175a7e7444d9d80ed4456450cc..d4755acfd0ba3016da545de87d64046a6f5ee387 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -6727,6 +6727,10 @@ WebView* RenderFrameImpl::CreateNewWindow( @@ -211,7 +211,7 @@ index 790f004d2a3a9ae5a3588fda097732a5daac0c75..83fcc9418b89b669863e730f2049a1d8 bool opener_suppressed, bool* no_javascript_access) override; diff --git a/third_party/blink/public/web/web_window_features.h b/third_party/blink/public/web/web_window_features.h -index 82e9d3dfb5f7da76d89fe15ae61d379fa46e177d..fd035512099a54dff6cc951a2226c23a252a90e2 100644 +index d92bab531c12c62a5321a23f4a0cb89691668127..c354a79c7c8dd047264df35b873e90c15fa364a2 100644 --- a/third_party/blink/public/web/web_window_features.h +++ b/third_party/blink/public/web/web_window_features.h @@ -35,6 +35,7 @@ @@ -222,7 +222,7 @@ index 82e9d3dfb5f7da76d89fe15ae61d379fa46e177d..fd035512099a54dff6cc951a2226c23a namespace blink { -@@ -74,6 +75,8 @@ struct WebWindowFeatures { +@@ -70,6 +71,8 @@ struct WebWindowFeatures { // TODO(apaseltiner): Investigate moving this field to a non-public struct // since it is only needed within //third_party/blink. std::optional> attribution_srcs; @@ -232,7 +232,7 @@ index 82e9d3dfb5f7da76d89fe15ae61d379fa46e177d..fd035512099a54dff6cc951a2226c23a } // namespace blink diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc -index 270f3f5e94bf2d07d44105488e2f8b02f951ae7b..0fba63098ae66f3537427132e38978aa91c992d9 100644 +index 438eba715eb4f2a59676491d4d06cd6969c2a107..cfdd94e58cc81ce7b56a1ca64fe7b32cf7bc1f7e 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc @@ -2340,6 +2340,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, @@ -241,6 +241,6 @@ index 270f3f5e94bf2d07d44105488e2f8b02f951ae7b..0fba63098ae66f3537427132e38978aa + window_features.raw_features = features; + - if (window_features.is_partitioned_popin) { - if (!IsFeatureEnabled( - network::mojom::PermissionsPolicyFeature::kPartitionedPopins, + // In fenced frames, we should always use `noopener`. + if (GetFrame()->IsInFencedFrameTree()) { + window_features.noopener = true; diff --git a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch index 12a7b9189faa4..c0d590102e8c8 100644 --- a/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch +++ b/patches/chromium/chore_expose_isolate_parameter_in_script_lifecycle_observers.patch @@ -34,7 +34,7 @@ index bbfac47a74f989482343c222b78f187b70297e4e..3677ca3345fbc775d139684a12fe3624 virtual void DidClearWindowObject() {} virtual void DidChangeScrollOffset() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index f0a6a03efe20bf674a6fb2d4ad33de4a829cef53..c0deee8987c60ce4cf35eac80ad17240b8f11ee0 100644 +index 7070884305eb648c9aa0020f8161202671e1f671..cdb0711205111f8fc76e995e6690fb5fa76ee9cb 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -4668,10 +4668,11 @@ void RenderFrameImpl::DidInstallConditionalFeatures( diff --git a/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch b/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch index 5aa7e7763f79c..992ceed10ace0 100644 --- a/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch +++ b/patches/chromium/chore_grandfather_in_electron_views_and_delegates.patch @@ -10,10 +10,10 @@ Subject: chore: "grandfather in" Electron Views and Delegates 6448510: Lock further access to View::set_owned_by_client(). | https://chromium-review.googlesource.com/c/chromium/src/+/6448510 diff --git a/ui/views/view.h b/ui/views/view.h -index 42d29651bb0985c09f04019c2970258d97ecc730..670a6ec9b859fb13f4cd0813cabf8debd33c06a1 100644 +index 5d89a7ce81b2df250c02601a45eaec93e3cc171d..709ae884a2d62c6c4df286ae897ef6a4148c1ddd 100644 --- a/ui/views/view.h +++ b/ui/views/view.h -@@ -81,6 +81,19 @@ class ArcNotificationContentView; +@@ -78,6 +78,19 @@ class ArcNotificationContentView; class WideFrameView; } // namespace ash diff --git a/patches/chromium/chore_partial_revert_of.patch b/patches/chromium/chore_partial_revert_of.patch index b5eda7580defa..f24d4d8ab86bb 100644 --- a/patches/chromium/chore_partial_revert_of.patch +++ b/patches/chromium/chore_partial_revert_of.patch @@ -14,10 +14,10 @@ track down the source of this problem & figure out if we can fix it by changing something in Electron. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 226b05d62edc0dae87aa76cd6b766250cb0856d6..540b0adfcc65c95327ec269e75681469f4c36847 100644 +index 6b58df7202c19bda334f711d91af09839f461911..93c078a29e7142e54a20470f7c18f8aa8abf63bf 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5366,7 +5366,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5285,7 +5285,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( : IsGuest(); // While some guest types do not have a guest SiteInstance, the ones that // don't all override WebContents creation above. diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index 1638d42d2c1b7..01837337a15cf 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -159,10 +159,10 @@ index 3bbd4e568ba99245622a96f0801d2b6cd203025f..1e0b7d16b33daed980961dd49c667a3b } content::WebContents* CreateCustomWebContents( diff --git a/components/embedder_support/android/delegate/web_contents_delegate_android.cc b/components/embedder_support/android/delegate/web_contents_delegate_android.cc -index 97a429245bfc15aa321d73c142e1ba7cc8c60dec..43a907ff56743580fda414570e6bce5a00b1f247 100644 +index 36baad877619ad506e07ff385a250c60e9c3f94a..6b5f5352be13e583f996cc131fbdd36f57f96041 100644 --- a/components/embedder_support/android/delegate/web_contents_delegate_android.cc +++ b/components/embedder_support/android/delegate/web_contents_delegate_android.cc -@@ -210,15 +210,14 @@ bool WebContentsDelegateAndroid::IsWebContentsCreationOverridden( +@@ -216,15 +216,14 @@ bool WebContentsDelegateAndroid::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -181,7 +181,7 @@ index 97a429245bfc15aa321d73c142e1ba7cc8c60dec..43a907ff56743580fda414570e6bce5a java_gurl); } diff --git a/components/embedder_support/android/delegate/web_contents_delegate_android.h b/components/embedder_support/android/delegate/web_contents_delegate_android.h -index 261d38394a9ff6f81848b94d6b183b2062c37ba9..0c6a26599bb8fef6f9ee6180fc0a98760d857b19 100644 +index 1676a7d1e1734d196aeb3d2e27997de1743f034c..9be7c579c08af7b9b0de947a9d9af39b4d510b3c 100644 --- a/components/embedder_support/android/delegate/web_contents_delegate_android.h +++ b/components/embedder_support/android/delegate/web_contents_delegate_android.h @@ -78,8 +78,7 @@ class WebContentsDelegateAndroid : public content::WebContentsDelegate { @@ -223,10 +223,10 @@ index b969f1d97b7e3396119b579cfbe61e19ff7d2dd4..b8d6169652da28266a514938b45b39c5 content::WebContents* AddNewContents( content::WebContents* source, diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index eebcf3d97557d5a95c00b483910a23717d1775c5..1cc8474a5f369cd0b13c328179c9be560b167468 100644 +index b50aa1890036c762ec0df75d133f7b9fb29df4cd..f2f80c86e7910cf513aa916a80c51502bb186f58 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -5329,8 +5329,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( +@@ -5250,8 +5250,7 @@ FrameTree* WebContentsImpl::CreateNewWindow( if (delegate_ && delegate_->IsWebContentsCreationOverridden( opener, source_site_instance, params.window_container_type, @@ -237,7 +237,7 @@ index eebcf3d97557d5a95c00b483910a23717d1775c5..1cc8474a5f369cd0b13c328179c9be56 static_cast(delegate_->CreateCustomWebContents( opener, source_site_instance, is_new_browsing_instance, diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index 541a17144b2d906865a025711dee0be776712a93..9223d7355402f07c666df7ac4c19e9eab7d90e99 100644 +index 4f79d90a7d30a6ce2a3720ef94c1ade264d20e16..923d8834e231b91e7a692e0178ece122b8d70536 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc @@ -161,8 +161,7 @@ bool WebContentsDelegate::IsWebContentsCreationOverridden( @@ -251,10 +251,10 @@ index 541a17144b2d906865a025711dee0be776712a93..9223d7355402f07c666df7ac4c19e9ea } diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 5780c53b97d983652a4e08009533a33abee228c8..1a73f726ac1cf55b2834cf8db57b84add376cf7a 100644 +index 1dab9cf23213d497bb6354d3b909911b014675ba..30d7c81394df4e0f382d9a67fcd414b2d07903db 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h -@@ -365,8 +365,7 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -377,8 +377,7 @@ class CONTENT_EXPORT WebContentsDelegate { SiteInstance* source_site_instance, mojom::WindowContainerType window_container_type, const GURL& opener_url, diff --git a/patches/chromium/extend_apply_webpreferences.patch b/patches/chromium/extend_apply_webpreferences.patch index 2392b5e4ad7da..e77220b149624 100644 --- a/patches/chromium/extend_apply_webpreferences.patch +++ b/patches/chromium/extend_apply_webpreferences.patch @@ -15,10 +15,10 @@ Ideally we could add an embedder observer pattern here but that can be done in future work. diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index 1ba451388e2c8a702a3709d82456c32e6423c9b0..e4f04cd84388bbf2bde68080cfb20267a29c50b3 100644 +index 0d1cd0e4f502f44362fba6552080f31fe5c6b7ea..6e303fd506aa52f8def296fdd15b429de1467abe 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -1899,6 +1899,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, +@@ -1893,6 +1893,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, #if BUILDFLAG(IS_MAC) web_view_impl->SetMaximumLegibleScale( prefs.default_maximum_page_scale_factor); diff --git a/patches/chromium/feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch b/patches/chromium/feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch index a738ab0c8750d..309c5f823a61a 100644 --- a/patches/chromium/feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch +++ b/patches/chromium/feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch @@ -262,7 +262,7 @@ index 61683d0eddb04c494ca5e650e7d556b44968ec49..5492456a9138b250e97a5479838bb443 } // namespace ui diff --git a/ui/shell_dialogs/select_file_dialog_linux_portal.cc b/ui/shell_dialogs/select_file_dialog_linux_portal.cc -index 37e3d53abeca3a90649064053100cf9938b1f406..87dfa1e1c230f3aba90ba9520684828e958de093 100644 +index af5f9cdb01d18abf00bb5b20e5f2ab5e4ce24dc6..378939d2d2b48f1f591523db431005d038e2a88b 100644 --- a/ui/shell_dialogs/select_file_dialog_linux_portal.cc +++ b/ui/shell_dialogs/select_file_dialog_linux_portal.cc @@ -25,6 +25,7 @@ @@ -317,8 +317,8 @@ index 37e3d53abeca3a90649064053100cf9938b1f406..87dfa1e1c230f3aba90ba9520684828e + return file_dialog::IsPortalAvailable(); } - bool SelectFileDialogLinuxPortal::IsRunning( -@@ -386,11 +393,14 @@ dbus_xdg::Dictionary SelectFileDialogLinuxPortal::BuildOptionsDictionary( + void SelectFileDialogLinuxPortal::ListenerDestroyed() { +@@ -385,11 +392,14 @@ dbus_xdg::Dictionary SelectFileDialogLinuxPortal::BuildOptionsDictionary( const PortalFilterSet& filter_set) { dbus_xdg::Dictionary dict; @@ -336,7 +336,7 @@ index 37e3d53abeca3a90649064053100cf9938b1f406..87dfa1e1c230f3aba90ba9520684828e [[fallthrough]]; case SelectFileDialog::SELECT_FOLDER: case SelectFileDialog::Type::SELECT_EXISTING_FOLDER: -@@ -403,6 +413,11 @@ dbus_xdg::Dictionary SelectFileDialogLinuxPortal::BuildOptionsDictionary( +@@ -402,6 +412,11 @@ dbus_xdg::Dictionary SelectFileDialogLinuxPortal::BuildOptionsDictionary( break; } diff --git a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch index 1fdf4dc461216..e3b3ff9446bd3 100644 --- a/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch +++ b/patches/chromium/feat_corner_smoothing_css_rule_and_blink_painting.patch @@ -201,7 +201,7 @@ index 0802c73aa4aaf4e1fb5efd367758f19c36691f71..5f06c0af277a7c937e694470beac707a return result; } diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn -index 30e90d51c0f3ab884e5525471f279c410ce15d55..bb479ac88f556ae76abbb57867bddb379f4db2be 100644 +index 244fb5832fde6b71b59dbb7f6c83256c4ced7318..b12c3a23afecc024e9d60354d9d43ea000b1ee35 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn @@ -1671,6 +1671,8 @@ component("platform") { @@ -312,7 +312,7 @@ index 1d6b8160e8db2a94ee61ed41ac9a74db5b1bfb17..373bcd30c6a4526262912021aaf2b560 auto DrawAsSinglePath = [&]() { diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index 065479cfd23b9a6b63a8330dd2273b00d3740b62..12c5594c569a2f1a1906059f1fbf17ab5e6babc2 100644 +index a5dcd4c68acab6c6a294ababf5527496faec792e..463c97dbf245b1e57e2de5e5131044d89bbcdcd0 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 @@ -214,6 +214,10 @@ diff --git a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch index b44f9d05266ec..4cbbe91d39ffa 100644 --- a/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch +++ b/patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch @@ -17,7 +17,7 @@ headers, moving forward we should find a way in upstream to provide access to these headers for loader clients created on the browser process. diff --git a/services/network/public/cpp/resource_request.cc b/services/network/public/cpp/resource_request.cc -index 4c6da7daa167e8e687d43b6c59948fdc694052f7..1f9a142462146f1cef675455a782996b0d533cfd 100644 +index 177aa95b01f8020d3a6a61124405f03ad4c1bace..645bafa225b758cd1aab1e998da740758337cba6 100644 --- a/services/network/public/cpp/resource_request.cc +++ b/services/network/public/cpp/resource_request.cc @@ -196,6 +196,7 @@ ResourceRequest::TrustedParams& ResourceRequest::TrustedParams::operator=( @@ -37,7 +37,7 @@ index 4c6da7daa167e8e687d43b6c59948fdc694052f7..1f9a142462146f1cef675455a782996b allow_cookies_from_browser == other.allow_cookies_from_browser && include_request_cookies_with_response == diff --git a/services/network/public/cpp/resource_request.h b/services/network/public/cpp/resource_request.h -index 759539fe29d5599936254e1ddf50ff54b4fa8c46..6fba963f21ac5a3b4bb1e140e5120ccdee1720bc 100644 +index 53143c10acf2ac064cbc6605ef60ada3ab648c0d..c08a0ac7eadd749e3a3dc2c5fd489472665bb8df 100644 --- a/services/network/public/cpp/resource_request.h +++ b/services/network/public/cpp/resource_request.h @@ -99,6 +99,7 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ResourceRequest { @@ -49,7 +49,7 @@ index 759539fe29d5599936254e1ddf50ff54b4fa8c46..6fba963f21ac5a3b4bb1e140e5120ccd mojo::PendingRemote cookie_observer; mojo::PendingRemote trust_token_observer; diff --git a/services/network/public/cpp/url_request_mojom_traits.cc b/services/network/public/cpp/url_request_mojom_traits.cc -index 828d1d573b4710cddacf84a5cc16058831c7a4d4..fb7dc02e15863212d705a60eeab665e0833b1e4a 100644 +index 646be484e4d5b3b917bed0ee2d0a52fdf57a8291..b49035fab82ddb29e211e1e215c70aab0a625222 100644 --- a/services/network/public/cpp/url_request_mojom_traits.cc +++ b/services/network/public/cpp/url_request_mojom_traits.cc @@ -67,6 +67,7 @@ bool StructTraits& enabled_client_hints( diff --git a/services/network/public/mojom/url_request.mojom b/services/network/public/mojom/url_request.mojom -index df9bd2130004821582903699aac1b38403c785a6..8b10c16a10119f2628300b3c52cca0fe5a6bd6e4 100644 +index affb80d9ffcc8da3f572b1a1461d2cd648ef3376..3f6301b1732171073c5fb072feaf12e3fb55c74c 100644 --- a/services/network/public/mojom/url_request.mojom +++ b/services/network/public/mojom/url_request.mojom @@ -111,6 +111,9 @@ struct TrustedUrlRequestParams { diff --git a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch index deb4a0700b58c..9a6611357a6d5 100644 --- a/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch +++ b/patches/chromium/feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch @@ -119,7 +119,7 @@ index 36410ff29d9c82e59f93fbb82968064bd330dfde..6c3f994e0b184f78bd9442002bb4dfae virtual void PassiveInsecureContentFound(const WebURL&) {} diff --git a/third_party/blink/renderer/core/editing/commands/clipboard_commands.cc b/third_party/blink/renderer/core/editing/commands/clipboard_commands.cc -index a5ac9d4a417ac8e75e761c40841f41ab9057c761..292bd1f9de78828e739dae24a45a1dd3d6585240 100644 +index 80c15ef5381aa08c0c6ce3f51534bb04af64775d..9a9024ba766226848974e5518ccbffa79ee55e65 100644 --- a/third_party/blink/renderer/core/editing/commands/clipboard_commands.cc +++ b/third_party/blink/renderer/core/editing/commands/clipboard_commands.cc @@ -123,7 +123,7 @@ bool ClipboardCommands::CanReadClipboard(LocalFrame& frame, diff --git a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch index e0ee7fa3c95c9..9a10dbdc5af93 100644 --- a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch +++ b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch @@ -28,10 +28,10 @@ The patch should be removed in favor of either: Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397. diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index 310198673bf513ddaf57f37ec98e818cf3f51baf..f643131d7854845c1f77007946270790d87519f4 100644 +index 06b6f3ac21407d670d6eeac279ac5e876f6f900b..2b9d0a355b89f9eacf79a068ead7bef35915a6e3 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc -@@ -11469,6 +11469,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { +@@ -11457,6 +11457,11 @@ url::Origin NavigationRequest::GetOriginForURLLoaderFactoryUnchecked() { target_rph_id); } diff --git a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch index d4ed747439c08..984cdb085b8e6 100644 --- a/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch +++ b/patches/chromium/fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch @@ -87,10 +87,10 @@ index 75df43e3cd2721a92c90c18154d53d5c203e2465..ce42c75c8face36d21f53f44c0201ac4 // The view with active text input state, i.e., a focused element. // It will be nullptr if no such view exists. Note that the active view diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index d42bc3cb3e6adb2cd2c05a3ca629c84153c53663..226b05d62edc0dae87aa76cd6b766250cb0856d6 100644 +index 075ea7cd9f097b60adcad2857cf7115deb3741bc..6b58df7202c19bda334f711d91af09839f461911 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10205,7 +10205,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( +@@ -10133,7 +10133,7 @@ void WebContentsImpl::OnFocusedElementChangedInFrame( "WebContentsImpl::OnFocusedElementChangedInFrame", "render_frame_host", frame); RenderWidgetHostViewBase* root_view = diff --git a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch index dd5c01c8c246a..9a2da412b0b81 100644 --- a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch +++ b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch @@ -59,10 +59,10 @@ index cba373664bec3a32abad6fe0396bd67b53b7e67f..a54f1b3351efd2d8f324436f7f35cd43 #endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_SCRIPT_EXECUTION_CALLBACK_H_ diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index f42b5f8c7676cda5d73ee035e18165acabb186f3..7ff305ce80f243ce4ab0844321644908ab6addb9 100644 +index b299f0dbfcc23458390d2c7298cc5df33f129b2b..80e7e0674d5b11836f40a5f338e7f850050e1776 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc -@@ -3190,6 +3190,7 @@ void LocalFrame::RequestExecuteScript( +@@ -3192,6 +3192,7 @@ void LocalFrame::RequestExecuteScript( mojom::blink::EvaluationTiming evaluation_timing, mojom::blink::LoadEventBlockingOption blocking_option, WebScriptExecutionCallback callback, @@ -70,7 +70,7 @@ index f42b5f8c7676cda5d73ee035e18165acabb186f3..7ff305ce80f243ce4ab0844321644908 BackForwardCacheAware back_forward_cache_aware, mojom::blink::WantResultOption want_result_option, mojom::blink::PromiseResultOption promise_behavior) { -@@ -3247,7 +3248,7 @@ void LocalFrame::RequestExecuteScript( +@@ -3250,7 +3251,7 @@ void LocalFrame::RequestExecuteScript( PausableScriptExecutor::CreateAndRun( script_state, std::move(script_sources), execute_script_policy, user_gesture, evaluation_timing, blocking_option, want_result_option, @@ -80,10 +80,10 @@ index f42b5f8c7676cda5d73ee035e18165acabb186f3..7ff305ce80f243ce4ab0844321644908 void LocalFrame::SetEvictCachedSessionStorageOnFreezeOrUnload() { diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h -index 4dc94a550c58420ad75f76de882985c25841f9d7..f878b132293b4eec0669a52cc4c260d5fa43862d 100644 +index 6a09da6989fc007aed611cdce1939c2bf03deb49..daf57898ecd61dadb53761ad413f44d92c647e2f 100644 --- a/third_party/blink/renderer/core/frame/local_frame.h +++ b/third_party/blink/renderer/core/frame/local_frame.h -@@ -826,6 +826,7 @@ class CORE_EXPORT LocalFrame final +@@ -834,6 +834,7 @@ class CORE_EXPORT LocalFrame final mojom::blink::EvaluationTiming, mojom::blink::LoadEventBlockingOption, WebScriptExecutionCallback, @@ -92,7 +92,7 @@ index 4dc94a550c58420ad75f76de882985c25841f9d7..f878b132293b4eec0669a52cc4c260d5 mojom::blink::WantResultOption, mojom::blink::PromiseResultOption); diff --git a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc -index 1a96ae610e8469a311730915c35dab9943aa9d77..6d6893015058de20fc8cda69c09b6438f27ae3d6 100644 +index f3ea156c7ea1f215476976bcea2438d04c59a63f..146d44491158c4b6d3f33d61a6f242e8d8d42faf 100644 --- a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc +++ b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc @@ -981,6 +981,7 @@ void LocalFrameMojoHandler::JavaScriptExecuteRequestInIsolatedWorld( diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index ac03ae9ead1a9..94d421e1ff586 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -20,7 +20,7 @@ index 53bbf0174048d62b252b797b06695e6290273e80..4350b57ebf424e392c54dd2b54e62690 } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index fae2d2f743c6798340438dcc8b9ad0a38e6b1617..07d9e9073a6fbc5a864373b8f5665f0ca3ec1a0c 100644 +index 9f8fe55d6c360e3a709f2e5f05baf02c9ca29101..83a45bf47d98bef95bde6333758316aeb2a7e357 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -342,6 +342,11 @@ class CONTENT_EXPORT ContentBrowserClient { diff --git a/patches/chromium/gritsettings_resource_ids.patch b/patches/chromium/gritsettings_resource_ids.patch index 1b3dda5516537..4618d5ba4a287 100644 --- a/patches/chromium/gritsettings_resource_ids.patch +++ b/patches/chromium/gritsettings_resource_ids.patch @@ -6,7 +6,7 @@ Subject: gritsettings_resource_ids.patch Add electron resources file to the list of resource ids generation. diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec -index b137d827595addbd4e8880ee14dc3b7cd1261dbb..68a6c8f4549a9f084be94a6aa19d3312320e393f 100644 +index 6ed8fba243f6351a0f45cf459379e45ba405cf72..1dcc6586a91f716da58c09e1f5a690c75a763136 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec @@ -1619,6 +1619,11 @@ diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch index f0bd233136f61..9ec276281d437 100644 --- a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -384,7 +384,7 @@ index 71158ca9a7101911bb76f0c1b5300b0ff0e326b3..1441b9d4f9560c8b26d4beffe31449ed // The NSWindow used by BridgedNativeWidget. Provides hooks into AppKit that // can only be accomplished by overriding methods. diff --git a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm -index 433f12928857e288b6b0d4f4dd3d1f29da08cf6c..bb95aabec2e0d5c7b3a5d315c9a3f8cb3a45c8d2 100644 +index e00bf1b56121eca5ebcedc3dac25c7f873828523..40e1dec573cd626cad415e419204d10516b0ec0f 100644 --- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm +++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm @@ -21,6 +21,7 @@ @@ -432,7 +432,7 @@ index 433f12928857e288b6b0d4f4dd3d1f29da08cf6c..bb95aabec2e0d5c7b3a5d315c9a3f8cb @implementation NativeWidgetMacNSWindow { @private CommandDispatcher* __strong _commandDispatcher; -@@ -389,6 +398,8 @@ - (NSAccessibilityRole)accessibilityRole { +@@ -399,6 +408,8 @@ - (NSAccessibilityRole)accessibilityRole { // NSWindow overrides. @@ -441,7 +441,7 @@ index 433f12928857e288b6b0d4f4dd3d1f29da08cf6c..bb95aabec2e0d5c7b3a5d315c9a3f8cb + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle { if (windowStyle & NSWindowStyleMaskTitled) { if (Class customFrame = [NativeWidgetMacNSWindowTitledFrame class]) -@@ -400,6 +411,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle { +@@ -410,6 +421,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle { return [super frameViewClassForStyleMask:windowStyle]; } @@ -581,10 +581,10 @@ index f69cd6100f2ac5ccb6f185e0d0bf186073ed5953..29a40923a55287b608c2ffae63a1dbbc return kAttributes; } diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index 4b2d7e9ce68ad678f6f7f4b8379b6b6437967be1..10317f8dcaf990dec20a0fcc4b48af9b15934ad3 100644 +index 28140ff5ea05a3edf32034d6dcd4305bc35ce523..ba75db5616911295d69e9e20fed88cb7cd14478d 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn -@@ -343,6 +343,7 @@ source_set("browser") { +@@ -342,6 +342,7 @@ source_set("browser") { "//ui/webui/resources", "//v8", "//v8:v8_version", @@ -714,10 +714,10 @@ index f57ce1a0430df7692be55685e79121ed604daf2a..3fbc26fb179a64a2f1eab027a05b1624 defines = [] diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn -index 844867f9d4f52e0d591c674238f99cec42cd9ac8..f02673ec1f36f83c2aea9642e2fd1a3fde5da3a0 100644 +index 28e7f247df52ff84f50811e05ef22027a1a92536..780f0b5a528c2344d1d8a30b1f4a846e1eaa7192 100644 --- a/content/renderer/BUILD.gn +++ b/content/renderer/BUILD.gn -@@ -323,6 +323,7 @@ target(link_target_type, "renderer") { +@@ -327,6 +327,7 @@ target(link_target_type, "renderer") { "//ui/strings:auto_image_annotation_strings_grit", "//url", "//v8", @@ -796,7 +796,7 @@ index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbe } // namespace content diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn -index 795c9054faa75b3c20d091e6fe56f0a865f293ff..bacde6a543504003064ee42642d20973d0e6492a 100644 +index f9c5e8de687409857baf732a4227317e7d503b40..5adbe891175aa1f762558bfa0251e12ca6a94c6f 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn @@ -702,6 +702,7 @@ static_library("test_support") { @@ -816,7 +816,7 @@ index 795c9054faa75b3c20d091e6fe56f0a865f293ff..bacde6a543504003064ee42642d20973 } mojom("content_test_mojo_bindings") { -@@ -2066,6 +2069,7 @@ test("content_browsertests") { +@@ -2065,6 +2068,7 @@ test("content_browsertests") { "//ui/shell_dialogs", "//ui/snapshot", "//ui/webui:test_support", @@ -824,7 +824,7 @@ index 795c9054faa75b3c20d091e6fe56f0a865f293ff..bacde6a543504003064ee42642d20973 ] if (!(is_chromeos && target_cpu == "arm64" && current_cpu == "arm")) { -@@ -3408,6 +3412,7 @@ test("content_unittests") { +@@ -3406,6 +3410,7 @@ test("content_unittests") { "//ui/shell_dialogs", "//ui/webui:test_support", "//url", diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch index a2b870519af15..11c9e3724f584 100644 --- a/patches/chromium/printing.patch +++ b/patches/chromium/printing.patch @@ -666,7 +666,7 @@ index ac2f719be566020d9f41364560c12e6d6d0fe3d8..16d758a6936f66148a196761cfb875f6 PrintingFailed(int32 cookie, PrintFailureReason reason); diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc -index 2e151997ca968271449a3a3b4144c1b50f86c24f..71bcd655c36b322451261daffd09d99d1f7d929f 100644 +index a53e79851e4f01c8d256cf36d8fd6838737aa740..5d786ca1b6ae4314a871dee16b183f34669bcbf6 100644 --- a/components/printing/renderer/print_render_frame_helper.cc +++ b/components/printing/renderer/print_render_frame_helper.cc @@ -53,6 +53,7 @@ @@ -677,7 +677,7 @@ index 2e151997ca968271449a3a3b4144c1b50f86c24f..71bcd655c36b322451261daffd09d99d #include "printing/units.h" #include "services/metrics/public/cpp/ukm_source_id.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" -@@ -1243,14 +1244,14 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { +@@ -1240,14 +1241,14 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { } print_in_progress_ = true; @@ -694,7 +694,7 @@ index 2e151997ca968271449a3a3b4144c1b50f86c24f..71bcd655c36b322451261daffd09d99d if (!weak_this) { return; } -@@ -1281,12 +1282,14 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver( +@@ -1278,12 +1279,14 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver( receivers_.Add(this, std::move(receiver)); } @@ -712,7 +712,7 @@ index 2e151997ca968271449a3a3b4144c1b50f86c24f..71bcd655c36b322451261daffd09d99d ScopedIPC scoped_ipc(weak_ptr_factory_.GetWeakPtr()); if (ipc_nesting_level_ > kAllowedIpcDepthForPrint) { return; -@@ -1303,9 +1306,10 @@ void PrintRenderFrameHelper::PrintRequestedPagesInternal( +@@ -1300,9 +1303,10 @@ void PrintRenderFrameHelper::PrintRequestedPagesInternal( is_loading_ = frame->WillPrintSoon(); if (is_loading_) { @@ -726,7 +726,7 @@ index 2e151997ca968271449a3a3b4144c1b50f86c24f..71bcd655c36b322451261daffd09d99d SetupOnStopLoadingTimeout(); return; } -@@ -1315,7 +1319,7 @@ void PrintRenderFrameHelper::PrintRequestedPagesInternal( +@@ -1312,7 +1316,7 @@ void PrintRenderFrameHelper::PrintRequestedPagesInternal( // plugin node and print that instead. auto plugin = delegate_->GetPdfElement(frame); @@ -735,7 +735,7 @@ index 2e151997ca968271449a3a3b4144c1b50f86c24f..71bcd655c36b322451261daffd09d99d if (render_frame_gone_) { return; -@@ -1471,6 +1475,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) { +@@ -1468,6 +1472,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) { if (ipc_nesting_level_ > kAllowedIpcDepthForPrint) return; @@ -744,7 +744,7 @@ index 2e151997ca968271449a3a3b4144c1b50f86c24f..71bcd655c36b322451261daffd09d99d print_preview_context_.OnPrintPreview(); #if BUILDFLAG(IS_CHROMEOS) -@@ -2083,17 +2089,25 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { +@@ -2080,17 +2086,25 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, const blink::WebNode& node, @@ -773,7 +773,7 @@ index 2e151997ca968271449a3a3b4144c1b50f86c24f..71bcd655c36b322451261daffd09d99d DidFinishPrinting(PrintingResult::kFailPrintInit); return; } -@@ -2114,8 +2128,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, +@@ -2111,8 +2125,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, print_pages_params_->params->print_scaling_option; auto self = weak_ptr_factory_.GetWeakPtr(); @@ -790,7 +790,7 @@ index 2e151997ca968271449a3a3b4144c1b50f86c24f..71bcd655c36b322451261daffd09d99d // Check if `this` is still valid. if (!self) return; -@@ -2382,29 +2403,43 @@ void PrintRenderFrameHelper::IPCProcessed() { +@@ -2379,29 +2400,43 @@ void PrintRenderFrameHelper::IPCProcessed() { } bool PrintRenderFrameHelper::InitPrintSettings(blink::WebLocalFrame* frame, diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index 78a9912905382..00dcc3dfe19a6 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -44,10 +44,10 @@ index 982b5edc933fdf1c4884dd0e0e7b957cee31c5ef..f28d6f919b5c6aca87c3feb701967a25 void RenderWidgetHostImpl::ShowContextMenuAtPoint( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 4fd490cec97d5391fcf5f821e39de4ccf67b6ae7..eebcf3d97557d5a95c00b483910a23717d1775c5 100644 +index e003e3a9784e3a9741283128a97f4e3bc255935b..b50aa1890036c762ec0df75d133f7b9fb29df4cd 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -6206,6 +6206,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { +@@ -6123,6 +6123,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { return text_input_manager_.get(); } @@ -60,10 +60,10 @@ index 4fd490cec97d5391fcf5f821e39de4ccf67b6ae7..eebcf3d97557d5a95c00b483910a2371 RenderWidgetHostImpl* render_widget_host) { return render_widget_host == GetPrimaryMainFrame()->GetRenderWidgetHost(); diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index ca7a0453d21f810c10e35ae447bd3b0ca615007b..2b562b8f8adaced3a87b45f04472313cee3eb479 100644 +index 477abb0581334f2c0bee43982426cc87309024ce..563e943c90c03876dce8846ca32775b8929e569e 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -1188,6 +1188,7 @@ class CONTENT_EXPORT WebContentsImpl +@@ -1190,6 +1190,7 @@ class CONTENT_EXPORT WebContentsImpl void SendScreenRects() override; void SendActiveState(bool active) override; TextInputManager* GetTextInputManager() override; diff --git a/patches/chromium/refactor_unfilter_unresponsive_events.patch b/patches/chromium/refactor_unfilter_unresponsive_events.patch index f224484222d4a..80267dbac2144 100644 --- a/patches/chromium/refactor_unfilter_unresponsive_events.patch +++ b/patches/chromium/refactor_unfilter_unresponsive_events.patch @@ -15,10 +15,10 @@ This CL removes these filters so the unresponsive event can still be accessed from our JS event. The filtering is moved into Electron's code. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 540b0adfcc65c95327ec269e75681469f4c36847..792c886d364f23f9888552cf9e7995624cdd3775 100644 +index 93c078a29e7142e54a20470f7c18f8aa8abf63bf..70ce66aeaecb2f34efb7db8a74c63f9f7f8cdbc8 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -10354,25 +10354,13 @@ void WebContentsImpl::RendererUnresponsive( +@@ -10282,25 +10282,13 @@ void WebContentsImpl::RendererUnresponsive( base::RepeatingClosure hang_monitor_restarter) { OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RendererUnresponsive", "render_widget_host", render_widget_host); diff --git a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch index 3d7e34e166cf5..61623bb68826e 100644 --- a/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch +++ b/patches/chromium/revert_partial_remove_unused_prehandlemouseevent.patch @@ -54,10 +54,10 @@ index 2fa9876286ecda6a60a2c1970896cb275bbd7ab9..3f14e59de0e296b17f574aa40b879d2f if (mouse_event_callback.Run(mouse_event)) { return; diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 792c886d364f23f9888552cf9e7995624cdd3775..24c8e744669624f8f3d45fa4e8c6aa645b5205a2 100644 +index 70ce66aeaecb2f34efb7db8a74c63f9f7f8cdbc8..e3769d79b173f758939981b6e58cc97e39cd71c1 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4521,6 +4521,12 @@ void WebContentsImpl::RenderWidgetWasResized( +@@ -4448,6 +4448,12 @@ void WebContentsImpl::RenderWidgetWasResized( width_changed); } @@ -71,10 +71,10 @@ index 792c886d364f23f9888552cf9e7995624cdd3775..24c8e744669624f8f3d45fa4e8c6aa64 const gfx::PointF& client_pt) { if (delegate_) { diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index 2b562b8f8adaced3a87b45f04472313cee3eb479..e8b3edf974c6471ef72654544999e9fedf2be89d 100644 +index 563e943c90c03876dce8846ca32775b8929e569e..af8a1d0dfe51f641db7440f8df7faa9f5e37cf64 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -1119,6 +1119,7 @@ class CONTENT_EXPORT WebContentsImpl +@@ -1121,6 +1121,7 @@ class CONTENT_EXPORT WebContentsImpl double GetPendingZoomLevel(RenderWidgetHostImpl* rwh) override; @@ -83,7 +83,7 @@ index 2b562b8f8adaced3a87b45f04472313cee3eb479..e8b3edf974c6471ef72654544999e9fe const gfx::PointF& client_pt); void PreHandleDragExit(); diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index 9223d7355402f07c666df7ac4c19e9eab7d90e99..2bd315eadaf1790d5e3fe104f18c20ffb20de99f 100644 +index 923d8834e231b91e7a692e0178ece122b8d70536..bdb490b9f5b76faf2f5ed09812b202fea1c63a73 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc @@ -127,6 +127,12 @@ bool WebContentsDelegate::HandleContextMenu(RenderFrameHost& render_frame_host, @@ -100,10 +100,10 @@ index 9223d7355402f07c666df7ac4c19e9eab7d90e99..2bd315eadaf1790d5e3fe104f18c20ff WebContents* source, const input::NativeWebKeyboardEvent& event) { diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 1a73f726ac1cf55b2834cf8db57b84add376cf7a..8115f86ee33c56080ff472fb0f0f227ce2c01e0c 100644 +index 30d7c81394df4e0f382d9a67fcd414b2d07903db..b92971710565bcf650f47d83d3e6163095b345da 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h -@@ -311,6 +311,13 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -323,6 +323,13 @@ class CONTENT_EXPORT WebContentsDelegate { virtual bool HandleContextMenu(RenderFrameHost& render_frame_host, const ContextMenuParams& params); diff --git a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch index db32d9487ded2..b7a78ce782901 100644 --- a/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch +++ b/patches/chromium/revert_views_remove_desktopwindowtreehostwin_window_enlargement.patch @@ -10,10 +10,10 @@ on Windows. We should refactor our code so that this patch isn't necessary. diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json -index fde149ffb99e0662ccea6d2f964835960c826fea..f73c2b6e44eac62af53926322a3d5a06773f1b8a 100644 +index 21026b6a40bbccf616b3a6390bb8359d23470380..c52e49e673616df91b115d39c5c78bcd1d7db7ff 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json -@@ -25673,6 +25673,21 @@ +@@ -25731,6 +25731,21 @@ ] } ], diff --git a/patches/chromium/scroll_bounce_flag.patch b/patches/chromium/scroll_bounce_flag.patch index cb426fb31c8d8..9c76c29f9ce59 100644 --- a/patches/chromium/scroll_bounce_flag.patch +++ b/patches/chromium/scroll_bounce_flag.patch @@ -6,7 +6,7 @@ Subject: scroll_bounce_flag.patch Patch to make scrollBounce option work. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc -index d378f944864e4f20e8c475a9583c38c877c1ab89..ceba31d4477b08ab97cbfe3a14a30cb919751a9c 100644 +index 90ba3ac24eaeb4897f410b1a787852f003e56d88..b1294e12137254dea7618907aa03f9f7bedda13b 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -1212,7 +1212,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index 2e46a60e51f65..e8be63cad2724 100644 --- a/patches/chromium/web_contents.patch +++ b/patches/chromium/web_contents.patch @@ -9,10 +9,10 @@ is needed for OSR. Originally landed in https://github.com/electron/libchromiumcontent/pull/226. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 1cc8474a5f369cd0b13c328179c9be560b167468..003cd53d8d658351fa88cbc7f1dc33169c36b61b 100644 +index f2f80c86e7910cf513aa916a80c51502bb186f58..0c6c8b099036f2945872632d6d78343eab442570 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4252,6 +4252,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -4179,6 +4179,13 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, params.main_frame_name, GetOpener(), primary_main_frame_policy, base::UnguessableToken::Create()); @@ -26,7 +26,7 @@ index 1cc8474a5f369cd0b13c328179c9be560b167468..003cd53d8d658351fa88cbc7f1dc3316 std::unique_ptr delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -4262,6 +4269,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, +@@ -4189,6 +4196,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params, view_ = CreateWebContentsView(this, std::move(delegate), &render_view_host_delegate_view_); } @@ -35,10 +35,10 @@ index 1cc8474a5f369cd0b13c328179c9be560b167468..003cd53d8d658351fa88cbc7f1dc3316 CHECK(view_.get()); diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index 3255b4c9a3efe35850f3c5de5137524091b6235c..121fba14cd65bc84f8d724885311f0927766c8b0 100644 +index fc95615d2f09678fc9cbd32c777d04b66e259047..d7e026c481b6de4bcf33c0ab48f2b0a27ed7a9fa 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h -@@ -131,11 +131,14 @@ class PrerenderHandle; +@@ -129,11 +129,14 @@ class PrerenderHandle; class RenderFrameHost; class RenderViewHost; class RenderWidgetHost; @@ -53,7 +53,7 @@ index 3255b4c9a3efe35850f3c5de5137524091b6235c..121fba14cd65bc84f8d724885311f092 class WebUI; struct DropData; struct GlobalRenderFrameHostId; -@@ -293,6 +296,10 @@ class WebContents : public PageNavigator, public base::SupportsUserData { +@@ -291,6 +294,10 @@ class WebContents : public PageNavigator, public base::SupportsUserData { network::mojom::WebSandboxFlags starting_sandbox_flags = network::mojom::WebSandboxFlags::kNone; diff --git a/patches/chromium/webview_fullscreen.patch b/patches/chromium/webview_fullscreen.patch index bd16ef2db5161..277ede025fd48 100644 --- a/patches/chromium/webview_fullscreen.patch +++ b/patches/chromium/webview_fullscreen.patch @@ -15,10 +15,10 @@ Note that we also need to manually update embedder's `api::WebContents::IsFullscreenForTabOrPending` value. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 8e1228336a141f9812b03a9a4e810c797f14446b..913919047d0f968bc9eac13b049618d05b222e06 100644 +index 772cff9b1a9a061645f2220fdc3003627679ac58..9fbc1891a2298c04a461bc717c2431eef415aa72 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -9051,6 +9051,17 @@ void RenderFrameHostImpl::EnterFullscreen( +@@ -9001,6 +9001,17 @@ void RenderFrameHostImpl::EnterFullscreen( } } @@ -37,10 +37,10 @@ index 8e1228336a141f9812b03a9a4e810c797f14446b..913919047d0f968bc9eac13b049618d0 if (had_fullscreen_token && !GetView()->HasFocus()) { GetView()->Focus(); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 003cd53d8d658351fa88cbc7f1dc33169c36b61b..d42bc3cb3e6adb2cd2c05a3ca629c84153c53663 100644 +index 0c6c8b099036f2945872632d6d78343eab442570..075ea7cd9f097b60adcad2857cf7115deb3741bc 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4538,21 +4538,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( +@@ -4465,21 +4465,25 @@ KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent( const input::NativeWebKeyboardEvent& event) { OPTIONAL_TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("content.verbose"), "WebContentsImpl::PreHandleKeyboardEvent"); @@ -80,7 +80,7 @@ index 003cd53d8d658351fa88cbc7f1dc33169c36b61b..d42bc3cb3e6adb2cd2c05a3ca629c841 } bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) { -@@ -4711,7 +4715,7 @@ void WebContentsImpl::EnterFullscreenMode( +@@ -4638,7 +4642,7 @@ void WebContentsImpl::EnterFullscreenMode( OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::EnterFullscreenMode"); DCHECK(CanEnterFullscreenMode(requesting_frame)); DCHECK(requesting_frame->IsActive()); @@ -90,7 +90,7 @@ index 003cd53d8d658351fa88cbc7f1dc33169c36b61b..d42bc3cb3e6adb2cd2c05a3ca629c841 // inactive when sites request fullscreen via capability delegation, consume // transient activation from a gesture made before another window was focused, diff --git a/third_party/blink/renderer/core/fullscreen/fullscreen.cc b/third_party/blink/renderer/core/fullscreen/fullscreen.cc -index c533c80eb4eea180a2ef89a225d7c75390d40225..4c81dea15346b35a9a43c92fb3b778367888a6ca 100644 +index 6298158d9b007fb33ccc6551d3caad0e596d8f59..f0c4093742c1ade422b73f0d7d335311522506fe 100644 --- a/third_party/blink/renderer/core/fullscreen/fullscreen.cc +++ b/third_party/blink/renderer/core/fullscreen/fullscreen.cc @@ -105,7 +105,6 @@ void FullscreenElementChanged(Document& document, diff --git a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch index fe7eb54a64437..0c44714b73294 100644 --- a/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch +++ b/patches/devtools_frontend/chore_expose_ui_to_allow_electron_to_set_dock_side.patch @@ -10,10 +10,10 @@ to handle this without patching, but this is fairly clean for now and no longer patching legacy devtools code. diff --git a/front_end/entrypoints/main/MainImpl.ts b/front_end/entrypoints/main/MainImpl.ts -index 064720d2c68c3f73f2d3909af7dc0c5036802769..af313a1d6b39a60763e9e0b54c0642d13a02fc91 100644 +index ad6c608d8a1caecbffba95bb911abe5639e13449..d9ef6e74d767b1712be1d4ca503c1d21973ba372 100644 --- a/front_end/entrypoints/main/MainImpl.ts +++ b/front_end/entrypoints/main/MainImpl.ts -@@ -771,6 +771,8 @@ export class MainImpl { +@@ -769,6 +769,8 @@ export class MainImpl { globalThis.Main = globalThis.Main || {}; // @ts-expect-error Exported for Tests.js globalThis.Main.Main = MainImpl; diff --git a/shell/browser/electron_plugin_info_host_impl.cc b/shell/browser/electron_plugin_info_host_impl.cc index 456be676c4414..8a09038a05a76 100644 --- a/shell/browser/electron_plugin_info_host_impl.cc +++ b/shell/browser/electron_plugin_info_host_impl.cc @@ -49,7 +49,7 @@ void ElectronPluginInfoHostImpl::PluginsLoaded( std::vector matching_plugins; std::vector mime_types; PluginService::GetInstance()->GetPluginInfoArray( - params.url, params.mime_type, true, &matching_plugins, &mime_types); + params.url, params.mime_type, &matching_plugins, &mime_types); if (!matching_plugins.empty()) { output->plugin = matching_plugins[0]; output->actual_mime_type = mime_types[0]; From f330705f8bbaad33b8aab0ac541ea6f50eeb88aa Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Thu, 13 Nov 2025 10:09:34 -0800 Subject: [PATCH 251/268] fix: crash on windows when UTF-8 is in path (#48898) In 6399527761b43abb5a3ea40dd64eb05efad3b9de we changed the path strings that `node_modules.cc` operates on from single-byte to wide strings. Unfortunately this means that `generic_path()` that the "fix: ensure TraverseParent bails on resource path exit" patch was calling was no longer a safe method to call on Windows if the underlying string has unicode characters in it. Here we fix it by using `ConvertGenericPathToUTF8` from the Node.js internal utilities. --- patches/node/.patches | 2 +- .../node/api_remove_deprecated_getisolate.patch | 4 ++-- ...verseparent_bails_on_resource_path_exit.patch | 16 ++++++++-------- ...xpose_readfilesync_override_for_modules.patch | 6 +++--- ...se_cp_utf8_for_wide_file_names_on_win32.patch | 14 +++++--------- 5 files changed, 19 insertions(+), 23 deletions(-) diff --git a/patches/node/.patches b/patches/node/.patches index 172ea7c7e3ff6..619b6affec393 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -26,7 +26,6 @@ build_allow_unbundling_of_node_js_dependencies.patch build_change_crdtp_protocoltypetraits_signatures_to_avoid_conflict.patch fix_adjust_wpt_and_webidl_tests_for_enabled_float16array.patch refactor_attach_cppgc_heap_on_v8_isolate_creation.patch -fix_ensure_traverseparent_bails_on_resource_path_exit.patch fix_cppgc_initializing_twice.patch fix_expose_readfilesync_override_for_modules.patch fix_array_out-of-bounds_read_in_boyer-moore_search.patch @@ -42,4 +41,5 @@ chore_handle_support_for_import_defer_as_ns_and_import_defer.patch api_delete_deprecated_fields_on_v8_isolate.patch api_promote_deprecation_of_v8_context_and_v8_object_api_methods.patch src_use_cp_utf8_for_wide_file_names_on_win32.patch +fix_ensure_traverseparent_bails_on_resource_path_exit.patch reland_temporal_unflag_temporal.patch diff --git a/patches/node/api_remove_deprecated_getisolate.patch b/patches/node/api_remove_deprecated_getisolate.patch index 11c2fad5df2f7..8b381856d140c 100644 --- a/patches/node/api_remove_deprecated_getisolate.patch +++ b/patches/node/api_remove_deprecated_getisolate.patch @@ -586,7 +586,7 @@ index 57e068ae249d618c2658638f9f3b03e1fedb6524..8c51ae4e0a435971c6d0288af8781087 data_.Reset(); return ret; diff --git a/src/node_modules.cc b/src/node_modules.cc -index bdbc511ef3f680bbac6770b89f47acaee95d56a2..d8477191efafba3c41c06d765f4b03bd00b8573c 100644 +index eea4ba313d8dbcf7b88b79f5a3e9ba2eb39d7c3e..529b7cfc15536c3fe5e7798c0f82698121751f2a 100644 --- a/src/node_modules.cc +++ b/src/node_modules.cc @@ -69,7 +69,7 @@ void BindingData::Deserialize(v8::Local context, @@ -598,7 +598,7 @@ index bdbc511ef3f680bbac6770b89f47acaee95d56a2..d8477191efafba3c41c06d765f4b03bd Realm* realm = Realm::GetCurrent(context); BindingData* binding = realm->AddBindingData(holder); CHECK_NOT_NULL(binding); -@@ -735,7 +735,7 @@ void BindingData::CreatePerContextProperties(Local target, +@@ -696,7 +696,7 @@ void BindingData::CreatePerContextProperties(Local target, Realm* realm = Realm::GetCurrent(context); realm->AddBindingData(target); diff --git a/patches/node/fix_ensure_traverseparent_bails_on_resource_path_exit.patch b/patches/node/fix_ensure_traverseparent_bails_on_resource_path_exit.patch index d37e5b046d156..2b8b182e909f6 100644 --- a/patches/node/fix_ensure_traverseparent_bails_on_resource_path_exit.patch +++ b/patches/node/fix_ensure_traverseparent_bails_on_resource_path_exit.patch @@ -8,10 +8,10 @@ resource path. This commit ensures that the TraverseParent function bails out if the parent path is outside of the resource path. diff --git a/src/node_modules.cc b/src/node_modules.cc -index 9eec93f52f0d0b2e45ae04ff357b4ced0770782f..b93ccedaf703f86ae2092c304785394c471d520c 100644 +index cbc3283fc2d511cce2eae0048cc9bf0fa917d38a..3b4d82da2ad30cafa96611eaa2d68ddf1badeac0 100644 --- a/src/node_modules.cc +++ b/src/node_modules.cc -@@ -284,8 +284,41 @@ const BindingData::PackageConfig* BindingData::TraverseParent( +@@ -320,8 +320,41 @@ const BindingData::PackageConfig* BindingData::TraverseParent( Realm* realm, const std::filesystem::path& check_path) { std::filesystem::path current_path = check_path; auto env = realm->env(); @@ -47,22 +47,22 @@ index 9eec93f52f0d0b2e45ae04ff357b4ced0770782f..b93ccedaf703f86ae2092c304785394c + }); + }; + -+ bool did_original_path_start_with_resources_path = starts_with(check_path. -+ generic_string(), resources_path); ++ bool did_original_path_start_with_resources_path = starts_with( ++ ConvertGenericPathToUTF8(check_path), resources_path); + do { current_path = current_path.parent_path(); -@@ -304,6 +337,12 @@ const BindingData::PackageConfig* BindingData::TraverseParent( - return nullptr; +@@ -341,6 +374,12 @@ const BindingData::PackageConfig* BindingData::TraverseParent( + } } + // If current path is outside the resources path, bail. + if (did_original_path_start_with_resources_path && -+ !starts_with(current_path.generic_string(), resources_path)) { ++ !starts_with(ConvertGenericPathToUTF8(current_path), resources_path)) { + return nullptr; + } + // Check if the path ends with `/node_modules` - if (current_path.generic_string().ends_with("/node_modules")) { + if (current_path.filename() == "node_modules") { return nullptr; diff --git a/patches/node/fix_expose_readfilesync_override_for_modules.patch b/patches/node/fix_expose_readfilesync_override_for_modules.patch index 984a59d120fb8..62b99c918f08e 100644 --- a/patches/node/fix_expose_readfilesync_override_for_modules.patch +++ b/patches/node/fix_expose_readfilesync_override_for_modules.patch @@ -20,7 +20,7 @@ index 2884149d82d180e0d2ecfa7ac8fd92f201f1cb55..dded4bf3d7106d127efbad81087f0c37 V(performance_entry_callback, v8::Function) \ V(prepare_stack_trace_callback, v8::Function) \ diff --git a/src/node_modules.cc b/src/node_modules.cc -index b93ccedaf703f86ae2092c304785394c471d520c..bdbc511ef3f680bbac6770b89f47acaee95d56a2 100644 +index 9eec93f52f0d0b2e45ae04ff357b4ced0770782f..eea4ba313d8dbcf7b88b79f5a3e9ba2eb39d7c3e 100644 --- a/src/node_modules.cc +++ b/src/node_modules.cc @@ -23,6 +23,7 @@ namespace modules { @@ -90,7 +90,7 @@ index b93ccedaf703f86ae2092c304785394c471d520c..bdbc511ef3f680bbac6770b89f47acae void BindingData::ReadPackageJSON(const FunctionCallbackInfo& args) { CHECK_GE(args.Length(), 1); // path, [is_esm, base, specifier] CHECK(args[0]->IsString()); // path -@@ -674,6 +710,8 @@ void SaveCompileCacheEntry(const FunctionCallbackInfo& args) { +@@ -635,6 +671,8 @@ void SaveCompileCacheEntry(const FunctionCallbackInfo& args) { void BindingData::CreatePerIsolateProperties(IsolateData* isolate_data, Local target) { Isolate* isolate = isolate_data->isolate(); @@ -99,7 +99,7 @@ index b93ccedaf703f86ae2092c304785394c471d520c..bdbc511ef3f680bbac6770b89f47acae SetMethod(isolate, target, "readPackageJSON", ReadPackageJSON); SetMethod(isolate, target, -@@ -733,6 +771,8 @@ void BindingData::CreatePerContextProperties(Local target, +@@ -694,6 +732,8 @@ void BindingData::CreatePerContextProperties(Local target, void BindingData::RegisterExternalReferences( ExternalReferenceRegistry* registry) { diff --git a/patches/node/src_use_cp_utf8_for_wide_file_names_on_win32.patch b/patches/node/src_use_cp_utf8_for_wide_file_names_on_win32.patch index b3e93de8af202..d1207f12b1317 100644 --- a/patches/node/src_use_cp_utf8_for_wide_file_names_on_win32.patch +++ b/patches/node/src_use_cp_utf8_for_wide_file_names_on_win32.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Fedor Indutny <238531+indutny@users.noreply.github.com> -Date: Fri, 7 Nov 2025 19:41:44 -0800 +From: Fedor Indutny +Date: Tue, 11 Nov 2025 13:43:01 -0800 Subject: src: use CP_UTF8 for wide file names on win32 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -136,10 +136,10 @@ index 969e7d08086f8442bed476feaf15599b8c79db7c..e7459654401c275dfb86207831016ed7 std::make_error_code(std::errc::file_exists), "cp", diff --git a/src/node_modules.cc b/src/node_modules.cc -index d8477191efafba3c41c06d765f4b03bd00b8573c..5444e556b89ba5b71739753eaafa706cd9727013 100644 +index 529b7cfc15536c3fe5e7798c0f82698121751f2a..cbc3283fc2d511cce2eae0048cc9bf0fa917d38a 100644 --- a/src/node_modules.cc +++ b/src/node_modules.cc -@@ -365,12 +365,13 @@ const BindingData::PackageConfig* BindingData::TraverseParent( +@@ -332,22 +332,24 @@ const BindingData::PackageConfig* BindingData::TraverseParent( // Stop the search when the process doesn't have permissions // to walk upwards @@ -158,10 +158,6 @@ index d8477191efafba3c41c06d765f4b03bd00b8573c..5444e556b89ba5b71739753eaafa706c + } } - // If current path is outside the resources path, bail. -@@ -380,13 +381,14 @@ const BindingData::PackageConfig* BindingData::TraverseParent( - } - // Check if the path ends with `/node_modules` - if (current_path.generic_string().ends_with("/node_modules")) { + if (current_path.filename() == "node_modules") { @@ -176,7 +172,7 @@ index d8477191efafba3c41c06d765f4b03bd00b8573c..5444e556b89ba5b71739753eaafa706c if (package_json != nullptr) { return package_json; } -@@ -408,20 +410,12 @@ void BindingData::GetNearestParentPackageJSONType( +@@ -369,20 +371,12 @@ void BindingData::GetNearestParentPackageJSONType( ToNamespacedPath(realm->env(), &path_value); From 8a9d8aa22eb47fc4e6fcd8719e15aea19862d43b Mon Sep 17 00:00:00 2001 From: Niklas Wenzel Date: Thu, 13 Nov 2025 20:39:59 +0100 Subject: [PATCH 252/268] docs: fix docs for `app.isHardwareAccelerationEnabled()` (#48925) --- docs/api/app.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/app.md b/docs/api/app.md index 72e80cac33416..d27cc46ad194e 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -1218,7 +1218,7 @@ This method can only be called before app is ready. ### `app.isHardwareAccelerationEnabled()` -Returns `boolean` - whether hardware acceleration is currently disabled. +Returns `boolean` - whether hardware acceleration is currently enabled. > [!NOTE] > This information is only usable after the `gpu-info-update` event is emitted. From 91d6c4235c5af2e3cbe93ff84bccf13e914c60b1 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Thu, 13 Nov 2025 21:25:09 +0100 Subject: [PATCH 253/268] test: fix types in chromium-spec (#48943) --- spec/chromium-spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/chromium-spec.ts b/spec/chromium-spec.ts index efb1797313fd4..b962dc363c72e 100644 --- a/spec/chromium-spec.ts +++ b/spec/chromium-spec.ts @@ -915,7 +915,7 @@ describe('chromium features', () => { if (action !== 'none') { // Make the PermissionRequestHandler behave according to action variable passed for this test - testSession.setPermissionRequestHandler((_wc, permission, callback) => { + testSession.setPermissionRequestHandler((_wc: Electron.WebContents, permission: string, callback: (allow: boolean) => void) => { if (permission === 'geolocation') { if (action === 'allow') callback(true); else if (action === 'deny') callback(false); From bde10a0b47ce435b4f52abcc3edd1ac1a90377b8 Mon Sep 17 00:00:00 2001 From: Keeley Hammond Date: Thu, 13 Nov 2025 13:03:24 -0800 Subject: [PATCH 254/268] fix: handle tar.xz files in uploaders, add to breaking changes (#48941) * fix: handle tar.xz files in uploaders, add to breaking changes * docs: add additional file extension info --- docs/breaking-changes.md | 5 +++++ script/release/release.ts | 8 ++++---- script/release/uploaders/upload.py | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/breaking-changes.md b/docs/breaking-changes.md index 4043fa2fad8dd..31d9a27bbd21f 100644 --- a/docs/breaking-changes.md +++ b/docs/breaking-changes.md @@ -20,6 +20,11 @@ Using the `clipboard` API directly in the renderer process is deprecated. If you want to call this API from a renderer process, place the API call in your preload script and expose it using the [contextBridge](https://www.electronjs.org/docs/latest/api/context-bridge) API. +### Behavior Changed: MacOS dSYM files now compressed with tar.xz + +Debug symbols for MacOS (dSYM) now use xz compression in order to handle larger file sizes. `dsym.zip` files are now +`dsym.tar.xz` files. End users using debug symbols may need to update their zip utilities. + ## Planned Breaking API Changes (39.0) ### Deprecated: `--host-rules` command line switch diff --git a/script/release/release.ts b/script/release/release.ts index 6e64764e44301..63f73126dd7ae 100755 --- a/script/release/release.ts +++ b/script/release/release.ts @@ -137,11 +137,11 @@ function assetsForVersion (version: string, validatingRelease: boolean) { `chromedriver-${version}-win32-ia32.zip`, `chromedriver-${version}-win32-x64.zip`, `chromedriver-${version}-win32-arm64.zip`, - `electron-${version}-darwin-x64-dsym.zip`, + `electron-${version}-darwin-x64-dsym.tar.xz`, `electron-${version}-darwin-x64-dsym-snapshot.zip`, `electron-${version}-darwin-x64-symbols.zip`, `electron-${version}-darwin-x64.zip`, - `electron-${version}-darwin-arm64-dsym.zip`, + `electron-${version}-darwin-arm64-dsym.tar.xz`, `electron-${version}-darwin-arm64-dsym-snapshot.zip`, `electron-${version}-darwin-arm64-symbols.zip`, `electron-${version}-darwin-arm64.zip`, @@ -152,11 +152,11 @@ function assetsForVersion (version: string, validatingRelease: boolean) { `electron-${version}-linux-x64-debug.zip`, `electron-${version}-linux-x64-symbols.zip`, `electron-${version}-linux-x64.zip`, - `electron-${version}-mas-x64-dsym.zip`, + `electron-${version}-mas-x64-dsym.tar.xz`, `electron-${version}-mas-x64-dsym-snapshot.zip`, `electron-${version}-mas-x64-symbols.zip`, `electron-${version}-mas-x64.zip`, - `electron-${version}-mas-arm64-dsym.zip`, + `electron-${version}-mas-arm64-dsym.tar.xz`, `electron-${version}-mas-arm64-dsym-snapshot.zip`, `electron-${version}-mas-arm64-symbols.zip`, `electron-${version}-mas-arm64.zip`, diff --git a/script/release/uploaders/upload.py b/script/release/uploaders/upload.py index c5fa934b01cd6..cf1bb3c0e4904 100755 --- a/script/release/uploaders/upload.py +++ b/script/release/uploaders/upload.py @@ -88,7 +88,7 @@ def main(): upload_electron(release, ts_defs_path, args) dsym_zip = os.path.join(OUT_DIR, DSYM_NAME) - shutil.copy2(os.path.join(OUT_DIR, 'dsym.zip'), dsym_zip) + shutil.copy2(os.path.join(OUT_DIR, 'dsym.tar.xz'), dsym_zip) upload_electron(release, dsym_zip, args) dsym_snapshot_zip = os.path.join(OUT_DIR, DSYM_SNAPSHOT_NAME) From 2e83738f543f132d0b9b1a58caf135eb8227139d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 13 Nov 2025 15:50:13 -0600 Subject: [PATCH 255/268] refactor: use `std::map::extract()` in `api::WebRequest` (#48929) refactor: use std::map::extract() in api::WebRequest Small readability refactor to api::WebRequest::blocked_requests_: use extract() when we want to pull a BlockedRequest from the map and then process it. --- shell/browser/api/electron_api_web_request.cc | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/shell/browser/api/electron_api_web_request.cc b/shell/browser/api/electron_api_web_request.cc index 0b644a925b9a8..814ed1e9b45e9 100644 --- a/shell/browser/api/electron_api_web_request.cc +++ b/shell/browser/api/electron_api_web_request.cc @@ -402,11 +402,11 @@ int WebRequest::HandleOnBeforeRequestResponseEvent( void WebRequest::OnBeforeRequestListenerResult(uint64_t id, v8::Local response) { - const auto iter = blocked_requests_.find(id); - if (iter == std::end(blocked_requests_)) + auto nh = blocked_requests_.extract(id); + if (!nh) return; - auto& request = iter->second; + auto& request = nh.mapped(); int result = net::OK; if (response->IsObject()) { @@ -424,7 +424,6 @@ void WebRequest::OnBeforeRequestListenerResult(uint64_t id, base::SequencedTaskRunner::GetCurrentDefault()->PostTask( FROM_HERE, base::BindOnce(std::move(request.callback), result)); - blocked_requests_.erase(iter); } int WebRequest::OnBeforeSendHeaders(extensions::WebRequestInfo* info, @@ -469,11 +468,11 @@ int WebRequest::HandleOnBeforeSendHeadersResponseEvent( void WebRequest::OnBeforeSendHeadersListenerResult( uint64_t id, v8::Local response) { - const auto iter = blocked_requests_.find(id); - if (iter == std::end(blocked_requests_)) + auto nh = blocked_requests_.extract(id); + if (!nh) return; - auto& request = iter->second; + auto& request = nh.mapped(); net::HttpRequestHeaders* old_headers = request.request_headers; net::HttpRequestHeaders new_headers; @@ -511,7 +510,6 @@ void WebRequest::OnBeforeSendHeadersListenerResult( FROM_HERE, base::BindOnce(std::move(request.before_send_headers_callback), updated_headers.first, updated_headers.second, result)); - blocked_requests_.erase(iter); } int WebRequest::OnHeadersReceived( @@ -563,11 +561,11 @@ int WebRequest::HandleOnHeadersReceivedResponseEvent( void WebRequest::OnHeadersReceivedListenerResult( uint64_t id, v8::Local response) { - const auto iter = blocked_requests_.find(id); - if (iter == std::end(blocked_requests_)) + auto nh = blocked_requests_.extract(id); + if (!nh) return; - auto& request = iter->second; + auto& request = nh.mapped(); int result = net::OK; bool user_modified_headers = false; @@ -600,7 +598,6 @@ void WebRequest::OnHeadersReceivedListenerResult( base::SequencedTaskRunner::GetCurrentDefault()->PostTask( FROM_HERE, base::BindOnce(std::move(request.callback), result)); - blocked_requests_.erase(iter); } void WebRequest::OnSendHeaders(extensions::WebRequestInfo* info, @@ -772,9 +769,8 @@ void WebRequest::OnLoginAuthResult( uint64_t id, net::AuthCredentials* credentials, const std::optional& maybe_creds) { - auto iter = blocked_requests_.find(id); - if (iter == blocked_requests_.end()) - NOTREACHED(); + auto nh = blocked_requests_.extract(id); + CHECK(nh); AuthRequiredResponse action = AuthRequiredResponse::AUTH_REQUIRED_RESPONSE_NO_ACTION; @@ -784,8 +780,7 @@ void WebRequest::OnLoginAuthResult( } base::SequencedTaskRunner::GetCurrentDefault()->PostTask( - FROM_HERE, base::BindOnce(std::move(iter->second.auth_callback), action)); - blocked_requests_.erase(iter); + FROM_HERE, base::BindOnce(std::move(nh.mapped().auth_callback), action)); } // static From 0a6d0c00cf7bdf2df243494f7770864620ac6e4e Mon Sep 17 00:00:00 2001 From: Keeley Hammond Date: Thu, 13 Nov 2025 20:07:52 -0800 Subject: [PATCH 256/268] build: correct uploader copy for tar files (#48953) --- script/lib/config.py | 9 +++++++++ script/release/uploaders/upload.py | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/script/lib/config.py b/script/lib/config.py index 6d60db6a214e4..d2076fbd94563 100644 --- a/script/lib/config.py +++ b/script/lib/config.py @@ -51,3 +51,12 @@ def get_zip_name(name, version, suffix=''): if suffix: zip_name += '-' + suffix return zip_name + '.zip' + +def get_tar_name(name, version, suffix=''): + arch = get_target_arch() + if arch == 'arm': + arch += 'v7l' + zip_name = f'{name}-{version}-{get_platform_key()}-{arch}' + if suffix: + zip_name += '-' + suffix + return zip_name + '.tar.xz' diff --git a/script/release/uploaders/upload.py b/script/release/uploaders/upload.py index cf1bb3c0e4904..36b5a3dd7f670 100755 --- a/script/release/uploaders/upload.py +++ b/script/release/uploaders/upload.py @@ -16,7 +16,7 @@ from zipfile import ZipFile from lib.config import PLATFORM, get_target_arch, \ - get_zip_name, set_verbose_mode, \ + get_zip_name, get_tar_name, set_verbose_mode, \ is_verbose_mode, get_platform_key, \ verbose_mode_print from lib.util import get_electron_branding, execute, get_electron_version, \ @@ -33,7 +33,8 @@ DIST_NAME = get_zip_name(PROJECT_NAME, ELECTRON_VERSION) SYMBOLS_NAME = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'symbols') -DSYM_NAME = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'dsym') +# Use tar.xz compression for dsym files due to size +DSYM_NAME = get_tar_name(PROJECT_NAME, ELECTRON_VERSION, 'dsym') DSYM_SNAPSHOT_NAME = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'dsym-snapshot') PDB_NAME = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'pdb') From 4deaa458b26ca7e07eed85918245e1b26e9c0140 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Fri, 14 Nov 2025 14:46:21 +0100 Subject: [PATCH 257/268] test: add `view.getBounds|setBounds` tests (#48936) test: add view.getBounds|setBounds tests --- spec/api-view-spec.ts | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/spec/api-view-spec.ts b/spec/api-view-spec.ts index 48c8ccae0c48f..fc39bccb29d6d 100644 --- a/spec/api-view-spec.ts +++ b/spec/api-view-spec.ts @@ -92,4 +92,46 @@ describe('View', () => { expect(v.getVisible()).to.be.false(); }); }); + + describe('view.getBounds|setBounds', () => { + it('defaults to 0,0,0,0', () => { + const v = new View(); + expect(v.getBounds()).to.deep.equal({ x: 0, y: 0, width: 0, height: 0 }); + }); + + it('can be set and retrieved', () => { + const v = new View(); + v.setBounds({ x: 10, y: 20, width: 300, height: 400 }); + expect(v.getBounds()).to.deep.equal({ x: 10, y: 20, width: 300, height: 400 }); + }); + + it('emits bounds-changed when bounds mutate', () => { + const v = new View(); + let called = 0; + v.once('bounds-changed', () => { called++; }); + v.setBounds({ x: 5, y: 6, width: 7, height: 8 }); + expect(called).to.equal(1); + }); + + it('allows zero-size bounds', () => { + const v = new View(); + v.setBounds({ x: 1, y: 2, width: 0, height: 0 }); + expect(v.getBounds()).to.deep.equal({ x: 1, y: 2, width: 0, height: 0 }); + }); + + it('allows negative coordinates', () => { + const v = new View(); + v.setBounds({ x: -10, y: -20, width: 100, height: 50 }); + expect(v.getBounds()).to.deep.equal({ x: -10, y: -20, width: 100, height: 50 }); + }); + + it('child bounds remain relative after parent moves', () => { + const parent = new View(); + const child = new View(); + parent.addChildView(child); + child.setBounds({ x: 10, y: 15, width: 25, height: 30 }); + parent.setBounds({ x: 50, y: 60, width: 500, height: 600 }); + expect(child.getBounds()).to.deep.equal({ x: 10, y: 15, width: 25, height: 30 }); + }); + }); }); From 81236e4e4e97256798363b71f1dae5eaee0b9cc8 Mon Sep 17 00:00:00 2001 From: Noah Gregory Date: Fri, 14 Nov 2025 14:24:08 -0500 Subject: [PATCH 258/268] feat: validate integrity of ASAR Integrity dictionary on macOS (#48587) --- filenames.gni | 2 + shell/common/asar/archive_mac.mm | 4 ++ shell/common/asar/integrity_digest.h | 15 ++++++ shell/common/asar/integrity_digest.mm | 74 +++++++++++++++++++++++++++ 4 files changed, 95 insertions(+) create mode 100644 shell/common/asar/integrity_digest.h create mode 100644 shell/common/asar/integrity_digest.mm diff --git a/filenames.gni b/filenames.gni index 8808b3b907054..21b57205fed3b 100644 --- a/filenames.gni +++ b/filenames.gni @@ -194,6 +194,8 @@ filenames = { "shell/common/api/electron_api_clipboard_mac.mm", "shell/common/api/electron_api_native_image_mac.mm", "shell/common/asar/archive_mac.mm", + "shell/common/asar/integrity_digest.h", + "shell/common/asar/integrity_digest.mm", "shell/common/application_info_mac.mm", "shell/common/language_util_mac.mm", "shell/common/mac/main_application_bundle.h", diff --git a/shell/common/asar/archive_mac.mm b/shell/common/asar/archive_mac.mm index 455c5e03c2d08..bc6286e7eb851 100644 --- a/shell/common/asar/archive_mac.mm +++ b/shell/common/asar/archive_mac.mm @@ -17,6 +17,7 @@ #include "base/files/file_util.h" #include "base/strings/sys_string_conversions.h" #include "shell/common/asar/asar_util.h" +#include "shell/common/asar/integrity_digest.h" namespace asar { @@ -39,6 +40,9 @@ NSDictionary* integrity = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"ElectronAsarIntegrity"]; + if (!IsIntegrityDictionaryValid(integrity)) + return std::nullopt; + // Integrity not provided if (!integrity) return std::nullopt; diff --git a/shell/common/asar/integrity_digest.h b/shell/common/asar/integrity_digest.h new file mode 100644 index 0000000000000..9336baaba5f6f --- /dev/null +++ b/shell/common/asar/integrity_digest.h @@ -0,0 +1,15 @@ +// Copyright (c) 2025 Noah Gregory +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#ifndef ELECTRON_SHELL_COMMON_ASAR_INTEGRITY_DIGEST_H_ +#define ELECTRON_SHELL_COMMON_ASAR_INTEGRITY_DIGEST_H_ + +#include +namespace asar { + +bool IsIntegrityDictionaryValid(NSDictionary* integrity_dict); + +} // namespace asar + +#endif // ELECTRON_SHELL_COMMON_ASAR_INTEGRITY_DIGEST_H_ diff --git a/shell/common/asar/integrity_digest.mm b/shell/common/asar/integrity_digest.mm new file mode 100644 index 0000000000000..7f64ae57e22fd --- /dev/null +++ b/shell/common/asar/integrity_digest.mm @@ -0,0 +1,74 @@ +// Copyright (c) 2025 Noah Gregory +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#include "shell/common/asar/integrity_digest.h" + +#include + +#include +#include +#include + +#include "base/strings/sys_string_conversions.h" +#include "crypto/hash.h" + +namespace asar { + +constexpr crypto::hash::HashKind kIntegrityDictionaryHashKind = + crypto::hash::HashKind::kSha256; + +constexpr size_t kIntegrityDictionaryDigestSize = + DigestSizeForHashKind(kIntegrityDictionaryHashKind); +constexpr char kIntegrityDictionaryDigestSentinel[] = + "AGbevlPCksUGKNL8TSn7wGmJEuJsXb2A"; + +struct IntegrityDictionaryDigestSlot { + uint8_t sentinel[sizeof(kIntegrityDictionaryDigestSentinel) - 1]; + uint8_t used; + uint8_t version; + uint8_t digest[kIntegrityDictionaryDigestSize]; +}; + +constexpr IntegrityDictionaryDigestSlot MakeDigestSlot( + const char (&sentinel)[33]) { + IntegrityDictionaryDigestSlot slot{}; + std::span slot_sentinel_span(slot.sentinel); + std::copy_n(sentinel, slot_sentinel_span.size(), slot_sentinel_span.begin()); + slot.used = false; // to be set at package-time + slot.version = 0; // to be set at package-time + return slot; +} + +__attribute__((section("__DATA_CONST,__asar_integrity"), used)) +const volatile IntegrityDictionaryDigestSlot kIntegrityDictionaryDigest = + MakeDigestSlot(kIntegrityDictionaryDigestSentinel); + +bool IsIntegrityDictionaryValid(NSDictionary* integrity) { + if (kIntegrityDictionaryDigest.used == false) + return true; // No digest to validate against, fail open + if (kIntegrityDictionaryDigest.version != 1) + return false; // Unknown version, fail closed + crypto::hash::Hasher integrity_hasher(kIntegrityDictionaryHashKind); + for (NSString *relative_path_key in + [[integrity allKeys] sortedArrayUsingComparator:^NSComparisonResult( + NSString* s1, NSString* s2) { + return [s1 compare:s2 options:NSLiteralSearch]; + }]) { + NSDictionary* file_integrity = [integrity objectForKey:relative_path_key]; + NSString* algorithm = [file_integrity objectForKey:@"algorithm"]; + NSString* hash = [file_integrity objectForKey:@"hash"]; + integrity_hasher.Update(base::SysNSStringToUTF8(relative_path_key)); + integrity_hasher.Update(base::SysNSStringToUTF8(algorithm)); + integrity_hasher.Update(base::SysNSStringToUTF8(hash)); + } + std::array digest; + integrity_hasher.Finish(digest); + if (!std::equal(digest.begin(), digest.end(), + kIntegrityDictionaryDigest.digest)) { + return false; + } + return true; +} + +} // namespace asar From 460b97adf076f8ebd98efd8dbda94daee3174808 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 14 Nov 2025 12:11:42 -0800 Subject: [PATCH 259/268] build: limit workflow gh token permissions (#48237) --- .github/workflows/archaeologist-dig.yml | 4 ++++ .github/workflows/build-git-cache.yml | 8 +++++++ .github/workflows/build.yml | 21 +++++++++++++++++++ .github/workflows/clean-src-cache.yml | 10 ++++++--- .github/workflows/issue-labeled.yml | 7 +++++-- .github/workflows/issue-opened.yml | 2 ++ .github/workflows/issue-transferred.yml | 1 + .github/workflows/issue-unlabeled.yml | 5 +++-- .github/workflows/linux-publish.yml | 10 +++++++++ .github/workflows/macos-publish.yml | 12 +++++++++++ ...peline-electron-build-and-test-and-nan.yml | 10 +++++++++ .../pipeline-electron-build-and-test.yml | 11 ++++++---- .../workflows/pipeline-electron-docs-only.yml | 4 ++++ .github/workflows/pipeline-electron-lint.yml | 4 ++++ .../pipeline-segment-electron-build.yml | 4 ++++ .../pipeline-segment-electron-gn-check.yml | 4 ++++ .../pipeline-segment-electron-test.yml | 9 ++++---- .../pipeline-segment-node-nan-test.yml | 6 ++++++ .github/workflows/pull-request-labeled.yml | 2 ++ .github/workflows/semantic.yml | 3 +-- .github/workflows/stable-prep-items.yml | 1 + .github/workflows/stale.yml | 2 ++ .github/workflows/windows-publish.yml | 10 +++++++++ 23 files changed, 133 insertions(+), 17 deletions(-) diff --git a/.github/workflows/archaeologist-dig.yml b/.github/workflows/archaeologist-dig.yml index 4f41c409dbf46..14180fdc90ea3 100644 --- a/.github/workflows/archaeologist-dig.yml +++ b/.github/workflows/archaeologist-dig.yml @@ -3,10 +3,14 @@ name: Archaeologist on: pull_request: +permissions: {} + jobs: archaeologist-dig: name: Archaeologist Dig runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Checkout Electron uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 diff --git a/.github/workflows/build-git-cache.yml b/.github/workflows/build-git-cache.yml index fc981786321d5..6e081176cb5d0 100644 --- a/.github/workflows/build-git-cache.yml +++ b/.github/workflows/build-git-cache.yml @@ -6,9 +6,13 @@ on: schedule: - cron: "0 0 * * *" +permissions: {} + jobs: build-git-cache-linux: runs-on: electron-arc-centralus-linux-amd64-32core + permissions: + contents: read container: image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1 options: --user root @@ -30,6 +34,8 @@ jobs: build-git-cache-windows: runs-on: electron-arc-centralus-linux-amd64-32core + permissions: + contents: read container: image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1 options: --user root --device /dev/fuse --cap-add SYS_ADMIN @@ -52,6 +58,8 @@ jobs: build-git-cache-macos: runs-on: electron-arc-centralus-linux-amd64-32core + permissions: + contents: read # This job updates the same git cache as linux, so it needs to run after the linux one. needs: build-git-cache-linux container: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3c41c5b1caa7d..8418d0b9e1a58 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,10 +43,13 @@ defaults: run: shell: bash +permissions: {} + jobs: setup: runs-on: ubuntu-latest permissions: + contents: read pull-requests: read outputs: docs: ${{ steps.filter.outputs.docs }} @@ -84,6 +87,8 @@ jobs: needs: setup if: ${{ !inputs.skip-lint }} uses: ./.github/workflows/pipeline-electron-lint.yml + permissions: + contents: read with: container: '{"image":"ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}","options":"--user root"}' secrets: inherit @@ -93,6 +98,8 @@ jobs: needs: [setup, checkout-linux] if: ${{ needs.setup.outputs.docs-only == 'true' }} uses: ./.github/workflows/pipeline-electron-docs-only.yml + permissions: + contents: read with: container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}' secrets: inherit @@ -102,6 +109,8 @@ jobs: needs: setup if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-macos}} runs-on: electron-arc-centralus-linux-amd64-32core + permissions: + contents: read container: image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }} options: --user root @@ -130,6 +139,8 @@ jobs: needs: setup if: ${{ !inputs.skip-linux}} runs-on: electron-arc-centralus-linux-amd64-32core + permissions: + contents: read container: image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }} options: --user root @@ -159,6 +170,8 @@ jobs: needs: setup if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }} runs-on: electron-arc-centralus-linux-amd64-32core + permissions: + contents: read container: image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }} options: --user root --device /dev/fuse --cap-add SYS_ADMIN @@ -189,6 +202,8 @@ jobs: # GN Check Jobs macos-gn-check: uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml + permissions: + contents: read needs: checkout-macos with: target-platform: macos @@ -199,6 +214,8 @@ jobs: linux-gn-check: uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml + permissions: + contents: read needs: checkout-linux if: ${{ needs.setup.outputs.src == 'true' }} with: @@ -211,6 +228,8 @@ jobs: windows-gn-check: uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml + permissions: + contents: read needs: checkout-windows with: target-platform: win @@ -404,6 +423,8 @@ jobs: gha-done: name: GitHub Actions Completed runs-on: ubuntu-latest + permissions: + contents: read needs: [docs-only, macos-x64, macos-arm64, linux-x64, linux-x64-asan, linux-arm, linux-arm64, windows-x64, windows-x86, windows-arm64] if: always() && !contains(needs.*.result, 'failure') steps: diff --git a/.github/workflows/clean-src-cache.yml b/.github/workflows/clean-src-cache.yml index 9a1bfddccc888..d632ba2d5fa3f 100644 --- a/.github/workflows/clean-src-cache.yml +++ b/.github/workflows/clean-src-cache.yml @@ -1,16 +1,20 @@ name: Clean Source Cache -description: | - This workflow cleans up the source cache on the cross-instance cache volume - to free up space. It runs daily at midnight and clears files older than 15 days. +# Description: +# This workflow cleans up the source cache on the cross-instance cache volume +# to free up space. It runs daily at midnight and clears files older than 15 days. on: schedule: - cron: "0 0 * * *" +permissions: {} + jobs: clean-src-cache: runs-on: electron-arc-centralus-linux-amd64-32core + permissions: + contents: read container: image: ghcr.io/electron/build:bc2f48b2415a670de18d13605b1cf0eb5fdbaae1 options: --user root diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml index fbc8d12b252ea..3fe344f3c7f33 100644 --- a/.github/workflows/issue-labeled.yml +++ b/.github/workflows/issue-labeled.yml @@ -4,14 +4,15 @@ on: issues: types: [labeled] -permissions: # added using https://github.com/step-security/secure-workflows - contents: read +permissions: {} jobs: issue-labeled-with-status: name: status/{confirmed,reviewed} label added if: github.event.label.name == 'status/confirmed' || github.event.label.name == 'status/reviewed' runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Generate GitHub App token uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1 @@ -31,6 +32,8 @@ jobs: name: blocked/* label added if: startsWith(github.event.label.name, 'blocked/') runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Generate GitHub App token uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1 diff --git a/.github/workflows/issue-opened.yml b/.github/workflows/issue-opened.yml index 05fb8a3d2a106..ae6800d09ace9 100644 --- a/.github/workflows/issue-opened.yml +++ b/.github/workflows/issue-opened.yml @@ -11,6 +11,7 @@ jobs: add-to-issue-triage: if: ${{ contains(github.event.issue.labels.*.name, 'bug :beetle:') }} runs-on: ubuntu-latest + permissions: {} steps: - name: Generate GitHub App token uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1 @@ -28,6 +29,7 @@ jobs: set-labels: if: ${{ contains(github.event.issue.labels.*.name, 'bug :beetle:') }} runs-on: ubuntu-latest + permissions: {} steps: - name: Generate GitHub App token uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1 diff --git a/.github/workflows/issue-transferred.yml b/.github/workflows/issue-transferred.yml index 2e5543ae9ec5a..29a9c846a963d 100644 --- a/.github/workflows/issue-transferred.yml +++ b/.github/workflows/issue-transferred.yml @@ -10,6 +10,7 @@ jobs: issue-transferred: name: Issue Transferred runs-on: ubuntu-latest + permissions: {} if: ${{ !github.event.changes.new_repository.private }} steps: - name: Generate GitHub App token diff --git a/.github/workflows/issue-unlabeled.yml b/.github/workflows/issue-unlabeled.yml index a7080a896713d..04067970525fe 100644 --- a/.github/workflows/issue-unlabeled.yml +++ b/.github/workflows/issue-unlabeled.yml @@ -4,14 +4,15 @@ on: issues: types: [unlabeled] -permissions: - contents: read +permissions: {} jobs: issue-unlabeled-blocked: name: All blocked/* labels removed if: startsWith(github.event.label.name, 'blocked/') && github.event.issue.state == 'open' runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Check for any blocked labels id: check-for-blocked-labels diff --git a/.github/workflows/linux-publish.yml b/.github/workflows/linux-publish.yml index 93ed359ab3dba..a2dfaa9ee99e2 100644 --- a/.github/workflows/linux-publish.yml +++ b/.github/workflows/linux-publish.yml @@ -17,9 +17,13 @@ on: type: boolean default: false +permissions: {} + jobs: checkout-linux: runs-on: electron-arc-centralus-linux-amd64-32core + permissions: + contents: read container: image: ghcr.io/electron/build:${{ inputs.build-image-sha }} options: --user root @@ -40,6 +44,8 @@ jobs: publish-x64: uses: ./.github/workflows/pipeline-segment-electron-build.yml + permissions: + contents: read needs: checkout-linux with: environment: production-release @@ -55,6 +61,8 @@ jobs: publish-arm: uses: ./.github/workflows/pipeline-segment-electron-build.yml + permissions: + contents: read needs: checkout-linux with: environment: production-release @@ -70,6 +78,8 @@ jobs: publish-arm64: uses: ./.github/workflows/pipeline-segment-electron-build.yml + permissions: + contents: read needs: checkout-linux with: environment: production-release diff --git a/.github/workflows/macos-publish.yml b/.github/workflows/macos-publish.yml index 2464edc859241..0a068d98482b9 100644 --- a/.github/workflows/macos-publish.yml +++ b/.github/workflows/macos-publish.yml @@ -18,9 +18,13 @@ on: type: boolean default: false +permissions: {} + jobs: checkout-macos: runs-on: electron-arc-centralus-linux-amd64-32core + permissions: + contents: read container: image: ghcr.io/electron/build:${{ inputs.build-image-sha }} options: --user root @@ -44,6 +48,8 @@ jobs: publish-x64-darwin: uses: ./.github/workflows/pipeline-segment-electron-build.yml + permissions: + contents: read needs: checkout-macos with: environment: production-release @@ -59,6 +65,8 @@ jobs: publish-x64-mas: uses: ./.github/workflows/pipeline-segment-electron-build.yml + permissions: + contents: read needs: checkout-macos with: environment: production-release @@ -74,6 +82,8 @@ jobs: publish-arm64-darwin: uses: ./.github/workflows/pipeline-segment-electron-build.yml + permissions: + contents: read needs: checkout-macos with: environment: production-release @@ -89,6 +99,8 @@ jobs: publish-arm64-mas: uses: ./.github/workflows/pipeline-segment-electron-build.yml + permissions: + contents: read needs: checkout-macos with: environment: production-release diff --git a/.github/workflows/pipeline-electron-build-and-test-and-nan.yml b/.github/workflows/pipeline-electron-build-and-test-and-nan.yml index f4a7ec5243566..8ba78ac23fb3b 100644 --- a/.github/workflows/pipeline-electron-build-and-test-and-nan.yml +++ b/.github/workflows/pipeline-electron-build-and-test-and-nan.yml @@ -55,6 +55,8 @@ on: type: boolean default: false +permissions: {} + concurrency: group: electron-build-and-test-and-nan-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }} cancel-in-progress: ${{ github.ref_protected != true }} @@ -62,6 +64,8 @@ concurrency: jobs: build: uses: ./.github/workflows/pipeline-segment-electron-build.yml + permissions: + contents: read with: build-runs-on: ${{ inputs.build-runs-on }} build-container: ${{ inputs.build-container }} @@ -74,6 +78,10 @@ jobs: secrets: inherit test: uses: ./.github/workflows/pipeline-segment-electron-test.yml + permissions: + contents: read + issues: read + pull-requests: read needs: build with: target-arch: ${{ inputs.target-arch }} @@ -83,6 +91,8 @@ jobs: secrets: inherit nn-test: uses: ./.github/workflows/pipeline-segment-node-nan-test.yml + permissions: + contents: read needs: build with: target-arch: ${{ inputs.target-arch }} diff --git a/.github/workflows/pipeline-electron-build-and-test.yml b/.github/workflows/pipeline-electron-build-and-test.yml index ee043fb31795f..258bd969d767a 100644 --- a/.github/workflows/pipeline-electron-build-and-test.yml +++ b/.github/workflows/pipeline-electron-build-and-test.yml @@ -64,14 +64,13 @@ concurrency: group: electron-build-and-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }} cancel-in-progress: ${{ github.ref_protected != true }} -permissions: - contents: read - issues: read - pull-requests: read +permissions: {} jobs: build: uses: ./.github/workflows/pipeline-segment-electron-build.yml + permissions: + contents: read with: build-runs-on: ${{ inputs.build-runs-on }} build-container: ${{ inputs.build-container }} @@ -86,6 +85,10 @@ jobs: secrets: inherit test: uses: ./.github/workflows/pipeline-segment-electron-test.yml + permissions: + contents: read + issues: read + pull-requests: read needs: build with: target-arch: ${{ inputs.target-arch }} diff --git a/.github/workflows/pipeline-electron-docs-only.yml b/.github/workflows/pipeline-electron-docs-only.yml index 3cac1f4f0650d..548950a63eea4 100644 --- a/.github/workflows/pipeline-electron-docs-only.yml +++ b/.github/workflows/pipeline-electron-docs-only.yml @@ -8,6 +8,8 @@ on: description: 'Container to run the docs-only ts compile in' type: string +permissions: {} + concurrency: group: electron-docs-only-${{ github.ref }} cancel-in-progress: true @@ -19,6 +21,8 @@ jobs: docs-only: name: Docs Only Compile runs-on: electron-arc-centralus-linux-amd64-4core + permissions: + contents: read timeout-minutes: 20 container: ${{ fromJSON(inputs.container) }} steps: diff --git a/.github/workflows/pipeline-electron-lint.yml b/.github/workflows/pipeline-electron-lint.yml index 772e80c8f0cb4..e8d570da0737d 100644 --- a/.github/workflows/pipeline-electron-lint.yml +++ b/.github/workflows/pipeline-electron-lint.yml @@ -8,6 +8,8 @@ on: description: 'Container to run lint in' type: string +permissions: {} + concurrency: group: electron-lint-${{ github.ref_protected == true && github.run_id || github.ref }} cancel-in-progress: ${{ github.ref_protected != true }} @@ -19,6 +21,8 @@ jobs: lint: name: Lint runs-on: electron-arc-centralus-linux-amd64-4core + permissions: + contents: read timeout-minutes: 20 container: ${{ fromJSON(inputs.container) }} steps: diff --git a/.github/workflows/pipeline-segment-electron-build.yml b/.github/workflows/pipeline-segment-electron-build.yml index 7a8d44bcf5b50..e48e24892e979 100644 --- a/.github/workflows/pipeline-segment-electron-build.yml +++ b/.github/workflows/pipeline-segment-electron-build.yml @@ -59,6 +59,8 @@ on: type: boolean default: false +permissions: {} + concurrency: group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.target-variant }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }} cancel-in-progress: ${{ github.ref_protected != true }} @@ -81,6 +83,8 @@ jobs: run: shell: bash runs-on: ${{ inputs.build-runs-on }} + permissions: + contents: read container: ${{ fromJSON(inputs.build-container) }} environment: ${{ inputs.environment }} env: diff --git a/.github/workflows/pipeline-segment-electron-gn-check.yml b/.github/workflows/pipeline-segment-electron-gn-check.yml index 329d4241a6b84..cb78b735ec24d 100644 --- a/.github/workflows/pipeline-segment-electron-gn-check.yml +++ b/.github/workflows/pipeline-segment-electron-gn-check.yml @@ -26,6 +26,8 @@ on: type: string default: testing +permissions: {} + concurrency: group: electron-gn-check-${{ inputs.target-platform }}-${{ github.ref }} cancel-in-progress: true @@ -41,6 +43,8 @@ jobs: run: shell: bash runs-on: ${{ inputs.check-runs-on }} + permissions: + contents: read container: ${{ fromJSON(inputs.check-container) }} steps: - name: Checkout Electron diff --git a/.github/workflows/pipeline-segment-electron-test.yml b/.github/workflows/pipeline-segment-electron-test.yml index b2ecb969a9329..3b26f807291c5 100644 --- a/.github/workflows/pipeline-segment-electron-test.yml +++ b/.github/workflows/pipeline-segment-electron-test.yml @@ -35,10 +35,7 @@ concurrency: group: electron-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref_protected == true && github.run_id || github.ref }} cancel-in-progress: ${{ github.ref_protected != true }} -permissions: - contents: read - issues: read - pull-requests: read +permissions: {} env: CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }} @@ -53,6 +50,10 @@ jobs: run: shell: bash runs-on: ${{ inputs.test-runs-on }} + permissions: + contents: read + issues: read + pull-requests: read container: ${{ fromJSON(inputs.test-container) }} strategy: fail-fast: false diff --git a/.github/workflows/pipeline-segment-node-nan-test.yml b/.github/workflows/pipeline-segment-node-nan-test.yml index 3d6346c13cb64..a79cb452c7396 100644 --- a/.github/workflows/pipeline-segment-node-nan-test.yml +++ b/.github/workflows/pipeline-segment-node-nan-test.yml @@ -26,6 +26,8 @@ on: type: string default: testing +permissions: {} + concurrency: group: electron-node-nan-test-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ github.ref_protected == true && github.run_id || github.ref }} cancel-in-progress: ${{ github.ref_protected != true }} @@ -39,6 +41,8 @@ jobs: node-tests: name: Run Node.js Tests runs-on: electron-arc-centralus-linux-amd64-8core + permissions: + contents: read timeout-minutes: 30 env: TARGET_ARCH: ${{ inputs.target-arch }} @@ -93,6 +97,8 @@ jobs: nan-tests: name: Run Nan Tests runs-on: electron-arc-centralus-linux-amd64-4core + permissions: + contents: read timeout-minutes: 30 env: TARGET_ARCH: ${{ inputs.target-arch }} diff --git a/.github/workflows/pull-request-labeled.yml b/.github/workflows/pull-request-labeled.yml index 7cb86e3010e5d..129280ba2364f 100644 --- a/.github/workflows/pull-request-labeled.yml +++ b/.github/workflows/pull-request-labeled.yml @@ -11,6 +11,7 @@ jobs: name: backport/requested label added if: github.event.label.name == 'backport/requested 🗳' runs-on: ubuntu-latest + permissions: {} steps: - name: Trigger Slack workflow uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1 @@ -28,6 +29,7 @@ jobs: name: deprecation-review/complete label added if: github.event.label.name == 'deprecation-review/complete ✅' runs-on: ubuntu-latest + permissions: {} steps: - name: Generate GitHub App token uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1 diff --git a/.github/workflows/semantic.yml b/.github/workflows/semantic.yml index 56e07e2f0aa97..92abda9930c34 100644 --- a/.github/workflows/semantic.yml +++ b/.github/workflows/semantic.yml @@ -7,8 +7,7 @@ on: - edited - synchronize -permissions: - contents: read +permissions: {} jobs: main: diff --git a/.github/workflows/stable-prep-items.yml b/.github/workflows/stable-prep-items.yml index 576ddbc16c8b9..963a69ad17a12 100644 --- a/.github/workflows/stable-prep-items.yml +++ b/.github/workflows/stable-prep-items.yml @@ -11,6 +11,7 @@ jobs: check-stable-prep-items: name: Check Stable Prep Items runs-on: ubuntu-latest + permissions: {} steps: - name: Generate GitHub App token uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 28e1ba9538cb9..498489c0db33a 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -10,6 +10,7 @@ permissions: {} jobs: stale: runs-on: ubuntu-latest + permissions: {} steps: - name: Generate GitHub App token uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1 @@ -31,6 +32,7 @@ jobs: only-pr-labels: not-a-real-label pending-repro: runs-on: ubuntu-latest + permissions: {} if: ${{ always() }} needs: stale steps: diff --git a/.github/workflows/windows-publish.yml b/.github/workflows/windows-publish.yml index 33091b383ffc4..5fe757a4b6b28 100644 --- a/.github/workflows/windows-publish.yml +++ b/.github/workflows/windows-publish.yml @@ -18,9 +18,13 @@ on: type: boolean default: false +permissions: {} + jobs: checkout-windows: runs-on: electron-arc-centralus-linux-amd64-32core + permissions: + contents: read container: image: ghcr.io/electron/build:${{ inputs.build-image-sha }} options: --user root --device /dev/fuse --cap-add SYS_ADMIN @@ -48,6 +52,8 @@ jobs: publish-x64-win: uses: ./.github/workflows/pipeline-segment-electron-build.yml + permissions: + contents: read needs: checkout-windows with: environment: production-release @@ -62,6 +68,8 @@ jobs: publish-arm64-win: uses: ./.github/workflows/pipeline-segment-electron-build.yml + permissions: + contents: read needs: checkout-windows with: environment: production-release @@ -76,6 +84,8 @@ jobs: publish-x86-win: uses: ./.github/workflows/pipeline-segment-electron-build.yml + permissions: + contents: read needs: checkout-windows with: environment: production-release From 78770bb22d3e1edc1092d33e93e52d16a18b6505 Mon Sep 17 00:00:00 2001 From: Keeley Hammond Date: Fri, 14 Nov 2025 15:23:15 -0800 Subject: [PATCH 260/268] fix: revert enabling WASM trap handlers in all Node.js processes (#48973) Revert "fix: enable wasm trap handlers in all Node.js processes (#48788)" This reverts commit ca0b46b4130a8b48ab0b402ea16efe1ce655044f. --- shell/browser/electron_browser_main_parts.cc | 5 -- shell/common/v8_util.cc | 55 -------------------- shell/common/v8_util.h | 2 - shell/renderer/electron_renderer_client.cc | 51 ++++++++++++++++-- shell/services/node/node_service.cc | 7 --- 5 files changed, 47 insertions(+), 73 deletions(-) diff --git a/shell/browser/electron_browser_main_parts.cc b/shell/browser/electron_browser_main_parts.cc index 2b0c122ebdb44..139237d3a0413 100644 --- a/shell/browser/electron_browser_main_parts.cc +++ b/shell/browser/electron_browser_main_parts.cc @@ -62,7 +62,6 @@ #include "shell/common/logging.h" #include "shell/common/node_bindings.h" #include "shell/common/node_includes.h" -#include "shell/common/v8_util.h" #include "ui/base/idle/idle.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/ui_base_switches.h" @@ -275,10 +274,6 @@ void ElectronBrowserMainParts::PostEarlyInitialization() { // Initialize field trials. InitializeFieldTrials(); - if (base::FeatureList::IsEnabled(features::kWebAssemblyTrapHandler)) { - electron::SetUpWebAssemblyTrapHandler(); - } - // Reinitialize logging now that the app has had a chance to set the app name // and/or user data directory. logging::InitElectronLogging(*base::CommandLine::ForCurrentProcess(), diff --git a/shell/common/v8_util.cc b/shell/common/v8_util.cc index 9574b4085aef0..dc01845b39803 100644 --- a/shell/common/v8_util.cc +++ b/shell/common/v8_util.cc @@ -8,7 +8,6 @@ #include #include -#include "base/base_switches.h" #include "base/memory/raw_ptr.h" #include "gin/converter.h" #include "shell/common/api/electron_api_native_image.h" @@ -18,15 +17,6 @@ #include "ui/gfx/image/image_skia.h" #include "v8/include/v8.h" -#if BUILDFLAG(IS_LINUX) && (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM64)) -#define ENABLE_WEB_ASSEMBLY_TRAP_HANDLER_LINUX -#include "base/command_line.h" -#include "base/debug/stack_trace.h" -#include "components/crash/core/app/crashpad.h" // nogncheck -#include "content/public/common/content_switches.h" -#include "v8/include/v8-wasm-trap-handler-posix.h" -#endif - namespace electron { namespace { @@ -250,51 +240,6 @@ v8::Local DeserializeV8Value(v8::Isolate* isolate, return V8Deserializer(isolate, data).Deserialize(); } -void SetUpWebAssemblyTrapHandler() { -#if BUILDFLAG(IS_WIN) - // On Windows we use the default trap handler provided by V8. - v8::V8::EnableWebAssemblyTrapHandler(true); -#elif BUILDFLAG(IS_MAC) - // On macOS, Crashpad uses exception ports to handle signals in a - // different process. As we cannot just pass a callback to this other - // process, we ask V8 to install its own signal handler to deal with - // WebAssembly traps. - v8::V8::EnableWebAssemblyTrapHandler(true); -#elif defined(ENABLE_WEB_ASSEMBLY_TRAP_HANDLER_LINUX) - const bool crash_reporter_enabled = - crash_reporter::GetHandlerSocket(nullptr, nullptr); - - if (crash_reporter_enabled) { - // If either --enable-crash-reporter or --enable-crash-reporter-for-testing - // is enabled it should take care of signal handling for us, use the default - // implementation which doesn't register an additional handler. - v8::V8::EnableWebAssemblyTrapHandler(false); - return; - } - - const bool use_v8_default_handler = - base::CommandLine::ForCurrentProcess()->HasSwitch( - ::switches::kDisableInProcessStackTraces); - - if (use_v8_default_handler) { - // There is no signal handler yet, but it's okay if v8 registers one. - v8::V8::EnableWebAssemblyTrapHandler(/*use_v8_signal_handler=*/true); - return; - } - - if (base::debug::SetStackDumpFirstChanceCallback( - v8::TryHandleWebAssemblyTrapPosix)) { - // Crashpad and Breakpad are disabled, but the in-process stack dump - // handlers are enabled, so set the callback on the stack dump handlers. - v8::V8::EnableWebAssemblyTrapHandler(/*use_v8_signal_handler=*/false); - return; - } - - // As the registration of the callback failed, we don't enable trap - // handlers. -#endif -} - namespace util { /** diff --git a/shell/common/v8_util.h b/shell/common/v8_util.h index eca443eabfc1b..59ba4c633a346 100644 --- a/shell/common/v8_util.h +++ b/shell/common/v8_util.h @@ -30,8 +30,6 @@ v8::Local DeserializeV8Value(v8::Isolate* isolate, v8::Local DeserializeV8Value(v8::Isolate* isolate, base::span data); -void SetUpWebAssemblyTrapHandler(); - namespace util { [[nodiscard]] base::span as_byte_span( diff --git a/shell/renderer/electron_renderer_client.cc b/shell/renderer/electron_renderer_client.cc index 9a0f507951bbb..57010df2c06aa 100644 --- a/shell/renderer/electron_renderer_client.cc +++ b/shell/renderer/electron_renderer_client.cc @@ -6,6 +6,7 @@ #include +#include "base/base_switches.h" #include "base/command_line.h" #include "base/containers/contains.h" #include "content/public/renderer/render_frame.h" @@ -17,7 +18,6 @@ #include "shell/common/node_includes.h" #include "shell/common/node_util.h" #include "shell/common/options_switches.h" -#include "shell/common/v8_util.h" #include "shell/renderer/electron_render_frame_observer.h" #include "shell/renderer/web_worker_observer.h" #include "third_party/blink/public/common/web_preferences/web_preferences.h" @@ -26,6 +26,13 @@ #include "third_party/blink/renderer/core/execution_context/execution_context.h" // nogncheck #include "third_party/blink/renderer/core/frame/web_local_frame_impl.h" // nogncheck +#if BUILDFLAG(IS_LINUX) && (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM64)) +#define ENABLE_WEB_ASSEMBLY_TRAP_HANDLER_LINUX +#include "components/crash/core/app/crashpad.h" // nogncheck +#include "content/public/common/content_switches.h" +#include "v8/include/v8-wasm-trap-handler-posix.h" +#endif + namespace electron { ElectronRendererClient::ElectronRendererClient() @@ -240,9 +247,45 @@ void ElectronRendererClient::WillDestroyWorkerContextOnWorkerThread( } void ElectronRendererClient::SetUpWebAssemblyTrapHandler() { - // content/renderer layer already takes care of the feature flag detection - // so no need to check for features::kWebAssemblyTrapHandler here. - electron::SetUpWebAssemblyTrapHandler(); +// See CL:5372409 - copied from ShellContentRendererClient. +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) + // Mac and Windows use the default implementation (where the default v8 trap + // handler gets set up). + ContentRendererClient::SetUpWebAssemblyTrapHandler(); + return; +#elif defined(ENABLE_WEB_ASSEMBLY_TRAP_HANDLER_LINUX) + const bool crash_reporter_enabled = + crash_reporter::GetHandlerSocket(nullptr, nullptr); + + if (crash_reporter_enabled) { + // If either --enable-crash-reporter or --enable-crash-reporter-for-testing + // is enabled it should take care of signal handling for us, use the default + // implementation which doesn't register an additional handler. + ContentRendererClient::SetUpWebAssemblyTrapHandler(); + return; + } + + const bool use_v8_default_handler = + base::CommandLine::ForCurrentProcess()->HasSwitch( + ::switches::kDisableInProcessStackTraces); + + if (use_v8_default_handler) { + // There is no signal handler yet, but it's okay if v8 registers one. + v8::V8::EnableWebAssemblyTrapHandler(/*use_v8_signal_handler=*/true); + return; + } + + if (base::debug::SetStackDumpFirstChanceCallback( + v8::TryHandleWebAssemblyTrapPosix)) { + // Crashpad and Breakpad are disabled, but the in-process stack dump + // handlers are enabled, so set the callback on the stack dump handlers. + v8::V8::EnableWebAssemblyTrapHandler(/*use_v8_signal_handler=*/false); + return; + } + + // As the registration of the callback failed, we don't enable trap + // handlers. +#endif // defined(ENABLE_WEB_ASSEMBLY_TRAP_HANDLER_LINUX) } node::Environment* ElectronRendererClient::GetEnvironment( diff --git a/shell/services/node/node_service.cc b/shell/services/node/node_service.cc index d1cd785b943d1..ffb7f3c007b96 100644 --- a/shell/services/node/node_service.cc +++ b/shell/services/node/node_service.cc @@ -11,7 +11,6 @@ #include "base/no_destructor.h" #include "base/process/process.h" #include "base/strings/utf_string_conversions.h" -#include "content/public/common/content_features.h" #include "electron/mas.h" #include "net/base/network_change_notifier.h" #include "services/network/public/cpp/wrapper_shared_url_loader_factory.h" @@ -23,7 +22,6 @@ #include "shell/common/gin_helper/dictionary.h" #include "shell/common/node_bindings.h" #include "shell/common/node_includes.h" -#include "shell/common/v8_util.h" #include "shell/services/node/parent_port.h" #if !IS_MAS_BUILD() @@ -132,11 +130,6 @@ void NodeService::Initialize( v8::Isolate* const isolate = js_env_->isolate(); v8::HandleScope scope{isolate}; - // Initialize after setting up the V8 isolate. - if (base::FeatureList::IsEnabled(features::kWebAssemblyTrapHandler)) { - electron::SetUpWebAssemblyTrapHandler(); - } - node_bindings_->Initialize(isolate, isolate->GetCurrentContext()); network_change_notifier_ = net::NetworkChangeNotifier::CreateIfNeeded( From 6e82e7559060968bbf9f96154738ceced8ee8fe6 Mon Sep 17 00:00:00 2001 From: Keeley Hammond Date: Sat, 15 Nov 2025 02:32:08 -0800 Subject: [PATCH 261/268] build: add header for SetStackDumpFirstChanceCallback in renderer client (#48978) --- shell/renderer/electron_renderer_client.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/shell/renderer/electron_renderer_client.cc b/shell/renderer/electron_renderer_client.cc index 57010df2c06aa..74706ce9f5d23 100644 --- a/shell/renderer/electron_renderer_client.cc +++ b/shell/renderer/electron_renderer_client.cc @@ -9,6 +9,7 @@ #include "base/base_switches.h" #include "base/command_line.h" #include "base/containers/contains.h" +#include "base/debug/stack_trace.h" #include "content/public/renderer/render_frame.h" #include "net/http/http_request_headers.h" #include "shell/common/api/electron_bindings.h" From 2735f267cf317ef0671c8565b35250783cc0bc3f Mon Sep 17 00:00:00 2001 From: Nilay Arya Date: Wed, 19 Nov 2025 00:17:09 -0500 Subject: [PATCH 262/268] refactor: rename BaseWindow.clearWindowState to clearPersistedState --- docs/api/base-window.md | 2 +- lib/browser/api/browser-window.ts | 2 +- shell/browser/api/electron_api_base_window.cc | 9 +++--- shell/browser/api/electron_api_base_window.h | 2 +- shell/browser/native_window.cc | 4 +-- spec/api-browser-window-spec.ts | 28 +++++++++---------- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/docs/api/base-window.md b/docs/api/base-window.md index a78070ff723eb..2ed79c0c6f6db 100644 --- a/docs/api/base-window.md +++ b/docs/api/base-window.md @@ -396,7 +396,7 @@ Returns `BaseWindow | null` - The window that is focused in this application, ot Returns `BaseWindow | null` - The window with the given `id`. -#### `BaseWindow.clearWindowState(name)` +#### `BaseWindow.clearPersistedState(name)` * `name` string - The window `name` to clear state for (see [BaseWindowConstructorOptions](structures/base-window-options.md)). diff --git a/lib/browser/api/browser-window.ts b/lib/browser/api/browser-window.ts index d1565164015ba..842a36fb75395 100644 --- a/lib/browser/api/browser-window.ts +++ b/lib/browser/api/browser-window.ts @@ -111,7 +111,7 @@ BrowserWindow.getAllWindows = () => { return BaseWindow.getAllWindows().filter(isBrowserWindow) as any[] as BWT[]; }; -BrowserWindow.clearWindowState = BaseWindow.clearWindowState; +BrowserWindow.clearPersistedState = BaseWindow.clearPersistedState; BrowserWindow.getFocusedWindow = () => { for (const window of BrowserWindow.getAllWindows()) { diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index 26382eee212b0..7c5f84fdfa3d7 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -1173,9 +1173,9 @@ void BaseWindow::RemoveFromParentChildWindows() { } // static -void BaseWindow::ClearWindowState(const std::string& window_name) { +void BaseWindow::ClearPersistedState(const std::string& window_name) { if (window_name.empty()) { - LOG(WARNING) << "Cannot clear window state: window name is empty"; + LOG(WARNING) << "Cannot clear persisted window state: window name is empty"; return; } @@ -1201,7 +1201,7 @@ gin_helper::WrappableBase* BaseWindow::New(gin::Arguments* const args) { std::string error_message; if (!IsWindowNameValid(options, &error_message)) { // Window name is already in use throw an error and do not create the window - args->ThrowError(error_message); + args->ThrowTypeError(error_message); return nullptr; } @@ -1421,7 +1421,8 @@ void Initialize(v8::Local exports, .ToLocalChecked()); constructor.SetMethod("fromId", &BaseWindow::FromWeakMapID); constructor.SetMethod("getAllWindows", &BaseWindow::GetAll); - constructor.SetMethod("clearWindowState", &BaseWindow::ClearWindowState); + constructor.SetMethod("clearPersistedState", + &BaseWindow::ClearPersistedState); gin_helper::Dictionary dict(isolate, exports); dict.Set("BaseWindow", constructor); diff --git a/shell/browser/api/electron_api_base_window.h b/shell/browser/api/electron_api_base_window.h index 74bb59d94a0be..5a744da4de57b 100644 --- a/shell/browser/api/electron_api_base_window.h +++ b/shell/browser/api/electron_api_base_window.h @@ -47,7 +47,7 @@ class BaseWindow : public gin_helper::TrackableObject, // Clears window state from the Local State JSON file in // app.getPath('userData') via PrefService. - static void ClearWindowState(const std::string& window_name); + static void ClearPersistedState(const std::string& window_name); static bool IsWindowNameValid(const gin_helper::Dictionary& options, std::string* error_message); diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 1b6161f20adce..be8e6f07dd062 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -876,7 +876,7 @@ void NativeWindow::SaveWindowState() { return; } - const display::Screen* screen = display::Screen::GetScreen(); + const display::Screen* screen = display::Screen::Get(); DCHECK(screen); // GetDisplayMatching returns a fake display with 1920x1080 resolution at // (0,0) when no physical displays are attached. @@ -979,7 +979,7 @@ void NativeWindow::RestoreWindowState(const gin_helper::Dictionary& options) { gfx::Rect(*saved_left, *saved_top, *saved_right - *saved_left, *saved_bottom - *saved_top); - display::Screen* screen = display::Screen::GetScreen(); + display::Screen* screen = display::Screen::Get(); DCHECK(screen); // Set the primary display as the target display for restoration. diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index 94e0973b7bfbf..c805b5422af9f 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -7371,7 +7371,7 @@ describe('BrowserWindow module', () => { beforeEach(async () => { await setTimeout(2000); - BrowserWindow.clearWindowState(windowName); + BrowserWindow.clearPersistedState(windowName); w = new BrowserWindow({ show: false, width: 400, @@ -7497,7 +7497,7 @@ describe('BrowserWindow module', () => { // Timeout here plays nice with CI await setTimeout(2000); // Let's start with a clean slate everytime - BrowserWindow.clearWindowState(windowName); + BrowserWindow.clearPersistedState(windowName); }); afterEach(closeAllWindows); @@ -7517,7 +7517,7 @@ describe('BrowserWindow module', () => { const stateBefore = getWindowStateFromDisk(windowName, preferencesPath); expect(stateBefore).to.not.be.null('window state with window name "test-window-clear" should exist but does not'); - BrowserWindow.clearWindowState(windowName); + BrowserWindow.clearPersistedState(windowName); await waitForPrefsUpdate(getPrefsModTime(preferencesPath), preferencesPath); @@ -7550,7 +7550,7 @@ describe('BrowserWindow module', () => { w1.destroy(); - BrowserWindow.clearWindowState(windowName); + BrowserWindow.clearPersistedState(windowName); const w2 = new BrowserWindow({ height: 200, @@ -7569,7 +7569,7 @@ describe('BrowserWindow module', () => { it('should not throw when clearing non-existent window state', () => { expect(() => { - BrowserWindow.clearWindowState('non-existent-window'); + BrowserWindow.clearPersistedState('non-existent-window'); }).to.not.throw(); }); @@ -7597,7 +7597,7 @@ describe('BrowserWindow module', () => { expect(getWindowStateFromDisk(windowName1, preferencesPath)).to.not.be.null('window state with window name "test-window-1" should exist but does not'); expect(getWindowStateFromDisk(windowName2, preferencesPath)).to.not.be.null('window state with window name "test-window-2" should exist but does not'); - BrowserWindow.clearWindowState(windowName1); + BrowserWindow.clearPersistedState(windowName1); await waitForPrefsUpdate(getPrefsModTime(preferencesPath), preferencesPath); @@ -7615,7 +7615,7 @@ describe('BrowserWindow module', () => { // Timeout here plays nice with CI await setTimeout(2000); // Let's start with a clean slate everytime - BrowserWindow.clearWindowState(windowName); + BrowserWindow.clearPersistedState(windowName); }); afterEach(closeAllWindows); @@ -7646,7 +7646,7 @@ describe('BrowserWindow module', () => { it('should use default window options when no saved state exists', async () => { const defaultBounds = { width: 500, height: 400, x: 200, y: 250 }; - // BrowserWindow.clearWindowState(windowName) is called in beforeEach + // BrowserWindow.clearPersistedState(windowName) is called in beforeEach const w = new BrowserWindow({ name: windowName, windowStatePersistence: true, @@ -7835,8 +7835,8 @@ describe('BrowserWindow module', () => { const window2Name = 'test-window-2'; // Clear any existing state - BrowserWindow.clearWindowState(window1Name); - BrowserWindow.clearWindowState(window2Name); + BrowserWindow.clearPersistedState(window1Name); + BrowserWindow.clearPersistedState(window2Name); const workArea = screen.getPrimaryDisplay().workArea; @@ -8244,9 +8244,9 @@ describe('BrowserWindow module', () => { }; // Clear window state for all three windows from previous tests - BrowserWindow.clearWindowState(window1Name); - BrowserWindow.clearWindowState(window2Name); - BrowserWindow.clearWindowState(window3Name); + BrowserWindow.clearPersistedState(window1Name); + BrowserWindow.clearPersistedState(window2Name); + BrowserWindow.clearPersistedState(window3Name); // Create and save state for all three windows const w1 = new BrowserWindow({ @@ -8618,7 +8618,7 @@ describe('BrowserWindow module', () => { it('should not emit restored-window-state when no window state exists on disk', async () => { // Clear any existing state to ensure no state exists - BrowserWindow.clearWindowState(windowName); + BrowserWindow.clearPersistedState(windowName); let eventEmitted = false; From 1b98058ac6b64cbf01f3b762ab3619c31fc3de99 Mon Sep 17 00:00:00 2001 From: Nilay Arya Date: Wed, 19 Nov 2025 00:30:41 -0500 Subject: [PATCH 263/268] refactor: rename event restored-window-state to restored-persisted-state --- docs/api/base-window.md | 4 ++-- shell/browser/api/electron_api_base_window.cc | 2 +- spec/api-browser-window-spec.ts | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/api/base-window.md b/docs/api/base-window.md index 2ed79c0c6f6db..9bcbfdc48a03d 100644 --- a/docs/api/base-window.md +++ b/docs/api/base-window.md @@ -369,9 +369,9 @@ Calling `event.preventDefault()` will prevent the menu from being displayed. To convert `point` to DIP, use [`screen.screenToDipPoint(point)`](./screen.md#screenscreentodippointpoint-windows-linux). -#### Event: 'restored-window-state' +#### Event: 'restored-persisted-state' -Emitted after the window state has been restored. +Emitted after the persisted window state has been restored. Window state includes the window bounds (x, y, height, width) and display mode (maximized, fullscreen, kiosk). diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index 7c5f84fdfa3d7..9441ecffc2671 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -356,7 +356,7 @@ void BaseWindow::OnSystemContextMenu(int x, int y, bool* prevent_default) { } void BaseWindow::OnWindowStateRestored() { - EmitEventSoon("restored-window-state"); + EmitEventSoon("restored-persisted-state"); } #if BUILDFLAG(IS_WIN) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index c805b5422af9f..b08e7fcce2bc0 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -8575,7 +8575,7 @@ describe('BrowserWindow module', () => { const preferencesPath = path.join(app.getPath('userData'), 'Local State'); const windowName = 'test-restore-window'; - it('should emit restored-window-state when windowStatePersistence is enabled and state exists', async () => { + it('should emit restored-persisted-state when windowStatePersistence is enabled and state exists', async () => { await createAndSaveWindowState(preferencesPath, windowName, { width: 300, height: 200 }); const restoredPromise = new Promise((resolve) => { @@ -8585,7 +8585,7 @@ describe('BrowserWindow module', () => { show: false }); - w.once('restored-window-state', () => { + w.once('restored-persisted-state', () => { resolve(); w.destroy(); }); @@ -8594,7 +8594,7 @@ describe('BrowserWindow module', () => { await restoredPromise; }); - it('should not emit restored-window-state when windowStatePersistence is disabled', async () => { + it('should not emit restored-persisted-state when windowStatePersistence is disabled', async () => { await createAndSaveWindowState(preferencesPath, windowName, { width: 300, height: 200 }); let eventEmitted = false; @@ -8605,7 +8605,7 @@ describe('BrowserWindow module', () => { show: false }); - w.on('restored-window-state', () => { + w.on('restored-persisted-state', () => { eventEmitted = true; }); @@ -8616,7 +8616,7 @@ describe('BrowserWindow module', () => { w.destroy(); }); - it('should not emit restored-window-state when no window state exists on disk', async () => { + it('should not emit restored-persisted-state when no window state exists on disk', async () => { // Clear any existing state to ensure no state exists BrowserWindow.clearPersistedState(windowName); @@ -8628,7 +8628,7 @@ describe('BrowserWindow module', () => { show: false }); - w.on('restored-window-state', () => { + w.on('restored-persisted-state', () => { eventEmitted = true; }); From 6172df60dd7f77d0a2215e01fb735d04c19f1bf4 Mon Sep 17 00:00:00 2001 From: Nilay Arya Date: Thu, 20 Nov 2025 02:15:58 -0500 Subject: [PATCH 264/268] docs: better docs for virtual display addon --- docs/development/multi-monitor-testing.md | 45 ++++++++++++++++------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/docs/development/multi-monitor-testing.md b/docs/development/multi-monitor-testing.md index 7a8e62bc9732a..fa9626f3b0c05 100644 --- a/docs/development/multi-monitor-testing.md +++ b/docs/development/multi-monitor-testing.md @@ -27,31 +27,49 @@ const displayId = virtualDisplay.create({ **Returns:** `number` - Unique display ID used to identify the display. Returns `0` on failure to create display. -#### `virtualDisplay.destroy(displayId)` +> [!NOTE] +> It is recommended to call [`virtualDisplay.forceCleanup()`](#virtualdisplayforcecleanup) before every test to prevent display creation from failing in that test. macOS CoreGraphics maintains an internal display ID allocation pool that can become corrupted when virtual displays are created and destroyed rapidly during testing. Without proper cleanup, subsequent display creation may fail with inconsistent display IDs, resulting in test flakiness. -Removes the virtual display. +#### `virtualDisplay.forceCleanup()` + +Performs a complete cleanup of all virtual displays and resets the macOS CoreGraphics display system. ```js @ts-nocheck -const success = virtualDisplay.destroy(displayId) +beforeEach(() => { + virtualDisplay.forceCleanup() +}) ``` -**Returns:** `boolean` - Success status +#### `virtualDisplay.destroy(displayId)` + +Removes the virtual display. -#### `virtualDisplay.forceCleanup()` +```js @ts-nocheck +virtualDisplay.destroy(displayId) +``` -Performs a complete cleanup of all virtual displays and resets the macOS CoreGraphics display system. +> [!NOTE] +> Always destroy virtual displays after use to prevent corrupting the macOS CoreGraphics display pool and affecting subsequent tests. -It is recommended to call this before every test to prevent test failures. macOS CoreGraphics maintains an internal display ID allocation pool that can become corrupted when virtual displays are created and destroyed rapidly during testing. Without proper cleanup, subsequent display creation may fail with inconsistent display IDs, resulting in test flakiness. +## Recommended usage pattern ```js @ts-nocheck -// Recommended test pattern -beforeEach(() => { - virtualDisplay.forceCleanup() +describe('multi-monitor tests', () => { + const virtualDisplay = require('@electron-ci/virtual-display') + beforeEach(() => { + virtualDisplay.forceCleanup() + }) + + it('should handle multiple displays', () => { + const display1 = virtualDisplay.create({ width: 1920, height: 1080, x: 0, y: 0 }) + const display2 = virtualDisplay.create({ width: 2560, height: 1440, x: 1920, y: 0 }) + // Your test logic here + virtualDisplay.destroy(display1) + virtualDisplay.destroy(display2) + }) }) ``` -**Returns:** `boolean` - Success status - ## Display Constraints ### Size Limits @@ -77,8 +95,7 @@ const display2 = virtualDisplay.create({ x: 500, y: 0, width: 1920, height: 1080 // macOS automatically repositions display2 to x: 1920 to prevent overlap const actualBounds = screen.getAllDisplays().map(d => d.bounds) -// Result: [{ x: 0, y: 0, width: 1920, height: 1080 }, -// { x: 1920, y: 0, width: 1920, height: 1080 }] +// Result: [{ x: 0, y: 0, width: 1920, height: 1080 }, { x: 1920, y: 0, width: 1920, height: 1080 }] ``` **Gap:** From 533aaf2e981a188da9214f5857fdcb3570e8317c Mon Sep 17 00:00:00 2001 From: Nilay Arya Date: Thu, 20 Nov 2025 02:29:00 -0500 Subject: [PATCH 265/268] docs: better docs for virtual display addon --- docs/development/multi-monitor-testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/multi-monitor-testing.md b/docs/development/multi-monitor-testing.md index fa9626f3b0c05..900c8170d35df 100644 --- a/docs/development/multi-monitor-testing.md +++ b/docs/development/multi-monitor-testing.md @@ -1,6 +1,6 @@ # Multi-Monitor Testing -The `virtualDisplay` addon leverages macOS CoreGraphics APIs to create virtual displays, allowing you to write and run multi-monitor tests without the need for physical monitors. +The `virtualDisplay` addon leverages macOS CoreGraphics APIs to create virtual displays, allowing you to write and run multi-monitor tests without the need for physical monitors. Due to macOS CoreGraphics quirks, reading the entire guide once before writing tests is recommended. ## Methods From 905cf8b16a659b07ce3401a94de0779a87a75f70 Mon Sep 17 00:00:00 2001 From: Nilay Arya Date: Thu, 20 Nov 2025 02:29:49 -0500 Subject: [PATCH 266/268] fix: ensure only single display before multi monitor tests --- spec/api-browser-window-spec.ts | 33 +++++++------------ .../virtual-display/lib/virtual-display.js | 3 +- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index b08e7fcce2bc0..b3a1a45a27f38 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -8012,19 +8012,27 @@ describe('BrowserWindow module', () => { // FIXME(nilayarya): Figure out why these tests fail on macOS-x64 // virtualDisplay.create() is creating double displays on macOS-x64 - ifdescribe(process.platform === 'darwin' && process.arch === 'arm64')('multi-monitor tests', () => { + const testMultiMonitor = + process.platform === 'darwin' && + process.arch === 'arm64' && + screen.getAllDisplays().length === 1; + + ifdescribe(testMultiMonitor)('multi-monitor tests', () => { const virtualDisplay = require('@electron-ci/virtual-display'); const primaryDisplay = screen.getPrimaryDisplay(); - beforeEach(() => { + beforeEach(async () => { virtualDisplay.forceCleanup(); + let attempts = 0; + while (screen.getAllDisplays().length > 1 && attempts++ < 20) await setTimeout(1000); + const displayCount = screen.getAllDisplays().length; + // We expect only the primary display to be present + expect(displayCount).to.equal(1, `Display cleanup failed: ${displayCount} displays remain`); }); it('should restore window bounds correctly on a secondary display', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; - // We expect only the primary display to be present before the tests start - expect(screen.getAllDisplays().length).to.equal(1); // Create a new virtual target display to the right of the primary display const targetDisplayId = virtualDisplay.create({ @@ -8068,8 +8076,6 @@ describe('BrowserWindow module', () => { it('should restore window to a visible location when saved display no longer exists', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; - // We expect only the primary display to be present before the tests start - expect(screen.getAllDisplays().length).to.equal(1); // Create a new virtual target display to the right of the primary display const targetDisplayId = virtualDisplay.create({ @@ -8123,8 +8129,6 @@ describe('BrowserWindow module', () => { it('should fallback to nearest display when saved display no longer exists', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; - // We expect only the primary display to be present before the tests start - expect(screen.getAllDisplays().length).to.equal(1); // Create first virtual display to the right of primary const middleDisplayId = virtualDisplay.create({ @@ -8191,8 +8195,6 @@ describe('BrowserWindow module', () => { it('should restore multiple named windows independently across displays', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; - // We expect only the primary display to be present before the tests start - expect(screen.getAllDisplays().length).to.equal(1); // Create a first virtual display to the right of the primary display const targetDisplayId1 = virtualDisplay.create({ @@ -8306,8 +8308,6 @@ describe('BrowserWindow module', () => { it('should restore fullscreen state on correct display', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; - // We expect only the primary display to be present before the tests start - expect(screen.getAllDisplays().length).to.equal(1); // Create a new virtual target display to the right of the primary display const targetDisplayId = virtualDisplay.create({ @@ -8355,8 +8355,6 @@ describe('BrowserWindow module', () => { it('should restore maximized state on correct display', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; - // We expect only the primary display to be present before the tests start - expect(screen.getAllDisplays().length).to.equal(1); // Create a new virtual target display to the right of the primary display const targetDisplayId = virtualDisplay.create({ @@ -8410,8 +8408,6 @@ describe('BrowserWindow module', () => { it('should restore kiosk state on correct display', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; - // We expect only the primary display to be present before the tests start - expect(screen.getAllDisplays().length).to.equal(1); // Create a new virtual target display to the right of the primary display const targetDisplayId = virtualDisplay.create({ @@ -8459,8 +8455,6 @@ describe('BrowserWindow module', () => { it('should maintain same bounds when target display resolution increases', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; - // We expect only the primary display to be present before the tests start - expect(screen.getAllDisplays().length).to.equal(1); // Create initial virtual display const targetDisplayId = virtualDisplay.create({ @@ -8513,9 +8507,6 @@ describe('BrowserWindow module', () => { it('should reposition and resize window when target display resolution decreases', async () => { const targetDisplayX = primaryDisplay.bounds.x + primaryDisplay.bounds.width; const targetDisplayY = primaryDisplay.bounds.y; - // We expect only the primary display to be present before the tests start - expect(screen.getAllDisplays().length).to.equal(1); - // Create initial virtual display with high resolution const targetDisplayId = virtualDisplay.create({ width: 2560, diff --git a/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js b/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js index f43c420599df0..ffbc7f59cdc91 100644 --- a/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js +++ b/spec/fixtures/native-addon/virtual-display/lib/virtual-display.js @@ -2,5 +2,6 @@ module.exports = process.platform === 'darwin' ? require('../build/Release/virtual_display.node') : { create: () => { throw new Error('Virtual displays only supported on macOS'); }, - destroy: () => { throw new Error('Virtual displays only supported on macOS'); } + destroy: () => { throw new Error('Virtual displays only supported on macOS'); }, + forceCleanup: () => { throw new Error('Virtual displays only supported on macOS'); } }; From f572d1a041caa79500cf73cfd691f82bdb5c41d5 Mon Sep 17 00:00:00 2001 From: Nilay Arya Date: Mon, 24 Nov 2025 13:24:00 -0500 Subject: [PATCH 267/268] docs: tutorial for windowStatePersistence --- docs/README.md | 3 +- docs/tutorial/window-state-persistence.md | 102 ++++++++++++++++++++++ 2 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 docs/tutorial/window-state-persistence.md diff --git a/docs/README.md b/docs/README.md index 02d5d1331ca29..3af381dc56347 100644 --- a/docs/README.md +++ b/docs/README.md @@ -37,10 +37,11 @@ an issue: * [Represented File for macOS BrowserWindows](tutorial/represented-file.md) * [Native File Drag & Drop](tutorial/native-file-drag-drop.md) * [Navigation History](tutorial/navigation-history.md) + * [Window State Persistence](tutorial/window-state-persistence.md) * [Offscreen Rendering](tutorial/offscreen-rendering.md) * [Dark Mode](tutorial/dark-mode.md) * [Web embeds in Electron](tutorial/web-embeds.md) -* [Boilerplates and CLIs](tutorial/boilerplates-and-clis.md) + * [Boilerplates and CLIs](tutorial/boilerplates-and-clis.md) * [Boilerplate vs CLI](tutorial/boilerplates-and-clis.md#boilerplate-vs-cli) * [Electron Forge](tutorial/boilerplates-and-clis.md#electron-forge) * [electron-builder](tutorial/boilerplates-and-clis.md#electron-builder) diff --git a/docs/tutorial/window-state-persistence.md b/docs/tutorial/window-state-persistence.md new file mode 100644 index 0000000000000..492c84b2f0fb5 --- /dev/null +++ b/docs/tutorial/window-state-persistence.md @@ -0,0 +1,102 @@ +# Window State Persistence + +## Overview + +Window State Persistence allows your Electron application to automatically save and restore a window's position, size, and display modes (such as maximized or fullscreen states) across application restarts. + +This feature is particularly useful for applications where users frequently resize, move, or maximize windows and expect them to remain in the same state when reopening the app. + +## Usage + +### Basic usage + +To enable Window State Persistence, simply set `windowStatePersistence: true` in your window constructor options and provide a unique `name` for the window. + +```js +const { app, BrowserWindow } = require('electron') + +function createWindow () { + const win = new BrowserWindow({ + name: 'main-window', + width: 800, + height: 600, + windowStatePersistence: true + }) + + win.loadFile('index.html') +} + +app.whenReady().then(createWindow) +``` + +With this configuration, Electron will automatically: + +1. Restore the window's position, size, and display mode when created (if a previous state exists) +2. Save the window state whenever it changes (position, size, or display mode). +3. Emit a `restored-persisted-state` event after successfully restoring state. +4. Adapt restored window state to multi-monitor setups and display changes automatically. + +> [!NOTE] +> Window State Persistence requires that the window has a unique `name` property set in its constructor options. This name serves as the identifier for storing and retrieving the window's saved state. + +### Selective persistence + +You can control which aspects of the window state are persisted by passing an object with specific options: + +```js +const { app, BrowserWindow } = require('electron') + +function createWindow () { + const win = new BrowserWindow({ + name: 'main-window', + width: 800, + height: 600, + windowStatePersistence: { + bounds: true, // Save position and size (default: true) + displayMode: false // Don't save maximized/fullscreen/kiosk state (default: true) + } + }) + + win.loadFile('index.html') +} + +app.whenReady().then(createWindow) +``` + +In this example, the window will remember its position and size but will always start in normal mode, even if it was maximized or fullscreened when last closed. + +### Clearing persisted state + +You can programmatically clear the saved state for a specific window using the static `clearPersistedState` method: + +```js +const { BrowserWindow } = require('electron') + +// Clear saved state for a specific window +BrowserWindow.clearPersistedState('main-window') + +// Now when you create a window with this name, +// it will use the default constructor options +const win = new BrowserWindow({ + name: 'main-window', + width: 800, + height: 600, + windowStatePersistence: true +}) +``` + +## API Reference + +The Window State Persistence APIs are available on both `BaseWindow` and `BrowserWindow` (since `BrowserWindow` extends `BaseWindow`) and work identically. + +For complete API documentation, see: + +- [`windowStatePersistence` in BaseWindowConstructorOptions][base-window-options] +- [`WindowStatePersistence` object structure][window-state-persistence-structure] +- [`BaseWindow.clearPersistedState()`][clear-persisted-state] +- [`restored-persisted-state` event][restored-event] + +[base-window-options]: ../api/structures/base-window-options.md +[window-state-persistence-structure]: ../api/structures/window-state-persistence.md +[clear-persisted-state]: ../api/base-window.md#basewindowclearpersistedstatename +[restored-event]: ../api/base-window.md#event-restored-persisted-state From bc82373be3974f9e5a96bac75c2785b87a4ed506 Mon Sep 17 00:00:00 2001 From: Nilay Arya Date: Thu, 27 Nov 2025 23:23:29 -0500 Subject: [PATCH 268/268] test: add checks for virtual display creation --- spec/api-browser-window-spec.ts | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index b3a1a45a27f38..614722db2ffc3 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -8041,7 +8041,8 @@ describe('BrowserWindow module', () => { x: targetDisplayX, y: targetDisplayY }); - + // Wait for the target display to be created + while (screen.getAllDisplays().length !== 2) await setTimeout(1000); // Verify the virtual display is created correctly const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); expect(targetDisplay.bounds.x).to.equal(targetDisplayX); @@ -8085,6 +8086,8 @@ describe('BrowserWindow module', () => { y: targetDisplayY }); + // Wait for the target display to be created + while (screen.getAllDisplays().length !== 2) await setTimeout(1000); // Verify the virtual display is created correctly - single check for targetDisplay.bounds.x const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); expect(targetDisplay.bounds.x).to.equal(targetDisplayX); @@ -8147,6 +8150,9 @@ describe('BrowserWindow module', () => { y: targetDisplayY }); + // Wait for the target displays to be created + while (screen.getAllDisplays().length !== 3) await setTimeout(1000); + // Verify the virtual displays are created correctly - single check for origin x values const middleDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); expect(middleDisplay.bounds.x).to.equal(targetDisplayX); @@ -8211,6 +8217,9 @@ describe('BrowserWindow module', () => { y: targetDisplayY }); + // Wait for the target displays to be created + while (screen.getAllDisplays().length !== 3) await setTimeout(1000); + // Verify the virtual displays are created correctly - single check for origin x values const targetDisplay1 = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); expect(targetDisplay1.bounds.x).to.equal(targetDisplayX); @@ -8317,6 +8326,9 @@ describe('BrowserWindow module', () => { y: targetDisplayY }); + // Wait for the target displays to be created + while (screen.getAllDisplays().length !== 2) await setTimeout(1000); + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); expect(targetDisplay.bounds.x).to.equal(targetDisplayX); @@ -8364,6 +8376,9 @@ describe('BrowserWindow module', () => { y: targetDisplayY }); + // Wait for the target displays to be created + while (screen.getAllDisplays().length !== 2) await setTimeout(1000); + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); expect(targetDisplay.bounds.x).to.equal(targetDisplayX); @@ -8417,6 +8432,9 @@ describe('BrowserWindow module', () => { y: targetDisplayY }); + // Wait for the target display to be created + while (screen.getAllDisplays().length !== 2) await setTimeout(1000); + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); // Create window on target display and set kiosk: true @@ -8463,6 +8481,8 @@ describe('BrowserWindow module', () => { x: targetDisplayX, y: targetDisplayY }); + // Wait for the target display to be created + while (screen.getAllDisplays().length !== 2) await setTimeout(1000); const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); @@ -8474,6 +8494,9 @@ describe('BrowserWindow module', () => { y: targetDisplayY }); + // Wait for the target display to be created + while (screen.getAllDisplays().length !== 3) await setTimeout(1000); + // Bounds for the test window on the virtual target display const initialBounds = { width: 400, @@ -8515,6 +8538,9 @@ describe('BrowserWindow module', () => { y: targetDisplayY }); + // Wait for the target display to be created + while (screen.getAllDisplays().length !== 2) await setTimeout(1000); + const targetDisplay = screen.getDisplayNearestPoint({ x: targetDisplayX, y: targetDisplayY }); // Create a new virtual display with half the resolution of the target display shifted down @@ -8525,6 +8551,9 @@ describe('BrowserWindow module', () => { y: targetDisplay.bounds.height / 2 }); + // Wait for the target display to be created + while (screen.getAllDisplays().length !== 3) await setTimeout(1000); + // Bounds that would overflow on a smaller display const initialBounds = { x: targetDisplay.workArea.x,