From d3ee141d908e169229550af8b804c9a497706dd3 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Mon, 10 May 2021 11:01:58 -0700 Subject: [PATCH 001/587] Bump v14.0.0-nightly.20210510 --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 61e78375dca90..335ae4b14425b 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -14.0.0-nightly.20210507 \ No newline at end of file +14.0.0-nightly.20210510 \ No newline at end of file diff --git a/package.json b/package.json index 4471fab6528ba..8c6eec7fb4f7d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "14.0.0-nightly.20210507", + "version": "14.0.0-nightly.20210510", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index 9ef64d5350365..ddb6d1967be9b 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 14,0,0,20210507 - PRODUCTVERSION 14,0,0,20210507 + FILEVERSION 14,0,0,20210510 + PRODUCTVERSION 14,0,0,20210510 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From 2173f7b60bdb9d2941fe2c3f861c943d2200b0e4 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Mon, 10 May 2021 11:11:03 -0700 Subject: [PATCH 002/587] Revert "Bump v14.0.0-nightly.20210510" This reverts commit d3ee141d908e169229550af8b804c9a497706dd3. --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 335ae4b14425b..61e78375dca90 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -14.0.0-nightly.20210510 \ No newline at end of file +14.0.0-nightly.20210507 \ No newline at end of file diff --git a/package.json b/package.json index 8c6eec7fb4f7d..4471fab6528ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "14.0.0-nightly.20210510", + "version": "14.0.0-nightly.20210507", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index ddb6d1967be9b..9ef64d5350365 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 14,0,0,20210510 - PRODUCTVERSION 14,0,0,20210510 + FILEVERSION 14,0,0,20210507 + PRODUCTVERSION 14,0,0,20210507 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From b1b8db362fa1982f5d6d4a60954ab7c4f0fce635 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Mon, 10 May 2021 11:15:52 -0700 Subject: [PATCH 003/587] Bump v14.0.0-nightly.20210510 --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 61e78375dca90..335ae4b14425b 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -14.0.0-nightly.20210507 \ No newline at end of file +14.0.0-nightly.20210510 \ No newline at end of file diff --git a/package.json b/package.json index 4471fab6528ba..8c6eec7fb4f7d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "14.0.0-nightly.20210507", + "version": "14.0.0-nightly.20210510", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index 9ef64d5350365..ddb6d1967be9b 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 14,0,0,20210507 - PRODUCTVERSION 14,0,0,20210507 + FILEVERSION 14,0,0,20210510 + PRODUCTVERSION 14,0,0,20210510 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From f0ad7dd315cecacf62addccf722d50a623ef726a Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Mon, 10 May 2021 11:17:00 -0700 Subject: [PATCH 004/587] Revert "Bump v14.0.0-nightly.20210510" This reverts commit b1b8db362fa1982f5d6d4a60954ab7c4f0fce635. --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 335ae4b14425b..61e78375dca90 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -14.0.0-nightly.20210510 \ No newline at end of file +14.0.0-nightly.20210507 \ No newline at end of file diff --git a/package.json b/package.json index 8c6eec7fb4f7d..4471fab6528ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "14.0.0-nightly.20210510", + "version": "14.0.0-nightly.20210507", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index ddb6d1967be9b..9ef64d5350365 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 14,0,0,20210510 - PRODUCTVERSION 14,0,0,20210510 + FILEVERSION 14,0,0,20210507 + PRODUCTVERSION 14,0,0,20210507 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From cb05a1d82f8f04368867f0d3edf75bc00d305eeb Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Mon, 10 May 2021 11:28:29 -0700 Subject: [PATCH 005/587] Bump v14.0.0-nightly.20210510 --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 61e78375dca90..335ae4b14425b 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -14.0.0-nightly.20210507 \ No newline at end of file +14.0.0-nightly.20210510 \ No newline at end of file diff --git a/package.json b/package.json index 4471fab6528ba..8c6eec7fb4f7d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "14.0.0-nightly.20210507", + "version": "14.0.0-nightly.20210510", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index 9ef64d5350365..ddb6d1967be9b 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 14,0,0,20210507 - PRODUCTVERSION 14,0,0,20210507 + FILEVERSION 14,0,0,20210510 + PRODUCTVERSION 14,0,0,20210510 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From 3d6adb8c763384c921ef0214682c755b08906d1d Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Mon, 10 May 2021 11:31:25 -0700 Subject: [PATCH 006/587] Revert "Bump v14.0.0-nightly.20210510" This reverts commit cb05a1d82f8f04368867f0d3edf75bc00d305eeb. --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 335ae4b14425b..61e78375dca90 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -14.0.0-nightly.20210510 \ No newline at end of file +14.0.0-nightly.20210507 \ No newline at end of file diff --git a/package.json b/package.json index 8c6eec7fb4f7d..4471fab6528ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "14.0.0-nightly.20210510", + "version": "14.0.0-nightly.20210507", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index ddb6d1967be9b..9ef64d5350365 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 14,0,0,20210510 - PRODUCTVERSION 14,0,0,20210510 + FILEVERSION 14,0,0,20210507 + PRODUCTVERSION 14,0,0,20210507 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From 5167d11bfc82943e3543b99f82c751e2b69e9732 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Mon, 10 May 2021 11:33:30 -0700 Subject: [PATCH 007/587] Bump v14.0.0-nightly.20210510 --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 61e78375dca90..335ae4b14425b 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -14.0.0-nightly.20210507 \ No newline at end of file +14.0.0-nightly.20210510 \ No newline at end of file diff --git a/package.json b/package.json index 4471fab6528ba..8c6eec7fb4f7d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "14.0.0-nightly.20210507", + "version": "14.0.0-nightly.20210510", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index 9ef64d5350365..ddb6d1967be9b 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 14,0,0,20210507 - PRODUCTVERSION 14,0,0,20210507 + FILEVERSION 14,0,0,20210510 + PRODUCTVERSION 14,0,0,20210510 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From 33229f6a27b39cb73dfbf49411d290d672c83d68 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Mon, 10 May 2021 11:34:07 -0700 Subject: [PATCH 008/587] Revert "Bump v14.0.0-nightly.20210510" This reverts commit 5167d11bfc82943e3543b99f82c751e2b69e9732. --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 335ae4b14425b..61e78375dca90 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -14.0.0-nightly.20210510 \ No newline at end of file +14.0.0-nightly.20210507 \ No newline at end of file diff --git a/package.json b/package.json index 8c6eec7fb4f7d..4471fab6528ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "14.0.0-nightly.20210510", + "version": "14.0.0-nightly.20210507", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index ddb6d1967be9b..9ef64d5350365 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 14,0,0,20210510 - PRODUCTVERSION 14,0,0,20210510 + FILEVERSION 14,0,0,20210507 + PRODUCTVERSION 14,0,0,20210507 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From e9b18a8e2aaae1cdd4345c837058e0c77bf4e9e6 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Mon, 10 May 2021 12:15:36 -0700 Subject: [PATCH 009/587] Bump v14.0.0-nightly.20210510 --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 61e78375dca90..335ae4b14425b 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -14.0.0-nightly.20210507 \ No newline at end of file +14.0.0-nightly.20210510 \ No newline at end of file diff --git a/package.json b/package.json index 4471fab6528ba..8c6eec7fb4f7d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "14.0.0-nightly.20210507", + "version": "14.0.0-nightly.20210510", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index 9ef64d5350365..ddb6d1967be9b 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 14,0,0,20210507 - PRODUCTVERSION 14,0,0,20210507 + FILEVERSION 14,0,0,20210510 + PRODUCTVERSION 14,0,0,20210510 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From dca3b41ee6633718e0a541aa4c2f5a44c608b242 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 16:43:19 -0700 Subject: [PATCH 010/587] build(deps): bump hosted-git-info from 2.7.1 to 2.8.9 (#29079) Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.7.1 to 2.8.9. - [Release notes](https://github.com/npm/hosted-git-info/releases) - [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md) - [Commits](https://github.com/npm/hosted-git-info/compare/v2.7.1...v2.8.9) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index bd002ae9596ae..43f163886ead0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3527,9 +3527,9 @@ homedir-polyfill@^1.0.1: parse-passwd "^1.0.0" hosted-git-info@^2.1.4: - version "2.7.1" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" - integrity sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w== + version "2.8.9" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" + integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== http-errors@1.7.2: version "1.7.2" From 821c81f5ee09099a39157db06c0c5104f469cbbd Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 11 May 2021 09:45:21 +0200 Subject: [PATCH 011/587] fix: update NSView radii on fullscreen transition (#29084) --- shell/browser/native_window_mac.h | 3 ++ shell/browser/native_window_mac.mm | 76 ++++++++++++++++++------------ 2 files changed, 48 insertions(+), 31 deletions(-) diff --git a/shell/browser/native_window_mac.h b/shell/browser/native_window_mac.h index 3409bbc024c20..4f66a26601731 100644 --- a/shell/browser/native_window_mac.h +++ b/shell/browser/native_window_mac.h @@ -161,6 +161,8 @@ class NativeWindowMac : public NativeWindow, // Use a custom content view instead of Chromium's BridgedContentView. void OverrideNSWindowContentView(); + void UpdateVibrancyRadii(bool fullscreen); + // Set the attribute of NSWindow while work around a bug of zoom button. void SetStyleMask(bool on, NSUInteger flag); void SetCollectionBehavior(bool on, NSUInteger flag); @@ -271,6 +273,7 @@ class NativeWindowMac : public NativeWindow, base::scoped_nsobject background_color_before_vibrancy_; bool transparency_before_vibrancy_ = false; + std::string vibrancy_type_; // The presentation options before entering simple fullscreen mode. NSApplicationPresentationOptions simple_fullscreen_options_; diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index a4677f1823c72..67b2ed06722ee 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -1303,6 +1303,45 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { [window_ setDisableAutoHideCursor:!auto_hide]; } +void NativeWindowMac::UpdateVibrancyRadii(bool fullscreen) { + NSView* vibrant_view = [window_ vibrantView]; + NSVisualEffectView* effect_view = (NSVisualEffectView*)vibrant_view; + + if (effect_view != nil && !vibrancy_type_.empty()) { + const bool no_rounded_corner = + [window_ styleMask] & NSWindowStyleMaskFullSizeContentView; + if (!has_frame() && !is_modal() && !no_rounded_corner) { + CGFloat radius; + if (fullscreen) { + radius = 0.0f; + } else if (@available(macOS 11.0, *)) { + radius = 9.0f; + } else { + // Smaller corner radius on versions prior to Big Sur. + radius = 5.0f; + } + + CGFloat dimension = 2 * radius + 1; + NSSize size = NSMakeSize(dimension, dimension); + NSImage* maskImage = [NSImage imageWithSize:size + flipped:NO + drawingHandler:^BOOL(NSRect rect) { + NSBezierPath* bezierPath = [NSBezierPath + bezierPathWithRoundedRect:rect + xRadius:radius + yRadius:radius]; + [[NSColor blackColor] set]; + [bezierPath fill]; + return YES; + }]; + + [maskImage setCapInsets:NSEdgeInsetsMake(radius, radius, radius, radius)]; + [maskImage setResizingMode:NSImageResizingModeStretch]; + [effect_view setMaskImage:maskImage]; + } + } +} + void NativeWindowMac::SetVibrancy(const std::string& type) { NSView* vibrant_view = [window_ vibrantView]; @@ -1320,6 +1359,7 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { return; } + vibrancy_type_ = type; background_color_before_vibrancy_.reset([[window_ backgroundColor] retain]); transparency_before_vibrancy_ = [window_ titlebarAppearsTransparent]; @@ -1345,39 +1385,11 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { [effect_view setState:NSVisualEffectStateFollowsWindowActiveState]; } - // Make Vibrant view have rounded corners, so the frameless window can keep - // its rounded corners. - const bool no_rounded_corner = - [window_ styleMask] & NSWindowStyleMaskFullSizeContentView; - if (!has_frame() && !is_modal() && !no_rounded_corner) { - CGFloat radius; - if (@available(macOS 11.0, *)) { - radius = 9.0f; - } else { - radius = 5.0f; // smaller corner radius on older versions - } - CGFloat dimension = 2 * radius + 1; - NSSize size = NSMakeSize(dimension, dimension); - NSImage* maskImage = [NSImage imageWithSize:size - flipped:NO - drawingHandler:^BOOL(NSRect rect) { - NSBezierPath* bezierPath = [NSBezierPath - bezierPathWithRoundedRect:rect - xRadius:radius - yRadius:radius]; - [[NSColor blackColor] set]; - [bezierPath fill]; - return YES; - }]; - [maskImage setCapInsets:NSEdgeInsetsMake(radius, radius, radius, radius)]; - [maskImage setResizingMode:NSImageResizingModeStretch]; - - [effect_view setMaskImage:maskImage]; - } - [[window_ contentView] addSubview:effect_view positioned:NSWindowBelow relativeTo:nil]; + + UpdateVibrancyRadii(IsFullscreen()); } std::string dep_warn = " has been deprecated and removed as of macOS 10.15."; @@ -1385,7 +1397,6 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { node::Environment::GetCurrent(JavascriptEnvironment::GetIsolate()); NSVisualEffectMaterial vibrancyType; - if (type == "appearance-based") { EmitWarning(env, "NSVisualEffectMaterialAppearanceBased" + dep_warn, "electron"); @@ -1623,6 +1634,8 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { [buttons_view_ removeFromSuperview]; InternalSetStandardButtonsVisibility(true); } + + UpdateVibrancyRadii(true); } void NativeWindowMac::NotifyWindowWillLeaveFullScreen() { @@ -1634,6 +1647,7 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { } RedrawTrafficLights(); + UpdateVibrancyRadii(false); } void NativeWindowMac::Cleanup() { From 2b84d79b185a550684d60b3902a2cb02a90e61dc Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 11 May 2021 06:02:53 -0700 Subject: [PATCH 012/587] Bump v14.0.0-nightly.20210511 --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 335ae4b14425b..1ac15642141b4 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -14.0.0-nightly.20210510 \ No newline at end of file +14.0.0-nightly.20210511 \ No newline at end of file diff --git a/package.json b/package.json index 8c6eec7fb4f7d..1f0961f9f07fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "14.0.0-nightly.20210510", + "version": "14.0.0-nightly.20210511", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index ddb6d1967be9b..8af308a9cb7a9 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 14,0,0,20210510 - PRODUCTVERSION 14,0,0,20210510 + FILEVERSION 14,0,0,20210511 + PRODUCTVERSION 14,0,0,20210511 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From 35f2ed8978c1575fc5443bc09a4d561fed01e93c Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Tue, 11 May 2021 09:30:35 -0700 Subject: [PATCH 013/587] build: offload hash checking logic to lambda worker during release (#29096) --- package.json | 1 - script/release/get-url-hash.js | 31 +++++ script/release/prepare-release.js | 3 +- script/release/release.js | 219 ++++++++++-------------------- yarn.lock | 7 - 5 files changed, 105 insertions(+), 156 deletions(-) create mode 100644 script/release/get-url-hash.js diff --git a/package.json b/package.json index 1f0961f9f07fe..05938627b3678 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,6 @@ "shx": "^0.3.2", "standard-markdown": "^6.0.0", "stream-json": "^1.7.1", - "sumchecker": "^2.0.2", "tap-xunit": "^2.4.1", "temp": "^0.8.3", "timers-browserify": "1.4.2", diff --git a/script/release/get-url-hash.js b/script/release/get-url-hash.js new file mode 100644 index 0000000000000..3193eec51e604 --- /dev/null +++ b/script/release/get-url-hash.js @@ -0,0 +1,31 @@ +const AWS = require('aws-sdk'); + +const lambda = new AWS.Lambda({ + credentials: { + accessKeyId: process.env.AWS_LAMBDA_EXECUTE_KEY, + secretAccessKey: process.env.AWS_LAMBDA_EXECUTE_SECRET + }, + region: 'us-east-1' +}); + +module.exports = function getUrlHash (targetUrl, algorithm = 'sha256') { + return new Promise((resolve, reject) => { + lambda.invoke({ + FunctionName: 'hasher', + Payload: JSON.stringify({ + targetUrl, + algorithm + }) + }, (err, data) => { + if (err) return reject(err); + try { + const response = JSON.parse(data.Payload); + if (response.statusCode !== 200) return reject(new Error('non-200 status code received from hasher function')); + if (!response.hash) return reject(new Error('Successful lambda call but failed to get valid hash')); + resolve(response.hash); + } catch (err) { + return reject(err); + } + }); + }); +}; diff --git a/script/release/prepare-release.js b/script/release/prepare-release.js index 3f3065dd241eb..c70546ce79dfd 100755 --- a/script/release/prepare-release.js +++ b/script/release/prepare-release.js @@ -135,8 +135,7 @@ async function pushRelease (branch) { async function runReleaseBuilds (branch) { await ciReleaseBuild(branch, { - ghRelease: true, - automaticRelease: args.automaticRelease + ghRelease: true }); } diff --git a/script/release/release.js b/script/release/release.js index 33ef932178143..49bc8b88c0236 100755 --- a/script/release/release.js +++ b/script/release/release.js @@ -5,20 +5,16 @@ if (!process.env.CI) require('dotenv-safe').load(); const args = require('minimist')(process.argv.slice(2), { boolean: [ 'validateRelease', - 'skipVersionCheck', - 'automaticRelease', 'verboseNugget' ], default: { verboseNugget: false } }); const fs = require('fs'); const { execSync } = require('child_process'); -const nugget = require('nugget'); const got = require('got'); const pkg = require('../../package.json'); const pkgVersion = `v${pkg.version}`; const path = require('path'); -const sumchecker = require('sumchecker'); const temp = require('temp').track(); const { URL } = require('url'); const { Octokit } = require('@octokit/rest'); @@ -29,6 +25,7 @@ const pass = '✓'.green; const fail = '✗'.red; const { ELECTRON_DIR } = require('../lib/utils'); +const getUrlHash = require('./get-url-hash'); const octokit = new Octokit({ auth: process.env.ELECTRON_GITHUB_TOKEN @@ -64,7 +61,7 @@ async function getDraftRelease (version, skipValidation) { async function validateReleaseAssets (release, validatingRelease) { const requiredAssets = assetsForVersion(release.tag_name, validatingRelease).sort(); const extantAssets = release.assets.map(asset => asset.name).sort(); - const downloadUrls = release.assets.map(asset => asset.browser_download_url).sort(); + const downloadUrls = release.assets.map(asset => ({ url: asset.browser_download_url, file: asset.name })).sort((a, b) => a.file.localeCompare(b.file)); failureCount = 0; requiredAssets.forEach(asset => { @@ -74,15 +71,15 @@ async function validateReleaseAssets (release, validatingRelease) { if (!validatingRelease || !release.draft) { if (release.draft) { - await verifyAssets(release); + await verifyDraftGitHubReleaseAssets(release); } else { - await verifyShasums(downloadUrls) + await verifyShasumsForRemoteFiles(downloadUrls) .catch(err => { console.log(`${fail} error verifyingShasums`, err); }); } - const s3Urls = s3UrlsForVersion(release.tag_name); - await verifyShasums(s3Urls, true); + const s3RemoteFiles = s3RemoteFilesForVersion(release.tag_name); + await verifyShasumsForRemoteFiles(s3RemoteFiles, true); } } @@ -174,21 +171,29 @@ function assetsForVersion (version, validatingRelease) { return patterns; } -function s3UrlsForVersion (version) { +function s3RemoteFilesForVersion (version) { const bucket = 'https://gh-contractor-zcbenz.s3.amazonaws.com/'; - const patterns = [ - `${bucket}atom-shell/dist/${version}/iojs-${version}-headers.tar.gz`, - `${bucket}atom-shell/dist/${version}/iojs-${version}.tar.gz`, - `${bucket}atom-shell/dist/${version}/node-${version}.tar.gz`, - `${bucket}atom-shell/dist/${version}/node.lib`, - `${bucket}atom-shell/dist/${version}/win-x64/iojs.lib`, - `${bucket}atom-shell/dist/${version}/win-x86/iojs.lib`, - `${bucket}atom-shell/dist/${version}/x64/node.lib`, - `${bucket}atom-shell/dist/${version}/SHASUMS.txt`, - `${bucket}atom-shell/dist/${version}/SHASUMS256.txt`, - `${bucket}atom-shell/dist/index.json` + const versionPrefix = `${bucket}atom-shell/dist/${version}/`; + const filePaths = [ + `iojs-${version}-headers.tar.gz`, + `iojs-${version}.tar.gz`, + `node-${version}.tar.gz`, + 'node.lib', + 'x64/node.lib', + 'win-x64/iojs.lib', + 'win-x86/iojs.lib', + 'win-arm64/iojs.lib', + 'win-x64/node.lib', + 'win-x86/node.lib', + 'win-arm64/node.lib', + 'arm64/node.lib', + 'SHASUMS.txt', + 'SHASUMS256.txt' ]; - return patterns; + return filePaths.map((filePath) => ({ + file: filePath, + url: `${versionPrefix}${filePath}` + })); } function runScript (scriptName, scriptArgs, cwd) { @@ -366,13 +371,13 @@ async function makeTempDir () { }); } -async function verifyAssets (release) { - const downloadDir = await makeTempDir(); +const SHASUM_256_FILENAME = 'SHASUMS256.txt'; +const SHASUM_1_FILENAME = 'SHASUMS.txt'; - console.log('Downloading files from GitHub to verify shasums'); - const shaSumFile = 'SHASUMS256.txt'; +async function verifyDraftGitHubReleaseAssets (release) { + console.log('Fetching authenticated GitHub artifact URLs to verify shasums'); - let filesToCheck = await Promise.all(release.assets.map(async asset => { + const remoteFilesToHash = await Promise.all(release.assets.map(async asset => { const requestOptions = await octokit.repos.getReleaseAsset.endpoint({ owner: 'electron', repo: targetRepo, @@ -391,137 +396,59 @@ async function verifyAssets (release) { headers }); - await downloadFiles(response.headers.location, downloadDir, asset.name); - return asset.name; + return { url: response.headers.location, file: asset.name }; })).catch(err => { console.log(`${fail} Error downloading files from GitHub`, err); process.exit(1); }); - filesToCheck = filesToCheck.filter(fileName => fileName !== shaSumFile); - let checkerOpts; - await validateChecksums({ - algorithm: 'sha256', - filesToCheck, - fileDirectory: downloadDir, - shaSumFile, - checkerOpts, - fileSource: 'GitHub' - }); + await verifyShasumsForRemoteFiles(remoteFilesToHash); } -function downloadFiles (urls, directory, targetName) { - return new Promise((resolve, reject) => { - const nuggetOpts = { dir: directory }; - nuggetOpts.quiet = !args.verboseNugget; - if (targetName) nuggetOpts.target = targetName; - - nugget(urls, nuggetOpts, (err) => { - if (err) { - reject(err); - } else { - console.log(`${pass} all files downloaded successfully!`); - resolve(); - } - }); - }); +async function getShaSumMappingFromUrl (shaSumFileUrl, fileNamePrefix) { + const response = await got(shaSumFileUrl); + const raw = response.body; + return raw.split('\n').map(line => line.trim()).filter(Boolean).reduce((map, line) => { + const [sha, file] = line.split(' '); + map[file.slice(fileNamePrefix.length)] = sha; + return map; + }, {}); } -async function verifyShasums (urls, isS3) { - const fileSource = isS3 ? 'S3' : 'GitHub'; - console.log(`Downloading files from ${fileSource} to verify shasums`); - const downloadDir = await makeTempDir(); - let filesToCheck = []; - try { - if (!isS3) { - await downloadFiles(urls, downloadDir); - filesToCheck = urls.map(url => { - const currentUrl = new URL(url); - return path.basename(currentUrl.pathname); - }).filter(file => file.indexOf('SHASUMS') === -1); - } else { - const s3VersionPath = `/atom-shell/dist/${pkgVersion}/`; - await Promise.all(urls.map(async (url) => { - const currentUrl = new URL(url); - const dirname = path.dirname(currentUrl.pathname); - const filename = path.basename(currentUrl.pathname); - const s3VersionPathIdx = dirname.indexOf(s3VersionPath); - if (s3VersionPathIdx === -1 || dirname === s3VersionPath) { - if (s3VersionPathIdx !== -1 && filename.indexof('SHASUMS') === -1) { - filesToCheck.push(filename); - } - await downloadFiles(url, downloadDir); - } else { - const subDirectory = dirname.substr(s3VersionPathIdx + s3VersionPath.length); - const fileDirectory = path.join(downloadDir, subDirectory); - try { - fs.statSync(fileDirectory); - } catch (err) { - fs.mkdirSync(fileDirectory); - } - filesToCheck.push(path.join(subDirectory, filename)); - await downloadFiles(url, fileDirectory); - } - })); - } - } catch (err) { - console.log(`${fail} Error downloading files from ${fileSource}`, err); - process.exit(1); - } - console.log(`${pass} Successfully downloaded the files from ${fileSource}.`); - let checkerOpts; - if (isS3) { - checkerOpts = { defaultTextEncoding: 'binary' }; - } - - await validateChecksums({ - algorithm: 'sha256', - filesToCheck, - fileDirectory: downloadDir, - shaSumFile: 'SHASUMS256.txt', - checkerOpts, - fileSource - }); - - if (isS3) { - await validateChecksums({ - algorithm: 'sha1', - filesToCheck, - fileDirectory: downloadDir, - shaSumFile: 'SHASUMS.txt', - checkerOpts, - fileSource - }); +async function validateFileHashesAgainstShaSumMapping (remoteFilesWithHashes, mapping) { + for (const remoteFileWithHash of remoteFilesWithHashes) { + check(remoteFileWithHash.hash === mapping[remoteFileWithHash.file], `Release asset ${remoteFileWithHash.file} should have hash of ${mapping[remoteFileWithHash.file]} but found ${remoteFileWithHash.hash}`, true); } } -async function validateChecksums (validationArgs) { - console.log(`Validating checksums for files from ${validationArgs.fileSource} ` + - `against ${validationArgs.shaSumFile}.`); - const shaSumFilePath = path.join(validationArgs.fileDirectory, validationArgs.shaSumFile); - const checker = new sumchecker.ChecksumValidator(validationArgs.algorithm, - shaSumFilePath, validationArgs.checkerOpts); - await checker.validate(validationArgs.fileDirectory, validationArgs.filesToCheck) - .catch(err => { - if (err instanceof sumchecker.ChecksumMismatchError) { - console.error(`${fail} The checksum of ${err.filename} from ` + - `${validationArgs.fileSource} did not match the shasum in ` + - `${validationArgs.shaSumFile}`); - } else if (err instanceof sumchecker.ChecksumParseError) { - console.error(`${fail} The checksum file ${validationArgs.shaSumFile} ` + - `from ${validationArgs.fileSource} could not be parsed.`, err); - } else if (err instanceof sumchecker.NoChecksumFoundError) { - console.error(`${fail} The file ${err.filename} from ` + - `${validationArgs.fileSource} was not in the shasum file ` + - `${validationArgs.shaSumFile}.`); - } else { - console.error(`${fail} Error matching files from ` + - `${validationArgs.fileSource} shasums in ${validationArgs.shaSumFile}.`, err); - } - process.exit(1); - }); - console.log(`${pass} All files from ${validationArgs.fileSource} match ` + - `shasums defined in ${validationArgs.shaSumFile}.`); +async function verifyShasumsForRemoteFiles (remoteFilesToHash, filesAreNodeJSArtifacts = false) { + console.log(`Generating SHAs for ${remoteFilesToHash.length} files to verify shasums`); + + // Only used for node.js artifact uploads + const shaSum1File = remoteFilesToHash.find(({ file }) => file === SHASUM_1_FILENAME); + // Used for both node.js artifact uploads and normal electron artifacts + const shaSum256File = remoteFilesToHash.find(({ file }) => file === SHASUM_256_FILENAME); + remoteFilesToHash = remoteFilesToHash.filter(({ file }) => file !== SHASUM_1_FILENAME && file !== SHASUM_256_FILENAME); + + const remoteFilesWithHashes = await Promise.all(remoteFilesToHash.map(async (file) => { + return { + hash: await getUrlHash(file.url, 'sha256'), + ...file + }; + })); + + await validateFileHashesAgainstShaSumMapping(remoteFilesWithHashes, await getShaSumMappingFromUrl(shaSum256File.url, filesAreNodeJSArtifacts ? '' : '*')); + + if (filesAreNodeJSArtifacts) { + const remoteFilesWithSha1Hashes = await Promise.all(remoteFilesToHash.map(async (file) => { + return { + hash: await getUrlHash(file.url, 'sha1'), + ...file + }; + })); + + await validateFileHashesAgainstShaSumMapping(remoteFilesWithSha1Hashes, await getShaSumMappingFromUrl(shaSum1File.url, filesAreNodeJSArtifacts ? '' : '*')); + } } makeRelease(args.validateRelease); diff --git a/yarn.lock b/yarn.lock index 43f163886ead0..d7e093c9a348d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7474,13 +7474,6 @@ strip-json-comments@~2.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= -sumchecker@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/sumchecker/-/sumchecker-2.0.2.tgz#0f42c10e5d05da5d42eea3e56c3399a37d6c5b3e" - integrity sha1-D0LBDl0F2l1C7qPlbDOZo31sWz4= - dependencies: - debug "^2.2.0" - supports-color@^4.1.0: version "4.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" From 82946133b18150c2d8d091bb8878b41e0dc3a1a3 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Tue, 11 May 2021 09:31:10 -0700 Subject: [PATCH 014/587] build: do not use a shared checkout for linux publish (#29076) --- .circleci/config.yml | 70 +++----------------------------------------- 1 file changed, 4 insertions(+), 66 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e3d6b26ff8871..36e6a8848c4b6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1877,18 +1877,6 @@ jobs: attach: false checkout: true - linux-x64-publish-skip-checkout: - executor: linux-docker - environment: - <<: *env-linux-2xlarge-release - <<: *env-release-build - UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >> - <<: *env-ninja-status - steps: - - electron-publish: - attach: true - checkout: false - linux-ia32-testing: executor: linux-docker environment: @@ -1931,20 +1919,6 @@ jobs: attach: false checkout: true - linux-ia32-publish-skip-checkout: - executor: linux-docker - environment: - <<: *env-linux-2xlarge-release - <<: *env-ia32 - <<: *env-release-build - <<: *env-32bit-release - UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >> - <<: *env-ninja-status - steps: - - electron-publish: - attach: true - checkout: false - linux-arm-testing: executor: linux-docker environment: @@ -1990,20 +1964,6 @@ jobs: attach: false checkout: true - linux-arm-publish-skip-checkout: - executor: linux-docker - environment: - <<: *env-linux-2xlarge-release - <<: *env-arm - <<: *env-release-build - <<: *env-32bit-release - UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >> - <<: *env-ninja-status - steps: - - electron-publish: - attach: true - checkout: false - linux-arm64-testing: executor: linux-docker environment: @@ -2058,19 +2018,6 @@ jobs: attach: false checkout: true - linux-arm64-publish-skip-checkout: - executor: linux-docker - environment: - <<: *env-linux-2xlarge-release - <<: *env-arm64 - <<: *env-release-build - UPLOAD_TO_S3: << pipeline.parameters.upload-to-s3 >> - <<: *env-ninja-status - steps: - - electron-publish: - attach: true - checkout: false - osx-testing-x64: executor: macos environment: @@ -2497,22 +2444,13 @@ workflows: publish-linux: when: << pipeline.parameters.run-linux-publish >> jobs: - - linux-checkout - - linux-x64-publish-skip-checkout: - requires: - - linux-checkout + - linux-x64-publish: context: release-env - - linux-ia32-publish-skip-checkout: - requires: - - linux-checkout + - linux-ia32-publish: context: release-env - - linux-arm-publish-skip-checkout: - requires: - - linux-checkout + - linux-arm-publish: context: release-env - - linux-arm64-publish-skip-checkout: - requires: - - linux-checkout + - linux-arm64-publish: context: release-env publish-x64-linux: From 06f51b7283e913217e2f47d47aa7eec818263c46 Mon Sep 17 00:00:00 2001 From: Keeley Hammond Date: Tue, 11 May 2021 13:57:11 -0700 Subject: [PATCH 015/587] fix: prevent crash on web-contents creation when error is thrown (#28971) * fix: prevent crash when error occurs during event emitter CallMethod * wip: emit error event within trycatch * fix: handle uncaught exceptions within node on web_contents init * fix: create gin_helper::CallMethodCatchException * test: add web-contents create crash to test cases * test: clean up test data for web-contents crash Co-authored-by: Jeremy Rose * fix: convert CatchException to WebContents static helper method * fix: restore try_catch to callsite Co-authored-by: Jeremy Rose --- shell/browser/api/electron_api_web_contents.cc | 12 ++++++++++++ shell/common/node_includes.h | 1 + .../webview-contents-error-on-creation/index.js | 14 ++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 spec-main/fixtures/crash-cases/webview-contents-error-on-creation/index.js diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index f6eb816f86e52..6dfb859273652 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -3708,7 +3708,11 @@ gin::Handle WebContents::New( const gin_helper::Dictionary& options) { gin::Handle handle = gin::CreateHandle(isolate, new WebContents(isolate, options)); + v8::TryCatch try_catch(isolate); gin_helper::CallMethod(isolate, handle.get(), "_init"); + if (try_catch.HasCaught()) { + node::errors::TriggerUncaughtException(isolate, try_catch); + } return handle; } @@ -3719,7 +3723,11 @@ gin::Handle WebContents::CreateAndTake( Type type) { gin::Handle handle = gin::CreateHandle( isolate, new WebContents(isolate, std::move(web_contents), type)); + v8::TryCatch try_catch(isolate); gin_helper::CallMethod(isolate, handle.get(), "_init"); + if (try_catch.HasCaught()) { + node::errors::TriggerUncaughtException(isolate, try_catch); + } return handle; } @@ -3739,7 +3747,11 @@ gin::Handle WebContents::FromOrCreate( WebContents* api_web_contents = From(web_contents); if (!api_web_contents) { api_web_contents = new WebContents(isolate, web_contents); + v8::TryCatch try_catch(isolate); gin_helper::CallMethod(isolate, api_web_contents, "_init"); + if (try_catch.HasCaught()) { + node::errors::TriggerUncaughtException(isolate, try_catch); + } } return gin::CreateHandle(isolate, api_web_contents); } diff --git a/shell/common/node_includes.h b/shell/common/node_includes.h index a2ff95669ef0e..05b655f893c1f 100644 --- a/shell/common/node_includes.h +++ b/shell/common/node_includes.h @@ -64,6 +64,7 @@ #include "env.h" #include "node.h" #include "node_buffer.h" +#include "node_errors.h" #include "node_internals.h" #include "node_options-inl.h" #include "node_options.h" diff --git a/spec-main/fixtures/crash-cases/webview-contents-error-on-creation/index.js b/spec-main/fixtures/crash-cases/webview-contents-error-on-creation/index.js new file mode 100644 index 0000000000000..cbfc7eb98b488 --- /dev/null +++ b/spec-main/fixtures/crash-cases/webview-contents-error-on-creation/index.js @@ -0,0 +1,14 @@ +const { app, BrowserWindow } = require('electron'); + +app.whenReady().then(() => { + const mainWindow = new BrowserWindow({ + show: false + }); + mainWindow.loadFile('about:blank'); + + app.on('web-contents-created', () => { + throw new Error(); + }); + + app.quit(); +}); From e01faedaa5ec6e391e1290d7c29231e0811a32e2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 May 2021 14:02:14 -0700 Subject: [PATCH 016/587] build(deps): bump lodash from 4.17.20 to 4.17.21 (#29066) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index d7e093c9a348d..0d5921d22df62 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4502,9 +4502,9 @@ lodash.range@^3.2.0: integrity sha1-9GHliPZmg/fq3q3lE+OKaaVloV0= lodash@^4.0.0, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15: - version "4.17.20" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" - integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== log-symbols@^2.2.0: version "2.2.0" From a51aaeb28ff8d425edc3eea13ac8d989cb929322 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Wed, 12 May 2021 09:38:21 +0200 Subject: [PATCH 017/587] refactor: replace v8::Local::Cast() with As() (#29097) --- shell/common/api/electron_api_v8_util.cc | 2 +- shell/common/gin_converters/net_converter.cc | 4 ++-- shell/common/gin_converters/std_converter.h | 6 ++--- shell/common/gin_helper/callback.cc | 5 ++-- shell/common/gin_helper/event_emitter.cc | 2 +- .../common/gin_helper/persistent_dictionary.h | 3 +-- shell/common/gin_helper/promise.h | 2 +- shell/common/gin_helper/wrappable.cc | 2 +- shell/common/v8_value_converter.cc | 2 +- .../api/context_bridge/object_cache.cc | 4 ++-- .../api/electron_api_context_bridge.cc | 24 +++++++++---------- shell/renderer/api/electron_api_web_frame.cc | 7 +++--- .../electron_sandboxed_renderer_client.cc | 2 +- 13 files changed, 31 insertions(+), 34 deletions(-) diff --git a/shell/common/api/electron_api_v8_util.cc b/shell/common/api/electron_api_v8_util.cc index a0133ec525848..3c45f1a235422 100644 --- a/shell/common/api/electron_api_v8_util.cc +++ b/shell/common/api/electron_api_v8_util.cc @@ -38,7 +38,7 @@ struct Converter> { if (!val->IsArray()) return false; - v8::Local array(v8::Local::Cast(val)); + v8::Local array = val.As(); if (array->Length() != 2) return false; diff --git a/shell/common/gin_converters/net_converter.cc b/shell/common/gin_converters/net_converter.cc index c92c99e258160..b5f776d40642c 100644 --- a/shell/common/gin_converters/net_converter.cc +++ b/shell/common/gin_converters/net_converter.cc @@ -191,7 +191,7 @@ bool Converter::FromV8( }; auto context = isolate->GetCurrentContext(); - auto headers = v8::Local::Cast(val); + auto headers = val.As(); auto keys = headers->GetOwnPropertyNames(context).ToLocalChecked(); for (uint32_t i = 0; i < keys->Length(); i++) { v8::Local keyVal; @@ -203,7 +203,7 @@ bool Converter::FromV8( auto localVal = headers->Get(context, keyVal).ToLocalChecked(); if (localVal->IsArray()) { - auto values = v8::Local::Cast(localVal); + auto values = localVal.As(); for (uint32_t j = 0; j < values->Length(); j++) { if (!addHeaderFromValue(key, values->Get(context, j).ToLocalChecked())) { diff --git a/shell/common/gin_converters/std_converter.h b/shell/common/gin_converters/std_converter.h index fef3cd26fa673..1230334e6f100 100644 --- a/shell/common/gin_converters/std_converter.h +++ b/shell/common/gin_converters/std_converter.h @@ -86,7 +86,7 @@ struct Converter> { v8::Local* out) { if (!val->IsArray()) return false; - *out = v8::Local::Cast(val); + *out = val.As(); return true; } }; @@ -102,7 +102,7 @@ struct Converter> { v8::Local* out) { if (!val->IsString()) return false; - *out = v8::Local::Cast(val); + *out = val.As(); return true; } }; @@ -128,7 +128,7 @@ struct Converter> { auto context = isolate->GetCurrentContext(); std::set result; - v8::Local array(v8::Local::Cast(val)); + v8::Local array = val.As(); uint32_t length = array->Length(); for (uint32_t i = 0; i < length; ++i) { T item; diff --git a/shell/common/gin_helper/callback.cc b/shell/common/gin_helper/callback.cc index 52761fa5efbbe..a02333323b568 100644 --- a/shell/common/gin_helper/callback.cc +++ b/shell/common/gin_helper/callback.cc @@ -86,7 +86,7 @@ class RefCountedGlobal : public base::RefCountedThreadSafe, DeleteOnUIThread> { public: RefCountedGlobal(v8::Isolate* isolate, v8::Local value) - : handle_(isolate, v8::Local::Cast(value)) {} + : handle_(isolate, value.As()) {} bool IsAlive() const { return !handle_.IsEmpty(); } @@ -147,8 +147,7 @@ v8::Local BindFunctionWith(v8::Isolate* isolate, v8::MaybeLocal bind = func->Get(context, gin::StringToV8(isolate, "bind")); CHECK(!bind.IsEmpty()); - v8::Local bind_func = - v8::Local::Cast(bind.ToLocalChecked()); + v8::Local bind_func = bind.ToLocalChecked().As(); v8::Local converted[] = {func, arg1, arg2}; return bind_func->Call(context, func, base::size(converted), converted) .ToLocalChecked(); diff --git a/shell/common/gin_helper/event_emitter.cc b/shell/common/gin_helper/event_emitter.cc index 710147b54f156..737305911fc5f 100644 --- a/shell/common/gin_helper/event_emitter.cc +++ b/shell/common/gin_helper/event_emitter.cc @@ -59,7 +59,7 @@ v8::Local CreateNativeEvent( if (frame && callback) { gin::Handle native_event = Event::Create(isolate); native_event->SetCallback(std::move(callback)); - event = v8::Local::Cast(native_event.ToV8()); + event = native_event.ToV8().As(); } else { // No need to create native event if we do not need to send reply. event = CreateEvent(isolate); diff --git a/shell/common/gin_helper/persistent_dictionary.h b/shell/common/gin_helper/persistent_dictionary.h index f7b049583dce0..e73da7ab259f9 100644 --- a/shell/common/gin_helper/persistent_dictionary.h +++ b/shell/common/gin_helper/persistent_dictionary.h @@ -53,8 +53,7 @@ struct Converter { gin_helper::PersistentDictionary* out) { if (!val->IsObject()) return false; - *out = gin_helper::PersistentDictionary(isolate, - v8::Local::Cast(val)); + *out = gin_helper::PersistentDictionary(isolate, val.As()); return true; } }; diff --git a/shell/common/gin_helper/promise.h b/shell/common/gin_helper/promise.h index 329756ad231dc..0da188fe41170 100644 --- a/shell/common/gin_helper/promise.h +++ b/shell/common/gin_helper/promise.h @@ -133,7 +133,7 @@ class Promise : public PromiseBase { v8::Context::Scope context_scope(GetContext()); v8::Local value = gin::ConvertToV8(isolate(), std::move(cb)); - v8::Local handler = v8::Local::Cast(value); + v8::Local handler = value.As(); return GetHandle()->Then(GetContext(), handler); } diff --git a/shell/common/gin_helper/wrappable.cc b/shell/common/gin_helper/wrappable.cc index e5fe390e15ebc..4b68957c2df6b 100644 --- a/shell/common/gin_helper/wrappable.cc +++ b/shell/common/gin_helper/wrappable.cc @@ -84,7 +84,7 @@ namespace internal { void* FromV8Impl(v8::Isolate* isolate, v8::Local val) { if (!val->IsObject()) return nullptr; - v8::Local obj = v8::Local::Cast(val); + v8::Local obj = val.As(); if (obj->InternalFieldCount() != 1) return nullptr; return obj->GetAlignedPointerFromInternalField(0); diff --git a/shell/common/v8_value_converter.cc b/shell/common/v8_value_converter.cc index 9bc691f0a1f77..43a7ddc2013b9 100644 --- a/shell/common/v8_value_converter.cc +++ b/shell/common/v8_value_converter.cc @@ -282,7 +282,7 @@ v8::Local V8ValueConverter::ToArrayBuffer( } v8::Local args[] = {array_buffer}; - auto func = v8::Local::Cast(from_value); + auto func = from_value.As(); auto result = func->Call(context, v8::Null(isolate), 1, args); if (!result.IsEmpty()) { return result.ToLocalChecked(); diff --git a/shell/renderer/api/context_bridge/object_cache.cc b/shell/renderer/api/context_bridge/object_cache.cc index 72ab60d24e99e..cb672d29c7774 100644 --- a/shell/renderer/api/context_bridge/object_cache.cc +++ b/shell/renderer/api/context_bridge/object_cache.cc @@ -20,7 +20,7 @@ ObjectCache::~ObjectCache() = default; void ObjectCache::CacheProxiedObject(v8::Local from, v8::Local proxy_value) { if (from->IsObject() && !from->IsNullOrUndefined()) { - auto obj = v8::Local::Cast(from); + auto obj = from.As(); int hash = obj->GetIdentityHash(); proxy_map_[hash].push_front(std::make_pair(from, proxy_value)); @@ -32,7 +32,7 @@ v8::MaybeLocal ObjectCache::GetCachedProxiedObject( if (!from->IsObject() || from->IsNullOrUndefined()) return v8::MaybeLocal(); - auto obj = v8::Local::Cast(from); + auto obj = from.As(); int hash = obj->GetIdentityHash(); auto iter = proxy_map_.find(hash); if (iter == proxy_map_.end()) diff --git a/shell/renderer/api/electron_api_context_bridge.cc b/shell/renderer/api/electron_api_context_bridge.cc index 82eee560b706b..d6e93ffb496d6 100644 --- a/shell/renderer/api/electron_api_context_bridge.cc +++ b/shell/renderer/api/electron_api_context_bridge.cc @@ -83,7 +83,7 @@ bool DeepFreeze(const v8::Local& object, object->Get(context, property_names->Get(context, i).ToLocalChecked()) .ToLocalChecked(); if (child->IsObject() && !child->IsTypedArray()) { - if (!DeepFreeze(v8::Local::Cast(child), context, frozen)) + if (!DeepFreeze(child.As(), context, frozen)) return false; } } @@ -181,7 +181,7 @@ v8::MaybeLocal PassValueToOtherContext( // Proxy functions and monitor the lifetime in the new context to release // the global handle at the right time. if (value->IsFunction()) { - auto func = v8::Local::Cast(value); + auto func = value.As(); v8::MaybeLocal maybe_original_fn = GetPrivate( source_context, func, context_bridge::kOriginalFunctionPrivateKey); @@ -224,7 +224,7 @@ v8::MaybeLocal PassValueToOtherContext( // Proxy promises as they have a safe and guaranteed memory lifecycle if (value->IsPromise()) { v8::Context::Scope destination_scope(destination_context); - auto source_promise = v8::Local::Cast(value); + auto source_promise = value.As(); // Make the promise a shared_ptr so that when the original promise is // freed the proxy promise is correctly freed as well instead of being // left dangling @@ -290,10 +290,10 @@ v8::MaybeLocal PassValueToOtherContext( ignore_result(source_promise->Then( source_context, - v8::Local::Cast( - gin::ConvertToV8(destination_context->GetIsolate(), then_cb)), - v8::Local::Cast( - gin::ConvertToV8(destination_context->GetIsolate(), catch_cb)))); + gin::ConvertToV8(destination_context->GetIsolate(), then_cb) + .As(), + gin::ConvertToV8(destination_context->GetIsolate(), catch_cb) + .As())); object_cache->CacheProxiedObject(value, proxied_promise_handle); return v8::MaybeLocal(proxied_promise_handle); @@ -325,7 +325,7 @@ v8::MaybeLocal PassValueToOtherContext( // promises are proxied correctly. if (IsPlainArray(value)) { v8::Context::Scope destination_context_scope(destination_context); - v8::Local arr = v8::Local::Cast(value); + v8::Local arr = value.As(); size_t length = arr->Length(); v8::Local cloned_arr = v8::Array::New(destination_context->GetIsolate(), length); @@ -356,7 +356,7 @@ v8::MaybeLocal PassValueToOtherContext( // Proxy all objects if (IsPlainObject(value)) { - auto object_value = v8::Local::Cast(value); + auto object_value = value.As(); auto passed_value = CreateProxyForAPI( object_value, source_context, destination_context, object_cache, support_dynamic_properties, recursion_depth + 1); @@ -408,7 +408,7 @@ void ProxyFunctionWrapper(const v8::FunctionCallbackInfo& info) { !maybe_func.ToLocal(&func_value)) return; - v8::Local func = v8::Local::Cast(func_value); + v8::Local func = func_value.As(); v8::Local func_owning_context = func->CreationContext(); { @@ -507,7 +507,7 @@ v8::MaybeLocal CreateProxyForAPI( if (support_dynamic_properties) { v8::Context::Scope source_context_scope(source_context); auto maybe_desc = api.GetHandle()->GetOwnPropertyDescriptor( - source_context, v8::Local::Cast(key)); + source_context, key.As()); v8::Local desc_value; if (!maybe_desc.ToLocal(&desc_value) || !desc_value->IsObject()) continue; @@ -600,7 +600,7 @@ void ExposeAPIInMainWorld(v8::Isolate* isolate, } if (proxy->IsObject() && !proxy->IsTypedArray() && - !DeepFreeze(v8::Local::Cast(proxy), main_context)) + !DeepFreeze(proxy.As(), main_context)) return; global.SetReadOnlyNonConfigurable(key, proxy); diff --git a/shell/renderer/api/electron_api_web_frame.cc b/shell/renderer/api/electron_api_web_frame.cc index 4353d5355be57..839a53c5de61e 100644 --- a/shell/renderer/api/electron_api_web_frame.cc +++ b/shell/renderer/api/electron_api_web_frame.cc @@ -102,9 +102,8 @@ namespace api { namespace { -content::RenderFrame* GetRenderFrame(v8::Local value) { - v8::Local context = - v8::Local::Cast(value)->CreationContext(); +content::RenderFrame* GetRenderFrame(v8::Local value) { + v8::Local context = value->CreationContext(); if (context.IsEmpty()) return nullptr; blink::WebLocalFrame* frame = blink::WebLocalFrame::FrameForContext(context); @@ -559,7 +558,7 @@ class WebFrameRenderer : public gin::Wrappable, nullptr); } - static int GetWebFrameId(v8::Local content_window) { + static int GetWebFrameId(v8::Local content_window) { // Get the WebLocalFrame before (possibly) executing any user-space JS while // getting the |params|. We track the status of the RenderFrame via an // observer in case it is deleted during user code execution. diff --git a/shell/renderer/electron_sandboxed_renderer_client.cc b/shell/renderer/electron_sandboxed_renderer_client.cc index ac497e19ab14a..5a3ec07504598 100644 --- a/shell/renderer/electron_sandboxed_renderer_client.cc +++ b/shell/renderer/electron_sandboxed_renderer_client.cc @@ -114,7 +114,7 @@ void InvokeHiddenCallback(v8::Handle context, .ToLocalChecked(); auto callback_value = binding->Get(context, callback_key).ToLocalChecked(); DCHECK(callback_value->IsFunction()); // set by sandboxed_renderer/init.js - auto callback = v8::Handle::Cast(callback_value); + auto callback = callback_value.As(); ignore_result(callback->Call(context, binding, 0, nullptr)); } From 8944bceae2abef4bd1d2ed0fe31707789eed748d Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 12 May 2021 01:49:16 -0700 Subject: [PATCH 018/587] build: merge double space in SHASUM validation logic (#29117) --- script/release/release.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/release/release.js b/script/release/release.js index 49bc8b88c0236..6185019c9e701 100755 --- a/script/release/release.js +++ b/script/release/release.js @@ -409,7 +409,7 @@ async function getShaSumMappingFromUrl (shaSumFileUrl, fileNamePrefix) { const response = await got(shaSumFileUrl); const raw = response.body; return raw.split('\n').map(line => line.trim()).filter(Boolean).reduce((map, line) => { - const [sha, file] = line.split(' '); + const [sha, file] = line.replace(' ', ' ').split(' '); map[file.slice(fileNamePrefix.length)] = sha; return map; }, {}); From ad0d236ea3be6d3a5af17860a73b1f6f07e183dd Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Wed, 12 May 2021 06:02:43 -0700 Subject: [PATCH 019/587] Bump v14.0.0-nightly.20210512 --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 1ac15642141b4..cb2e7289264d9 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -14.0.0-nightly.20210511 \ No newline at end of file +14.0.0-nightly.20210512 \ No newline at end of file diff --git a/package.json b/package.json index 05938627b3678..44fea38886880 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "14.0.0-nightly.20210511", + "version": "14.0.0-nightly.20210512", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index 8af308a9cb7a9..8cd3cdc7d3fc9 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 14,0,0,20210511 - PRODUCTVERSION 14,0,0,20210511 + FILEVERSION 14,0,0,20210512 + PRODUCTVERSION 14,0,0,20210512 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From abdd349e5871590560c3740f30d068f48557fe07 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 12 May 2021 11:40:39 -0700 Subject: [PATCH 020/587] build: use autoninja to print stats (#29111) --- .circleci/config.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 36e6a8848c4b6..49c38ec692e1c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -531,7 +531,7 @@ step-electron-build: &step-electron-build # Regenerate because we just deleted some ninja files gn gen out/Default --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS" fi - ninja -C out/Default electron -j $NUMBER_OF_NINJA_PROCESSES + NINJA_SUMMARIZE_BUILD=1 autoninja -C out/Default electron -j $NUMBER_OF_NINJA_PROCESSES node electron/script/check-symlinks.js step-native-unittests-build: &step-native-unittests-build @@ -923,14 +923,6 @@ step-fix-known-hosts-linux: &step-fix-known-hosts-linux ./src/electron/.circleci/fix-known-hosts.sh fi -step-ninja-summary: &step-ninja-summary - run: - name: Print ninja summary - command: | - set +e - set +o pipefail - python depot_tools/post_build_ninja_summary.py -C src/out/Default || echo Ninja Summary Failed - step-ninja-report: &step-ninja-report store_artifacts: path: src/out/Default/.ninja_log @@ -1536,7 +1528,6 @@ commands: - *step-restore-out-cache - *step-gn-gen-default - *step-electron-build - - *step-ninja-summary - *step-ninja-report - *step-maybe-electron-dist-strip - *step-electron-dist-build From 48959d72f68668a46d647f157c0b7fa8db8ea6be Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 12 May 2021 11:59:20 -0700 Subject: [PATCH 021/587] build: unconditionally include stack_trace.h (#29110) --- patches/chromium/.patches | 1 + ...clude_of_stack_trace_h_unconditional.patch | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 patches/chromium/make_include_of_stack_trace_h_unconditional.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index a2cad75f83e36..e67c971e102cf 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -106,3 +106,4 @@ extend_apply_webpreferences.patch fix_expose_decrementcapturercount_in_web_contents_impl.patch add_setter_for_browsermainloop_result_code.patch revert_roll_clang_llvmorg-13-init-7051-gdad5caa5-2.patch +make_include_of_stack_trace_h_unconditional.patch diff --git a/patches/chromium/make_include_of_stack_trace_h_unconditional.patch b/patches/chromium/make_include_of_stack_trace_h_unconditional.patch new file mode 100644 index 0000000000000..d91176c28591b --- /dev/null +++ b/patches/chromium/make_include_of_stack_trace_h_unconditional.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Samuel Attard +Date: Tue, 11 May 2021 20:41:00 -0700 +Subject: make include of stack_trace.h unconditional + +This conditional include throws goma for a loop for no real reason. +While we work on either upstreaming this or fixing the underlying goma +issue this makes our builds 33% faster during local testing (11m vs 18m). + +diff --git a/base/sequence_checker.h b/base/sequence_checker.h +index 50a548a759c2dc6d79978741a0c803500d53a9f8..cd5049e8bf59c51b890bcc332f9a1c5f0ec339c9 100644 +--- a/base/sequence_checker.h ++++ b/base/sequence_checker.h +@@ -10,9 +10,8 @@ + #include "base/strings/string_piece.h" + #include "build/build_config.h" + +-#if DCHECK_IS_ON() + #include "base/debug/stack_trace.h" +-#endif ++ + + // SequenceChecker is a helper class used to help verify that some methods of a + // class are called sequentially (for thread-safety). It supports thread safety From 432ce94d20fb6f2b265d1b51f5d128bee835d6d1 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 12 May 2021 11:59:30 -0700 Subject: [PATCH 022/587] build: split tests by timing to make it more even (#29121) --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 49c38ec692e1c..7931895ca5337 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1309,16 +1309,16 @@ steps-tests: &steps-tests export LLVM_SYMBOLIZER_PATH=$PWD/third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer export MOCHA_TIMEOUT=180000 echo "Piping output to ASAN_SYMBOLIZE ($ASAN_SYMBOLIZE)" - (cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec-main/*-spec.ts | circleci tests split)) 2>&1 | $ASAN_SYMBOLIZE - (cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.js | circleci tests split)) 2>&1 | $ASAN_SYMBOLIZE + (cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec-main/*-spec.ts | circleci tests split --split-by=timings)) 2>&1 | $ASAN_SYMBOLIZE + (cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.js | circleci tests split --split-by=timings)) 2>&1 | $ASAN_SYMBOLIZE else if [ "$TARGET_ARCH" == "arm64" ] &&[ "`uname`" == "Darwin" ]; then export ELECTRON_SKIP_NATIVE_MODULE_TESTS=true (cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging) (cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging) else - (cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec-main/*-spec.ts | circleci tests split)) - (cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.js | circleci tests split)) + (cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec-main/*-spec.ts | circleci tests split --split-by=timings)) + (cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.js | circleci tests split --split-by=timings)) fi fi - run: From 5ceec9189e543639f12e2639f19ad2d33b3b100e Mon Sep 17 00:00:00 2001 From: Tabish Mahfuz Date: Thu, 13 May 2021 00:32:30 +0530 Subject: [PATCH 023/587] fix: Menu.setApplicationMenu can return a useless array 29088 (#29118) --- lib/browser/api/menu.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/browser/api/menu.ts b/lib/browser/api/menu.ts index 26969d4bb3fb2..00dbe9f7ca25a 100644 --- a/lib/browser/api/menu.ts +++ b/lib/browser/api/menu.ts @@ -177,7 +177,7 @@ Menu.setApplicationMenu = function (menu: MenuType) { bindings.setApplicationMenu(menu); } else { const windows = BaseWindow.getAllWindows(); - return windows.map(w => w.setMenu(menu)); + windows.map(w => w.setMenu(menu)); } }; From c13a523a792bb714bb049257d06c4cd0e6573de7 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Wed, 12 May 2021 12:03:18 -0700 Subject: [PATCH 024/587] chore: remove no-op EnableWebComponentsV0 feature (#29107) --- shell/browser/feature_list.cc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/shell/browser/feature_list.cc b/shell/browser/feature_list.cc index 59bdd50f6f974..618c9b77ad5bb 100644 --- a/shell/browser/feature_list.cc +++ b/shell/browser/feature_list.cc @@ -38,12 +38,6 @@ void InitializeFeatureList() { std::string(",") + net::features::kCookiesWithoutSameSiteMustBeSecure.name; - // https://www.polymer-project.org/blog/2018-10-02-webcomponents-v0-deprecations - // https://chromium-review.googlesource.com/c/chromium/src/+/1869562 - // Any website which uses older WebComponents will fail in without this - // enabled, since Electron does not support origin trials. - enable_features += std::string(",") + "WebComponentsV0Enabled"; - #if !BUILDFLAG(ENABLE_PICTURE_IN_PICTURE) disable_features += std::string(",") + media::kPictureInPicture.name; #endif From 3ad9c27823eda0a0a85bc4ba4480f605df05bd43 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Wed, 12 May 2021 21:04:06 +0200 Subject: [PATCH 025/587] chore: add wg-security as required reviewer for other files with IPC handlers (#29092) --- .github/CODEOWNERS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d10b60555cb04..b47ebf611b95e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -12,4 +12,7 @@ DEPS @electron/wg-upgrades /script/release @electron/wg-releases # Security WG +/lib/browser/devtools.ts @electron/wg-security +/lib/browser/guest-view-manager.ts @electron/wg-security +/lib/browser/guest-window-proxy.ts @electron/wg-security /lib/browser/rpc-server.ts @electron/wg-security From 3869bb2b29ab404135b034d4e2187ec03c7bb5c3 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 12 May 2021 18:14:38 -0700 Subject: [PATCH 026/587] build: dedupe release summary jobs (#29139) --- .circleci/config.yml | 44 +++++++++----------------------------------- 1 file changed, 9 insertions(+), 35 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7931895ca5337..869bc50889d30 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2383,37 +2383,7 @@ jobs: <<: *steps-tests # Layer 4: Summary. - linux-x64-release-summary: - executor: - name: linux-docker - size: medium - environment: - <<: *env-linux-medium - <<: *env-send-slack-notifications - steps: - - *step-maybe-notify-slack-success - - linux-ia32-release-summary: - executor: - name: linux-docker - size: medium - environment: - <<: *env-linux-medium - <<: *env-send-slack-notifications - steps: - - *step-maybe-notify-slack-success - - linux-arm-release-summary: - executor: - name: linux-docker - size: medium - environment: - <<: *env-linux-medium - <<: *env-send-slack-notifications - steps: - - *step-maybe-notify-slack-success - - linux-arm64-release-summary: + linux-release-summary: executor: name: linux-docker size: medium @@ -2635,7 +2605,8 @@ workflows: - linux-x64-verify-ffmpeg: requires: - linux-x64-release - - linux-x64-release-summary: + - linux-release-summary: + name: linux-x64-release-summary requires: - linux-x64-release - linux-x64-release-tests @@ -2648,19 +2619,22 @@ workflows: - linux-ia32-verify-ffmpeg: requires: - linux-ia32-release - - linux-ia32-release-summary: + - linux-release-summary: + name: linux-ia32-release-summary requires: - linux-ia32-release - linux-ia32-release-tests - linux-ia32-verify-ffmpeg - linux-arm-release - - linux-arm-release-summary: + - linux-release-summary: + name: linux-arm-release-summary requires: - linux-arm-release - linux-arm64-release - - linux-arm64-release-summary: + - linux-release-summary: + name: linux-arm64-release-summary requires: - linux-arm64-release From 84cc72c415faaf1e161924c1f0469a476d90de86 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 12 May 2021 18:15:44 -0700 Subject: [PATCH 027/587] build: rename and unify checkout-fast and checkout-and-save-cache (#29138) Checkout fast was slower and checkout-and-save-cache sometimes didn't save a cache... Basically this unifies our checkout-and-save-cache steps under the existing electron-build command so less steps are duplicated and renames checkout-fast and checkout-and-save-cache to be more aligned with what they actually do. * `checkout-fast` --> `checkout-for-workspace`: Checks out a fully synced directory and then persists to a workspace layer * `checkout-and-save-cache` --> `make-src-cache`: Ensures that there is a valid and accurate src cache for this commit. It doesn't always check it out, sometimes it early outs via the src-cache-marker Notes: no-notes --- .circleci/config.yml | 121 ++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 64 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 869bc50889d30..3e24dc65aec96 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1139,49 +1139,6 @@ steps-lint: &steps-lint cd src/electron node script/yarn tsc -p tsconfig.script.json -steps-checkout-and-save-cache: &steps-checkout-and-save-cache - steps: - - *step-checkout-electron - - *step-check-for-doc-only-change - - *step-persist-doc-only-change - - *step-maybe-early-exit-doc-only-change - - *step-depot-tools-get - - *step-depot-tools-add-to-path - - *step-restore-brew-cache - - *step-get-more-space-on-mac - - *step-install-gnutar-on-mac - - - *step-generate-deps-hash - - *step-touch-sync-done - - maybe-restore-portaled-src-cache: - halt-if-successful: true - - *step-maybe-restore-git-cache - - *step-set-git-cache-path - # This sync call only runs if .circle-sync-done is an EMPTY file - - *step-gclient-sync - - store_artifacts: - path: patches - - *step-save-git-cache - # These next few steps reset Electron to the correct commit regardless of which cache was restored - - run: - name: Wipe Electron - command: rm -rf src/electron - - *step-checkout-electron - - *step-run-electron-only-hooks - - *step-generate-deps-hash-cleanly - - *step-mark-sync-done - - *step-minimize-workspace-size-from-checkout - - *step-delete-git-directories - - run: - name: Move src folder to the cross-OS portal - command: | - sudo mkdir -p /var/portal - sudo chown -R $(id -u):$(id -g) /var/portal - mv ./src /var/portal - - *step-save-src-cache - - *step-make-src-cache-marker - - *step-save-src-cache-marker - steps-electron-gn-check: &steps-electron-gn-check steps: - attach_workspace: @@ -1445,6 +1402,12 @@ commands: checkout-and-assume-cache: type: boolean default: false + save-git-cache: + type: boolean + default: false + checkout-to-create-src-cache: + type: boolean + default: false build: type: boolean default: true @@ -1486,13 +1449,18 @@ commands: - when: condition: << parameters.restore-src-cache >> steps: - - maybe-restore-portaled-src-cache + - maybe-restore-portaled-src-cache: + halt-if-successful: << parameters.checkout-to-create-src-cache >> - *step-maybe-restore-git-cache - *step-set-git-cache-path # This sync call only runs if .circle-sync-done is an EMPTY file - *step-gclient-sync - store_artifacts: path: patches + - when: + condition: << parameters.save-git-cache >> + steps: + - *step-save-git-cache # These next few steps reset Electron to the correct commit regardless of which cache was restored - run: name: Wipe Electron @@ -1502,6 +1470,7 @@ commands: - *step-generate-deps-hash-cleanly - *step-mark-sync-done - *step-minimize-workspace-size-from-checkout + - *step-delete-git-directories - when: condition: << parameters.persist-checkout >> steps: @@ -1510,6 +1479,18 @@ commands: paths: - depot_tools - src + - when: + condition: << parameters.checkout-to-create-src-cache >> + steps: + - run: + name: Move src folder to the cross-OS portal + command: | + sudo mkdir -p /var/portal + sudo chown -R $(id -u):$(id -g) /var/portal + mv ./src /var/portal + - *step-save-src-cache + - *step-make-src-cache-marker + - *step-save-src-cache-marker - when: condition: << parameters.build >> @@ -1709,7 +1690,7 @@ jobs: persist-checkout: true restore-src-cache: false - linux-checkout-fast: + linux-checkout-for-workspace: executor: linux-docker environment: <<: *env-linux-2xlarge @@ -1721,12 +1702,18 @@ jobs: checkout: true persist-checkout: true - linux-checkout-and-save-cache: + linux-make-src-cache: executor: linux-docker environment: <<: *env-linux-2xlarge GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' - <<: *steps-checkout-and-save-cache + steps: + - electron-build: + persist: false + build: false + checkout: true + save-git-cache: true + checkout-to-create-src-cache: true linux-checkout-for-native-tests: executor: linux-docker @@ -1767,7 +1754,7 @@ jobs: persist-checkout: true restore-src-cache: false - mac-checkout-fast: + mac-checkout-for-workspace: executor: linux-docker environment: <<: *env-linux-2xlarge @@ -1781,14 +1768,20 @@ jobs: checkout: true persist-checkout: true - mac-checkout-and-save-cache: + mac-make-src-cache: executor: linux-docker environment: <<: *env-linux-2xlarge <<: *env-testing-build <<: *env-macos-build GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac' - <<: *steps-checkout-and-save-cache + steps: + - electron-build: + persist: false + build: false + checkout: true + save-git-cache: true + checkout-to-create-src-cache: true # Layer 2: Builds. linux-x64-testing: @@ -2491,15 +2484,15 @@ workflows: build-linux: when: << pipeline.parameters.run-build-linux >> jobs: - - linux-checkout-fast - - linux-checkout-and-save-cache + - linux-checkout-for-workspace + - linux-make-src-cache - linux-x64-testing - linux-x64-testing-asan - linux-x64-testing-no-run-as-node - linux-x64-testing-gn-check: requires: - - linux-checkout-fast + - linux-checkout-for-workspace - linux-x64-testing-tests: requires: - linux-x64-testing @@ -2529,22 +2522,22 @@ workflows: - linux-arm64-testing - linux-arm64-testing-gn-check: requires: - - linux-checkout-fast + - linux-checkout-for-workspace - ts-compile-doc-change build-mac: when: << pipeline.parameters.run-build-mac >> jobs: - - mac-checkout-fast - - mac-checkout-and-save-cache + - mac-checkout-for-workspace + - mac-make-src-cache - osx-testing-x64: requires: - - mac-checkout-and-save-cache + - mac-make-src-cache - osx-testing-x64-gn-check: requires: - - mac-checkout-fast + - mac-checkout-for-workspace - osx-testing-x64-tests: requires: @@ -2552,7 +2545,7 @@ workflows: - osx-testing-arm64: requires: - - mac-checkout-and-save-cache + - mac-make-src-cache - osx-testing-arm64-tests: filters: @@ -2564,11 +2557,11 @@ workflows: - mas-testing-x64: requires: - - mac-checkout-and-save-cache + - mac-make-src-cache - mas-testing-x64-gn-check: requires: - - mac-checkout-fast + - mac-checkout-for-workspace - mas-testing-x64-tests: requires: @@ -2576,7 +2569,7 @@ workflows: - mas-testing-arm64: requires: - - mac-checkout-and-save-cache + - mac-make-src-cache - mas-testing-arm64-tests: filters: @@ -2595,8 +2588,8 @@ workflows: only: - master jobs: - - linux-checkout-fast - - linux-checkout-and-save-cache + - linux-checkout-for-workspace + - linux-make-src-cache - linux-x64-release - linux-x64-release-tests: From 65ff8d940be978e6a8d355f40db2d15459854951 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 12 May 2021 18:34:29 -0700 Subject: [PATCH 028/587] build: store artifacts in simpler way (#29133) --- .circleci/config.yml | 99 +++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 62 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3e24dc65aec96..7d3f26f1996ca 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -594,11 +594,6 @@ step-electron-dist-build: &step-electron-dist-build fi fi -step-electron-dist-store: &step-electron-dist-store - store_artifacts: - path: src/out/Default/dist.zip - destination: dist.zip - step-electron-maybe-chromedriver-gn-gen: &step-electron-maybe-chromedriver-gn-gen run: name: chromedriver GN gen @@ -627,11 +622,6 @@ step-electron-chromedriver-build: &step-electron-chromedriver-build cp out/chromedriver/chromedriver.zip out/Default fi -step-electron-chromedriver-store: &step-electron-chromedriver-store - store_artifacts: - path: src/out/Default/chromedriver.zip - destination: chromedriver.zip - step-nodejs-headers-build: &step-nodejs-headers-build run: name: Build Node.js headers @@ -639,16 +629,6 @@ step-nodejs-headers-build: &step-nodejs-headers-build cd src ninja -C out/Default third_party/electron_node:headers -step-nodejs-headers-store: &step-nodejs-headers-store - store_artifacts: - path: src/out/Default/gen/node_headers.tar.gz - destination: node_headers.tar.gz - -step-native-unittests-store: &step-native-unittests-store - store_artifacts: - path: src/out/Default/shell_browser_ui_unittests - destination: shell_browser_ui_unittests - step-electron-publish: &step-electron-publish run: name: Publish Electron Dist @@ -739,11 +719,6 @@ step-verify-ffmpeg: &step-verify-ffmpeg cd src python electron/script/verify-ffmpeg.py --source-root "$PWD" --build-dir out/Default --ffmpeg-path out/ffmpeg -step-ffmpeg-store: &step-ffmpeg-store - store_artifacts: - path: src/out/ffmpeg/ffmpeg.zip - destination: ffmpeg.zip - step-verify-mksnapshot: &step-verify-mksnapshot run: name: Verify mksnapshot @@ -812,11 +787,6 @@ step-mksnapshot-build: &step-mksnapshot-build (cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S) fi -step-mksnapshot-store: &step-mksnapshot-store - store_artifacts: - path: src/out/Default/mksnapshot.zip - destination: mksnapshot.zip - step-hunspell-build: &step-hunspell-build run: name: hunspell build @@ -826,11 +796,6 @@ step-hunspell-build: &step-hunspell-build ninja -C out/Default electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES fi -step-hunspell-store: &step-hunspell-store - store_artifacts: - path: src/out/Default/hunspell_dictionaries.zip - destination: hunspell_dictionaries.zip - step-maybe-generate-breakpad-symbols: &step-maybe-generate-breakpad-symbols run: name: Generate breakpad symbols @@ -851,11 +816,6 @@ step-maybe-zip-symbols: &step-maybe-zip-symbols ninja -C out/Default electron:electron_version DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH -step-symbols-store: &step-symbols-store - store_artifacts: - path: src/out/Default/symbols.zip - destination: symbols.zip - step-maybe-cross-arch-snapshot: &step-maybe-cross-arch-snapshot run: name: Generate cross arch snapshot (arm/arm64) @@ -879,11 +839,6 @@ step-maybe-cross-arch-snapshot: &step-maybe-cross-arch-snapshot cp out/Default-mksnapshot-test/*.bin cross-arch-snapshots fi -step-maybe-cross-arch-snapshot-store: &step-maybe-cross-arch-snapshot-store - store_artifacts: - path: src/cross-arch-snapshots - destination: cross-arch-snapshots - step-maybe-trigger-arm-test: &step-maybe-trigger-arm-test run: name: Trigger an arm test on VSTS if applicable @@ -1364,6 +1319,39 @@ commands: rm -rf src mv /var/portal/src ./ fi + + move_and_store_all_artifacts: + steps: + - run: + name: Move all generated artifacts to upload folder + command: | + rm -rf generated_artifacts + mkdir generated_artifacts + mv_if_exist() { + if [ -f "$1" ] || [ -d "$1" ]; then + echo Storing $1 + mv $1 generated_artifacts + else + echo Skipping $1 - It is not present on disk + fi + } + mv_if_exist src/out/Default/dist.zip + mv_if_exist src/out/Default/shell_browser_ui_unittests + mv_if_exist src/out/Default/gen/node_headers.tar.gz + mv_if_exist src/out/Default/symbols.zip + mv_if_exist src/out/Default/mksnapshot.zip + mv_if_exist src/out/Default/chromedriver.zip + mv_if_exist src/out/ffmpeg/ffmpeg.zip + mv_if_exist src/out/Default/hunspell_dictionaries.zip + mv_if_exist src/cross-arch-snapshots + when: always + - store_artifacts: + path: generated_artifacts + destination: ./ + - store_artifacts: + path: generated_artifacts/cross-arch-snapshots + destination: cross-arch-snapshots + checkout-from-cache: steps: - *step-checkout-electron @@ -1512,28 +1500,22 @@ commands: - *step-ninja-report - *step-maybe-electron-dist-strip - *step-electron-dist-build - - *step-electron-dist-store # Native test targets - *step-native-unittests-build - - *step-native-unittests-store # Node.js headers - *step-nodejs-headers-build - - *step-nodejs-headers-store - *step-show-goma-stats # mksnapshot - *step-mksnapshot-build - - *step-mksnapshot-store - *step-maybe-cross-arch-snapshot - - *step-maybe-cross-arch-snapshot-store # chromedriver - *step-electron-maybe-chromedriver-gn-gen - *step-electron-chromedriver-build - - *step-electron-chromedriver-store - when: condition: << parameters.build-nonproprietary-ffmpeg >> @@ -1541,11 +1523,9 @@ commands: # ffmpeg - *step-ffmpeg-gn-gen - *step-ffmpeg-build - - *step-ffmpeg-store # hunspell - *step-hunspell-build - - *step-hunspell-store # Save all data needed for a further tests run. - when: @@ -1558,7 +1538,6 @@ commands: steps: - *step-maybe-generate-breakpad-symbols - *step-maybe-zip-symbols - - *step-symbols-store - when: condition: << parameters.build >> @@ -1580,6 +1559,8 @@ commands: steps: - *step-save-out-cache + - move_and_store_all_artifacts + # Trigger tests on arm hardware if needed - *step-maybe-trigger-arm-test @@ -1624,37 +1605,31 @@ commands: - *step-maybe-generate-breakpad-symbols - *step-maybe-electron-dist-strip - *step-electron-dist-build - - *step-electron-dist-store - *step-maybe-zip-symbols - - *step-symbols-store # mksnapshot - *step-mksnapshot-build - - *step-mksnapshot-store # chromedriver - *step-electron-maybe-chromedriver-gn-gen - *step-electron-chromedriver-build - - *step-electron-chromedriver-store # Node.js headers - *step-nodejs-headers-build - - *step-nodejs-headers-store # ffmpeg - *step-ffmpeg-gn-gen - *step-ffmpeg-build - - *step-ffmpeg-store # hunspell - *step-hunspell-build - - *step-hunspell-store # typescript defs - *step-maybe-generate-typescript-defs # Publish - - *step-electron-publish + - *step-electron-publish + - move_and_store_all_artifacts # List of all jobs. jobs: From c0bfef16a043c56a2a6e059871d9409611fd6680 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 13 May 2021 11:01:36 +0900 Subject: [PATCH 029/587] docs: revise Mac App Store Submission Guide (#28922) * docs: revise Mac App Store Submission Guide * chore: update repo URL Co-authored-by: Mark Lee * chore: apply suggestions from code review Co-authored-by: Erick Zhao * chore: update to match style guide * chore: add cross reference * chore: fix inaccurate places * chore: apply reviews * chore: add link to provisioning profile Co-authored-by: Mark Lee Co-authored-by: Erick Zhao --- .../mac-app-store-submission-guide.md | 287 +++++++++++------- 1 file changed, 182 insertions(+), 105 deletions(-) diff --git a/docs/tutorial/mac-app-store-submission-guide.md b/docs/tutorial/mac-app-store-submission-guide.md index 565d5b1a4d15f..18e0fbfbb8cd4 100644 --- a/docs/tutorial/mac-app-store-submission-guide.md +++ b/docs/tutorial/mac-app-store-submission-guide.md @@ -1,53 +1,111 @@ # Mac App Store Submission Guide -Since v0.34.0, Electron allows submitting packaged apps to the Mac App Store -(MAS). This guide provides information on: how to submit your app and the -limitations of the MAS build. +This guide provides information on: -**Note:** Submitting an app to Mac App Store requires enrolling in the [Apple Developer -Program][developer-program], which costs money. +* How to sign Electron apps on macOS; +* How to submit Electron apps to Mac App Store (MAS); +* The limitations of the MAS build. -## How to Submit Your App +## Requirements -The following steps introduce a simple way to submit your app to Mac App Store. -However, these steps do not ensure your app will be approved by Apple; you -still need to read Apple's [Submitting Your App][submitting-your-app] guide on -how to meet the Mac App Store requirements. +To sign Electron apps, the following tools must be installed first: -### Get Certificate +* Xcode 11 or above. +* The [electron-osx-sign][electron-osx-sign] npm module. -To submit your app to the Mac App Store, you first must get a certificate from -Apple. You can follow these [existing guides][nwjs-guide] on web. +You also have to register an Apple Developer account and join the +[Apple Developer Program][developer-program]. -### Get Team ID +## Sign Electron apps -Before signing your app, you need to know the Team ID of your account. To locate -your Team ID, Sign in to [Apple Developer Center](https://developer.apple.com/account/), -and click Membership in the sidebar. Your Team ID appears in the Membership -Information section under the team name. +Electron apps can be distributed through Mac App Store or outside it. Each way +requires different ways of signing and testing. This guide focuses on +distribution via Mac App Store, but will also mention other methods. -### Sign Your App +The following steps describe how to get the certificates from Apple, how to sign +Electron apps, and how to test them. -After finishing the preparation work, you can package your app by following -[Application Distribution](application-distribution.md), and then proceed to -signing your app. +### Get certificates -First, you have to add a `ElectronTeamID` key to your app's `Info.plist`, which -has your Team ID as its value: +The simplest way to get signing certificates is to use Xcode: -```xml - - - ... - ElectronTeamID - TEAM_ID - - -``` +1. Open Xcode and open "Accounts" preferences; +2. Sign in with your Apple account; +3. Select a team and click "Manage Certificates"; +4. In the lower-left corner of the signing certificates sheet, click the Add + button (+), and add following certificates: + * "Apple Development" + * "Apple Distribution" + +The "Apple Development" certificate is used to sign apps for development and +testing, on machines that have been registered on Apple Developer website. The +method of registration will be described in +[Prepare provisioning profile](#prepare-provisioning-profile). + +Apps signed with the "Apple Development" certificate cannot be submitted to Mac +App Store. For that purpose, apps must be signed with the "Apple Distribution" +certificate instead. But note that apps signed with the "Apple Distribution" +certificate cannot run directly, they must be re-signed by Apple to be able to +run, which will only be possible after being downloaded from the Mac App Store. + +#### Other certificates + +You may notice that there are also other kinds of certificates. -Then, you need to prepare three entitlements files. +The "Developer ID Application" certificate is used to sign apps before +distributing them outside the Mac App Store. -`child.plist`: +The "Developer ID Installer" and "Mac Installer Distribution" certificates are +used to sign the Mac Installer Package instead of the app itself. Most Electron +apps do not use Mac Installer Package so they are generally not needed. + +The full list of certificate types can be found +[here](https://help.apple.com/xcode/mac/current/#/dev80c6204ec). + +Apps signed with "Apple Development" and "Apple Distribution" certificates can +only run under [App Sandbox][app-sandboxing], so they must use the MAS build of +Electron. However, the "Developer ID Application" certificate does not have this +restrictions, so apps signed with it can use either the normal build or the MAS +build of Electron. + +#### Legacy certificate names + +Apple has been changing the names of certificates during past years, you might +encounter them when reading old documentations, and some utilities are still +using one of the old names. + +* The "Apple Distribution" certificate was also named as "3rd Party Mac + Developer Application" and "Mac App Distribution". +* The "Apple Development" certificate was also named as "Mac Developer" and + "Development". + +### Prepare provisioning profile + +If you want to test your app on your local machine before submitting your app to +the Mac App Store, you have to sign the app with the "Apple Development" +certificate with the provisioning profile embedded in the app bundle. + +To [create a provisioning profile](https://help.apple.com/developer-account/#/devf2eb157f8), +you can follow the below steps: + +1. Open the "Certificates, Identifiers & Profiles" page on the + [Apple Developer](https://developer.apple.com/account) website. +2. Add a new App ID for your app in the "Identifiers" page. +3. Register your local machine in the "Devices" page. You can find your + machine's "Device ID" in the "Hardware" page of the "System Information" app. +4. Register a new Provisioning Profile in the "Profiles" page, and download it + to `/path/to/yourapp.provisionprofile`. + +### Enable Apple's App Sandbox + +Apps submitted to the Mac App Store must run under Apple's +[App Sandbox][app-sandboxing], and only the MAS build of Electron can run with +the App Sandbox. The standard darwin build of Electron will fail to launch +when run under App Sandbox. + +When signing the app with `electron-osx-sign`, it will automatically add the +necessary entitlements to your app's entitlements, but if you are using custom +entitlements, you must ensure App Sandbox capacity is added: ```xml @@ -56,13 +114,14 @@ Then, you need to prepare three entitlements files. com.apple.security.app-sandbox - com.apple.security.inherit - ``` -`parent.plist`: +#### Extra steps without `electron-osx-sign` + +If you are signing your app without using `electron-osx-sign`, you must ensure +the app bundle's entitlements have at least following keys: ```xml @@ -79,7 +138,11 @@ Then, you need to prepare three entitlements files. ``` -`loginhelper.plist`: +The `TEAM_ID` should be replaced with your Apple Developer account's Team ID, +and the `your.bundle.id` should be replaced with the App ID of the app. + +And the following entitlements must be added to the binaries and helpers in +the app's bundle: ```xml @@ -88,80 +151,97 @@ Then, you need to prepare three entitlements files. com.apple.security.app-sandbox + com.apple.security.inherit + ``` -You have to replace `TEAM_ID` with your Team ID, and replace `your.bundle.id` -with the Bundle ID of your app. - -And then sign your app with the following script: - -```sh -#!/bin/bash - -# Name of your app. -APP="YourApp" -# The path of your app to sign. -APP_PATH="/path/to/YourApp.app" -# The path to the location you want to put the signed package. -RESULT_PATH="~/Desktop/$APP.pkg" -# The name of certificates you requested. -APP_KEY="3rd Party Mac Developer Application: Company Name (APPIDENTITY)" -INSTALLER_KEY="3rd Party Mac Developer Installer: Company Name (APPIDENTITY)" -# The path of your plist files. -CHILD_PLIST="/path/to/child.plist" -PARENT_PLIST="/path/to/parent.plist" -LOGINHELPER_PLIST="/path/to/loginhelper.plist" - -FRAMEWORKS_PATH="$APP_PATH/Contents/Frameworks" - -codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Electron Framework" -codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib" -codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libnode.dylib" -codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework" -codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper.app/Contents/MacOS/$APP Helper" -codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper.app/" -codesign -s "$APP_KEY" -f --entitlements "$LOGINHELPER_PLIST" "$APP_PATH/Contents/Library/LoginItems/$APP Login Helper.app/Contents/MacOS/$APP Login Helper" -codesign -s "$APP_KEY" -f --entitlements "$LOGINHELPER_PLIST" "$APP_PATH/Contents/Library/LoginItems/$APP Login Helper.app/" -codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$APP_PATH/Contents/MacOS/$APP" -codesign -s "$APP_KEY" -f --entitlements "$PARENT_PLIST" "$APP_PATH" - -productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RESULT_PATH" +And the app bundle's `Info.plist` must include `ElectronTeamID` key, which has +your Apple Developer account's Team ID as its value: + +```xml + + + ... + ElectronTeamID + TEAM_ID + + +``` + +When using `electron-osx-sign` the `ElectronTeamID` key will be added +automatically by extracting the Team ID from the certificate's name. You may +need to manually add this key if `electron-osx-sign` could not find the correct +Team ID. + +### Sign apps for development + +To sign an app that can run on your development machine, you must sign it with +the "Apple Development" certificate and pass the provisioning profile to +`electron-osx-sign`. + +```bash +electron-osx-sign YourApp.app --identity='Apple Development' --provisioning-profile=/path/to/yourapp.provisionprofile ``` -If you are new to app sandboxing under macOS, you should also read through -Apple's [Enabling App Sandbox][enable-app-sandbox] to have a basic idea, then -add keys for the permissions needed by your app to the entitlements files. +If you are signing without `electron-osx-sign`, you must place the provisioning +profile to `YourApp.app/Contents/embedded.provisionprofile`. + +The signed app can only run on the machines that registered by the provisioning +profile, and this is the only way to test the signed app before submitting to +Mac App Store. + +### Sign apps for submitting to the Mac App Store -Apart from manually signing your app, you can also choose to use the -[electron-osx-sign][electron-osx-sign] module to do the job. +To sign an app that will be submitted to Mac App Store, you must sign it with +the "Apple Distribution" certificate. Note that apps signed with this +certificate will not run anywhere, unless it is downloaded from Mac App Store. -#### Sign Native Modules +```bash +electron-osx-sign YourApp.app --identity='Apple Distribution' +``` + +### Sign apps for distribution outside the Mac App Store -Native modules used in your app also need to be signed. If using -electron-osx-sign, be sure to include the path to the built binaries in the -argument list: +If you don't plan to submit the app to Mac App Store, you can sign it the +"Developer ID Application" certificate. In this way there is no requirement on +App Sandbox, and you should use the normal darwin build of Electron if you don't +use App Sandbox. -```sh -electron-osx-sign YourApp.app YourApp.app/Contents/Resources/app/node_modules/nativemodule/build/release/nativemodule +```bash +electron-osx-sign YourApp.app --identity='Developer ID Application' --no-gatekeeper-assess ``` -Also note that native modules may have intermediate files produced which should -not be included (as they would also need to be signed). If you use -[electron-packager][electron-packager] before version 8.1.0, add -`--ignore=.+\.o$` to your build step to ignore these files. Versions 8.1.0 and -later ignore those files by default. +By passing `--no-gatekeeper-assess`, the `electron-osx-sign` will skip the macOS +GateKeeper check as your app usually has not been notarized yet by this step. + + +This guide does not cover [App Notarization][app-notarization], but you might +want to do it otherwise Apple may prevent users from using your app outside Mac +App Store. + +## Submit Apps to the Mac App Store -### Upload Your App +After signing the app with the "Apple Distribution" certificate, you can +continue to submit it to Mac App Store. -After signing your app, you can use Application Loader to upload it to iTunes +However, this guide do not ensure your app will be approved by Apple; you +still need to read Apple's [Submitting Your App][submitting-your-app] guide on +how to meet the Mac App Store requirements. + +### Upload + +The Application Loader should be used to upload the signed app to iTunes Connect for processing, making sure you have [created a record][create-record] before uploading. -### Submit Your App for Review +If you are seeing errors like private APIs uses, you should check if the app is +using the MAS build of Electron. -After these steps, you can [submit your app for review][submit-for-review]. +### Submit for review + +After uploading, you should [submit your app for review][submit-for-review]. ## Limitations of MAS Build @@ -181,13 +261,13 @@ Also, due to the usage of app sandboxing, the resources which can be accessed by the app are strictly limited; you can read [App Sandboxing][app-sandboxing] for more information. -### Additional Entitlements +### Additional entitlements Depending on which Electron APIs your app uses, you may need to add additional -entitlements to your `parent.plist` file to be able to use these APIs from your -app's Mac App Store build. +entitlements to your app's entitlements file. Otherwise, the App Sandbox may +prevent you from using them. -#### Network Access +#### Network access Enable outgoing network connections to allow your app to connect to a server: @@ -261,15 +341,12 @@ Electron uses following cryptographic algorithms: * RIPEMD - [ISO/IEC 10118-3](https://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2010118-3:2004) [developer-program]: https://developer.apple.com/support/compare-memberships/ +[electron-osx-sign]: https://github.com/electron/electron-osx-sign +[app-sandboxing]: https://developer.apple.com/app-sandboxing/ +[app-notarization]: https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution [submitting-your-app]: https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/SubmittingYourApp/SubmittingYourApp.html -[nwjs-guide]: https://github.com/nwjs/nw.js/wiki/Mac-App-Store-%28MAS%29-Submission-Guideline#first-steps -[enable-app-sandbox]: https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html [create-record]: https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/CreatingiTunesConnectRecord.html -[electron-osx-sign]: https://github.com/electron-userland/electron-osx-sign -[electron-packager]: https://github.com/electron/electron-packager [submit-for-review]: https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html -[app-sandboxing]: https://developer.apple.com/app-sandboxing/ [export-compliance]: https://help.apple.com/app-store-connect/#/devc3f64248f -[temporary-exception]: https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/AppSandboxTemporaryExceptionEntitlements.html [user-selected]: https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6 [network-access]: https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW9 From 5233feaef9d60c67faf1446d62aa88dd2c0d0f74 Mon Sep 17 00:00:00 2001 From: PalmerAL Date: Wed, 12 May 2021 21:12:08 -0500 Subject: [PATCH 030/587] docs: Improve description of findInPage options (#29077) * docs: improve webContents.findInPage description * docs: improve webview.findInPage description --- docs/api/web-contents.md | 3 +-- docs/api/webview-tag.md | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index 2291b8ffa80af..98188c837e098 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -1281,8 +1281,7 @@ Inserts `text` to the focused element. * `text` String - Content to be searched, must not be empty. * `options` Object (optional) * `forward` Boolean (optional) - Whether to search forward or backward, defaults to `true`. - * `findNext` Boolean (optional) - Whether the operation is first request or a follow up, - defaults to `false`. + * `findNext` Boolean (optional) - Whether to begin a new text finding session with this request. Should be `true` for initial requests, and `false` for follow-up requests. Defaults to `false`. * `matchCase` Boolean (optional) - Whether search should be case-sensitive, defaults to `false`. diff --git a/docs/api/webview-tag.md b/docs/api/webview-tag.md index c1df1583e5be3..478c854fc7a76 100644 --- a/docs/api/webview-tag.md +++ b/docs/api/webview-tag.md @@ -506,8 +506,7 @@ Inserts `text` to the focused element. * `text` String - Content to be searched, must not be empty. * `options` Object (optional) * `forward` Boolean (optional) - Whether to search forward or backward, defaults to `true`. - * `findNext` Boolean (optional) - Whether the operation is first request or a follow up, - defaults to `false`. + * `findNext` Boolean (optional) - Whether to begin a new text finding session with this request. Should be `true` for initial requests, and `false` for follow-up requests. Defaults to `false`. * `matchCase` Boolean (optional) - Whether search should be case-sensitive, defaults to `false`. From 5e1d50d02007ba26b39ca418880cc516a520748f Mon Sep 17 00:00:00 2001 From: Ondreas <74183220+OndreasCZ@users.noreply.github.com> Date: Thu, 13 May 2021 04:12:35 +0200 Subject: [PATCH 031/587] docs: update "list" of docs languages in readme.md file (#29073) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 84646336ed39f..8928f4a26ff9b 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![devDependency Status](https://david-dm.org/electron/electron/dev-status.svg)](https://david-dm.org/electron/electron?type=dev) [![Electron Discord Invite](https://img.shields.io/discord/745037351163527189?color=%237289DA&label=chat&logo=discord&logoColor=white)](https://discord.com/invite/electron) -:memo: Available Translations: 🇨🇳 🇹🇼 🇧🇷 🇪🇸 🇰🇷 🇯🇵 🇷🇺 🇫🇷 🇹🇭 🇳🇱 🇹🇷 🇮🇩 🇺🇦 🇨🇿 🇮🇹 🇵🇱. +:memo: Available Translations: 🇨🇳 🇧🇷 🇪🇸 🇯🇵 🇷🇺 🇫🇷 🇺🇸 🇩🇪. View these docs in other languages at [electron/i18n](https://github.com/electron/i18n/tree/master/content/). The Electron framework lets you write cross-platform desktop applications From e1b58182b9aa6430ed31a42a39229b2cb52bd1ba Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 12 May 2021 23:42:16 -0700 Subject: [PATCH 032/587] build: save the ninja log for release builds too (#29140) --- .circleci/config.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7d3f26f1996ca..a0d38a7052f98 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -532,6 +532,7 @@ step-electron-build: &step-electron-build gn gen out/Default --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS" fi NINJA_SUMMARIZE_BUILD=1 autoninja -C out/Default electron -j $NUMBER_OF_NINJA_PROCESSES + cp out/Default/.ninja_log out/electron_ninja_log node electron/script/check-symlinks.js step-native-unittests-build: &step-native-unittests-build @@ -878,11 +879,6 @@ step-fix-known-hosts-linux: &step-fix-known-hosts-linux ./src/electron/.circleci/fix-known-hosts.sh fi -step-ninja-report: &step-ninja-report - store_artifacts: - path: src/out/Default/.ninja_log - destination: ninja_log - # Checkout Steps step-generate-deps-hash: &step-generate-deps-hash run: @@ -1344,6 +1340,7 @@ commands: mv_if_exist src/out/ffmpeg/ffmpeg.zip mv_if_exist src/out/Default/hunspell_dictionaries.zip mv_if_exist src/cross-arch-snapshots + mv_if_exist src/out/electron_ninja_log when: always - store_artifacts: path: generated_artifacts @@ -1497,7 +1494,6 @@ commands: - *step-restore-out-cache - *step-gn-gen-default - *step-electron-build - - *step-ninja-report - *step-maybe-electron-dist-strip - *step-electron-dist-build From 4b70ccde26c057a3376c52eb563431943ebc3be6 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Thu, 13 May 2021 00:23:00 -0700 Subject: [PATCH 033/587] build: make patch auto fixes come from PatchUp rather than Electron Bot (#29153) --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a0d38a7052f98..af1ce1f79b597 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -272,7 +272,7 @@ step-gclient-sync: &step-gclient-sync if ! git diff-index --quiet HEAD --; then # There are changes to the patches. Make a git commit with the updated patches git add patches - GIT_COMMITTER_NAME="Electron Bot" GIT_COMMITTER_EMAIL="electron@github.com" git commit -m "update patches" --author="Electron Bot " + GIT_COMMITTER_NAME="PatchUp" GIT_COMMITTER_EMAIL="73610968+patchup[bot]@users.noreply.github.com" git commit -m "chore: update patches" --author="PatchUp <73610968+patchup[bot]@users.noreply.github.com>" # Export it mkdir -p ../../patches git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch From 9cf71d72abf97c7583b200063915aa9c8fb23e15 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 13 May 2021 06:04:22 -0700 Subject: [PATCH 034/587] Bump v14.0.0-nightly.20210513 --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index cb2e7289264d9..13c7495c8b0c3 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -14.0.0-nightly.20210512 \ No newline at end of file +14.0.0-nightly.20210513 \ No newline at end of file diff --git a/package.json b/package.json index 44fea38886880..7dedf13651ea4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "14.0.0-nightly.20210512", + "version": "14.0.0-nightly.20210513", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index 8cd3cdc7d3fc9..2325ee5d7b197 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 14,0,0,20210512 - PRODUCTVERSION 14,0,0,20210512 + FILEVERSION 14,0,0,20210513 + PRODUCTVERSION 14,0,0,20210513 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From 2eb3bddb05b6efc92e36c22ed55c37021d84276a Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 13 May 2021 18:21:36 -0700 Subject: [PATCH 035/587] chore: bump chromium to 92.0.4505.0 (master) (#29058) * chore: bump chromium in DEPS to 92.0.4500.2 * resolve conflicts * update patches * chore: cherry-pick 82434206f306 from chromium (#29060) * fix patch * chore: bump chromium in DEPS to 92.0.4501.0 * chore: bump chromium in DEPS to 92.0.4502.0 * chore: bump chromium in DEPS to 92.0.4503.0 * chore: update patches * 2869869: [Code Health] Refactor ListValue::Insert in gpu compositor https://chromium-review.googlesource.com/c/chromium/src/+/2869869 * 2877924: Separate InkDropHost from InkDropHostView https://chromium-review.googlesource.com/c/chromium/src/+/2877924 * chore: bump chromium in DEPS to 92.0.4504.0 * update patches * Fixup for Separate InkDropHost from InkDropHostView https://chromium-review.googlesource.com/c/chromium/src/+/2877924 * 2873469: Compute hashes of .pak files during the build, and check it at runtime. https://chromium-review.googlesource.com/c/chromium/src/+/2873469 * 2874397: Remove flag to disable microtasks scope consistency checks https://chromium-review.googlesource.com/c/v8/v8/+/2874397 * 2881471: Remove unneeded trace_event.h includes in headers. https://chromium-review.googlesource.com/c/chromium/src/+/2881471 * 2844717: [Keyboard Tooltip] Rename RWHV*::SetTooltipText to UpdateTooltipUnderCursor https://chromium-review.googlesource.com/c/chromium/src/+/2844717 * chore: bump chromium in DEPS to 92.0.4505.0 * chore: update patches * 2883887: Retire ScopedObserver in /chrome/browser/predictors. https://chromium-review.googlesource.com/c/chromium/src/+/2883887 * 2883694: Retire ScopedObserver in /chrome/browser. https://chromium-review.googlesource.com/c/chromium/src/+/2883694 * fixup after merge * fixup: Remove flag to disable microtasks scope consistency checks * Temporarily disable setcallhandler-test.js nan test This test should be renabled once https://github.com/electron/electron/pull/29028 lands * Use gin_helper::MicrotasksScope instead of v8::MicrotasksScope * chore: bump chromium in DEPS to 92.0.4506.0 * update patches * Revert "update patches" This reverts commit 333ec0d4c205bd3cbee28d2bc3d068871dbb900a. * Revert "chore: bump chromium in DEPS to 92.0.4506.0" This reverts commit 2bd52f8cd89b173c8b15a61d74fa7539cdbf574b. * Fixup: Use gin_helper::MicrotasksScope instead of v8::MicrotasksScope * Fixup: Use gin_helper::MicrotasksScope instead of v8::MicrotasksScope Co-authored-by: Jeremy Rose Co-authored-by: Jeremy Rose Co-authored-by: John Kleinschmidt Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> --- DEPS | 2 +- build/args/all.gn | 2 + patches/chromium/.patches | 2 +- .../add_didinstallconditionalfeatures.patch | 12 ++-- patches/chromium/add_realloc.patch | 4 +- ...tter_for_browsermainloop_result_code.patch | 4 +- ..._secondary_label_via_simplemenumodel.patch | 10 +-- ...ink-worker-enable-csp-in-file-scheme.patch | 4 +- patches/chromium/blink_local_frame.patch | 6 +- patches/chromium/can_create_window.patch | 26 ++++---- ..._of_enable_pak_file_integrity_checks.patch | 34 ++++++++++ ..._v8_initialization_isolate_callbacks.patch | 2 +- ...screationoverridden_with_full_params.patch | 20 +++--- ...esources_not_chrome_for_spellchecker.patch | 6 +- ...ay_lock_the_protocol_scheme_registry.patch | 2 +- patches/chromium/disable-redraw-lock.patch | 8 +-- .../disable_color_correct_rendering.patch | 24 +++---- .../disable_compositor_recycling.patch | 2 +- patches/chromium/disable_hidden.patch | 8 +-- patches/chromium/disable_unload_metrics.patch | 2 +- ...ll_getwebframe_-_view_when_get_blink.patch | 4 +- .../chromium/enable_reset_aspect_ratio.patch | 4 +- .../extend_apply_webpreferences.patch | 4 +- ..._scheduler_throttling_per_renderview.patch | 16 ++--- ...to_add_observers_on_created_hunspell.patch | 2 +- ...ntcapturercount_in_web_contents_impl.patch | 6 +- ..._properly_honor_printing_page_ranges.patch | 2 +- patches/chromium/frame_host_manager.patch | 8 +-- .../chromium/gritsettings_resource_ids.patch | 4 +- .../mas_disable_remote_accessibility.patch | 16 ++--- patches/chromium/mas_no_private_api.patch | 14 ++-- .../chromium/notification_provenance.patch | 6 +- patches/chromium/printing.patch | 64 +++++++++---------- ...put_back_deleted_colors_for_autofill.patch | 14 ++-- ...r_changes_to_the_webcontentsobserver.patch | 10 +-- .../render_widget_host_view_base.patch | 2 +- patches/chromium/resource_file_conflict.patch | 6 +- ...ove_contentrendererclient_shouldfork.patch | 4 +- ...ang_llvmorg-13-init-7051-gdad5caa5-2.patch | 25 -------- patches/chromium/scroll_bounce_flag.patch | 4 +- .../support_mixed_sandbox_with_zygote.patch | 2 +- patches/chromium/web_contents.patch | 8 +-- .../worker_context_will_destroy.patch | 16 ++--- ...feat_add_hook_to_notify_script_ready.patch | 12 ++-- patches/v8/add_realloc.patch | 4 +- patches/v8/build_gn.patch | 8 +-- patches/v8/dcheck.patch | 8 +-- ...export_private_v8_symbols_on_windows.patch | 4 +- patches/v8/expose_mksnapshot.patch | 4 +- ...ed_attirbute_for_older_msvc_versions.patch | 6 +- script/nan-spec-runner.js | 1 + shell/browser/api/electron_api_app.cc | 4 +- .../api/electron_api_content_tracing.cc | 1 + shell/browser/file_select_helper.cc | 5 +- shell/browser/file_select_helper.h | 6 +- .../osr/osr_render_widget_host_view.cc | 3 +- .../browser/osr/osr_render_widget_host_view.h | 2 +- shell/browser/ui/views/submenu_button.cc | 6 +- shell/common/gin_helper/microtasks_scope.cc | 7 +- shell/common/gin_helper/microtasks_scope.h | 4 +- shell/common/node_bindings.cc | 2 + shell/common/v8_value_serializer.cc | 3 + .../api/electron_api_spell_check_client.cc | 4 ++ .../electron_render_frame_observer.cc | 5 ++ .../electron_sandboxed_renderer_client.cc | 7 ++ shell/renderer/web_worker_observer.cc | 3 + 66 files changed, 286 insertions(+), 244 deletions(-) create mode 100644 patches/chromium/chore_allow_overriding_of_enable_pak_file_integrity_checks.patch delete mode 100644 patches/chromium/revert_roll_clang_llvmorg-13-init-7051-gdad5caa5-2.patch diff --git a/DEPS b/DEPS index 10d0793481209..d31cff317dca0 100644 --- a/DEPS +++ b/DEPS @@ -14,7 +14,7 @@ gclient_gn_args = [ vars = { 'chromium_version': - '92.0.4499.0', + '92.0.4505.0', 'node_version': 'v14.16.1', 'nan_version': diff --git a/build/args/all.gn b/build/args/all.gn index 9ac1f938c4402..9bcddf2036244 100644 --- a/build/args/all.gn +++ b/build/args/all.gn @@ -28,3 +28,5 @@ libcxx_abi_unstable = false enable_pseudolocales = false is_cfi = false + +enable_pak_file_integrity_checks = false diff --git a/patches/chromium/.patches b/patches/chromium/.patches index e67c971e102cf..40231ea458a7b 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -105,5 +105,5 @@ fix_add_check_for_sandbox_then_result.patch extend_apply_webpreferences.patch fix_expose_decrementcapturercount_in_web_contents_impl.patch add_setter_for_browsermainloop_result_code.patch -revert_roll_clang_llvmorg-13-init-7051-gdad5caa5-2.patch +chore_allow_overriding_of_enable_pak_file_integrity_checks.patch make_include_of_stack_trace_h_unconditional.patch diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index f3f3650587f97..418be3156175e 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -23,10 +23,10 @@ index fa860cddc22da75967796674e9b467f8c726a368..730c7ddd2838eb50f6f5f0676f0f16f7 int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 50504820638367fc32e42583edad4f68d62a2526..abcfd464b8a92f65623bc4527123cc75ad38b712 100644 +index 93c52c64173085b28e2391b59b089edb1f67777b..c2b9b96589183d1a4fae8593e7994a10baa5e29b 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4146,6 +4146,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, +@@ -4130,6 +4130,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, observer.DidCreateScriptContext(context, world_id); } @@ -40,10 +40,10 @@ index 50504820638367fc32e42583edad4f68d62a2526..abcfd464b8a92f65623bc4527123cc75 int world_id) { for (auto& observer : observers_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index e938059c6eeec92b4041cc136ffc1f341741c0f3..e517f7478c3dbacf6bf41dcc39476bc8609bddb6 100644 +index 45dce82bb83995978092e78e1abb4a7d7a681a2a..308cc3f5b233efcade9eec86f5414e914c4ef9f7 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -578,6 +578,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -575,6 +575,8 @@ class CONTENT_EXPORT RenderFrameImpl blink::WebLocalFrameClient::LazyLoadBehavior lazy_load_behavior) override; void DidCreateScriptContext(v8::Local context, int world_id) override; @@ -123,10 +123,10 @@ index 577a27be65807a23ac8a4f082999614122449281..1d39f184cec039486355f4e08854aa16 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 e20a85d63590b3f9a6ab09cf7ccb4b9b9f43bba8..c8c4ba944f038c00e6aa9a679f8e12b1877d38fa 100644 +index 4ff7af209929a8297b276ddfd2ebaa0b0200cf22..b60f9a5d78a486a7f5b69b98ff2e7d4ca07c98f1 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.h +++ b/third_party/blink/renderer/core/loader/empty_clients.h -@@ -344,6 +344,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { +@@ -350,6 +350,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { void DidCreateScriptContext(v8::Local, int32_t world_id) override {} diff --git a/patches/chromium/add_realloc.patch b/patches/chromium/add_realloc.patch index 7ee39ca5ab0fe..9ff226f687479 100644 --- a/patches/chromium/add_realloc.patch +++ b/patches/chromium/add_realloc.patch @@ -39,10 +39,10 @@ index aef43319737398848dc40a3ab2d9e959ebb399f6..3c6dbc1ec10666b35d68e107a7a694c5 GIN_EXPORT static ArrayBufferAllocator* SharedInstance(); 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 54c0c689bcf1f68ebc11fc76f73d36c2439c7a0d..04fc1864937150f19945ec06a28f0601be286d0d 100644 +index c79fd01a887a54eed3868642b4e8d5a4b050ecca..d91c4344145f5ff2b081a5a9a3e931e9746a07af 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -@@ -698,6 +698,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { +@@ -708,6 +708,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { return result; } diff --git a/patches/chromium/add_setter_for_browsermainloop_result_code.patch b/patches/chromium/add_setter_for_browsermainloop_result_code.patch index 16daeb5578427..c56e181aa21b6 100644 --- a/patches/chromium/add_setter_for_browsermainloop_result_code.patch +++ b/patches/chromium/add_setter_for_browsermainloop_result_code.patch @@ -10,10 +10,10 @@ valid use cases for setting custom exit codes of the main loop. This exposes a simple setter that embedders can call. diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h -index 69b091698f04209af113af6c586ec8615ff52d41..c54ad51b6cf4b48c522ae79091697b5efa50673c 100644 +index 240fc57ad29fc684d802e4601b72cf3373d69c6b..7123c74af7f4077ecfa451539d49f8e232150317 100644 --- a/content/browser/browser_main_loop.h +++ b/content/browser/browser_main_loop.h -@@ -168,6 +168,10 @@ class CONTENT_EXPORT BrowserMainLoop { +@@ -166,6 +166,10 @@ class CONTENT_EXPORT BrowserMainLoop { int GetResultCode() const { return result_code_; } diff --git a/patches/chromium/allow_setting_secondary_label_via_simplemenumodel.patch b/patches/chromium/allow_setting_secondary_label_via_simplemenumodel.patch index 4cbb977597305..b1fd664d1855e 100644 --- a/patches/chromium/allow_setting_secondary_label_via_simplemenumodel.patch +++ b/patches/chromium/allow_setting_secondary_label_via_simplemenumodel.patch @@ -6,7 +6,7 @@ Subject: Allow setting secondary label via SimpleMenuModel Builds on https://chromium-review.googlesource.com/c/chromium/src/+/2208976 diff --git a/ui/base/models/simple_menu_model.cc b/ui/base/models/simple_menu_model.cc -index 016dab7776139c8ea7eab60569f3e5c5aeff8014..022225c4c02300667c58dc61165cc19d68eb4ca7 100644 +index 976a45c49c810b228e7576926979001593de8dcb..2975dcd4a946edd7100789a1c3d8e3637d2bd86c 100644 --- a/ui/base/models/simple_menu_model.cc +++ b/ui/base/models/simple_menu_model.cc @@ -53,6 +53,11 @@ std::u16string SimpleMenuModel::Delegate::GetLabelForCommandId( @@ -33,7 +33,7 @@ index 016dab7776139c8ea7eab60569f3e5c5aeff8014..022225c4c02300667c58dc61165cc19d void SimpleMenuModel::SetMinorText(int index, const std::u16string& minor_text) { items_[ValidateItemIndex(index)].minor_text = minor_text; -@@ -377,6 +387,12 @@ std::u16string SimpleMenuModel::GetLabelAt(int index) const { +@@ -382,6 +392,12 @@ std::u16string SimpleMenuModel::GetLabelAt(int index) const { return items_[ValidateItemIndex(index)].label; } @@ -47,7 +47,7 @@ index 016dab7776139c8ea7eab60569f3e5c5aeff8014..022225c4c02300667c58dc61165cc19d return items_[ValidateItemIndex(index)].minor_text; } diff --git a/ui/base/models/simple_menu_model.h b/ui/base/models/simple_menu_model.h -index 5ab6c93bb3599b72952bdc8226e6c473477b7315..1132ec877298d5d5812547ffa12a4be2f2708dc4 100644 +index 6127fb6a161598a58d08fb68f171fd02b9cbb6a7..5297195cb7128106a376818ade66daf0a5f6b868 100644 --- a/ui/base/models/simple_menu_model.h +++ b/ui/base/models/simple_menu_model.h @@ -50,6 +50,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { @@ -68,7 +68,7 @@ index 5ab6c93bb3599b72952bdc8226e6c473477b7315..1132ec877298d5d5812547ffa12a4be2 // Sets the minor text for the item at |index|. void SetMinorText(int index, const std::u16string& minor_text); -@@ -185,6 +189,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { +@@ -188,6 +192,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { ui::MenuSeparatorType GetSeparatorTypeAt(int index) const override; int GetCommandIdAt(int index) const override; std::u16string GetLabelAt(int index) const override; @@ -76,7 +76,7 @@ index 5ab6c93bb3599b72952bdc8226e6c473477b7315..1132ec877298d5d5812547ffa12a4be2 std::u16string GetMinorTextAt(int index) const override; ImageModel GetMinorIconAt(int index) const override; bool IsItemDynamicAt(int index) const override; -@@ -222,6 +227,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { +@@ -226,6 +231,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { int command_id = 0; ItemType type = TYPE_COMMAND; std::u16string label; diff --git a/patches/chromium/blink-worker-enable-csp-in-file-scheme.patch b/patches/chromium/blink-worker-enable-csp-in-file-scheme.patch index 06faed7ea503d..06a28c8b7e45d 100644 --- a/patches/chromium/blink-worker-enable-csp-in-file-scheme.patch +++ b/patches/chromium/blink-worker-enable-csp-in-file-scheme.patch @@ -6,10 +6,10 @@ Subject: blink-worker-enable-csp-in-file-scheme.patch This allows file:// URLs in workers to have a CSP. diff --git a/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc b/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc -index ac6db8ff4afbfef3e7be4eb44cc1d1cb9e1cb374..ee28560023fc488d88a89623203132f2d5a1df89 100644 +index 405467d3a4ddfa05532ab424d35883ece1c4f13d..cc634245d44bc8b1caf645766be40905f9c9f5d3 100644 --- a/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc +++ b/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc -@@ -366,7 +366,6 @@ void WorkerClassicScriptLoader::ProcessContentSecurityPolicy( +@@ -365,7 +365,6 @@ void WorkerClassicScriptLoader::ProcessContentSecurityPolicy( // document (which is implemented in WorkerMessagingProxy, and // m_contentSecurityPolicy should be left as nullptr to inherit the policy). if (!response.CurrentRequestUrl().ProtocolIs("blob") && diff --git a/patches/chromium/blink_local_frame.patch b/patches/chromium/blink_local_frame.patch index ebf2900139118..1c10fa08c85f6 100644 --- a/patches/chromium/blink_local_frame.patch +++ b/patches/chromium/blink_local_frame.patch @@ -49,10 +49,10 @@ index fd8c91839e3fcbd2ecc19a45008482fddee5c6cc..78bd9c5cf454faa59b2d3b3e1111fb3b // 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 fe637b885d4791e30410715f815ef0abf2564c6e..68c02f04cdf8523ccc6280dabd55bb05a35b6407 100644 +index 1aada3229aaaafa38c90e2e22311b2601d9b2097..d2df69ff400af2d1cd1f3a4aa93bc5f48a5595f8 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc -@@ -780,10 +780,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { +@@ -781,10 +781,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { } DCHECK(!view_ || !view_->IsAttached()); @@ -63,7 +63,7 @@ index fe637b885d4791e30410715f815ef0abf2564c6e..68c02f04cdf8523ccc6280dabd55bb05 if (!Client()) return false; -@@ -829,6 +825,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { +@@ -830,6 +826,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { DCHECK(!view_->IsAttached()); Client()->WillBeDetached(); diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 031e9c518f5ed..d25837daeb0a1 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 3925d8f312ea132e0edbc610d61588af5686e2d4..f2f31f6f954b560a3c3e31dc2233292b00c21b80 100644 +index a192ba52723032cbe6daaff20a64f278a1967777..d8200f463443f11dafd84f4620b9c7f109912cdd 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -5586,6 +5586,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -5718,6 +5718,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 3925d8f312ea132e0edbc610d61588af5686e2d4..f2f31f6f954b560a3c3e31dc2233292b &no_javascript_access); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 24f086e5798930a888ca2f78d9c36c93e046261b..b1cbf6f76c2032dd3a6c90f1c9cf97ccaa734bec 100644 +index 92ed79fc561b0789ab164b2c28a7860159c60c38..aed19709076c8b3d0df42b4dcb994f8bbe2d6026 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -3649,6 +3649,14 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( +@@ -3650,6 +3650,14 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( } auto* new_contents_impl = new_contents.get(); @@ -39,7 +39,7 @@ index 24f086e5798930a888ca2f78d9c36c93e046261b..b1cbf6f76c2032dd3a6c90f1c9cf97cc new_contents_impl->GetController().SetSessionStorageNamespace( partition_id, session_storage_namespace); -@@ -3691,12 +3699,6 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( +@@ -3692,12 +3700,6 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( AddWebContentsDestructionObserver(new_contents_impl); } @@ -53,10 +53,10 @@ index 24f086e5798930a888ca2f78d9c36c93e046261b..b1cbf6f76c2032dd3a6c90f1c9cf97cc 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 3344db32aeb41a4c00645e372fee5e52bc909aea..3e3772f93c0d253c111528d9889e662baf6281bc 100644 +index 6907ba65bfe130b9b1b0490b13fdc5923830d39d..c7854c3306bdd960bb6a76733f235c633449ecb8 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom -@@ -457,6 +457,10 @@ struct CreateNewWindowParams { +@@ -455,6 +455,10 @@ struct CreateNewWindowParams { // The impression associated with the navigation in the new window, if // one is specified. Impression? impression; @@ -81,10 +81,10 @@ index 338c0091490bd3e3d4517cf815fd3caf253d2164..2361f649d7c9cfb7dd8326ae682f4486 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 802e4f2875769f78365b23edb4edf7ef8a8b6af0..5622d3d9852edee2b2f49f87606f334d0fa2541e 100644 +index ccd0247f99eeef26de3b2f3206fd66fc4f690546..0e19f40fdd18746dee8813bf403a7759f6c0f46d 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -157,6 +157,7 @@ class NetworkService; +@@ -158,6 +158,7 @@ class NetworkService; class TrustedURLLoaderHeaderClient; } // namespace mojom struct ResourceRequest; @@ -92,7 +92,7 @@ index 802e4f2875769f78365b23edb4edf7ef8a8b6af0..5622d3d9852edee2b2f49f87606f334d } // namespace network namespace sandbox { -@@ -925,6 +926,8 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -928,6 +929,8 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -150,7 +150,7 @@ index b1cfa654259d431adfada00a00f9bfc8ae5ab292..484d36de2ac0ef3b1d19bbd0d6c79db8 // typically happens when popups are created. virtual void WebContentsCreated(WebContents* source_contents, diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc -index bb60e5d711ab45f89c401f4c053e453a324f6881..fbe1312f13f799b4c1b3dbc663fde81fe64162c8 100644 +index 2f302654b22364e0579310571bed92c716eed342..d094fb4cf201305ce14f07eac5840e5a492c8736 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -27,6 +27,7 @@ @@ -220,10 +220,10 @@ index 888a2a26e67dae0d42353e5e906d26ea30c66cb3..7e48698a4b18d4d805667b93f7996252 } // 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 c02bf531f7f7c82642710c0286a366f241f13797..6a9e101c7b56c9192cddcd7d14c414ab46a406ba 100644 +index fae11495f6e2925db0dca463eac6432e3ad70cf7..6116660721387cb4dee3f84be99b0f7f7ed72585 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc -@@ -1991,6 +1991,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, +@@ -1976,6 +1976,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, WebWindowFeatures window_features = GetWindowFeaturesFromString(features, incumbent_window); diff --git a/patches/chromium/chore_allow_overriding_of_enable_pak_file_integrity_checks.patch b/patches/chromium/chore_allow_overriding_of_enable_pak_file_integrity_checks.patch new file mode 100644 index 0000000000000..2a20d4243be23 --- /dev/null +++ b/patches/chromium/chore_allow_overriding_of_enable_pak_file_integrity_checks.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: John Kleinschmidt +Date: Tue, 11 May 2021 21:35:39 -0400 +Subject: chore: allow overriding of enable_pak_file_integrity_checks + +enable_pak_file_integrity_checks is not currently overridable +but Electron does not need to run this. + +diff --git a/chrome/browser/buildflags.gni b/chrome/browser/buildflags.gni +index 8c19e707371c7ad4fbcd46d58b147de3bfc89790..17c82c078a2beb8146c39290aa37703c7a3b07f2 100644 +--- a/chrome/browser/buildflags.gni ++++ b/chrome/browser/buildflags.gni +@@ -21,11 +21,13 @@ declare_args() { + # app_session_service and some not. + enable_app_session_service = + !(is_chromeos_lacros || is_chromecast || is_android) +-} + +-# If true, the resource .pak files will be hashed and the digest will be +-# embedded in the binary and checked at run-time. This is incompatible with +-# enable_resource_allowlist_generation on Windows because it creates a circular +-# dependency with chrome_dll. +-enable_pak_file_integrity_checks = +- !(enable_resource_allowlist_generation && is_win) && !is_android ++ ++ # If true, the resource .pak files will be hashed and the digest will be ++ # embedded in the binary and checked at run-time. This is incompatible with ++ # enable_resource_allowlist_generation on Windows because it creates a circular ++ # dependency with chrome_dll. ++ enable_pak_file_integrity_checks = ++ !(enable_resource_allowlist_generation && is_win) && !is_android ++ ++} +\ No newline at end of file diff --git a/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch b/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch index dc67d19dfff05..f0da1d0a070bb 100644 --- a/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch +++ b/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch @@ -9,7 +9,7 @@ we're running with contextIsolation enabled, we should be falling back to Blink's logic. This will be upstreamed in some form. 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 04fc1864937150f19945ec06a28f0601be286d0d..a3cc80e6a2751128a01fd5d027b4bd46c21f9fab 100644 +index d91c4344145f5ff2b081a5a9a3e931e9746a07af..9bf3523e1a307a469129df6e48f04df051f5003f 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc @@ -449,7 +449,7 @@ CodeGenerationCheckCallbackInMainThread(v8::Local context, diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index 273766f0c76ea..9d0b171f696c8 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -126,10 +126,10 @@ index 07014765f33bdddebcc5bc32a2713d6523faf394..f866f69f9c810d89f1a0e9e4952293f6 content::WebContents* source, const content::OpenURLParams& params) override; 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 33f1168f834d138aefb190b7718271d6962b3532..aeb30a22349e0682586bd1bad20dc5e21fd0b08d 100644 +index ef84e04d628fb5cdbaf8fbbf84af3bf23e00c522..f1ee0bee5bfd08227a29498f8410d5d3582e02c3 100644 --- a/chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.cc +++ b/chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.cc -@@ -65,8 +65,7 @@ class ChromeKeyboardContentsDelegate : public content::WebContentsDelegate, +@@ -66,8 +66,7 @@ class ChromeKeyboardContentsDelegate : public content::WebContentsDelegate, content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -140,10 +140,10 @@ index 33f1168f834d138aefb190b7718271d6962b3532..aeb30a22349e0682586bd1bad20dc5e2 } diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index 6a2ea7c4fd52fe2ae00c58706eddf0929cfca0cc..7e9e5a84af0b7b75041c2a2c42f66f80c2b7d61b 100644 +index 77cb5676b4e6b8d0d9b65cbf0979048822f796e9..b525c5f17d62a4d97ad425e1fc06de82ad706cb0 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc -@@ -1792,12 +1792,11 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -1793,12 +1793,11 @@ bool Browser::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -264,10 +264,10 @@ index c5c5a7b63b5b3b62a9517cbef3ae23ce57a3c89c..4f1b7e88d6d2ae89a60311c8aeb1fcee void AddNewContents(content::WebContents* source, std::unique_ptr new_contents, diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 54fce2b0b6da947473e8725bf97816de9f51b12a..aa50664e5fcb88ac72118ba5d354f835d427b6fd 100644 +index 9ce5f2eed289ed9d427abddde098bfcd09293db4..37ccef65290b4e996d8326886117f6b7b43f56c3 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -3601,8 +3601,7 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( +@@ -3602,8 +3602,7 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( if (delegate_ && delegate_->IsWebContentsCreationOverridden( source_site_instance, params.window_container_type, @@ -362,10 +362,10 @@ index 7d27e12c4e9a7f32af8a26f672359057a643dd67..7a30ac31f79871f2a9afa0345e0e88af content::RenderFrameHost* opener, content::SiteInstance* source_site_instance, diff --git a/fuchsia/engine/browser/frame_impl.cc b/fuchsia/engine/browser/frame_impl.cc -index cf444f0509056dff3e9486444bf3726c58247c8e..807b4d851139b3454c8a8a365f5925ccc7def0b1 100644 +index cb35d3ea88744e985c18e14d049ac39674b05e81..907eee0b8b94cef0fd75343aeb0191ca3b9f56c9 100644 --- a/fuchsia/engine/browser/frame_impl.cc +++ b/fuchsia/engine/browser/frame_impl.cc -@@ -374,8 +374,7 @@ bool FrameImpl::IsWebContentsCreationOverridden( +@@ -381,8 +381,7 @@ bool FrameImpl::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -376,10 +376,10 @@ index cf444f0509056dff3e9486444bf3726c58247c8e..807b4d851139b3454c8a8a365f5925cc // can catch bad client behavior while not interfering with normal operation. constexpr size_t kMaxPendingWebContentsCount = 10; diff --git a/fuchsia/engine/browser/frame_impl.h b/fuchsia/engine/browser/frame_impl.h -index fea7e90aa11231009c442e8a449478f63a6d98eb..7b8802fcec4a2fff3b3d147e1bbd97e54a9b18c6 100644 +index 08a79325f127bc7ed22df4e433c6a4aae6a3c9b7..03ff3ff83fa4edc9e78fcb3ef1a195078bf3f42a 100644 --- a/fuchsia/engine/browser/frame_impl.h +++ b/fuchsia/engine/browser/frame_impl.h -@@ -237,8 +237,7 @@ class FrameImpl : public fuchsia::web::Frame, +@@ -240,8 +240,7 @@ class FrameImpl : public fuchsia::web::Frame, content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, diff --git a/patches/chromium/chore_use_electron_resources_not_chrome_for_spellchecker.patch b/patches/chromium/chore_use_electron_resources_not_chrome_for_spellchecker.patch index d8c2160b66254..6771890f4e13f 100644 --- a/patches/chromium/chore_use_electron_resources_not_chrome_for_spellchecker.patch +++ b/patches/chromium/chore_use_electron_resources_not_chrome_for_spellchecker.patch @@ -7,10 +7,10 @@ spellchecker uses a few IDS_ resources. We need to load these from Electrons grit header instead of Chromes diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index c0ba41010a64873c240acb337a69c0a1c2b69ccb..fb937c7d0aaf06b7120c1549cf15d6e18ac89be2 100644 +index 6d324db8fefe630a87d703f2030a5320eb7e6389..9e3c8abfdcb8c0683abec613e368b285e0c1813f 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -6292,6 +6292,7 @@ static_library("browser") { +@@ -6336,6 +6336,7 @@ static_library("browser") { deps += [ "//components/spellcheck/browser", "//components/spellcheck/common", @@ -44,7 +44,7 @@ index 41761e18716a7d9221511978dc4582a1804920e2..faea3d936c678e31fa29b93ae1ccd976 ] } diff --git a/components/language/core/browser/language_prefs.cc b/components/language/core/browser/language_prefs.cc -index 0e744bad147c40075f07b3cb455cbc6720b55397..2dc130b4b8b10d230f71f44d95c6ef1edc484c33 100644 +index 49e30e1fa3e980c09ff783fde9982ee4f58aca9f..04f0871ca950a7a5963989bbe728b9b18b198b09 100644 --- a/components/language/core/browser/language_prefs.cc +++ b/components/language/core/browser/language_prefs.cc @@ -22,7 +22,7 @@ diff --git a/patches/chromium/delay_lock_the_protocol_scheme_registry.patch b/patches/chromium/delay_lock_the_protocol_scheme_registry.patch index a2f4dd3407369..03f22568dc157 100644 --- a/patches/chromium/delay_lock_the_protocol_scheme_registry.patch +++ b/patches/chromium/delay_lock_the_protocol_scheme_registry.patch @@ -19,7 +19,7 @@ https://chromium-review.googlesource.com/c/chromium/src/+/1901591, we should try re-submitting the patch. diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc -index 8dba74570f7f2c1e622bcbd899c972508b732c68..ca25728909e354990b7285545c2544918996874f 100644 +index ae8a8ae78e5cbd6dd414e6eb8bc35931418fb74c..80263ff6c4330e60addb7634781f9a3590c61eb8 100644 --- a/content/app/content_main_runner_impl.cc +++ b/content/app/content_main_runner_impl.cc @@ -737,7 +737,7 @@ int ContentMainRunnerImpl::Initialize(const ContentMainParams& params) { diff --git a/patches/chromium/disable-redraw-lock.patch b/patches/chromium/disable-redraw-lock.patch index 11aa1e1cc08b1..ffee194923bac 100644 --- a/patches/chromium/disable-redraw-lock.patch +++ b/patches/chromium/disable-redraw-lock.patch @@ -15,10 +15,10 @@ the redraw locking mechanism, which fixes these issues. The electron issue can be found at https://github.com/electron/electron/issues/1821 diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 2d64e8ab2bf1748892f7f4e7a89a10fc6597401b..052d1a9c35f9e9b571cf9bc0c16ffc0847ed89cb 100644 +index 41363666bbbec7a92ac563282816f0a058979bc7..82ec517dbd675ad8b4a78848b7d2a7f71512c2d5 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -306,6 +306,10 @@ constexpr int kSynthesizedMouseMessagesTimeDifference = 500; +@@ -307,6 +307,10 @@ constexpr int kSynthesizedMouseMessagesTimeDifference = 500; } // namespace @@ -29,7 +29,7 @@ index 2d64e8ab2bf1748892f7f4e7a89a10fc6597401b..052d1a9c35f9e9b571cf9bc0c16ffc08 // A scoping class that prevents a window from being able to redraw in response // to invalidations that may occur within it for the lifetime of the object. // -@@ -357,6 +361,7 @@ class HWNDMessageHandler::ScopedRedrawLock { +@@ -358,6 +362,7 @@ class HWNDMessageHandler::ScopedRedrawLock { cancel_unlock_(false), should_lock_(owner_->IsVisible() && !owner->HasChildRenderingWindow() && ::IsWindow(hwnd_) && @@ -37,7 +37,7 @@ index 2d64e8ab2bf1748892f7f4e7a89a10fc6597401b..052d1a9c35f9e9b571cf9bc0c16ffc08 (!(GetWindowLong(hwnd_, GWL_STYLE) & WS_CAPTION) || !ui::win::IsAeroGlassEnabled())) { if (should_lock_) -@@ -977,6 +982,10 @@ HWNDMessageHandler::RegisterUnadjustedMouseEvent() { +@@ -978,6 +983,10 @@ HWNDMessageHandler::RegisterUnadjustedMouseEvent() { return scoped_enable; } diff --git a/patches/chromium/disable_color_correct_rendering.patch b/patches/chromium/disable_color_correct_rendering.patch index 81396d433cb24..381f464d99e7f 100644 --- a/patches/chromium/disable_color_correct_rendering.patch +++ b/patches/chromium/disable_color_correct_rendering.patch @@ -20,10 +20,10 @@ to deal with color spaces. That is being tracked at https://crbug.com/634542 and https://crbug.com/711107. diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc -index 47f6adf0798feddd8c66db59914b290c34fed5b4..cfc15f026707d1572f3352ecae35fa96acca3229 100644 +index 8780f67b03764da7821d86fb1f22e59212b01add..04a9e83debe931b5bb32bd3b9e9bbf0ae9e74cef 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc -@@ -1789,6 +1789,10 @@ void LayerTreeHostImpl::SetIsLikelyToRequireADraw( +@@ -1790,6 +1790,10 @@ void LayerTreeHostImpl::SetIsLikelyToRequireADraw( gfx::ColorSpace LayerTreeHostImpl::GetRasterColorSpace( gfx::ContentColorUsage content_color_usage) const { @@ -35,10 +35,10 @@ index 47f6adf0798feddd8c66db59914b290c34fed5b4..cfc15f026707d1572f3352ecae35fa96 // If we are likely to software composite the resource, we use sRGB because diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h -index c02eb016dc3f772ccafcd8099b41a4aca4d8236a..317275b6315253f5f317a09b478b566536522f82 100644 +index 7fa2b4da8c86c89b97a747a5f965485923fae7c9..dd91f7c9eff59824b6571a97be0529f62592d185 100644 --- a/cc/trees/layer_tree_settings.h +++ b/cc/trees/layer_tree_settings.h -@@ -97,6 +97,8 @@ class CC_EXPORT LayerTreeSettings { +@@ -95,6 +95,8 @@ class CC_EXPORT LayerTreeSettings { bool use_rgba_4444 = false; bool unpremultiply_and_dither_low_bit_depth_tiles = false; @@ -241,7 +241,7 @@ index cbb30f8900ed07d5cccbf250f2f1e6fafb66b40e..411fabb7e8c3e2a1aceb9db0fefdc4c6 sandbox::policy::switches::kGpuSandboxAllowSysVShm, sandbox::policy::switches::kGpuSandboxFailuresFatal, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 4208521cf4f03a154f44d5bd925f1cc12c306e20..541125c33491201b660ec06da202619219c527c1 100644 +index 9ca967c31df3a144c40c14a641765a41c48f0f68..90507c84cb87ca889d9971a2c66db8e1cbdd5097 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -210,6 +210,7 @@ @@ -252,7 +252,7 @@ index 4208521cf4f03a154f44d5bd925f1cc12c306e20..541125c33491201b660ec06da2026192 #include "ui/gl/gl_switches.h" #include "ui/native_theme/native_theme_features.h" #include "url/origin.h" -@@ -3199,6 +3200,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( +@@ -3205,6 +3206,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( // Propagate the following switches to the renderer command line (along // with any associated values) if present in the browser command line. static const char* const kSwitchNames[] = { @@ -261,7 +261,7 @@ index 4208521cf4f03a154f44d5bd925f1cc12c306e20..541125c33491201b660ec06da2026192 sandbox::policy::switches::kDisableSeccompFilterSandbox, sandbox::policy::switches::kNoSandbox, diff --git a/third_party/blink/renderer/platform/graphics/canvas_color_params.cc b/third_party/blink/renderer/platform/graphics/canvas_color_params.cc -index 8fd5a50c73ca0173d9d02b8bc7de50c695981ac0..d7199766e42af43b3244e8ee86f755b5f13e3c68 100644 +index 628c6bca129cd58a25984ff8300bfb4c33ec7ebf..ff9ce55f2701990b5b6119c18575477bfdaeecf7 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_color_params.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_color_params.cc @@ -4,6 +4,7 @@ @@ -272,7 +272,7 @@ index 8fd5a50c73ca0173d9d02b8bc7de50c695981ac0..d7199766e42af43b3244e8ee86f755b5 #include "cc/paint/skia_paint_canvas.h" #include "components/viz/common/resources/resource_format_utils.h" #include "third_party/blink/renderer/platform/graphics/canvas_resource_params.h" -@@ -14,6 +15,7 @@ +@@ -13,6 +14,7 @@ #include "third_party/khronos/GLES3/gl3.h" #include "third_party/skia/include/core/SkSurfaceProps.h" #include "ui/gfx/color_space.h" @@ -280,7 +280,7 @@ index 8fd5a50c73ca0173d9d02b8bc7de50c695981ac0..d7199766e42af43b3244e8ee86f755b5 namespace blink { -@@ -147,6 +149,11 @@ uint8_t CanvasColorParams::BytesPerPixel() const { +@@ -146,6 +148,11 @@ uint8_t CanvasColorParams::BytesPerPixel() const { } gfx::ColorSpace CanvasColorParams::GetStorageGfxColorSpace() const { @@ -293,10 +293,10 @@ index 8fd5a50c73ca0173d9d02b8bc7de50c695981ac0..d7199766e42af43b3244e8ee86f755b5 } diff --git a/third_party/blink/renderer/platform/widget/compositing/layer_tree_settings.cc b/third_party/blink/renderer/platform/widget/compositing/layer_tree_settings.cc -index 2c8e7445e9226f4860a0d36284e0cf770dbaa233..6cabd21b8dd996578d9aa02a553d4e3bca5fde04 100644 +index f5751beeb390b556dde8598b67b5fc9270e6805b..b155ad47f19950602000cecba52b1176ef95a749 100644 --- a/third_party/blink/renderer/platform/widget/compositing/layer_tree_settings.cc +++ b/third_party/blink/renderer/platform/widget/compositing/layer_tree_settings.cc -@@ -24,6 +24,7 @@ +@@ -25,6 +25,7 @@ #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "ui/base/ui_base_features.h" #include "ui/base/ui_base_switches.h" @@ -304,7 +304,7 @@ index 2c8e7445e9226f4860a0d36284e0cf770dbaa233..6cabd21b8dd996578d9aa02a553d4e3b #include "ui/native_theme/native_theme_features.h" #include "ui/native_theme/overlay_scrollbar_constants_aura.h" -@@ -177,6 +178,9 @@ cc::LayerTreeSettings GenerateLayerTreeSettings( +@@ -178,6 +179,9 @@ cc::LayerTreeSettings GenerateLayerTreeSettings( settings.main_frame_before_activation_enabled = cmd.HasSwitch(cc::switches::kEnableMainFrameBeforeActivation); diff --git a/patches/chromium/disable_compositor_recycling.patch b/patches/chromium/disable_compositor_recycling.patch index 1384439f76775..4d38d7787fc09 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 3e7d3dbd8fd39a3554d91bd15c567b8fadb27d6f..88faeca16f13dbdb28ec3fb276e2b537c35a08f4 100644 +index 42d4d1390a4bb5217a5b70855038d7f5aec7caf3..d0e6dc5c1c8b1201aafbadfa901113fa648aa439 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -489,7 +489,11 @@ diff --git a/patches/chromium/disable_hidden.patch b/patches/chromium/disable_hidden.patch index 18d96fc623026..f0de8591bd2a9 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 252e7992b8d9376779cb8b59aae2dc12e1e3c0ba..ac6e92d1dab80d2e9d3a48ac419102b93615d7a9 100644 +index 88f3f7603431d6c64e483fc7e836f4d6d2cd099c..718bbe30cdcd6f5a0118e9b9f71a26762fcd2b32 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -711,6 +711,9 @@ void RenderWidgetHostImpl::WasHidden() { @@ -20,10 +20,10 @@ index 252e7992b8d9376779cb8b59aae2dc12e1e3c0ba..ac6e92d1dab80d2e9d3a48ac419102b9 blink::mojom::PointerLockResult::kWrongDocument); diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h -index 81c55683ea0c08bc87487b7d0bd45160634d3aa3..bb1b37ae5cb6fce48aaa7a8e9e636a7b1868eb25 100644 +index 20aaa6fee4db490f4e337ce724a4dc8e117c2066..a1b4fe9dd9c69209291741cc2b3a92ad20a097d9 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h -@@ -849,6 +849,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl +@@ -850,6 +850,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl mojom::CreateFrameWidgetParamsPtr BindAndGenerateCreateFrameWidgetParamsForNewWindow(); @@ -34,7 +34,7 @@ index 81c55683ea0c08bc87487b7d0bd45160634d3aa3..bb1b37ae5cb6fce48aaa7a8e9e636a7b // |routing_id| must not be MSG_ROUTING_NONE. // 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 606051acbdc77167d4b44d4990b1e52c6acf27f8..42e8390aed5dd0b7a7dad0069db3b5c9bb0faebf 100644 +index bef783530231bf2a0e402f2aa4d1ebf0b3199b6f..5cf5e0abe59afbe54bd4faeba5c59617ec0477b6 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -595,7 +595,7 @@ void RenderWidgetHostViewAura::HideImpl() { diff --git a/patches/chromium/disable_unload_metrics.patch b/patches/chromium/disable_unload_metrics.patch index 58ebd9953b3f2..0c8798f07306d 100644 --- a/patches/chromium/disable_unload_metrics.patch +++ b/patches/chromium/disable_unload_metrics.patch @@ -24,7 +24,7 @@ This patch temporarily disables the metrics so we can have green CI, and we should continue seeking for a real fix. diff --git a/content/browser/renderer_host/navigator.cc b/content/browser/renderer_host/navigator.cc -index e494a067dc20f2a4d95a62c3570b017f523f42bf..d2d36ed49b408c55834cfc84b5122ba6b2864459 100644 +index d71c4f44ffdf3b2dbe87e2c9670463a11de745d5..d5f04a2968d1a6bda9e91c2f80b6a00a0cbbdaa0 100644 --- a/content/browser/renderer_host/navigator.cc +++ b/content/browser/renderer_host/navigator.cc @@ -1078,6 +1078,7 @@ void Navigator::RecordNavigationMetrics( diff --git a/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch b/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch index 9d2388451c7e6..33e3aded1ad49 100644 --- a/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch +++ b/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch @@ -11,10 +11,10 @@ This regressed in https://chromium-review.googlesource.com/c/chromium/src/+/2572 Upstream: https://chromium-review.googlesource.com/c/chromium/src/+/2598393 diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 33fe8d118ced62aaba2c81ade206382395630086..9dccdd341860cfe7ee6038a99482d97fe0ffb3e6 100644 +index 8b23d276dbc7ba0ec27ab4e9e0fd916f49f8f423..f38393312a391d15bc77320031dded813ea1e4bc 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -2282,7 +2282,7 @@ blink::WebLocalFrame* RenderFrameImpl::GetWebFrame() { +@@ -2274,7 +2274,7 @@ blink::WebLocalFrame* RenderFrameImpl::GetWebFrame() { } const blink::web_pref::WebPreferences& RenderFrameImpl::GetBlinkPreferences() { diff --git a/patches/chromium/enable_reset_aspect_ratio.patch b/patches/chromium/enable_reset_aspect_ratio.patch index 2babe00ac6ec4..6b615199d7d61 100644 --- a/patches/chromium/enable_reset_aspect_ratio.patch +++ b/patches/chromium/enable_reset_aspect_ratio.patch @@ -19,10 +19,10 @@ index 4c0c38e5f00a20489b4787c4d5cfaf34b0747787..d2c7ba362285307182aa647448c27846 aspect_ratio.height()); } diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 052d1a9c35f9e9b571cf9bc0c16ffc0847ed89cb..92eb76ff7a5406ff022b5a88988ef78451c90c1c 100644 +index 82ec517dbd675ad8b4a78848b7d2a7f71512c2d5..4a44a9f5fe9ffa69ebd7bb10e02f7b6f8acdb21c 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc -@@ -927,8 +927,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen) { +@@ -928,8 +928,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen) { } void HWNDMessageHandler::SetAspectRatio(float aspect_ratio) { diff --git a/patches/chromium/extend_apply_webpreferences.patch b/patches/chromium/extend_apply_webpreferences.patch index 05ef093313946..25dd07c33354e 100644 --- a/patches/chromium/extend_apply_webpreferences.patch +++ b/patches/chromium/extend_apply_webpreferences.patch @@ -12,7 +12,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 90636a53231ce906a57e30596ebe8385802cecfa..259f945f0117ced38a24aa0dda0a845f9f8bf955 100644 +index d9887073dbbb313693f7398b2dd7d34dc50a31bd..0582f42be8cdd38a674c8e4b7ce03575d50ada9d 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc @@ -155,6 +155,7 @@ @@ -23,7 +23,7 @@ index 90636a53231ce906a57e30596ebe8385802cecfa..259f945f0117ced38a24aa0dda0a845f #include "third_party/blink/renderer/platform/graphics/image.h" #include "third_party/blink/renderer/platform/graphics/paint/cull_rect.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_record_builder.h" -@@ -1747,6 +1748,16 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, +@@ -1783,6 +1784,16 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, RuntimeEnabledFeatures::SetTranslateServiceEnabled( prefs.translate_service_available); diff --git a/patches/chromium/feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch index 6c03423b3c19c..51c7c412971c0 100644 --- a/patches/chromium/feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -48,10 +48,10 @@ index 9f1acca2bdb697b79a01362a9a5d8dd098eca925..c57c03b838a773d41614002afee27520 // This interface should only be implemented inside content. friend class RenderViewHostImpl; diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h -index b855cc7ce85117b3b32fe097b4c209ed5302e041..66456189bb90f2002682308a0ec83dc709d3cc72 100644 +index b65e4cc345b05292e1c31d0b05dacc1363d641a8..fe2f8b68cd7cc3f4417ae70dcd711ae56883e117 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h -@@ -206,6 +206,8 @@ class CONTENT_EXPORT RenderViewImpl : public blink::WebViewClient, +@@ -200,6 +200,8 @@ class CONTENT_EXPORT RenderViewImpl : public blink::WebViewClient, static WindowOpenDisposition NavigationPolicyToDisposition( blink::WebNavigationPolicy policy); @@ -59,7 +59,7 @@ index b855cc7ce85117b3b32fe097b4c209ed5302e041..66456189bb90f2002682308a0ec83dc7 + // Misc private functions ---------------------------------------------------- - #if defined(OS_ANDROID) + // In OOPIF-enabled modes, this tells each RenderFrame with a pending state diff --git a/third_party/blink/public/mojom/page/page.mojom b/third_party/blink/public/mojom/page/page.mojom index e122d4ffb857023841dabcb6fed352d7586d8344..3c7cd1cb8b204024a0835150302ee8896e01ee45 100644 --- a/third_party/blink/public/mojom/page/page.mojom @@ -73,7 +73,7 @@ index e122d4ffb857023841dabcb6fed352d7586d8344..3c7cd1cb8b204024a0835150302ee889 + SetSchedulerThrottling(bool allowed); }; diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h -index 733afd6ead8ff4103c3273401d8c68ac24b51b45..d6b08817ed5446b45d29996178d2fe22d18199a6 100644 +index 5c90d306a8e82dcee667e65c0908fc0fe034e6bb..30a8beae286a8606ebeab523782d98f43b42ba00 100644 --- a/third_party/blink/public/web/web_view.h +++ b/third_party/blink/public/web/web_view.h @@ -348,6 +348,7 @@ class WebView { @@ -85,10 +85,10 @@ index 733afd6ead8ff4103c3273401d8c68ac24b51b45..d6b08817ed5446b45d29996178d2fe22 // 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 540b321309ff594dc120077e0219d35cc92c9117..90636a53231ce906a57e30596ebe8385802cecfa 100644 +index 44e8d23433b42aebb293633928ddb27a9b7a6924..d9887073dbbb313693f7398b2dd7d34dc50a31bd 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -3519,6 +3519,13 @@ PageScheduler* WebViewImpl::Scheduler() const { +@@ -3555,6 +3555,13 @@ PageScheduler* WebViewImpl::Scheduler() const { return GetPage()->GetPageScheduler(); } @@ -102,7 +102,7 @@ index 540b321309ff594dc120077e0219d35cc92c9117..90636a53231ce906a57e30596ebe8385 void WebViewImpl::SetVisibilityState( mojom::blink::PageVisibilityState visibility_state, bool is_initial_state) { -@@ -3531,7 +3538,8 @@ void WebViewImpl::SetVisibilityState( +@@ -3566,7 +3573,8 @@ void WebViewImpl::SetVisibilityState( } GetPage()->SetVisibilityState(visibility_state, is_initial_state); GetPage()->GetPageScheduler()->SetPageVisible( @@ -113,7 +113,7 @@ index 540b321309ff594dc120077e0219d35cc92c9117..90636a53231ce906a57e30596ebe8385 mojom::blink::PageVisibilityState WebViewImpl::GetVisibilityState() { 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 21774b035c3f8ddd6c7fc507a59fab6e15c4cc02..8cd3edf177aed5c564a9154785cc168fa3e7ea25 100644 +index 5149d97889632aad6add9909a066c4d2feba22ee..1672c7e5a5c717df76b0b6af2df9e44cc7614204 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h @@ -392,6 +392,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, 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 e89c3d28c581b..ccc15a2166a0f 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,7 +7,7 @@ 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 85e09566753d08e6b275054334517315512ec62a..7d413cdc7de2719dd6fad3f9205872e5d8a09ecf 100644 +index 14e9f03d5663e68082827fb0a00f61ca03ead8d0..4ff0bc6f55de133aa0622690665ddcf42c791f5a 100644 --- a/chrome/browser/spellchecker/spellcheck_service.cc +++ b/chrome/browser/spellchecker/spellcheck_service.cc @@ -482,6 +482,9 @@ void SpellcheckService::LoadDictionaries() { diff --git a/patches/chromium/fix_expose_decrementcapturercount_in_web_contents_impl.patch b/patches/chromium/fix_expose_decrementcapturercount_in_web_contents_impl.patch index 2544fd9961fdf..f3b5e8a860f67 100644 --- a/patches/chromium/fix_expose_decrementcapturercount_in_web_contents_impl.patch +++ b/patches/chromium/fix_expose_decrementcapturercount_in_web_contents_impl.patch @@ -8,10 +8,10 @@ we invoke it in order to expose contents.decrementCapturerCount([stayHidden, sta to users. We should try to upstream this. diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index e66c762b5093e7154920b7df8638733bd146f535..46cc6cfd3c5b9ca14321bdf4c94a7126edec6eb5 100644 +index 7b14c710dd3be119feb8008616e94812298ad2d3..a413ac5bb7ede67ba86497eda2d062096165fa53 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -1736,9 +1736,11 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents, +@@ -1738,9 +1738,11 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents, // shown in the address bar), as opposed to one in for example a Prerender. bool IsPrimaryFrameTree(const FrameTree& frame_tree) const; @@ -25,7 +25,7 @@ index e66c762b5093e7154920b7df8638733bd146f535..46cc6cfd3c5b9ca14321bdf4c94a7126 // Calculates the PageVisibilityState for |visibility|, taking the capturing // state into account. diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index 4a80cbc4c290a21a8b2a5e5c570f97258d97a95c..d1cc03ac29cb3a1cf0ea2ac52a1d850fe821de43 100644 +index 19b8672d09ccf0daf0275aa5b54e11dfc613bf7b..9d37b7f2eda8454b974d70af24dc3333b0ec2b8a 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h @@ -563,6 +563,7 @@ class WebContents : public PageNavigator, diff --git a/patches/chromium/fix_properly_honor_printing_page_ranges.patch b/patches/chromium/fix_properly_honor_printing_page_ranges.patch index 8344f9b4dc1e8..7652d31f9033e 100644 --- a/patches/chromium/fix_properly_honor_printing_page_ranges.patch +++ b/patches/chromium/fix_properly_honor_printing_page_ranges.patch @@ -25,7 +25,7 @@ index 07fcfad6ecf676068d3f0b44f97e748d58b13016..f165eea20ca3b120f5fb499248d65fa7 // 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 90da306872814ed166cc38c769491d3a32af7ab0..4e3a9fb906ec91dda5e13d8e185dce068895e99f 100644 +index 1a52ea3cd11b3ec573cfef6f6f03ab39fcb998d6..c8a17ef24a4bb62fc03b361d5153acc8f0098c6b 100644 --- a/printing/printing_context_mac.mm +++ b/printing/printing_context_mac.mm @@ -189,7 +189,8 @@ PMPaper MatchPaper(CFArrayRef paper_list, diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index d72d96f1d7ce6..116c83c988ab0 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 3bd26f70aa00f051de7eae7ec94a56aaf018514d..4b766ad4055afc09b5f0287ffc3d3b4d8a74599f 100644 +index 13fd4a9e0bb1d15dba75a50781d5031748860b19..622a73251dfd183958df59372036009e7a4642e6 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc -@@ -2921,6 +2921,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -2934,6 +2934,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( request->ResetStateForSiteInstanceChange(); } @@ -20,10 +20,10 @@ index 3bd26f70aa00f051de7eae7ec94a56aaf018514d..4b766ad4055afc09b5f0287ffc3d3b4d } diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 5622d3d9852edee2b2f49f87606f334d0fa2541e..54e7028025790a9d8119eed53ebf28b16ddf8656 100644 +index 0e19f40fdd18746dee8813bf403a7759f6c0f46d..5508221b2127edd452ec56c8f674a8ed54924c09 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -262,6 +262,11 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -263,6 +263,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 afa895e7edbd0..41846a6849b8c 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 58356e7b6d647165d965587e63d3a7ceca212a87..18166539c39398e9863bef7abdde6321e12ca7fb 100644 +index bf45df883364b414091e5426a00d0922ce67222d..33238398728ba0773ef6e8268bf2eb7a34ac4a40 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec -@@ -763,6 +763,11 @@ +@@ -764,6 +764,11 @@ "includes": [3880], }, diff --git a/patches/chromium/mas_disable_remote_accessibility.patch b/patches/chromium/mas_disable_remote_accessibility.patch index ac8abf1255c0b..71bfb66637b09 100644 --- a/patches/chromium/mas_disable_remote_accessibility.patch +++ b/patches/chromium/mas_disable_remote_accessibility.patch @@ -90,7 +90,7 @@ index c3a9fbf0f9d2b80c1de42a22ad094a286f0b559b..02493d4b62c98a3aebd3e460c459218a DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostNSViewBridgeOwner); }; 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 03c0e80b45ea616862a65b5e37ac734ac204c483..4d3b4a097247afcab477e32ae6300e745f60b1d3 100644 +index f46b1d431957d6fb86f67d340c02469cb9457188..78c4c7588af478823c3b2cdad52164e328b7f39e 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.h +++ b/content/browser/renderer_host/render_widget_host_view_mac.h @@ -47,7 +47,9 @@ class ScopedPasswordInputEnabler; @@ -103,7 +103,7 @@ index 03c0e80b45ea616862a65b5e37ac734ac204c483..4d3b4a097247afcab477e32ae6300e74 @class RenderWidgetHostViewCocoa; namespace content { -@@ -654,10 +656,12 @@ class CONTENT_EXPORT RenderWidgetHostViewMac +@@ -658,10 +660,12 @@ class CONTENT_EXPORT RenderWidgetHostViewMac // EnsureSurfaceSynchronizedForWebTest(). uint32_t latest_capture_sequence_number_ = 0u; @@ -117,7 +117,7 @@ index 03c0e80b45ea616862a65b5e37ac734ac204c483..4d3b4a097247afcab477e32ae6300e74 // 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 e99a5a11a5f48b985aa3cc28eae2c53eec34a518..3e7d3dbd8fd39a3554d91bd15c567b8fadb27d6f 100644 +index 9a6df39be13403107c5864f366a461bd66cb1aff..42d4d1390a4bb5217a5b70855038d7f5aec7caf3 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -238,8 +238,10 @@ @@ -131,7 +131,7 @@ index e99a5a11a5f48b985aa3cc28eae2c53eec34a518..3e7d3dbd8fd39a3554d91bd15c567b8f // Disconnect from the previous bridge (this will have the effect of // destroying the associated bridge), and close the receiver (to allow it -@@ -1401,8 +1403,10 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1399,8 +1401,10 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, gfx::NativeViewAccessible RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() { @@ -142,7 +142,7 @@ index e99a5a11a5f48b985aa3cc28eae2c53eec34a518..3e7d3dbd8fd39a3554d91bd15c567b8f return [GetInProcessNSView() window]; } -@@ -1446,9 +1450,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1444,9 +1448,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, } void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) { @@ -154,7 +154,7 @@ index e99a5a11a5f48b985aa3cc28eae2c53eec34a518..3e7d3dbd8fd39a3554d91bd15c567b8f } bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame( -@@ -1937,12 +1943,14 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1935,12 +1941,14 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, void RenderWidgetHostViewMac::SetRemoteAccessibilityWindowToken( const std::vector& window_token) { @@ -170,10 +170,10 @@ index e99a5a11a5f48b985aa3cc28eae2c53eec34a518..3e7d3dbd8fd39a3554d91bd15c567b8f /////////////////////////////////////////////////////////////////////////////// diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn -index 195e6a88cb0612cedb4b228e10fc5660b5440be2..75250a4b9cb661d9fbea3580a50ff214b1b9510e 100644 +index a7fd3c7812a65cd10a53a2e29e7dd50b0aa428e9..f19cba3289def3fbd70b6106f7c4491b320bf608 100644 --- a/ui/base/BUILD.gn +++ b/ui/base/BUILD.gn -@@ -324,6 +324,13 @@ component("base") { +@@ -328,6 +328,13 @@ component("base") { ] } diff --git a/patches/chromium/mas_no_private_api.patch b/patches/chromium/mas_no_private_api.patch index 565f73c755bd1..b55e7d90e39bc 100644 --- a/patches/chromium/mas_no_private_api.patch +++ b/patches/chromium/mas_no_private_api.patch @@ -7,10 +7,10 @@ Guard usages in blink of private Mac APIs by MAS_BUILD, so they can be excluded for people who want to submit their apps to the Mac App store. diff --git a/content/browser/accessibility/accessibility_tree_formatter_mac.mm b/content/browser/accessibility/accessibility_tree_formatter_mac.mm -index 4336e1d01f88605ea7f2bbbb644869c5ee7b9b5a..a3eaef03a435d5b06fd8cb97264c19b08358013f 100644 +index 65adc773e82d99c5dd57d52e84a71e67d676be13..f5d0318c1c4fa036a233142cd6eea0a03eed7e39 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_mac.mm +++ b/content/browser/accessibility/accessibility_tree_formatter_mac.mm -@@ -264,7 +264,7 @@ +@@ -273,7 +273,7 @@ return PopulateSize([value sizeValue]); } } @@ -19,7 +19,7 @@ index 4336e1d01f88605ea7f2bbbb644869c5ee7b9b5a..a3eaef03a435d5b06fd8cb97264c19b0 // AXTextMarker if (content::IsAXTextMarker(value)) { return PopulateTextPosition(content::AXTextMarkerToAXPosition(value), -@@ -275,6 +275,7 @@ +@@ -284,6 +284,7 @@ if (content::IsAXTextMarkerRange(value)) { return PopulateTextMarkerRange(value, line_indexer); } @@ -27,7 +27,7 @@ index 4336e1d01f88605ea7f2bbbb644869c5ee7b9b5a..a3eaef03a435d5b06fd8cb97264c19b0 // AXValue if (CFGetTypeID(value) == AXValueGetTypeID()) { -@@ -392,7 +393,7 @@ +@@ -401,7 +402,7 @@ AXMakeConst(affinity)); return set; } @@ -36,7 +36,7 @@ index 4336e1d01f88605ea7f2bbbb644869c5ee7b9b5a..a3eaef03a435d5b06fd8cb97264c19b0 base::Value AccessibilityTreeFormatterMac::PopulateTextMarkerRange( id marker_range, const LineIndexer* line_indexer) const { -@@ -408,7 +409,7 @@ +@@ -417,7 +418,7 @@ PopulateTextPosition(ax_range.focus()->Clone(), line_indexer)); return dict; } @@ -125,7 +125,7 @@ index a7d6351854d08926c4e9c43c95e9075bd4d4c728..9c89595cb6c37527b96b4afde3871333 // is concerned. @property(nonatomic, readonly) NSString* subrole; diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/content/browser/accessibility/browser_accessibility_cocoa.mm -index 4e2e99418b4023abd59e82437bd7964dbb34fbe7..53f3295695dc7d83f2785cbe78050449c882deef 100644 +index 381eaf1ba11d860bfc8673eb09591ff861ee9f52..75f226eb170565fd27e63e843636df07ec13462f 100644 --- a/content/browser/accessibility/browser_accessibility_cocoa.mm +++ b/content/browser/accessibility/browser_accessibility_cocoa.mm @@ -203,6 +203,7 @@ @@ -471,7 +471,7 @@ index c15f3a631292b538698625328fb429ee3c9964f5..37e038753ecf1b82ec92c06b2c0729b5 } diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm -index b56737af6f4da7cc01f78430c53dfa5afd1bc6df..60cdaa18e55acfd5817d2689bdb5a0ec8c1318d7 100644 +index 97e7ab4543700d56e3da436b93185c12ae85e6e6..beda3f54f0c850691accf4e7716514f3f4bc2d5f 100644 --- a/device/bluetooth/bluetooth_adapter_mac.mm +++ b/device/bluetooth/bluetooth_adapter_mac.mm @@ -43,6 +43,7 @@ diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index 863cec4e531d1..ffd6aa25d170d 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -54,10 +54,10 @@ index 19c2beb1f1949f0dc4466a8728f151c035544b24..f7aa5f94d6dea0e6b2c1107b8ef01600 scoped_refptr 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 e27c23e0aeaf08c903c2fc1f7cb0b24d137b9a7a..4768449379941021c9c2fd388040b75395129231 100644 +index 3694fd8900bee0f235bbae31def3f5e6338538ed..5942c9fe4aab65492e78eaa4396bd362ab9f6d4b 100644 --- a/content/browser/notifications/blink_notification_service_impl_unittest.cc +++ b/content/browser/notifications/blink_notification_service_impl_unittest.cc -@@ -138,7 +138,7 @@ class BlinkNotificationServiceImplTest : public ::testing::Test { +@@ -139,7 +139,7 @@ class BlinkNotificationServiceImplTest : public ::testing::Test { notification_service_ = std::make_unique( notification_context_.get(), &browser_context_, @@ -108,7 +108,7 @@ index 71dad766e05ac4726e1e18159f2af5ea01079a91..ef8e55a4420288fe64c99e68d0a649a9 const GURL& document_url, mojo::PendingReceiver receiver); diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 6eee013d0401a7507cdcc0773ab0d9418c86b5c4..2afda54851efbb052371ce1e49f29cc56e93dce4 100644 +index efe1470d3af7c923f2a65ce4988f078f6e56672e..e68880e344f8efd790da07b2fd1071a2666f489c 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -2160,7 +2160,7 @@ void RenderProcessHostImpl::CreateNotificationService( diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch index 7562dde62ffda..2ccc76a7152e3 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 4743a6e49abbdc6ee9edf4b5d6cb546d241660ad..8a0d90edb7c9533aeb163813ae354c90a13318d0 100644 +index cbe686c86aab691efeca9d104575711fd46037d5..26362670d68e8a6b3297678931ea43a240ae9391 100644 --- a/chrome/browser/printing/print_job.cc +++ b/chrome/browser/printing/print_job.cc @@ -349,18 +349,25 @@ void PrintJob::StartPdfToEmfConversion( @@ -43,7 +43,7 @@ index 4743a6e49abbdc6ee9edf4b5d6cb546d241660ad..8a0d90edb7c9533aeb163813ae354c90 using RenderMode = PdfRenderSettings::Mode; RenderMode mode; diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc -index 91edb6e296fd94491a7b379f289e3f7a0b91a53b..ec4fd72f889188869a8ee05ffee2132207b98d48 100644 +index f2ba13cb21d66c2067264086926341e8490b1b84..29dc7c84c22d9aa7bf0711467fa98b16c89683c1 100644 --- a/chrome/browser/printing/print_job_worker.cc +++ b/chrome/browser/printing/print_job_worker.cc @@ -22,7 +22,6 @@ @@ -62,8 +62,8 @@ index 91edb6e296fd94491a7b379f289e3f7a0b91a53b..ec4fd72f889188869a8ee05ffee21322 #include "printing/print_job_constants.h" #include "printing/printed_document.h" #include "printing/printing_utils.h" -@@ -238,16 +238,21 @@ void PrintJobWorker::UpdatePrintSettings(base::Value new_settings, - // defined(USE_CUPS) +@@ -242,16 +242,21 @@ void PrintJobWorker::UpdatePrintSettings(base::Value new_settings, + #endif // defined(OS_LINUX) && defined(USE_CUPS) } - PrintingContext::Result result; @@ -87,7 +87,7 @@ index 91edb6e296fd94491a7b379f289e3f7a0b91a53b..ec4fd72f889188869a8ee05ffee21322 } #if BUILDFLAG(IS_CHROMEOS_ASH) -@@ -263,6 +268,13 @@ void PrintJobWorker::UpdatePrintSettingsFromPOD( +@@ -267,6 +272,13 @@ void PrintJobWorker::UpdatePrintSettingsFromPOD( void PrintJobWorker::GetSettingsDone(SettingsCallback callback, PrintingContext::Result result) { @@ -102,7 +102,7 @@ index 91edb6e296fd94491a7b379f289e3f7a0b91a53b..ec4fd72f889188869a8ee05ffee21322 } diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc -index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518cafdb352 100644 +index f6084545a8acf1485d862a2366eee1da56d0a565..e2882c8b4fbb5402066c9132ed5ebed138ed777c 100644 --- a/chrome/browser/printing/print_view_manager_base.cc +++ b/chrome/browser/printing/print_view_manager_base.cc @@ -28,10 +28,10 @@ @@ -126,8 +126,8 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 #include "mojo/public/cpp/system/buffer.h" #include "printing/buildflags/buildflags.h" #include "printing/metafile_skia.h" -@@ -75,6 +76,8 @@ using PrintSettingsCallback = - base::OnceCallback)>; +@@ -110,6 +111,8 @@ crosapi::mojom::PrintJobPtr PrintJobToMojom( + #endif void ShowWarningMessageBox(const std::u16string& message) { + LOG(ERROR) << "Invalid printer settings " << message; @@ -135,7 +135,7 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 // Runs always on the UI thread. static bool is_dialog_shown = false; if (is_dialog_shown) -@@ -83,6 +86,7 @@ void ShowWarningMessageBox(const std::u16string& message) { +@@ -118,6 +121,7 @@ void ShowWarningMessageBox(const std::u16string& message) { base::AutoReset auto_reset(&is_dialog_shown, true); chrome::ShowWarningMessageBox(nullptr, std::u16string(), message); @@ -143,7 +143,7 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 } #if BUILDFLAG(ENABLE_PRINT_PREVIEW) -@@ -220,7 +224,9 @@ void UpdatePrintSettingsReplyOnIO( +@@ -256,7 +260,9 @@ void UpdatePrintSettingsReplyOnIO( DCHECK(printer_query); auto params = mojom::PrintPagesParams::New(); params->params = mojom::PrintParams::New(); @@ -154,7 +154,7 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 RenderParamsFromPrintSettings(printer_query->settings(), params->params.get()); params->params->document_cookie = printer_query->cookie(); -@@ -345,12 +351,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents) +@@ -382,12 +388,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents) : PrintManager(web_contents), queue_(g_browser_process->print_job_manager()->queue()) { DCHECK(queue_); @@ -169,7 +169,7 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 } PrintViewManagerBase::~PrintViewManagerBase() { -@@ -358,7 +366,10 @@ PrintViewManagerBase::~PrintViewManagerBase() { +@@ -395,7 +403,10 @@ PrintViewManagerBase::~PrintViewManagerBase() { DisconnectFromCurrentPrintJob(); } @@ -181,7 +181,7 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 DisconnectFromCurrentPrintJob(); // Don't print / print preview crashed tabs. -@@ -366,7 +377,14 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) { +@@ -403,7 +414,14 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) { return false; SetPrintingRFH(rfh); @@ -197,7 +197,7 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 return true; } -@@ -487,9 +505,9 @@ void PrintViewManagerBase::StartLocalPrintJob( +@@ -524,9 +542,9 @@ void PrintViewManagerBase::StartLocalPrintJob( void PrintViewManagerBase::UpdatePrintingEnabled() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); // The Unretained() is safe because ForEachFrame() is synchronous. @@ -210,7 +210,7 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 } void PrintViewManagerBase::NavigationStopped() { -@@ -606,12 +624,13 @@ void PrintViewManagerBase::DidPrintDocument( +@@ -643,12 +661,13 @@ void PrintViewManagerBase::DidPrintDocument( void PrintViewManagerBase::GetDefaultPrintSettings( GetDefaultPrintSettingsCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -225,7 +225,7 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 content::RenderFrameHost* render_frame_host = print_manager_host_receivers_.GetCurrentTargetFrame(); -@@ -627,11 +646,12 @@ void PrintViewManagerBase::UpdatePrintSettings( +@@ -665,11 +684,12 @@ void PrintViewManagerBase::UpdatePrintSettings( base::Value job_settings, UpdatePrintSettingsCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -239,7 +239,7 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 if (!job_settings.FindIntKey(kSettingPrinterType)) { UpdatePrintSettingsReply(std::move(callback), nullptr, false); return; -@@ -665,7 +685,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) { +@@ -709,7 +729,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) { PrintManager::PrintingFailed(cookie); #if BUILDFLAG(ENABLE_PRINT_PREVIEW) @@ -248,7 +248,7 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 #endif ReleasePrinterQuery(); -@@ -677,6 +697,11 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) { +@@ -721,6 +741,11 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) { } void PrintViewManagerBase::ShowInvalidPrinterSettingsError() { @@ -260,7 +260,7 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&ShowWarningMessageBox, l10n_util::GetStringUTF16( -@@ -746,9 +771,13 @@ void PrintViewManagerBase::OnNotifyPrintJobEvent( +@@ -790,9 +815,13 @@ void PrintViewManagerBase::OnNotifyPrintJobEvent( content::NotificationService::NoDetails()); break; } @@ -276,7 +276,7 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 NOTREACHED(); break; } -@@ -846,8 +875,10 @@ bool PrintViewManagerBase::CreateNewPrintJob( +@@ -901,8 +930,10 @@ bool PrintViewManagerBase::CreateNewPrintJob( DCHECK(!quit_inner_loop_); DCHECK(query); @@ -289,7 +289,7 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 // We can't print if there is no renderer. if (!web_contents()->GetMainFrame()->GetRenderViewHost() || -@@ -868,8 +899,6 @@ bool PrintViewManagerBase::CreateNewPrintJob( +@@ -923,8 +954,6 @@ bool PrintViewManagerBase::CreateNewPrintJob( /*source_id=*/""); #endif @@ -298,7 +298,7 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 printing_succeeded_ = false; return true; } -@@ -918,14 +947,22 @@ void PrintViewManagerBase::ReleasePrintJob() { +@@ -973,14 +1002,22 @@ void PrintViewManagerBase::ReleasePrintJob() { content::RenderFrameHost* rfh = printing_rfh_; printing_rfh_ = nullptr; @@ -323,7 +323,7 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 // Don't close the worker thread. print_job_ = nullptr; } -@@ -961,7 +998,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() { +@@ -1016,7 +1053,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() { } bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) { @@ -333,7 +333,7 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 if (!cookie) { diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h -index a96e5a33643e4f1b214bea6143d9e2744bb4e5c3..ccb9808bdb334a78ed7b64dd3030caff52055ad6 100644 +index 62f4dc6083a13dd68ca510982a8073216d4f4b24..89ce604d8363c3a4d7b2f206da20167d9e722927 100644 --- a/chrome/browser/printing/print_view_manager_base.h +++ b/chrome/browser/printing/print_view_manager_base.h @@ -38,6 +38,8 @@ class PrintJob; @@ -357,7 +357,7 @@ index a96e5a33643e4f1b214bea6143d9e2744bb4e5c3..ccb9808bdb334a78ed7b64dd3030caff #if BUILDFLAG(ENABLE_PRINT_PREVIEW) // Prints the document in |print_data| with settings specified in -@@ -214,9 +219,15 @@ class PrintViewManagerBase : public content::NotificationObserver, +@@ -216,9 +221,15 @@ class PrintViewManagerBase : public content::NotificationObserver, // The current RFH that is printing with a system printing dialog. content::RenderFrameHost* printing_rfh_ = nullptr; @@ -374,7 +374,7 @@ index a96e5a33643e4f1b214bea6143d9e2744bb4e5c3..ccb9808bdb334a78ed7b64dd3030caff // This means we are _blocking_ until all the necessary pages have been // rendered or the print settings are being loaded. diff --git a/components/printing/common/print.mojom b/components/printing/common/print.mojom -index 4fde003f2a12794bfcd479ef2797cc6281c5720b..bc3bc4aee26f9373de35366ddb07f7bac67b6db6 100644 +index bea375f1c23fdb6efdd6e0f7801e7bd087ddb7a3..f74c70d1c535384df1849b2d2841b27f5d0b25c6 100644 --- a/components/printing/common/print.mojom +++ b/components/printing/common/print.mojom @@ -271,7 +271,7 @@ interface PrintPreviewUI { @@ -387,7 +387,7 @@ index 4fde003f2a12794bfcd479ef2797cc6281c5720b..bc3bc4aee26f9373de35366ddb07f7ba // Tells the RenderFrame to switch the CSS to print media type, render every // requested page using the print preview document's frame/node, and then diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc -index b888b7c38814cbac14ef0dc792a5372886532dcb..fec67ef8da4eaffde505b66f8317312c58f5656d 100644 +index fb3cbc567e322d3fe0c755712dfc8964e7767760..46301119f29f828f734ed9e4a2f6dcd1d86f6f8d 100644 --- a/components/printing/renderer/print_render_frame_helper.cc +++ b/components/printing/renderer/print_render_frame_helper.cc @@ -38,6 +38,7 @@ @@ -426,7 +426,7 @@ index b888b7c38814cbac14ef0dc792a5372886532dcb..fec67ef8da4eaffde505b66f8317312c if (!render_frame_gone_) frame->DispatchAfterPrintEvent(); -@@ -1252,7 +1254,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() { +@@ -1253,7 +1255,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() { } Print(frame, print_preview_context_.source_node(), @@ -569,7 +569,7 @@ index b888b7c38814cbac14ef0dc792a5372886532dcb..fec67ef8da4eaffde505b66f8317312c bool PrintRenderFrameHelper::PreviewPageRendered( diff --git a/components/printing/renderer/print_render_frame_helper.h b/components/printing/renderer/print_render_frame_helper.h -index ae14b4e5da65fb3548d4369216a3c6b90c8d17a1..67962f518035b528dd3e958e6e56c764257894ae 100644 +index 6a1fa397ec36b970d610fa30f6e4d6b4f8b7b3d6..6043c98774a68d39da665371cdb00ded00350f61 100644 --- a/components/printing/renderer/print_render_frame_helper.h +++ b/components/printing/renderer/print_render_frame_helper.h @@ -231,7 +231,7 @@ class PrintRenderFrameHelper @@ -578,8 +578,8 @@ index ae14b4e5da65fb3548d4369216a3c6b90c8d17a1..67962f518035b528dd3e958e6e56c764 // printing::mojom::PrintRenderFrame: - void PrintRequestedPages() override; + void PrintRequestedPages(bool silent, base::Value settings) override; - void PrintForSystemDialog() override; #if BUILDFLAG(ENABLE_PRINT_PREVIEW) + void PrintForSystemDialog() override; void SetPrintPreviewUI( @@ -298,7 +298,9 @@ class PrintRenderFrameHelper // WARNING: |this| may be gone after this method returns. @@ -610,7 +610,7 @@ index ae14b4e5da65fb3548d4369216a3c6b90c8d17a1..67962f518035b528dd3e958e6e56c764 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) // Set options for print preset from source PDF document. diff --git a/printing/printing_context.cc b/printing/printing_context.cc -index 92561ff7c6bce6febd8cd2f39f59e3df707f8bdb..241686fa8bdc346f073b5fb92f57c72cfd1be8af 100644 +index 30fa5344771c7e558ba44177429c551cba3b03e8..29d7e4a020989af699a25f69a4ee5ced70cb70bb 100644 --- a/printing/printing_context.cc +++ b/printing/printing_context.cc @@ -96,7 +96,6 @@ PrintingContext::Result PrintingContext::UsePdfSettings() { @@ -622,7 +622,7 @@ index 92561ff7c6bce6febd8cd2f39f59e3df707f8bdb..241686fa8bdc346f073b5fb92f57c72c std::unique_ptr settings = PrintSettingsFromJobSettings(job_settings); diff --git a/printing/printing_context.h b/printing/printing_context.h -index a45e0a76781513552295d6b1e6f46d1345088e76..47554e55a0aa7d1074f9c38dbe36b8a575838531 100644 +index 5c300fa414fbb8688674aed114543e602cdb96db..ba6d0bbce4edcb1a6e05108e4e83fc6ba5894bb4 100644 --- a/printing/printing_context.h +++ b/printing/printing_context.h @@ -133,12 +133,12 @@ class COMPONENT_EXPORT(PRINTING) PrintingContext { diff --git a/patches/chromium/put_back_deleted_colors_for_autofill.patch b/patches/chromium/put_back_deleted_colors_for_autofill.patch index 88ac461169970..0ed2bb18bb26e 100644 --- a/patches/chromium/put_back_deleted_colors_for_autofill.patch +++ b/patches/chromium/put_back_deleted_colors_for_autofill.patch @@ -8,12 +8,12 @@ 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/native_theme/common_theme.cc b/ui/native_theme/common_theme.cc -index 4436af30ea86d7949ae5f387fbeab9e6369ac12e..575aafe2d19c150e288141fb85cec3f78103ba4a 100644 +index 043ace0c33285d48a78541862ef9bc75d178dbe4..1fbe82d1baca7e296a2f44762fc5c99d66d60532 100644 --- a/ui/native_theme/common_theme.cc +++ b/ui/native_theme/common_theme.cc -@@ -72,6 +72,14 @@ base::Optional GetDarkSchemeColor(NativeTheme::ColorId color_id, - case NativeTheme::kColorId_BubbleBorderShadowBase: - return SK_ColorBLACK; +@@ -68,6 +68,14 @@ base::Optional GetDarkSchemeColor(NativeTheme::ColorId color_id, + case NativeTheme::kColorId_FocusedBorderColor: + return gfx::kGoogleBlue400; + // Results Tables + case NativeTheme::kColorId_ResultsTableNormalBackground: @@ -26,7 +26,7 @@ index 4436af30ea86d7949ae5f387fbeab9e6369ac12e..575aafe2d19c150e288141fb85cec3f7 // Button case NativeTheme::kColorId_ProminentButtonColor: return gfx::kGoogleBlue300; -@@ -570,6 +578,18 @@ SkColor GetDefaultColor(NativeTheme::ColorId color_id, +@@ -587,6 +595,18 @@ SkColor GetDefaultColor(NativeTheme::ColorId color_id, case NativeTheme::kColorId_WindowBackground: return SK_ColorWHITE; @@ -46,10 +46,10 @@ index 4436af30ea86d7949ae5f387fbeab9e6369ac12e..575aafe2d19c150e288141fb85cec3f7 // Keeping the kColorId_NumColors case instead of using the default case // allows ColorId additions to trigger compile error for an incomplete diff --git a/ui/native_theme/native_theme_color_id.h b/ui/native_theme/native_theme_color_id.h -index 64e6d428d805a71f1e8779c4c169d232bed79d2d..93086c17e231dbd2226bdc805f26d59703862d3b 100644 +index 84848edbbe9de7ef9fe6e2ab0a34d3b9428cde10..5e07980e4793cc3b19140510fb3fd3b23c6a88ef 100644 --- a/ui/native_theme/native_theme_color_id.h +++ b/ui/native_theme/native_theme_color_id.h -@@ -151,6 +151,11 @@ +@@ -157,6 +157,11 @@ OP(kColorId_TableHeaderText), \ OP(kColorId_TableHeaderBackground), \ OP(kColorId_TableHeaderSeparator), \ 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 540fde1e316b4..bff979d5cb6cd 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 fb25b91e254ca03002fda226861ff5b9c24f6b11..752f5e26b4f60561f38f08a8ce10cbce // RenderWidgetHost on the main frame, and false otherwise. virtual bool IsWidgetForMainFrame(RenderWidgetHostImpl*); diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index ac6e92d1dab80d2e9d3a48ac419102b93615d7a9..b56b5031abacad5e3d7c575097999845f4efd3e1 100644 +index 718bbe30cdcd6f5a0118e9b9f71a26762fcd2b32..51766160240c5fcaaa25dc3388e2be63c70511b4 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -1945,6 +1945,8 @@ void RenderWidgetHostImpl::FilterDropData(DropData* drop_data) { @@ -43,10 +43,10 @@ index ac6e92d1dab80d2e9d3a48ac419102b93615d7a9..b56b5031abacad5e3d7c575097999845 void RenderWidgetHostImpl::ShowContextMenuAtPoint( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index b1cbf6f76c2032dd3a6c90f1c9cf97ccaa734bec..54fce2b0b6da947473e8725bf97816de9f51b12a 100644 +index aed19709076c8b3d0df42b4dcb994f8bbe2d6026..9ce5f2eed289ed9d427abddde098bfcd09293db4 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4192,6 +4192,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { +@@ -4193,6 +4193,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { return text_input_manager_.get(); } @@ -59,10 +59,10 @@ index b1cbf6f76c2032dd3a6c90f1c9cf97ccaa734bec..54fce2b0b6da947473e8725bf97816de RenderWidgetHostImpl* render_widget_host) { return render_widget_host == GetMainFrame()->GetRenderWidgetHost(); diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index 2520b412d1cb644d44dbc12d6d4d1d4ab131ca33..e66c762b5093e7154920b7df8638733bd146f535 100644 +index 6d8dfd941f5306b59d1638abdfcf171c1308fed5..7b14c710dd3be119feb8008616e94812298ad2d3 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -960,6 +960,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents, +@@ -962,6 +962,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents, blink::mojom::FrameVisibility visibility) override; void SendScreenRects() override; TextInputManager* GetTextInputManager() override; diff --git a/patches/chromium/render_widget_host_view_base.patch b/patches/chromium/render_widget_host_view_base.patch index cbec93fdf7112..520c998967349 100644 --- a/patches/chromium/render_widget_host_view_base.patch +++ b/patches/chromium/render_widget_host_view_base.patch @@ -24,7 +24,7 @@ index fe8443d5411c73f1fb71fd20315173b0023be758..d4cd7ddcd50c512d07ca2175179e4163 const blink::WebMouseEvent& event, const ui::LatencyInfo& latency) { diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h -index 972a7ad3edf12481ec60f5bfd3b077d5eba5750b..9a54b3d1fcb146d5ed4f1d263352bd228a56d378 100644 +index 885d2f0198ff5d7d87047a66d688ff572112ba02..96ce338ea6e2ef2c0a785dfe4411b05c9ec44035 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.h +++ b/content/browser/renderer_host/render_widget_host_view_base.h @@ -25,8 +25,10 @@ diff --git a/patches/chromium/resource_file_conflict.patch b/patches/chromium/resource_file_conflict.patch index 4bc25f7e5352e..9c9d1451797ab 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 1219a5107c61ccca0f792cf65d99848f074dcfce..2138afbbf5eeafbac8bb0e12a760dfdab8e959f2 100644 +index 931fb7579a9d5a7b6e378ddc2d823e81ce7b8a6a..59f3a36836d6dd3687e64b85198cd7100e8272f3 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn -@@ -1504,7 +1504,7 @@ if (is_chrome_branded && !is_android) { +@@ -1531,7 +1531,7 @@ if (is_chrome_branded && !is_android) { } } @@ -64,7 +64,7 @@ index 1219a5107c61ccca0f792cf65d99848f074dcfce..2138afbbf5eeafbac8bb0e12a760dfda chrome_paks("packed_resources") { if (is_mac) { output_dir = "$root_gen_dir/repack" -@@ -1524,6 +1524,12 @@ if (!is_android) { +@@ -1559,6 +1559,12 @@ if (!is_android) { } } diff --git a/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch b/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch index caf878731211c..7016e5f327682 100644 --- a/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch +++ b/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch @@ -88,10 +88,10 @@ index 6191d4774ae35f00c3b58f62719962de616c8ad7..f717ae1d8e3bf642792f1dcfebbaa287 // |url|. If the function returns a valid |new_url|, the request must be // updated to use it. diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index abcfd464b8a92f65623bc4527123cc75ad38b712..33fe8d118ced62aaba2c81ade206382395630086 100644 +index c2b9b96589183d1a4fae8593e7994a10baa5e29b..8b23d276dbc7ba0ec27ab4e9e0fd916f49f8f423 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4924,6 +4924,22 @@ void RenderFrameImpl::BeginNavigation( +@@ -4908,6 +4908,22 @@ void RenderFrameImpl::BeginNavigation( // we can do a per-frame check here rather than a process-wide check. bool should_fork = HasWebUIScheme(url) || HasWebUIScheme(old_url) || (enabled_bindings_ & kWebUIBindingsPolicyMask); diff --git a/patches/chromium/revert_roll_clang_llvmorg-13-init-7051-gdad5caa5-2.patch b/patches/chromium/revert_roll_clang_llvmorg-13-init-7051-gdad5caa5-2.patch deleted file mode 100644 index 39f9d5c05fa1f..0000000000000 --- a/patches/chromium/revert_roll_clang_llvmorg-13-init-7051-gdad5caa5-2.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: deepak1556 -Date: Fri, 30 Apr 2021 16:36:14 -0700 -Subject: Revert "Roll clang llvmorg-13-init-7051-gdad5caa5-2 : - llvmorg-13-init-7296-ga749bd76-1" - -This reverts commit 6da81f26271d1efe8c3da6dd7cfb409d35763a35. - -This broke WoA builds, ref: https://github.com/electron/electron/issues/28876 - -diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py -index a4ae8fa31330c92a356d8fd9e67fc49826a2b5d6..33cd83fc835e0204a4aba0e17d2152b3021a4c35 100755 ---- a/tools/clang/scripts/update.py -+++ b/tools/clang/scripts/update.py -@@ -39,8 +39,8 @@ import zipfile - # https://chromium.googlesource.com/chromium/src/+/main/docs/updating_clang.md - # Reverting problematic clang rolls is safe, though. - # This is the output of `git describe` and is usable as a commit-ish. --CLANG_REVISION = 'llvmorg-13-init-7296-ga749bd76' --CLANG_SUB_REVISION = 3 -+CLANG_REVISION = 'llvmorg-13-init-7051-gdad5caa5' -+CLANG_SUB_REVISION = 2 - - PACKAGE_VERSION = '%s-%s' % (CLANG_REVISION, CLANG_SUB_REVISION) - RELEASE_VERSION = '13.0.0' diff --git a/patches/chromium/scroll_bounce_flag.patch b/patches/chromium/scroll_bounce_flag.patch index 15f093540ad38..388da6af39fdb 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 2d3f4ec3c94f669276ad8e8b5595f49100b7ad34..51321a2ee5602ae628eaad77e519b4d9c2821b3f 100644 +index 887a6860a61d6c353f3b3c86263c81acb7d2ace2..46585f2188f64734b6130bcce367ec2078148635 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc -@@ -1250,7 +1250,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { +@@ -1248,7 +1248,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 49aa63023c5bf..bcf602d606ea2 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 2afda54851efbb052371ce1e49f29cc56e93dce4..4208521cf4f03a154f44d5bd925f1cc12c306e20 100644 +index e68880e344f8efd790da07b2fd1071a2666f489c..9ca967c31df3a144c40c14a641765a41c48f0f68 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -387,10 +387,18 @@ class RendererSandboxedProcessLauncherDelegate diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index 864522ffec768..670b584928415 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 aa50664e5fcb88ac72118ba5d354f835d427b6fd..93b554fb8e6f560ff1e1081e34430f3ad65b7ca1 100644 +index 37ccef65290b4e996d8326886117f6b7b43f56c3..83c73c17461ff8fa7543c112e812dcaca592d133 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -2774,6 +2774,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -2775,6 +2775,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { frame_tree_.Init(site_instance.get(), params.renderer_initiated_creation, params.main_frame_name); @@ -25,7 +25,7 @@ index aa50664e5fcb88ac72118ba5d354f835d427b6fd..93b554fb8e6f560ff1e1081e34430f3a WebContentsViewDelegate* delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -2784,6 +2790,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -2785,6 +2791,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { view_.reset(CreateWebContentsView(this, delegate, &render_view_host_delegate_view_)); } @@ -34,7 +34,7 @@ index aa50664e5fcb88ac72118ba5d354f835d427b6fd..93b554fb8e6f560ff1e1081e34430f3a CHECK(view_.get()); diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index e441c4089e00707912f5ddd90d57a309e73e455a..4a80cbc4c290a21a8b2a5e5c570f97258d97a95c 100644 +index 9663a9a547329001493a6ef5735ec49ed6d396ca..19b8672d09ccf0daf0275aa5b54e11dfc613bf7b 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h @@ -88,8 +88,11 @@ class BrowserContext; diff --git a/patches/chromium/worker_context_will_destroy.patch b/patches/chromium/worker_context_will_destroy.patch index 94d555db3843e..6c15c9f993a0a 100644 --- a/patches/chromium/worker_context_will_destroy.patch +++ b/patches/chromium/worker_context_will_destroy.patch @@ -26,10 +26,10 @@ index a0d7f49d1e4ca4009fbebc0bd7df234eb6850b08..6191d4774ae35f00c3b58f62719962de // 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 a0bf74769bf06bb8a97b675c9eeac4d6c3829964..1f6380f738fd41906e79839560498b54461c6cea 100644 +index 8043fcb58599563fce4f400976ee39d9267d9ebf..5e52db3ad573248cd9a5357f3d748d2e98ec4586 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -916,6 +916,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { +@@ -932,6 +932,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread(); } @@ -43,10 +43,10 @@ index a0bf74769bf06bb8a97b675c9eeac4d6c3829964..1f6380f738fd41906e79839560498b54 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 5405fe0dc6367f2a356b07aa1cc2311f9d929208..6cac9ce793939864d38f1521af9c11a1310fb498 100644 +index 6446931f6d35bc15cc6effe9ff8fd9dcd0493735..3424db9919c2415eaeb18206564c5277ec48c412 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h -@@ -198,6 +198,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -201,6 +201,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { void DidStartWorkerThread() override; void WillStopWorkerThread() override; void WorkerContextCreated(const v8::Local& worker) override; @@ -55,10 +55,10 @@ index 5405fe0dc6367f2a356b07aa1cc2311f9d929208..6cac9ce793939864d38f1521af9c11a1 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 fb98c93af1855672cfd05928379833f30c2cbec8..68f2d67950cb34e99a4cb875df1bd8214a49ecbf 100644 +index 00a41fe334080fb2e387fcd58a0a21b18a58c22f..a5445103f9581b5afd4e96a2c3028e45dfce2c9f 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -697,6 +697,7 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -712,6 +712,7 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void DidStartWorkerThread() {} virtual void WillStopWorkerThread() {} virtual void WorkerContextCreated(const v8::Local& worker) {} @@ -67,10 +67,10 @@ index fb98c93af1855672cfd05928379833f30c2cbec8..68f2d67950cb34e99a4cb875df1bd821 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 f3112e1618c7040e6781a19519a19cded9b1335d..aeeeae4b4b9429a6c3cb3c91ae0c642e74fdcc36 100644 +index 78b7355132a334983f4b431c50f89ccc518dd0c5..0b02460fd1c52214890b257a0cfa3965cf03dee7 100644 --- a/third_party/blink/renderer/core/workers/worker_thread.cc +++ b/third_party/blink/renderer/core/workers/worker_thread.cc -@@ -738,6 +738,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() { +@@ -737,6 +737,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() { nested_runner_->QuitNow(); } 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 0319a90e9992b..daed03db0c081 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 f717ae1d8e3bf642792f1dcfebbaa2870ff97694..65d3085260e054a671afbecf55062d17 // 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 1f6380f738fd41906e79839560498b54461c6cea..bf6b13594de39cbf96df332922a2b364219b7905 100644 +index 5e52db3ad573248cd9a5357f3d748d2e98ec4586..31a8281b2c3ad6141dfa2b8c5e7128c561427f67 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -928,6 +928,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated( +@@ -944,6 +944,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated( worker); } @@ -52,10 +52,10 @@ index 1f6380f738fd41906e79839560498b54461c6cea..bf6b13594de39cbf96df332922a2b364 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 6cac9ce793939864d38f1521af9c11a1310fb498..4a8de2bd53f5b1ef4e9e3379f6ae4e38582c0e0b 100644 +index 3424db9919c2415eaeb18206564c5277ec48c412..5a6422084304a37a91892f1519a2c94bc6396f27 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h -@@ -198,6 +198,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -201,6 +201,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { void DidStartWorkerThread() override; void WillStopWorkerThread() override; void WorkerContextCreated(const v8::Local& worker) override; @@ -65,10 +65,10 @@ index 6cac9ce793939864d38f1521af9c11a1310fb498..4a8de2bd53f5b1ef4e9e3379f6ae4e38 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 68f2d67950cb34e99a4cb875df1bd8214a49ecbf..1b0b2744a95e67833f1c8057aad89349fe84e5eb 100644 +index a5445103f9581b5afd4e96a2c3028e45dfce2c9f..62b639de3dd8bef609b69cd23e821bc62438228d 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -697,6 +697,8 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -712,6 +712,8 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void DidStartWorkerThread() {} virtual void WillStopWorkerThread() {} virtual void WorkerContextCreated(const v8::Local& worker) {} diff --git a/patches/v8/add_realloc.patch b/patches/v8/add_realloc.patch index 8c62bfbbf2f3b..93830dcf1d3a1 100644 --- a/patches/v8/add_realloc.patch +++ b/patches/v8/add_realloc.patch @@ -12,7 +12,7 @@ when we override ReallocateBufferMemory, so we therefore need to implement Realloc on the v8 side. diff --git a/include/v8.h b/include/v8.h -index f3ed035d0dbc6e64fc555d6e2f6ad20f80ce3529..43a95bbfc2ed26cd041ee5d893aaebec3b613995 100644 +index 81fbe7f97f1f0945b4712287f0c511cc6920379c..c5b2c17da660dbc9fe40e2d33cb09db2554c2507 100644 --- a/include/v8.h +++ b/include/v8.h @@ -5363,6 +5363,13 @@ class V8_EXPORT ArrayBuffer : public Object { @@ -30,7 +30,7 @@ index f3ed035d0dbc6e64fc555d6e2f6ad20f80ce3529..43a95bbfc2ed26cd041ee5d893aaebec * Free the memory block of size |length|, pointed to by |data|. * That memory is guaranteed to be previously allocated by |Allocate|. diff --git a/src/api/api.cc b/src/api/api.cc -index ee141364d72a9719bf32d09b3aef0945eca7d7d0..31f4086936a9cdbbc926bb95467bf119350d4368 100644 +index 8f0cd7eaf0f1f2ecf81293e5a401c10139a06824..62b4be5bf0e64f04da22cbf32643ab86cb901bb6 100644 --- a/src/api/api.cc +++ b/src/api/api.cc @@ -324,6 +324,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { diff --git a/patches/v8/build_gn.patch b/patches/v8/build_gn.patch index 6d7655ab44a89..30a2abf3af80e 100644 --- a/patches/v8/build_gn.patch +++ b/patches/v8/build_gn.patch @@ -9,10 +9,10 @@ necessary for native modules to load. Also, some fixes relating to mksnapshot on ARM. diff --git a/BUILD.gn b/BUILD.gn -index ff0aaa30098839a1186626061363aca985c8e46d..cf0daf8006928970e8dc2e9dd2cb20985d3309ae 100644 +index 313c1d51aab36d4324955b6468be13e3073bf413..e0bae1c3b9611eafd7333459c0cfd81b4f4235f7 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -507,7 +507,7 @@ config("internal_config") { +@@ -500,7 +500,7 @@ config("internal_config") { ":cppgc_header_features", ] @@ -21,7 +21,7 @@ index ff0aaa30098839a1186626061363aca985c8e46d..cf0daf8006928970e8dc2e9dd2cb2098 defines += [ "BUILDING_V8_SHARED" ] } } -@@ -5182,7 +5182,7 @@ if (current_toolchain == v8_generator_toolchain) { +@@ -5176,7 +5176,7 @@ if (current_toolchain == v8_generator_toolchain) { "src/interpreter/bytecodes.h", ] @@ -30,7 +30,7 @@ index ff0aaa30098839a1186626061363aca985c8e46d..cf0daf8006928970e8dc2e9dd2cb2098 deps = [ ":v8_libbase", -@@ -5220,6 +5220,8 @@ if (current_toolchain == v8_snapshot_toolchain) { +@@ -5214,6 +5214,8 @@ if (current_toolchain == v8_snapshot_toolchain) { configs = [ ":internal_config" ] diff --git a/patches/v8/dcheck.patch b/patches/v8/dcheck.patch index ef87263a27239..5b53df2d01eef 100644 --- a/patches/v8/dcheck.patch +++ b/patches/v8/dcheck.patch @@ -6,10 +6,10 @@ Subject: dcheck.patch https://github.com/auchenberg/volkswagen diff --git a/src/api/api.cc b/src/api/api.cc -index 31f4086936a9cdbbc926bb95467bf119350d4368..b4772fdc015659c081061a8265b04d29b63651ff 100644 +index 62b4be5bf0e64f04da22cbf32643ab86cb901bb6..f7f0e7ee899746be121f6b840988cd8e46a1e194 100644 --- a/src/api/api.cc +++ b/src/api/api.cc -@@ -8735,7 +8735,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { +@@ -8762,7 +8762,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { } void Isolate::PerformMicrotaskCheckpoint() { @@ -19,10 +19,10 @@ index 31f4086936a9cdbbc926bb95467bf119350d4368..b4772fdc015659c081061a8265b04d29 isolate->default_microtask_queue()->PerformCheckpoint(this); } diff --git a/src/heap/heap.cc b/src/heap/heap.cc -index 6a332a26493dc1af6c4afb9c8a32f8af3d78acb5..9054ea4814bc67dd78bd174c5e2273b1cd01bff6 100644 +index d03c65b078f17e6ddba7354c175751b06557c3e8..0108642b96c30bb6928f317870788800681c1222 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc -@@ -5815,9 +5815,9 @@ void Heap::DeinitSharedSpaces() { +@@ -5822,9 +5822,9 @@ void Heap::DeinitSharedSpaces() { void Heap::AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback, GCType gc_type, void* data) { DCHECK_NOT_NULL(callback); diff --git a/patches/v8/do_not_export_private_v8_symbols_on_windows.patch b/patches/v8/do_not_export_private_v8_symbols_on_windows.patch index e09914d2c4179..ada39ec8d4832 100644 --- a/patches/v8/do_not_export_private_v8_symbols_on_windows.patch +++ b/patches/v8/do_not_export_private_v8_symbols_on_windows.patch @@ -12,10 +12,10 @@ This patch can be safely removed if, when it is removed, `node.lib` does not contain any standard C++ library exports (e.g. `std::ostringstream`). diff --git a/BUILD.gn b/BUILD.gn -index 71afc320af85b8f0021ba3e64aacb0f1af5a45ab..98b1e1f346c5d6c8b1f6574c5154446d7c6257df 100644 +index 311ad20094357e67be03802bd1be5aafa550529d..b520050f54a3ab4f2f1f05f3eea6bede0d17b4d0 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -507,6 +507,10 @@ config("internal_config") { +@@ -500,6 +500,10 @@ config("internal_config") { ":cppgc_header_features", ] diff --git a/patches/v8/expose_mksnapshot.patch b/patches/v8/expose_mksnapshot.patch index d6fc6f5b7d830..be3030727fe1e 100644 --- a/patches/v8/expose_mksnapshot.patch +++ b/patches/v8/expose_mksnapshot.patch @@ -6,10 +6,10 @@ Subject: expose_mksnapshot.patch Needed in order to target mksnapshot for mksnapshot zip. diff --git a/BUILD.gn b/BUILD.gn -index cf0daf8006928970e8dc2e9dd2cb20985d3309ae..71afc320af85b8f0021ba3e64aacb0f1af5a45ab 100644 +index e0bae1c3b9611eafd7333459c0cfd81b4f4235f7..311ad20094357e67be03802bd1be5aafa550529d 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -5194,7 +5194,6 @@ if (current_toolchain == v8_generator_toolchain) { +@@ -5188,7 +5188,6 @@ if (current_toolchain == v8_generator_toolchain) { if (current_toolchain == v8_snapshot_toolchain) { v8_executable("mksnapshot") { diff --git a/patches/v8/fix_build_deprecated_attirbute_for_older_msvc_versions.patch b/patches/v8/fix_build_deprecated_attirbute_for_older_msvc_versions.patch index b6cb93fc150d7..a1cebcd8d6804 100644 --- a/patches/v8/fix_build_deprecated_attirbute_for_older_msvc_versions.patch +++ b/patches/v8/fix_build_deprecated_attirbute_for_older_msvc_versions.patch @@ -9,10 +9,10 @@ higher versions, but native module compiling with this version will have an issue. diff --git a/include/v8config.h b/include/v8config.h -index 20bd56854efbdf4b730a02b3ef7a709cbe84fb4c..141cf459f148885a18daf5ab61ea331e62f7faad 100644 +index c1bb691f8789e5ab17ed9c8c4ad6ea2d51e72670..214101a990a1551b309aed7be19946896441cfa2 100644 --- a/include/v8config.h +++ b/include/v8config.h -@@ -412,10 +412,13 @@ path. Add it with -I to the command line +@@ -403,10 +403,13 @@ path. Add it with -I to the command line # define V8_NOINLINE /* NOT SUPPORTED */ #endif @@ -28,7 +28,7 @@ index 20bd56854efbdf4b730a02b3ef7a709cbe84fb4c..141cf459f148885a18daf5ab61ea331e #else # define V8_DEPRECATED(message) #endif -@@ -423,7 +426,11 @@ path. Add it with -I to the command line +@@ -414,7 +417,11 @@ path. Add it with -I to the command line // A macro (V8_DEPRECATE_SOON) to make it easier to see what will be deprecated. #if defined(V8_IMMINENT_DEPRECATION_WARNINGS) diff --git a/script/nan-spec-runner.js b/script/nan-spec-runner.js index e4c077f3e1eb0..4af65945ea001 100644 --- a/script/nan-spec-runner.js +++ b/script/nan-spec-runner.js @@ -49,6 +49,7 @@ async function main () { const DISABLED_TESTS = [ 'nannew-test.js', + 'setcallhandler-test.js', // TODO(jkleinsc) renable once https://github.com/electron/electron/pull/29028 lands 'typedarrays-test.js' // TODO(nornagon): https://github.com/electron/electron/issues/28414 ]; const testsToRun = fs.readdirSync(path.resolve(NAN_DIR, 'test', 'js')) diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc index c7b4f0e7683e4..86b1aef1df475 100644 --- a/shell/browser/api/electron_api_app.cc +++ b/shell/browser/api/electron_api_app.cc @@ -1377,9 +1377,7 @@ std::vector App::GetAppMetrics(v8::Isolate* isolate) { } v8::Local App::GetGPUFeatureStatus(v8::Isolate* isolate) { - auto status = content::GetFeatureStatus(); - base::DictionaryValue temp; - return gin::ConvertToV8(isolate, status ? *status : temp); + return gin::ConvertToV8(isolate, content::GetFeatureStatus()); } v8::Local App::GetGPUInfo(v8::Isolate* isolate, diff --git a/shell/browser/api/electron_api_content_tracing.cc b/shell/browser/api/electron_api_content_tracing.cc index 90da88d1baf4b..32f9ed490c32a 100644 --- a/shell/browser/api/electron_api_content_tracing.cc +++ b/shell/browser/api/electron_api_content_tracing.cc @@ -10,6 +10,7 @@ #include "base/optional.h" #include "base/task/thread_pool.h" #include "base/threading/thread_restrictions.h" +#include "base/trace_event/trace_config.h" #include "content/public/browser/tracing_controller.h" #include "shell/common/gin_converters/callback_converter.h" #include "shell/common/gin_converters/file_path_converter.h" diff --git a/shell/browser/file_select_helper.cc b/shell/browser/file_select_helper.cc index 622cd215b5191..37e5e645f62ae 100644 --- a/shell/browser/file_select_helper.cc +++ b/shell/browser/file_select_helper.cc @@ -49,7 +49,7 @@ FileSelectHelper::FileSelectHelper( DCHECK(web_contents_); content::WebContentsObserver::Observe(web_contents_); - observer_.Add(render_frame_host_->GetRenderViewHost()->GetWidget()); + observation_.Observe(render_frame_host_->GetRenderViewHost()->GetWidget()); } FileSelectHelper::~FileSelectHelper() = default; @@ -235,7 +235,8 @@ void FileSelectHelper::OnFilesSelected( void FileSelectHelper::RenderWidgetHostDestroyed( content::RenderWidgetHost* widget_host) { render_frame_host_ = nullptr; - observer_.Remove(widget_host); + DCHECK(observation_.IsObservingSource(widget_host)); + observation_.Reset(); } // content::WebContentsObserver: diff --git a/shell/browser/file_select_helper.h b/shell/browser/file_select_helper.h index 78a678483ec93..e4dd9e251dea0 100644 --- a/shell/browser/file_select_helper.h +++ b/shell/browser/file_select_helper.h @@ -12,6 +12,7 @@ #include #include "base/files/file_path.h" +#include "base/scoped_observation.h" #include "chrome/common/pref_names.h" #include "content/public/browser/file_select_listener.h" #include "content/public/browser/render_frame_host.h" @@ -100,8 +101,9 @@ class FileSelectHelper : public content::WebContentsObserver, scoped_refptr listener_; FileChooserParams::Mode mode_; - ScopedObserver - observer_{this}; + base::ScopedObservation + observation_{this}; // Temporary files only used on OSX. This class is responsible for deleting // these files when they are no longer needed. diff --git a/shell/browser/osr/osr_render_widget_host_view.cc b/shell/browser/osr/osr_render_widget_host_view.cc index d64647003736d..7120e396539d9 100644 --- a/shell/browser/osr/osr_render_widget_host_view.cc +++ b/shell/browser/osr/osr_render_widget_host_view.cc @@ -456,7 +456,8 @@ void OffScreenRenderWidgetHostView::Destroy() { delete this; } -void OffScreenRenderWidgetHostView::SetTooltipText(const std::u16string&) {} +void OffScreenRenderWidgetHostView::UpdateTooltipUnderCursor( + const std::u16string&) {} uint32_t OffScreenRenderWidgetHostView::GetCaptureSequenceNumber() const { return latest_capture_sequence_number_; diff --git a/shell/browser/osr/osr_render_widget_host_view.h b/shell/browser/osr/osr_render_widget_host_view.h index 0e037c8e3d6f8..54f727b82ed82 100644 --- a/shell/browser/osr/osr_render_widget_host_view.h +++ b/shell/browser/osr/osr_render_widget_host_view.h @@ -121,7 +121,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase, void ImeCancelComposition(void) override; void RenderProcessGone() override; void Destroy(void) override; - void SetTooltipText(const std::u16string&) override; + void UpdateTooltipUnderCursor(const std::u16string&) override; content::CursorManager* GetCursorManager() override; void CopyFromSurface( const gfx::Rect& src_rect, diff --git a/shell/browser/ui/views/submenu_button.cc b/shell/browser/ui/views/submenu_button.cc index 03c26543e212a..37420b3f60257 100644 --- a/shell/browser/ui/views/submenu_button.cc +++ b/shell/browser/ui/views/submenu_button.cc @@ -35,10 +35,10 @@ SubmenuButton::SubmenuButton(PressedCallback callback, gfx::Canvas::SizeStringInt(GetText(), gfx::FontList(), &text_width_, &text_height_, 0, 0); - SetInkDropMode(InkDropMode::ON); - SetInkDropBaseColor( + ink_drop()->SetMode(views::InkDropHost::InkDropMode::ON); + ink_drop()->SetBaseColor( color_utils::BlendTowardMaxContrast(background_color_, 0x81)); - views::InkDrop::UseInkDropForFloodFillRipple(this, false, true); + views::InkDrop::UseInkDropForFloodFillRipple(ink_drop(), false, true); } SubmenuButton::~SubmenuButton() = default; diff --git a/shell/common/gin_helper/microtasks_scope.cc b/shell/common/gin_helper/microtasks_scope.cc index 06d67b8e9878e..a3f8c73d74930 100644 --- a/shell/common/gin_helper/microtasks_scope.cc +++ b/shell/common/gin_helper/microtasks_scope.cc @@ -9,13 +9,14 @@ namespace gin_helper { MicrotasksScope::MicrotasksScope(v8::Isolate* isolate, - bool ignore_browser_checkpoint) { + bool ignore_browser_checkpoint, + v8::MicrotasksScope::Type scope_type) { if (Locker::IsBrowserProcess()) { if (!ignore_browser_checkpoint) v8::MicrotasksScope::PerformCheckpoint(isolate); } else { - v8_microtasks_scope_ = std::make_unique( - isolate, v8::MicrotasksScope::kRunMicrotasks); + v8_microtasks_scope_ = + std::make_unique(isolate, scope_type); } } diff --git a/shell/common/gin_helper/microtasks_scope.h b/shell/common/gin_helper/microtasks_scope.h index aaa6aaf5d4e9a..9879c405e79d6 100644 --- a/shell/common/gin_helper/microtasks_scope.h +++ b/shell/common/gin_helper/microtasks_scope.h @@ -17,7 +17,9 @@ namespace gin_helper { class MicrotasksScope { public: explicit MicrotasksScope(v8::Isolate* isolate, - bool ignore_browser_checkpoint = false); + bool ignore_browser_checkpoint = false, + v8::MicrotasksScope::Type scope_type = + v8::MicrotasksScope::kRunMicrotasks); ~MicrotasksScope(); private: diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc index a6fb17e343c0e..33a16ab9f8bf4 100644 --- a/shell/common/node_bindings.cc +++ b/shell/common/node_bindings.cc @@ -174,6 +174,8 @@ bool AllowWasmCodeGenerationCallback(v8::Local context, void ErrorMessageListener(v8::Local message, v8::Local data) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); + gin_helper::MicrotasksScope microtasks_scope( + isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); node::Environment* env = node::Environment::GetCurrent(isolate); if (env) { diff --git a/shell/common/v8_value_serializer.cc b/shell/common/v8_value_serializer.cc index 73726976203c3..fdb04b88c3c67 100644 --- a/shell/common/v8_value_serializer.cc +++ b/shell/common/v8_value_serializer.cc @@ -8,6 +8,7 @@ #include #include "gin/converter.h" +#include "shell/common/gin_helper/microtasks_scope.h" #include "third_party/blink/public/common/messaging/cloneable_message.h" #include "v8/include/v8.h" @@ -24,6 +25,8 @@ class V8Serializer : public v8::ValueSerializer::Delegate { ~V8Serializer() override = default; bool Serialize(v8::Local value, blink::CloneableMessage* out) { + gin_helper::MicrotasksScope microtasks_scope( + isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); WriteBlinkEnvelope(19); serializer_.WriteHeader(); diff --git a/shell/renderer/api/electron_api_spell_check_client.cc b/shell/renderer/api/electron_api_spell_check_client.cc index 51379aecbd92f..6b18148dd86fc 100644 --- a/shell/renderer/api/electron_api_spell_check_client.cc +++ b/shell/renderer/api/electron_api_spell_check_client.cc @@ -18,6 +18,7 @@ #include "components/spellcheck/renderer/spellcheck_worditerator.h" #include "shell/common/gin_helper/dictionary.h" #include "shell/common/gin_helper/function_template.h" +#include "shell/common/gin_helper/microtasks_scope.h" #include "third_party/blink/public/web/web_text_checking_completion.h" #include "third_party/blink/public/web/web_text_checking_result.h" #include "third_party/icu/source/common/unicode/uscript.h" @@ -219,6 +220,9 @@ void SpellCheckClient::SpellCheckWords(const SpellCheckScope& scope, const std::set& words) { DCHECK(!scope.spell_check_.IsEmpty()); + gin_helper::MicrotasksScope microtasks_scope( + isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); + v8::Local templ = gin_helper::CreateFunctionTemplate( isolate_, base::BindRepeating(&SpellCheckClient::OnSpellCheckDone, AsWeakPtr())); diff --git a/shell/renderer/electron_render_frame_observer.cc b/shell/renderer/electron_render_frame_observer.cc index 7733e1b8cc32a..408c86e4a2d06 100644 --- a/shell/renderer/electron_render_frame_observer.cc +++ b/shell/renderer/electron_render_frame_observer.cc @@ -19,6 +19,7 @@ #include "net/base/net_module.h" #include "net/grit/net_resources.h" #include "services/service_manager/public/cpp/interface_provider.h" +#include "shell/common/gin_helper/microtasks_scope.h" #include "shell/common/options_switches.h" #include "shell/common/world_ids.h" #include "third_party/blink/public/common/browser_interface_broker_proxy.h" @@ -63,6 +64,10 @@ void ElectronRenderFrameObserver::DidClearWindowObject() { void ElectronRenderFrameObserver::DidInstallConditionalFeatures( v8::Handle context, int world_id) { + auto* isolate = context->GetIsolate(); + v8::MicrotasksScope microtasks_scope( + isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); + if (ShouldNotifyClient(world_id)) renderer_client_->DidCreateScriptContext(context, render_frame_); diff --git a/shell/renderer/electron_sandboxed_renderer_client.cc b/shell/renderer/electron_sandboxed_renderer_client.cc index 5a3ec07504598..19898de29283b 100644 --- a/shell/renderer/electron_sandboxed_renderer_client.cc +++ b/shell/renderer/electron_sandboxed_renderer_client.cc @@ -14,6 +14,7 @@ #include "shell/common/api/electron_bindings.h" #include "shell/common/application_info.h" #include "shell/common/gin_helper/dictionary.h" +#include "shell/common/gin_helper/microtasks_scope.h" #include "shell/common/node_bindings.h" #include "shell/common/node_includes.h" #include "shell/common/node_util.h" @@ -168,6 +169,8 @@ void ElectronSandboxedRendererClient::RunScriptsAtDocumentStart( return; auto* isolate = blink::MainThreadIsolate(); + gin_helper::MicrotasksScope microtasks_scope( + isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::HandleScope handle_scope(isolate); v8::Local context = @@ -184,6 +187,8 @@ void ElectronSandboxedRendererClient::RunScriptsAtDocumentEnd( return; auto* isolate = blink::MainThreadIsolate(); + gin_helper::MicrotasksScope microtasks_scope( + isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::HandleScope handle_scope(isolate); v8::Local context = @@ -269,6 +274,8 @@ void ElectronSandboxedRendererClient::WillReleaseScriptContext( return; auto* isolate = context->GetIsolate(); + gin_helper::MicrotasksScope microtasks_scope( + isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::HandleScope handle_scope(isolate); v8::Context::Scope context_scope(context); InvokeHiddenCallback(context, kLifecycleKey, "onExit"); diff --git a/shell/renderer/web_worker_observer.cc b/shell/renderer/web_worker_observer.cc index b4b5aa30b066e..7f919f983979e 100644 --- a/shell/renderer/web_worker_observer.cc +++ b/shell/renderer/web_worker_observer.cc @@ -45,6 +45,9 @@ WebWorkerObserver::~WebWorkerObserver() { void WebWorkerObserver::WorkerScriptReadyForEvaluation( v8::Local worker_context) { v8::Context::Scope context_scope(worker_context); + auto* isolate = worker_context->GetIsolate(); + v8::MicrotasksScope microtasks_scope( + isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); // Start the embed thread. node_bindings_->PrepareMessageLoop(); From 4073599f59023360fbaff0a6e90f34dc26246338 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 14 May 2021 18:05:34 +0900 Subject: [PATCH 036/587] fix: remove background color hack in vibrancy (#29114) --- docs/api/browser-window.md | 2 +- shell/browser/native_window_mac.h | 2 -- shell/browser/native_window_mac.mm | 12 +----------- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index a1602e47ccf12..3dd9de0c2de4b 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -238,7 +238,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. window shadow and window animations. Default is `true`. * `vibrancy` String (optional) - Add a type of vibrancy effect to the window, only on macOS. Can be `appearance-based`, `light`, `dark`, `titlebar`, `selection`, - `menu`, `popover`, `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please note that using `frame: false` in combination with a vibrancy value requires that you use a non-default `titleBarStyle` as well. Also note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` are deprecated and have been removed in macOS Catalina (10.15). + `menu`, `popover`, `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` are deprecated and have been removed in macOS Catalina (10.15). * `zoomToPageWidth` Boolean (optional) - Controls the behavior on macOS when option-clicking the green stoplight button on the toolbar or by clicking the Window > Zoom menu item. If `true`, the window will grow to the preferred diff --git a/shell/browser/native_window_mac.h b/shell/browser/native_window_mac.h index 4f66a26601731..65fe746a58e16 100644 --- a/shell/browser/native_window_mac.h +++ b/shell/browser/native_window_mac.h @@ -271,8 +271,6 @@ class NativeWindowMac : public NativeWindow, NSInteger original_level_; NSUInteger simple_fullscreen_mask_; - base::scoped_nsobject background_color_before_vibrancy_; - bool transparency_before_vibrancy_ = false; std::string vibrancy_type_; // The presentation options before entering simple fullscreen mode. diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index 67b2ed06722ee..f6867beb87976 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -1338,6 +1338,7 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { [maskImage setCapInsets:NSEdgeInsetsMake(radius, radius, radius, radius)]; [maskImage setResizingMode:NSImageResizingModeStretch]; [effect_view setMaskImage:maskImage]; + [window_ setCornerMask:maskImage]; } } } @@ -1346,10 +1347,6 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { NSView* vibrant_view = [window_ vibrantView]; if (type.empty()) { - if (background_color_before_vibrancy_) { - [window_ setBackgroundColor:background_color_before_vibrancy_]; - [window_ setTitlebarAppearsTransparent:transparency_before_vibrancy_]; - } if (vibrant_view == nil) return; @@ -1360,13 +1357,6 @@ void ViewDidMoveToSuperview(NSView* self, SEL _cmd) { } vibrancy_type_ = type; - background_color_before_vibrancy_.reset([[window_ backgroundColor] retain]); - transparency_before_vibrancy_ = [window_ titlebarAppearsTransparent]; - - if (title_bar_style_ != TitleBarStyle::kNormal) { - [window_ setTitlebarAppearsTransparent:YES]; - [window_ setBackgroundColor:[NSColor clearColor]]; - } NSVisualEffectView* effect_view = (NSVisualEffectView*)vibrant_view; if (effect_view == nil) { From b7a23450b7ec345929d282dcf0e2c8a75c179d51 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Fri, 14 May 2021 13:36:15 +0200 Subject: [PATCH 037/587] fix: illegal access errors with nodeIntegrationInSubFrames (#29093) --- .../electron_render_frame_observer.cc | 17 ++++++- shell/renderer/electron_renderer_client.cc | 5 +- .../electron_sandboxed_renderer_client.cc | 2 + .../crash-cases/js-execute-iframe/index.html | 29 +++++++++++ .../crash-cases/js-execute-iframe/index.js | 51 +++++++++++++++++++ .../crash-cases/js-execute-iframe/page2.html | 4 ++ 6 files changed, 104 insertions(+), 4 deletions(-) create mode 100644 spec-main/fixtures/crash-cases/js-execute-iframe/index.html create mode 100644 spec-main/fixtures/crash-cases/js-execute-iframe/index.js create mode 100644 spec-main/fixtures/crash-cases/js-execute-iframe/page2.html diff --git a/shell/renderer/electron_render_frame_observer.cc b/shell/renderer/electron_render_frame_observer.cc index 408c86e4a2d06..ecd6c7f0dc443 100644 --- a/shell/renderer/electron_render_frame_observer.cc +++ b/shell/renderer/electron_render_frame_observer.cc @@ -79,6 +79,7 @@ void ElectronRenderFrameObserver::DidInstallConditionalFeatures( bool is_main_world = IsMainWorld(world_id); bool is_main_frame = render_frame_->IsMainFrame(); bool allow_node_in_sub_frames = prefs.node_integration_in_sub_frames; + bool should_create_isolated_context = use_context_isolation && is_main_world && (is_main_frame || allow_node_in_sub_frames); @@ -157,12 +158,24 @@ bool ElectronRenderFrameObserver::IsIsolatedWorld(int world_id) { bool ElectronRenderFrameObserver::ShouldNotifyClient(int world_id) { auto prefs = render_frame_->GetBlinkPreferences(); + + // This is necessary because if an iframe is created and a source is not + // set, the iframe loads about:blank and creates a script context for the + // same. We don't want to create a Node.js environment here because if the src + // is later set, the JS necessary to do that triggers illegal access errors + // when the initial about:blank Node.js environment is cleaned up. See: + // https://source.chromium.org/chromium/chromium/src/+/main:content/renderer/render_frame_impl.h;l=870-892;drc=4b6001440a18740b76a1c63fa2a002cc941db394 + GURL url = render_frame_->GetWebFrame()->GetDocument().Url(); bool allow_node_in_sub_frames = prefs.node_integration_in_sub_frames; + if (allow_node_in_sub_frames && url.IsAboutBlank() && + !render_frame_->IsMainFrame()) + return false; + if (prefs.context_isolation && (render_frame_->IsMainFrame() || allow_node_in_sub_frames)) return IsIsolatedWorld(world_id); - else - return IsMainWorld(world_id); + + return IsMainWorld(world_id); } } // namespace electron diff --git a/shell/renderer/electron_renderer_client.cc b/shell/renderer/electron_renderer_client.cc index f35d60e2855cf..59d511ba2ba3e 100644 --- a/shell/renderer/electron_renderer_client.cc +++ b/shell/renderer/electron_renderer_client.cc @@ -80,12 +80,13 @@ void ElectronRendererClient::DidCreateScriptContext( // TODO(zcbenz): Do not create Node environment if node integration is not // enabled. - // Only load node if we are a main frame or a devtools extension - // unless node support has been explicitly enabled for sub frames + // Only load Node.js if we are a main frame or a devtools extension + // unless Node.js support has been explicitly enabled for subframes. auto prefs = render_frame->GetBlinkPreferences(); bool is_main_frame = render_frame->IsMainFrame(); bool is_devtools = IsDevToolsExtension(render_frame); bool allow_node_in_subframes = prefs.node_integration_in_sub_frames; + bool should_load_node = (is_main_frame || is_devtools || allow_node_in_subframes) && !IsWebViewFrame(renderer_context, render_frame); diff --git a/shell/renderer/electron_sandboxed_renderer_client.cc b/shell/renderer/electron_sandboxed_renderer_client.cc index 19898de29283b..afa958fcde6e7 100644 --- a/shell/renderer/electron_sandboxed_renderer_client.cc +++ b/shell/renderer/electron_sandboxed_renderer_client.cc @@ -209,8 +209,10 @@ void ElectronSandboxedRendererClient::DidCreateScriptContext( bool is_main_frame = render_frame->IsMainFrame(); bool is_devtools = IsDevTools(render_frame) || IsDevToolsExtension(render_frame); + bool allow_node_in_sub_frames = render_frame->GetBlinkPreferences().node_integration_in_sub_frames; + bool should_load_preload = (is_main_frame || is_devtools || allow_node_in_sub_frames) && !IsWebViewFrame(context, render_frame); diff --git a/spec-main/fixtures/crash-cases/js-execute-iframe/index.html b/spec-main/fixtures/crash-cases/js-execute-iframe/index.html new file mode 100644 index 0000000000000..96a82f6749f25 --- /dev/null +++ b/spec-main/fixtures/crash-cases/js-execute-iframe/index.html @@ -0,0 +1,29 @@ + + + + + + \ No newline at end of file diff --git a/spec-main/fixtures/crash-cases/js-execute-iframe/index.js b/spec-main/fixtures/crash-cases/js-execute-iframe/index.js new file mode 100644 index 0000000000000..d024d4eea4b14 --- /dev/null +++ b/spec-main/fixtures/crash-cases/js-execute-iframe/index.js @@ -0,0 +1,51 @@ +const { app, BrowserWindow } = require('electron'); +const net = require('net'); +const path = require('path'); + +function createWindow () { + const mainWindow = new BrowserWindow({ + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + nodeIntegrationInSubFrames: true + } + }); + + mainWindow.loadFile('index.html'); +} + +app.whenReady().then(() => { + createWindow(); + + app.on('activate', () => { + if (BrowserWindow.getAllWindows().length === 0) createWindow(); + }); +}); + +app.on('window-all-closed', () => { + if (process.platform !== 'darwin') app.quit(); +}); + +const server = net.createServer((c) => { + console.log('client connected'); + + c.on('end', () => { + console.log('client disconnected'); + app.quit(); + }); + + c.write('hello\r\n'); + c.pipe(c); +}); + +server.on('error', (err) => { + throw err; +}); + +const p = process.platform === 'win32' + ? path.join('\\\\?\\pipe', process.cwd(), 'myctl') + : '/tmp/echo.sock'; + +server.listen(p, () => { + console.log('server bound'); +}); diff --git a/spec-main/fixtures/crash-cases/js-execute-iframe/page2.html b/spec-main/fixtures/crash-cases/js-execute-iframe/page2.html new file mode 100644 index 0000000000000..755d755c42e30 --- /dev/null +++ b/spec-main/fixtures/crash-cases/js-execute-iframe/page2.html @@ -0,0 +1,4 @@ + + + HELLO + \ No newline at end of file From cba6626af8c78bd835b1abfe77701b42a7fef7ba Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Fri, 14 May 2021 14:06:55 +0200 Subject: [PATCH 038/587] fix: ensure extensions w/o a background page have file access (#29123) --- shell/browser/electron_browser_client.cc | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index 58f82ec0332a0..dcfd285d8551a 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -27,6 +27,7 @@ #include "base/task/post_task.h" #include "chrome/browser/browser_process.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version.h" #include "components/net_log/chrome_net_log.h" #include "components/network_hints/common/network_hints.mojom.h" @@ -144,6 +145,7 @@ #include "extensions/browser/extension_message_filter.h" #include "extensions/browser/extension_navigation_throttle.h" #include "extensions/browser/extension_navigation_ui_data.h" +#include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_protocols.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extensions_browser_client.h" @@ -225,6 +227,15 @@ enum class RenderProcessHostPrivilege { kExtension, }; +// Copied from chrome/browser/extensions/extension_util.cc. +bool AllowFileAccess(const std::string& extension_id, + content::BrowserContext* context) { + return base::CommandLine::ForCurrentProcess()->HasSwitch( + ::switches::kDisableExtensionsFileAccessCheck) || + extensions::ExtensionPrefs::Get(context)->AllowFileAccess( + extension_id); +} + RenderProcessHostPrivilege GetPrivilegeRequiredByUrl( const GURL& url, extensions::ExtensionRegistry* registry) { @@ -1182,12 +1193,12 @@ void ElectronBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories( {content::kChromeUIResourcesHost})); } - // Extension with a background page get file access that gets approval from - // ChildProcessSecurityPolicy. - extensions::ExtensionHost* host = - extensions::ProcessManager::Get(web_contents->GetBrowserContext()) - ->GetBackgroundHostForExtension(extension->id()); - if (host) { + // Extensions with the necessary permissions get access to file:// URLs that + // gets approval from ChildProcessSecurityPolicy. Keep this logic in sync with + // ExtensionWebContentsObserver::RenderFrameCreated. + extensions::Manifest::Type type = extension->GetType(); + if (type == extensions::Manifest::TYPE_EXTENSION && + AllowFileAccess(extension->id(), web_contents->GetBrowserContext())) { factories->emplace(url::kFileScheme, FileURLLoaderFactory::Create(render_process_id)); } From 1c3339640a6e6feff1cd188423384d7106f1635b Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Fri, 14 May 2021 06:05:22 -0700 Subject: [PATCH 039/587] Bump v14.0.0-nightly.20210514 --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 13c7495c8b0c3..7f543e49b55ea 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -14.0.0-nightly.20210513 \ No newline at end of file +14.0.0-nightly.20210514 \ No newline at end of file diff --git a/package.json b/package.json index 7dedf13651ea4..810a3d1b14bdf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "14.0.0-nightly.20210513", + "version": "14.0.0-nightly.20210514", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index 2325ee5d7b197..c154f15d1aea1 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 14,0,0,20210513 - PRODUCTVERSION 14,0,0,20210513 + FILEVERSION 14,0,0,20210514 + PRODUCTVERSION 14,0,0,20210514 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From 5e6f8349ec09f2d1be53cf17aae7cf3099b154fa Mon Sep 17 00:00:00 2001 From: Noelle Leigh <5957867+noelleleigh@users.noreply.github.com> Date: Fri, 14 May 2021 21:32:21 -0400 Subject: [PATCH 040/587] docs: --force-fieldtrials was h2 rather than h3 (#29161) All the other argument headers were h3 (`###`) but `--force-fieldtrials` was h2 (`##`) for some reason. I changed it to make it consistent with the others. --- docs/api/command-line-switches.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/command-line-switches.md b/docs/api/command-line-switches.md index b0239a8f46a96..b125f128c635b 100644 --- a/docs/api/command-line-switches.md +++ b/docs/api/command-line-switches.md @@ -75,7 +75,7 @@ This switch can not be used in `app.commandLine.appendSwitch` since it is parsed earlier than user's app is loaded, but you can set the `ELECTRON_ENABLE_LOGGING` environment variable to achieve the same effect. -## --force-fieldtrials=`trials` +### --force-fieldtrials=`trials` Field trials to be forcefully enabled or disabled. From c68c65f383f7b210c2ad93715dd70dbb9dcb4798 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Sat, 15 May 2021 09:42:07 +0200 Subject: [PATCH 041/587] refactor: implement using contextBridge (#29037) * refactor: implement using contextBridge * chore: address PR feedback * chore: address PR feedback * fix: check for HTMLIFrameElement instance in attachGuest --- filenames.auto.gni | 4 + lib/browser/api/web-contents.ts | 7 +- lib/common/type-utils.ts | 16 ++-- lib/isolated_renderer/init.ts | 12 +-- lib/renderer/web-view/guest-view-internal.ts | 68 +++++++++------ lib/renderer/web-view/web-view-element.ts | 36 ++++---- lib/renderer/web-view/web-view-impl.ts | 69 +++++++-------- lib/renderer/web-view/web-view-init.ts | 17 ++-- shell/renderer/api/electron_api_web_frame.cc | 35 +------- shell/renderer/electron_renderer_client.cc | 27 ------ shell/renderer/electron_renderer_client.h | 2 - .../electron_sandboxed_renderer_client.cc | 28 ------ .../electron_sandboxed_renderer_client.h | 2 - shell/renderer/renderer_client_base.cc | 87 ++++++++++++++++++- shell/renderer/renderer_client_base.h | 8 +- typings/internal-ambient.d.ts | 11 ++- typings/internal-electron.d.ts | 5 -- 17 files changed, 220 insertions(+), 214 deletions(-) diff --git a/filenames.auto.gni b/filenames.auto.gni index b88878ea1898c..0de22fca09fbc 100644 --- a/filenames.auto.gni +++ b/filenames.auto.gni @@ -167,9 +167,13 @@ auto_filenames = { ] isolated_bundle_deps = [ + "lib/common/type-utils.ts", + "lib/common/web-view-methods.ts", "lib/isolated_renderer/init.ts", + "lib/renderer/web-view/web-view-attributes.ts", "lib/renderer/web-view/web-view-constants.ts", "lib/renderer/web-view/web-view-element.ts", + "lib/renderer/web-view/web-view-impl.ts", "package.json", "tsconfig.electron.json", "tsconfig.json", diff --git a/lib/browser/api/web-contents.ts b/lib/browser/api/web-contents.ts index 4ed02f2b7506d..245b1a3b27579 100644 --- a/lib/browser/api/web-contents.ts +++ b/lib/browser/api/web-contents.ts @@ -1,4 +1,4 @@ -import { app, ipcMain, session, deprecate, webFrameMain } from 'electron/main'; +import { app, ipcMain, session, webFrameMain } from 'electron/main'; import type { BrowserWindowConstructorOptions, LoadURLOptions } from 'electron/main'; import * as url from 'url'; @@ -709,11 +709,6 @@ WebContents.prototype._init = function () { } }); }); - - const prefs = this.getWebPreferences() || {}; - if (prefs.webviewTag && prefs.contextIsolation) { - deprecate.log('Security Warning: A WebContents was just created with both webviewTag and contextIsolation enabled. This combination is fundamentally less secure and effectively bypasses the protections of contextIsolation. We strongly recommend you move away from webviews to OOPIF or BrowserView in order for your app to be more secure'); - } } this.on('login', (event, ...args) => { diff --git a/lib/common/type-utils.ts b/lib/common/type-utils.ts index 8033b3ae60345..59b1705b3e123 100644 --- a/lib/common/type-utils.ts +++ b/lib/common/type-utils.ts @@ -1,4 +1,6 @@ -const { nativeImage } = process._linkedBinding('electron_common_native_image'); +function getCreateNativeImage () { + return process._linkedBinding('electron_common_native_image').nativeImage.createEmpty; +} export function isPromise (val: any) { return ( @@ -57,8 +59,8 @@ function serializeNativeImage (image: Electron.NativeImage) { return { __ELECTRON_SERIALIZED_NativeImage__: true, representations }; } -function deserializeNativeImage (value: any) { - const image = nativeImage.createEmpty(); +function deserializeNativeImage (value: any, createNativeImage: typeof Electron.nativeImage['createEmpty']) { + const image = createNativeImage(); // Use Buffer when there's only one representation for better perf. // This avoids compressing to/from PNG where it's not necessary to @@ -93,15 +95,15 @@ export function serialize (value: any): any { } } -export function deserialize (value: any): any { +export function deserialize (value: any, createNativeImage: typeof Electron.nativeImage['createEmpty'] = getCreateNativeImage()): any { if (value && value.__ELECTRON_SERIALIZED_NativeImage__) { - return deserializeNativeImage(value); + return deserializeNativeImage(value, createNativeImage); } else if (Array.isArray(value)) { - return value.map(deserialize); + return value.map(value => deserialize(value, createNativeImage)); } else if (isSerializableObject(value)) { return value; } else if (value instanceof Object) { - return objectMap(value, deserialize); + return objectMap(value, value => deserialize(value, createNativeImage)); } else { return value; } diff --git a/lib/isolated_renderer/init.ts b/lib/isolated_renderer/init.ts index 49824021068e6..d2cbf4207fa98 100644 --- a/lib/isolated_renderer/init.ts +++ b/lib/isolated_renderer/init.ts @@ -1,15 +1,9 @@ -/* global nodeProcess, isolatedWorld */ +/* global isolatedApi */ import type * as webViewElementModule from '@electron/internal/renderer/web-view/web-view-element'; -process._linkedBinding = nodeProcess._linkedBinding; - -const v8Util = process._linkedBinding('electron_common_v8_util'); - -const webViewImpl = v8Util.getHiddenValue(isolatedWorld, 'web-view-impl'); - -if (webViewImpl) { +if (isolatedApi.guestViewInternal) { // Must setup the WebView element in main world. const { setupWebView } = require('@electron/internal/renderer/web-view/web-view-element') as typeof webViewElementModule; - setupWebView(webViewImpl as any); + setupWebView(isolatedApi); } diff --git a/lib/renderer/web-view/guest-view-internal.ts b/lib/renderer/web-view/guest-view-internal.ts index d4feb223bb5e4..c3701311e3f9a 100644 --- a/lib/renderer/web-view/guest-view-internal.ts +++ b/lib/renderer/web-view/guest-view-internal.ts @@ -1,20 +1,22 @@ -import { webFrame } from 'electron'; import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal'; import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils'; import { webViewEvents } from '@electron/internal/common/web-view-events'; - -import { WebViewImpl } from '@electron/internal/renderer/web-view/web-view-impl'; import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages'; +const { mainFrame: webFrame } = process._linkedBinding('electron_renderer_web_frame'); + +export interface GuestViewDelegate { + dispatchEvent (eventName: string, props: Record): void; + reset(): void; +} + const DEPRECATED_EVENTS: Record = { 'page-title-updated': 'page-title-set' } as const; -const dispatchEvent = function ( - webView: WebViewImpl, eventName: string, eventKey: string, ...args: Array -) { +const dispatchEvent = function (delegate: GuestViewDelegate, eventName: string, eventKey: string, ...args: Array) { if (DEPRECATED_EVENTS[eventName] != null) { - dispatchEvent(webView, DEPRECATED_EVENTS[eventName], eventKey, ...args); + dispatchEvent(delegate, DEPRECATED_EVENTS[eventName], eventKey, ...args); } const props: Record = {}; @@ -22,28 +24,21 @@ const dispatchEvent = function ( props[prop] = args[index]; }); - webView.dispatchEvent(eventName, props); - - if (eventName === 'load-commit') { - webView.onLoadCommit(props); - } else if (eventName === '-focus-change') { - webView.onFocusChange(); - } + delegate.dispatchEvent(eventName, props); }; -export function registerEvents (webView: WebViewImpl, viewInstanceId: number) { +export function registerEvents (viewInstanceId: number, delegate: GuestViewDelegate) { ipcRendererInternal.on(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DESTROY_GUEST}-${viewInstanceId}`, function () { - webView.guestInstanceId = undefined; - webView.reset(); - webView.dispatchEvent('destroyed'); + delegate.reset(); + delegate.dispatchEvent('destroyed', {}); }); ipcRendererInternal.on(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_DISPATCH_EVENT}-${viewInstanceId}`, function (event, eventName, ...args) { - dispatchEvent(webView, eventName, eventName, ...args); + dispatchEvent(delegate, eventName, eventName, ...args); }); ipcRendererInternal.on(`${IPC_MESSAGES.GUEST_VIEW_INTERNAL_IPC_MESSAGE}-${viewInstanceId}`, function (event, channel, ...args) { - webView.dispatchEvent('ipc-message', { channel, args }); + delegate.dispatchEvent('ipc-message', { channel, args }); }); } @@ -57,16 +52,39 @@ export function createGuest (params: Record): Promise { return ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_VIEW_MANAGER_CREATE_GUEST, params); } -export function attachGuest ( - elementInstanceId: number, guestInstanceId: number, params: Record, contentWindow: Window -) { - const embedderFrameId = webFrame.getWebFrameId(contentWindow); +export function attachGuest (iframe: HTMLIFrameElement, elementInstanceId: number, guestInstanceId: number, params: Record) { + if (!(iframe instanceof HTMLIFrameElement)) { + throw new Error('Invalid embedder frame'); + } + + const embedderFrameId = webFrame.getWebFrameId(iframe.contentWindow!); if (embedderFrameId < 0) { // this error should not happen. throw new Error('Invalid embedder frame'); } - ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_VIEW_MANAGER_ATTACH_GUEST, embedderFrameId, elementInstanceId, guestInstanceId, params); + + return ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_VIEW_MANAGER_ATTACH_GUEST, embedderFrameId, elementInstanceId, guestInstanceId, params); } export function detachGuest (guestInstanceId: number) { return ipcRendererUtils.invokeSync(IPC_MESSAGES.GUEST_VIEW_MANAGER_DETACH_GUEST, guestInstanceId); } + +export function capturePage (guestInstanceId: number, args: any[]) { + return ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_VIEW_MANAGER_CAPTURE_PAGE, guestInstanceId, args); +} + +export function invoke (guestInstanceId: number, method: string, args: any[]) { + return ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_VIEW_MANAGER_CALL, guestInstanceId, method, args); +} + +export function invokeSync (guestInstanceId: number, method: string, args: any[]) { + return ipcRendererUtils.invokeSync(IPC_MESSAGES.GUEST_VIEW_MANAGER_CALL, guestInstanceId, method, args); +} + +export function propertyGet (guestInstanceId: number, name: string) { + return ipcRendererUtils.invokeSync(IPC_MESSAGES.GUEST_VIEW_MANAGER_PROPERTY_GET, guestInstanceId, name); +} + +export function propertySet (guestInstanceId: number, name: string, value: any) { + return ipcRendererUtils.invokeSync(IPC_MESSAGES.GUEST_VIEW_MANAGER_PROPERTY_SET, guestInstanceId, name, value); +} diff --git a/lib/renderer/web-view/web-view-element.ts b/lib/renderer/web-view/web-view-element.ts index 051550d5d815d..84ac5a9ba79c4 100644 --- a/lib/renderer/web-view/web-view-element.ts +++ b/lib/renderer/web-view/web-view-element.ts @@ -9,14 +9,13 @@ // modules must be passed from outside, all included files must be plain JS. import { WEB_VIEW_CONSTANTS } from '@electron/internal/renderer/web-view/web-view-constants'; -import type * as webViewImplModule from '@electron/internal/renderer/web-view/web-view-impl'; +import { WebViewImpl, WebViewImplHooks, setupMethods } from '@electron/internal/renderer/web-view/web-view-impl'; import type { SrcAttribute } from '@electron/internal/renderer/web-view/web-view-attributes'; -const internals = new WeakMap(); +const internals = new WeakMap(); // Return a WebViewElement class that is defined in this context. -const defineWebViewElement = (webViewImpl: typeof webViewImplModule) => { - const { guestViewInternal, WebViewImpl } = webViewImpl; +const defineWebViewElement = (hooks: WebViewImplHooks) => { return class WebViewElement extends HTMLElement { static get observedAttributes () { return [ @@ -38,13 +37,7 @@ const defineWebViewElement = (webViewImpl: typeof webViewImplModule) => { constructor () { super(); - const internal = new WebViewImpl(this); - internal.dispatchEventInMainWorld = (eventName, props) => { - const event = new Event(eventName); - Object.assign(event, props); - return internal.webviewNode.dispatchEvent(event); - }; - internals.set(this, internal); + internals.set(this, new WebViewImpl(this, hooks)); } getWebContentsId () { @@ -61,7 +54,10 @@ const defineWebViewElement = (webViewImpl: typeof webViewImplModule) => { return; } if (!internal.elementAttached) { - guestViewInternal.registerEvents(internal, internal.viewInstanceId); + hooks.guestViewInternal.registerEvents(internal.viewInstanceId, { + dispatchEvent: internal.dispatchEvent.bind(internal), + reset: internal.reset.bind(internal) + }); internal.elementAttached = true; (internal.attributes.get(WEB_VIEW_CONSTANTS.ATTRIBUTE_SRC) as SrcAttribute).parse(); } @@ -79,9 +75,9 @@ const defineWebViewElement = (webViewImpl: typeof webViewImplModule) => { if (!internal) { return; } - guestViewInternal.deregisterEvents(internal.viewInstanceId); + hooks.guestViewInternal.deregisterEvents(internal.viewInstanceId); if (internal.guestInstanceId) { - guestViewInternal.detachGuest(internal.guestInstanceId); + hooks.guestViewInternal.detachGuest(internal.guestInstanceId); } internal.elementAttached = false; internal.reset(); @@ -90,15 +86,15 @@ const defineWebViewElement = (webViewImpl: typeof webViewImplModule) => { }; // Register custom element. -const registerWebViewElement = (webViewImpl: typeof webViewImplModule) => { +const registerWebViewElement = (hooks: WebViewImplHooks) => { // I wish eslint wasn't so stupid, but it is // eslint-disable-next-line - const WebViewElement = defineWebViewElement(webViewImpl) as unknown as typeof ElectronInternal.WebViewElement + const WebViewElement = defineWebViewElement(hooks) as unknown as typeof ElectronInternal.WebViewElement - webViewImpl.setupMethods(WebViewElement); + setupMethods(WebViewElement, hooks); // The customElements.define has to be called in a special scope. - webViewImpl.webFrame.allowGuestViewElementDefinition(window, () => { + hooks.allowGuestViewElementDefinition(window, () => { window.customElements.define('webview', WebViewElement); window.WebView = WebViewElement; @@ -116,14 +112,14 @@ const registerWebViewElement = (webViewImpl: typeof webViewImplModule) => { }; // Prepare to register the element. -export const setupWebView = (webViewImpl: typeof webViewImplModule) => { +export const setupWebView = (hooks: WebViewImplHooks) => { const useCapture = true; const listener = (event: Event) => { if (document.readyState === 'loading') { return; } - registerWebViewElement(webViewImpl); + registerWebViewElement(hooks); window.removeEventListener(event.type, listener, useCapture); }; diff --git a/lib/renderer/web-view/web-view-impl.ts b/lib/renderer/web-view/web-view-impl.ts index 51f39d9f5bae0..75bde104b7a31 100644 --- a/lib/renderer/web-view/web-view-impl.ts +++ b/lib/renderer/web-view/web-view-impl.ts @@ -1,17 +1,9 @@ -import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal'; -import * as ipcRendererUtils from '@electron/internal/renderer/ipc-renderer-internal-utils'; -import * as guestViewInternal from '@electron/internal/renderer/web-view/guest-view-internal'; +import type * as guestViewInternalModule from '@electron/internal/renderer/web-view/guest-view-internal'; import { WEB_VIEW_CONSTANTS } from '@electron/internal/renderer/web-view/web-view-constants'; import { syncMethods, asyncMethods, properties } from '@electron/internal/common/web-view-methods'; import type { WebViewAttribute, PartitionAttribute } from '@electron/internal/renderer/web-view/web-view-attributes'; import { setupWebViewAttributes } from '@electron/internal/renderer/web-view/web-view-attributes'; import { deserialize } from '@electron/internal/common/type-utils'; -import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages'; - -export { webFrame } from 'electron'; -export * as guestViewInternal from '@electron/internal/renderer/web-view/guest-view-internal'; - -const v8Util = process._linkedBinding('electron_common_v8_util'); // ID generator. let nextId = 0; @@ -20,6 +12,13 @@ const getNextId = function () { return ++nextId; }; +export interface WebViewImplHooks { + readonly guestViewInternal: typeof guestViewInternalModule; + readonly allowGuestViewElementDefinition: NodeJS.InternalWebFrame['allowGuestViewElementDefinition']; + readonly setIsWebView: (iframe: HTMLIFrameElement) => void; + readonly createNativeImage?: typeof Electron.nativeImage['createEmpty']; +} + // Represents the internal state of the WebView node. export class WebViewImpl { public beforeFirstNavigation = true @@ -37,9 +36,7 @@ export class WebViewImpl { public attributes: Map; - public dispatchEventInMainWorld?: (eventName: string, props: any) => boolean; - - constructor (public webviewNode: HTMLElement) { + constructor (public webviewNode: HTMLElement, private hooks: WebViewImplHooks) { // Create internal iframe element. this.internalElement = this.createInternalElement(); const shadowRoot = this.webviewNode.attachShadow({ mode: 'open' }); @@ -65,7 +62,7 @@ export class WebViewImpl { iframeElement.style.width = '100%'; iframeElement.style.border = '0'; // used by RendererClientBase::IsWebViewFrame - v8Util.setHiddenValue(iframeElement, 'internal', this); + this.hooks.setIsWebView(iframeElement); return iframeElement; } @@ -118,13 +115,21 @@ export class WebViewImpl { } createGuest () { - guestViewInternal.createGuest(this.buildParams()).then(guestInstanceId => { + this.hooks.guestViewInternal.createGuest(this.buildParams()).then(guestInstanceId => { this.attachGuestInstance(guestInstanceId); }); } dispatchEvent (eventName: string, props: Record = {}) { - this.dispatchEventInMainWorld!(eventName, props); + const event = new Event(eventName); + Object.assign(event, props); + this.webviewNode.dispatchEvent(event); + + if (eventName === 'load-commit') { + this.onLoadCommit(props); + } else if (eventName === '-focus-change') { + this.onFocusChange(); + } } // Adds an 'on' property on the webview, which can be used to set/unset @@ -194,11 +199,11 @@ export class WebViewImpl { this.internalInstanceId = getNextId(); this.guestInstanceId = guestInstanceId; - guestViewInternal.attachGuest( + this.hooks.guestViewInternal.attachGuest( + this.internalElement, this.internalInstanceId, this.guestInstanceId, - this.buildParams(), - this.internalElement.contentWindow! + this.buildParams() ); // TODO(zcbenz): Should we deprecate the "resize" event? Wait, it is not @@ -210,46 +215,38 @@ export class WebViewImpl { // I wish eslint wasn't so stupid, but it is // eslint-disable-next-line -export const setupMethods = (WebViewElement: typeof ElectronInternal.WebViewElement) => { +export const setupMethods = (WebViewElement: typeof ElectronInternal.WebViewElement, hooks: WebViewImplHooks) => { // Focusing the webview should move page focus to the underlying iframe. WebViewElement.prototype.focus = function () { this.contentWindow.focus(); }; // Forward proto.foo* method calls to WebViewImpl.foo*. - const createBlockHandler = function (method: string) { - return function (this: ElectronInternal.WebViewElement, ...args: Array) { - return ipcRendererUtils.invokeSync(IPC_MESSAGES.GUEST_VIEW_MANAGER_CALL, this.getWebContentsId(), method, args); - }; - }; - for (const method of syncMethods) { - (WebViewElement.prototype as Record)[method] = createBlockHandler(method); - } - - const createNonBlockHandler = function (method: string) { - return function (this: ElectronInternal.WebViewElement, ...args: Array) { - return ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_VIEW_MANAGER_CALL, this.getWebContentsId(), method, args); + (WebViewElement.prototype as Record)[method] = function (this: ElectronInternal.WebViewElement, ...args: Array) { + return hooks.guestViewInternal.invokeSync(this.getWebContentsId(), method, args); }; - }; + } for (const method of asyncMethods) { - (WebViewElement.prototype as Record)[method] = createNonBlockHandler(method); + (WebViewElement.prototype as Record)[method] = function (this: ElectronInternal.WebViewElement, ...args: Array) { + return hooks.guestViewInternal.invoke(this.getWebContentsId(), method, args); + }; } WebViewElement.prototype.capturePage = async function (...args) { - return deserialize(await ipcRendererInternal.invoke(IPC_MESSAGES.GUEST_VIEW_MANAGER_CAPTURE_PAGE, this.getWebContentsId(), args)); + return deserialize(await hooks.guestViewInternal.capturePage(this.getWebContentsId(), args), hooks.createNativeImage); }; const createPropertyGetter = function (property: string) { return function (this: ElectronInternal.WebViewElement) { - return ipcRendererUtils.invokeSync(IPC_MESSAGES.GUEST_VIEW_MANAGER_PROPERTY_GET, this.getWebContentsId(), property); + return hooks.guestViewInternal.propertyGet(this.getWebContentsId(), property); }; }; const createPropertySetter = function (property: string) { return function (this: ElectronInternal.WebViewElement, arg: any) { - return ipcRendererUtils.invokeSync(IPC_MESSAGES.GUEST_VIEW_MANAGER_PROPERTY_SET, this.getWebContentsId(), property, arg); + return hooks.guestViewInternal.propertySet(this.getWebContentsId(), property, arg); }; }; diff --git a/lib/renderer/web-view/web-view-init.ts b/lib/renderer/web-view/web-view-init.ts index ff8799dae9f9d..1da1ce18c6751 100644 --- a/lib/renderer/web-view/web-view-init.ts +++ b/lib/renderer/web-view/web-view-init.ts @@ -1,10 +1,11 @@ import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal'; import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages'; -import type * as webViewImpl from '@electron/internal/renderer/web-view/web-view-impl'; -import type * as webViewElement from '@electron/internal/renderer/web-view/web-view-element'; +import type * as webViewElementModule from '@electron/internal/renderer/web-view/web-view-element'; +import type * as guestViewInternalModule from '@electron/internal/renderer/web-view/guest-view-internal'; const v8Util = process._linkedBinding('electron_common_v8_util'); +const { mainFrame: webFrame } = process._linkedBinding('electron_renderer_web_frame'); function handleFocusBlur () { // Note that while Chromium content APIs have observer for focus/blur, they @@ -22,12 +23,16 @@ function handleFocusBlur () { export function webViewInit (contextIsolation: boolean, webviewTag: boolean, guestInstanceId: number) { // Don't allow recursive ``. if (webviewTag && !guestInstanceId) { - const webViewImplModule = require('@electron/internal/renderer/web-view/web-view-impl') as typeof webViewImpl; + const guestViewInternal = require('@electron/internal/renderer/web-view/guest-view-internal') as typeof guestViewInternalModule; if (contextIsolation) { - v8Util.setHiddenValue(window, 'web-view-impl', webViewImplModule); + v8Util.setHiddenValue(window, 'guestViewInternal', guestViewInternal); } else { - const { setupWebView } = require('@electron/internal/renderer/web-view/web-view-element') as typeof webViewElement; - setupWebView(webViewImplModule); + const { setupWebView } = require('@electron/internal/renderer/web-view/web-view-element') as typeof webViewElementModule; + setupWebView({ + guestViewInternal, + allowGuestViewElementDefinition: webFrame.allowGuestViewElementDefinition, + setIsWebView: iframe => v8Util.setHiddenValue(iframe, 'isWebView', true) + }); } } diff --git a/shell/renderer/api/electron_api_web_frame.cc b/shell/renderer/api/electron_api_web_frame.cc index 839a53c5de61e..936ba140dc86c 100644 --- a/shell/renderer/api/electron_api_web_frame.cc +++ b/shell/renderer/api/electron_api_web_frame.cc @@ -130,18 +130,6 @@ bool SpellCheckWord(content::RenderFrame* render_frame, #endif -class RenderFrameStatus final : public content::RenderFrameObserver { - public: - explicit RenderFrameStatus(content::RenderFrame* render_frame) - : content::RenderFrameObserver(render_frame) {} - ~RenderFrameStatus() final = default; - - bool is_ok() { return render_frame() != nullptr; } - - // RenderFrameObserver implementation. - void OnDestruct() final {} -}; - class ScriptExecutionCallback : public blink::WebScriptExecutionCallback { public: // for compatibility with the older version of this, error is after result @@ -377,7 +365,7 @@ class WebFrameRenderer : public gin::Wrappable, .SetMethod("setVisualZoomLevelLimits", &WebFrameRenderer::SetVisualZoomLevelLimits) .SetMethod("allowGuestViewElementDefinition", - &WebFrameRenderer::AllowGuestViewElementDefinition) + &RendererClientBase::AllowGuestViewElementDefinition) .SetMethod("insertText", &WebFrameRenderer::InsertText) .SetMethod("insertCSS", &WebFrameRenderer::InsertCSS) .SetMethod("removeInsertedCSS", &WebFrameRenderer::RemoveInsertedCSS) @@ -541,31 +529,12 @@ class WebFrameRenderer : public gin::Wrappable, web_frame->View()->SetDefaultPageScaleLimits(min_level, max_level); } - void AllowGuestViewElementDefinition(v8::Isolate* isolate, - v8::Local context, - v8::Local register_cb) { - v8::HandleScope handle_scope(isolate); - v8::Context::Scope context_scope(context->CreationContext()); - blink::WebCustomElement::EmbedderNamesAllowedScope embedder_names_scope; - - content::RenderFrame* render_frame; - if (!MaybeGetRenderFrame(isolate, "allowGuestViewElementDefinition", - &render_frame)) - return; - - render_frame->GetWebFrame()->RequestExecuteV8Function( - context->CreationContext(), register_cb, v8::Null(isolate), 0, nullptr, - nullptr); - } - static int GetWebFrameId(v8::Local content_window) { // Get the WebLocalFrame before (possibly) executing any user-space JS while // getting the |params|. We track the status of the RenderFrame via an // observer in case it is deleted during user code execution. content::RenderFrame* render_frame = GetRenderFrame(content_window); - RenderFrameStatus render_frame_status(render_frame); - - if (!render_frame_status.is_ok()) + if (!render_frame) return -1; blink::WebLocalFrame* frame = render_frame->GetWebFrame(); diff --git a/shell/renderer/electron_renderer_client.cc b/shell/renderer/electron_renderer_client.cc index 59d511ba2ba3e..2518832c976c0 100644 --- a/shell/renderer/electron_renderer_client.cc +++ b/shell/renderer/electron_renderer_client.cc @@ -16,7 +16,6 @@ #include "shell/common/gin_helper/event_emitter_caller.h" #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/renderer/electron_render_frame_observer.h" #include "shell/renderer/web_worker_observer.h" @@ -198,32 +197,6 @@ void ElectronRendererClient::WillDestroyWorkerContextOnWorkerThread( } } -void ElectronRendererClient::SetupMainWorldOverrides( - v8::Handle context, - content::RenderFrame* render_frame) { - auto prefs = render_frame->GetBlinkPreferences(); - // We only need to run the isolated bundle if webview is enabled - if (!prefs.webview_tag) - return; - // Setup window overrides in the main world context - // Wrap the bundle into a function that receives the isolatedWorld as - // an argument. - auto* isolate = context->GetIsolate(); - std::vector> isolated_bundle_params = { - node::FIXED_ONE_BYTE_STRING(isolate, "nodeProcess"), - node::FIXED_ONE_BYTE_STRING(isolate, "isolatedWorld")}; - - auto* env = GetEnvironment(render_frame); - DCHECK(env); - - std::vector> isolated_bundle_args = { - env->process_object(), - GetContext(render_frame->GetWebFrame(), isolate)->Global()}; - - util::CompileAndCall(context, "electron/js2c/isolated_bundle", - &isolated_bundle_params, &isolated_bundle_args, nullptr); -} - node::Environment* ElectronRendererClient::GetEnvironment( content::RenderFrame* render_frame) const { if (injected_frames_.find(render_frame) == injected_frames_.end()) diff --git a/shell/renderer/electron_renderer_client.h b/shell/renderer/electron_renderer_client.h index 57dae75238be9..102008d44cb36 100644 --- a/shell/renderer/electron_renderer_client.h +++ b/shell/renderer/electron_renderer_client.h @@ -31,8 +31,6 @@ class ElectronRendererClient : public RendererClientBase { content::RenderFrame* render_frame) override; void WillReleaseScriptContext(v8::Handle context, content::RenderFrame* render_frame) override; - void SetupMainWorldOverrides(v8::Handle context, - content::RenderFrame* render_frame) override; private: // content::ContentRendererClient: diff --git a/shell/renderer/electron_sandboxed_renderer_client.cc b/shell/renderer/electron_sandboxed_renderer_client.cc index afa958fcde6e7..8eb90becef9f1 100644 --- a/shell/renderer/electron_sandboxed_renderer_client.cc +++ b/shell/renderer/electron_sandboxed_renderer_client.cc @@ -241,34 +241,6 @@ void ElectronSandboxedRendererClient::DidCreateScriptContext( InvokeHiddenCallback(context, kLifecycleKey, "onLoaded"); } -void ElectronSandboxedRendererClient::SetupMainWorldOverrides( - v8::Handle context, - content::RenderFrame* render_frame) { - auto prefs = render_frame->GetBlinkPreferences(); - // We only need to run the isolated bundle if webview is enabled - if (!prefs.webview_tag) - return; - - // Setup window overrides in the main world context - // Wrap the bundle into a function that receives the isolatedWorld as - // an argument. - auto* isolate = context->GetIsolate(); - - gin_helper::Dictionary process = gin::Dictionary::CreateEmpty(isolate); - process.SetMethod("_linkedBinding", GetBinding); - - std::vector> isolated_bundle_params = { - node::FIXED_ONE_BYTE_STRING(isolate, "nodeProcess"), - node::FIXED_ONE_BYTE_STRING(isolate, "isolatedWorld")}; - - std::vector> isolated_bundle_args = { - process.GetHandle(), - GetContext(render_frame->GetWebFrame(), isolate)->Global()}; - - util::CompileAndCall(context, "electron/js2c/isolated_bundle", - &isolated_bundle_params, &isolated_bundle_args, nullptr); -} - void ElectronSandboxedRendererClient::WillReleaseScriptContext( v8::Handle context, content::RenderFrame* render_frame) { diff --git a/shell/renderer/electron_sandboxed_renderer_client.h b/shell/renderer/electron_sandboxed_renderer_client.h index 30cd4e1739a06..67c9002ec658c 100644 --- a/shell/renderer/electron_sandboxed_renderer_client.h +++ b/shell/renderer/electron_sandboxed_renderer_client.h @@ -27,8 +27,6 @@ class ElectronSandboxedRendererClient : public RendererClientBase { content::RenderFrame* render_frame) override; void WillReleaseScriptContext(v8::Handle context, content::RenderFrame* render_frame) override; - void SetupMainWorldOverrides(v8::Handle context, - content::RenderFrame* render_frame) override; // content::ContentRendererClient: void RenderFrameCreated(content::RenderFrame*) override; void RenderViewCreated(content::RenderView*) override; diff --git a/shell/renderer/renderer_client_base.cc b/shell/renderer/renderer_client_base.cc index a0e3fb05d5867..bb98b77e3e9b3 100644 --- a/shell/renderer/renderer_client_base.cc +++ b/shell/renderer/renderer_client_base.cc @@ -22,10 +22,15 @@ #include "electron/buildflags/buildflags.h" #include "media/blink/multibuffer_data_source.h" #include "printing/buildflags/buildflags.h" +#include "shell/common/api/electron_api_native_image.h" #include "shell/common/color_util.h" #include "shell/common/gin_helper/dictionary.h" +#include "shell/common/node_includes.h" +#include "shell/common/node_util.h" #include "shell/common/options_switches.h" #include "shell/common/world_ids.h" +#include "shell/renderer/api/context_bridge/object_cache.h" +#include "shell/renderer/api/electron_api_context_bridge.h" #include "shell/renderer/browser_exposed_renderer_interfaces.h" #include "shell/renderer/content_settings_observer.h" #include "shell/renderer/electron_api_service_impl.h" @@ -85,6 +90,21 @@ namespace electron { namespace { +content::RenderFrame* GetRenderFrame(v8::Local value) { + v8::Local context = value->CreationContext(); + if (context.IsEmpty()) + return nullptr; + blink::WebLocalFrame* frame = blink::WebLocalFrame::FrameForContext(context); + if (!frame) + return nullptr; + return content::RenderFrame::FromWebFrame(frame); +} + +void SetIsWebView(v8::Isolate* isolate, v8::Local object) { + gin_helper::Dictionary dict(isolate, object); + dict.SetHidden("isWebView", true); +} + std::vector ParseSchemesCLISwitch(base::CommandLine* command_line, const char* switch_name) { std::string custom_schemes = command_line->GetSwitchValueASCII(switch_name); @@ -496,11 +516,70 @@ bool RendererClientBase::IsWebViewFrame( gin_helper::Dictionary frame_element_dict(isolate, frame_element); - v8::Local internal; - if (!frame_element_dict.GetHidden("internal", &internal)) - return false; + bool is_webview = false; + return frame_element_dict.GetHidden("isWebView", &is_webview) && is_webview; +} + +void RendererClientBase::SetupMainWorldOverrides( + v8::Handle context, + content::RenderFrame* render_frame) { + auto prefs = render_frame->GetBlinkPreferences(); + // We only need to run the isolated bundle if webview is enabled + if (!prefs.webview_tag) + return; + + // Setup window overrides in the main world context + // Wrap the bundle into a function that receives the isolatedApi as + // an argument. + auto* isolate = context->GetIsolate(); + v8::HandleScope handle_scope(isolate); + v8::Context::Scope context_scope(context); + + gin_helper::Dictionary isolated_api = gin::Dictionary::CreateEmpty(isolate); + isolated_api.SetMethod("allowGuestViewElementDefinition", + &AllowGuestViewElementDefinition); + isolated_api.SetMethod("setIsWebView", &SetIsWebView); + isolated_api.SetMethod("createNativeImage", &api::NativeImage::CreateEmpty); + + auto source_context = GetContext(render_frame->GetWebFrame(), isolate); + gin_helper::Dictionary global(isolate, source_context->Global()); + + v8::Local guest_view_internal; + if (global.GetHidden("guestViewInternal", &guest_view_internal)) { + api::context_bridge::ObjectCache object_cache; + auto result = api::PassValueToOtherContext( + source_context, context, guest_view_internal, &object_cache, false, 0); + if (!result.IsEmpty()) { + isolated_api.Set("guestViewInternal", result.ToLocalChecked()); + } + } + + std::vector> isolated_bundle_params = { + node::FIXED_ONE_BYTE_STRING(isolate, "isolatedApi")}; - return !internal.IsEmpty(); + std::vector> isolated_bundle_args = { + isolated_api.GetHandle()}; + + util::CompileAndCall(context, "electron/js2c/isolated_bundle", + &isolated_bundle_params, &isolated_bundle_args, nullptr); +} + +// static +void RendererClientBase::AllowGuestViewElementDefinition( + v8::Isolate* isolate, + v8::Local context, + v8::Local register_cb) { + v8::HandleScope handle_scope(isolate); + v8::Context::Scope context_scope(context->CreationContext()); + blink::WebCustomElement::EmbedderNamesAllowedScope embedder_names_scope; + + content::RenderFrame* render_frame = GetRenderFrame(context); + if (!render_frame) + return; + + render_frame->GetWebFrame()->RequestExecuteV8Function( + context->CreationContext(), register_cb, v8::Null(isolate), 0, nullptr, + nullptr); } } // namespace electron diff --git a/shell/renderer/renderer_client_base.h b/shell/renderer/renderer_client_base.h index 4193ab622f988..6c75a706da862 100644 --- a/shell/renderer/renderer_client_base.h +++ b/shell/renderer/renderer_client_base.h @@ -74,7 +74,7 @@ class RendererClientBase : public content::ContentRendererClient content::RenderFrame* render_frame) = 0; virtual void DidClearWindowObject(content::RenderFrame* render_frame); virtual void SetupMainWorldOverrides(v8::Handle context, - content::RenderFrame* render_frame) = 0; + content::RenderFrame* render_frame); std::unique_ptr CreatePrescientNetworking( content::RenderFrame* render_frame) override; @@ -86,7 +86,11 @@ class RendererClientBase : public content::ContentRendererClient static v8::Local RunScript(v8::Local context, v8::Local source); - // v8Util.getHiddenValue(window.frameElement, 'internal') + static void AllowGuestViewElementDefinition( + v8::Isolate* isolate, + v8::Local context, + v8::Local register_cb); + bool IsWebViewFrame(v8::Handle context, content::RenderFrame* render_frame) const; diff --git a/typings/internal-ambient.d.ts b/typings/internal-ambient.d.ts index 6079b445b0014..1f18b7efa3327 100644 --- a/typings/internal-ambient.d.ts +++ b/typings/internal-ambient.d.ts @@ -1,9 +1,14 @@ /* eslint-disable no-var */ declare var internalBinding: any; -declare var nodeProcess: any; -declare var isolatedWorld: any; declare var binding: { get: (name: string) => any; process: NodeJS.Process; createPreloadScript: (src: string) => Function }; +declare var isolatedApi: { + guestViewInternal: any; + allowGuestViewElementDefinition: NodeJS.InternalWebFrame['allowGuestViewElementDefinition']; + setIsWebView: (iframe: HTMLIFrameElement) => void; + createNativeImage: typeof Electron.nativeImage['createEmpty']; +} + declare const BUILDFLAG: (flag: boolean) => boolean; declare const ENABLE_DESKTOP_CAPTURER: boolean; @@ -115,6 +120,8 @@ declare namespace NodeJS { interface InternalWebFrame extends Electron.WebFrame { getWebPreference(name: K): InternalWebPreferences[K]; + getWebFrameId(window: Window): number; + allowGuestViewElementDefinition(context: object, callback: Function): void; } interface WebFrameBinding { diff --git a/typings/internal-electron.d.ts b/typings/internal-electron.d.ts index 1e0cb010d461f..5cc680b7a4ad1 100644 --- a/typings/internal-electron.d.ts +++ b/typings/internal-electron.d.ts @@ -91,11 +91,6 @@ declare namespace Electron { viewInstanceId: number; } - interface WebFrame { - getWebFrameId(window: Window): number; - allowGuestViewElementDefinition(window: Window, context: any): void; - } - interface WebFrameMain { _send(internal: boolean, channel: string, args: any): void; _sendInternal(channel: string, ...args: any[]): void; From 1f5d1a47046b028931c092328b1a8f9107708bcd Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Mon, 17 May 2021 06:03:41 -0700 Subject: [PATCH 042/587] Bump v14.0.0-nightly.20210517 --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 7f543e49b55ea..a1a50091fd598 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -14.0.0-nightly.20210514 \ No newline at end of file +14.0.0-nightly.20210517 \ No newline at end of file diff --git a/package.json b/package.json index 810a3d1b14bdf..ad301e34e9cec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "14.0.0-nightly.20210514", + "version": "14.0.0-nightly.20210517", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index c154f15d1aea1..842bddfe2b94c 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 14,0,0,20210514 - PRODUCTVERSION 14,0,0,20210514 + FILEVERSION 14,0,0,20210517 + PRODUCTVERSION 14,0,0,20210517 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From 04888d2b1fbf88ed477cf6d8205f8c667d1d655d Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Mon, 17 May 2021 13:24:34 -0700 Subject: [PATCH 043/587] chore: uncomment some DCHECKs (#29132) --- patches/chromium/dcheck.patch | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/patches/chromium/dcheck.patch b/patches/chromium/dcheck.patch index 691bfb41e84e2..661a0a2915977 100644 --- a/patches/chromium/dcheck.patch +++ b/patches/chromium/dcheck.patch @@ -16,35 +16,6 @@ example, the checks might be disabled for a whole build target, but actually only one or two specific checks fail. Then it's better to simply comment out the failing checks and allow the rest of the target to have them enabled. -diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc -index 814eebf4b641fe01a29875b9c06aea84b2ab7206..892039c0481c0c66cefbff6a37bf51fe1ae61c6b 100644 ---- a/content/browser/renderer_host/navigation_controller_impl.cc -+++ b/content/browser/renderer_host/navigation_controller_impl.cc -@@ -1416,8 +1416,10 @@ NavigationType NavigationControllerImpl::ClassifyNavigation( - return NAVIGATION_TYPE_NEW_SUBFRAME; - } - -- // We only clear the session history in tests when navigating to a new entry. -- DCHECK(!params.history_list_was_cleared); -+ // Electron does its own book keeping of navigation entries and we -+ // expect content to not track any, by clearing history list for -+ // all navigations. -+ // DCHECK(!params.history_list_was_cleared); - - if (rfh->GetParent()) { - // All manual subframes would be did_create_new_entry and handled above, so -@@ -1732,7 +1734,10 @@ void NavigationControllerImpl::RendererDidNavigateToNewEntry( - } - } - -- DCHECK(!params.history_list_was_cleared || !replace_entry); -+ // Electron does its own book keeping of navigation entries and we -+ // expect content to not track any, by clearing history list for -+ // all navigations. -+ // DCHECK(!params.history_list_was_cleared || !replace_entry); - // The browser requested to clear the session history when it initiated the - // navigation. Now we know that the renderer has updated its state accordingly - // and it is safe to also clear the browser side history. diff --git a/ui/base/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc index d1f10922b82e4e0578d1c32978784216117e0696..8f0a750d1a5957b987c5ac506455587a09474461 100644 --- a/ui/base/clipboard/clipboard_win.cc From 8f7a385f948447156a9fd544c569578d5ffa589e Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Mon, 17 May 2021 15:16:54 -0700 Subject: [PATCH 044/587] chore: remove blink-worker-enable-csp-in-file-scheme.patch (#29136) --- patches/chromium/.patches | 1 - ...ink-worker-enable-csp-in-file-scheme.patch | 19 ------------------- 2 files changed, 20 deletions(-) delete mode 100644 patches/chromium/blink-worker-enable-csp-in-file-scheme.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 40231ea458a7b..8271c33bb04d1 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -13,7 +13,6 @@ render_widget_host_view_mac.patch thread_capabilities.patch webview_cross_drag.patch gin_enable_disable_v8_platform.patch -blink-worker-enable-csp-in-file-scheme.patch disable-redraw-lock.patch enable_reset_aspect_ratio.patch v8_context_snapshot_generator.patch diff --git a/patches/chromium/blink-worker-enable-csp-in-file-scheme.patch b/patches/chromium/blink-worker-enable-csp-in-file-scheme.patch deleted file mode 100644 index 06a28c8b7e45d..0000000000000 --- a/patches/chromium/blink-worker-enable-csp-in-file-scheme.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: deepak1556 -Date: Thu, 20 Sep 2018 17:47:47 -0700 -Subject: blink-worker-enable-csp-in-file-scheme.patch - -This allows file:// URLs in workers to have a CSP. - -diff --git a/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc b/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc -index 405467d3a4ddfa05532ab424d35883ece1c4f13d..cc634245d44bc8b1caf645766be40905f9c9f5d3 100644 ---- a/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc -+++ b/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc -@@ -365,7 +365,6 @@ void WorkerClassicScriptLoader::ProcessContentSecurityPolicy( - // document (which is implemented in WorkerMessagingProxy, and - // m_contentSecurityPolicy should be left as nullptr to inherit the policy). - if (!response.CurrentRequestUrl().ProtocolIs("blob") && -- !response.CurrentRequestUrl().ProtocolIs("file") && - !response.CurrentRequestUrl().ProtocolIs("filesystem")) { - content_security_policy_ = MakeGarbageCollected(); - content_security_policy_->AddPolicies(ParseContentSecurityPolicyHeaders( From 4fe8005f27c49170dcb643825e591ff80206a28b Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Mon, 17 May 2021 15:37:03 -0700 Subject: [PATCH 045/587] chore: remove unused function from render_widget_host_view_base.patch (#29134) --- .../chromium/render_widget_host_view_base.patch | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/patches/chromium/render_widget_host_view_base.patch b/patches/chromium/render_widget_host_view_base.patch index 520c998967349..3c2b54f3ec85f 100644 --- a/patches/chromium/render_widget_host_view_base.patch +++ b/patches/chromium/render_widget_host_view_base.patch @@ -24,7 +24,7 @@ index fe8443d5411c73f1fb71fd20315173b0023be758..d4cd7ddcd50c512d07ca2175179e4163 const blink::WebMouseEvent& event, const ui::LatencyInfo& latency) { diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h -index 885d2f0198ff5d7d87047a66d688ff572112ba02..96ce338ea6e2ef2c0a785dfe4411b05c9ec44035 100644 +index 885d2f0198ff5d7d87047a66d688ff572112ba02..73e177e36da01ae938f1d606bc7d31f541fd4a5f 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.h +++ b/content/browser/renderer_host/render_widget_host_view_base.h @@ -25,8 +25,10 @@ @@ -50,17 +50,7 @@ index 885d2f0198ff5d7d87047a66d688ff572112ba02..96ce338ea6e2ef2c0a785dfe4411b05c class WebCursor; class WebContentsAccessibility; class DelegatedFrameHost; -@@ -148,6 +152,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { - bool show_reason_unoccluded, - bool show_reason_bfcache_restore) final; - -+ virtual void InitAsGuest(RenderWidgetHostView* parent_host_view, -+ RenderWidgetHostViewGuest* guest_view) {} -+ - // This only needs to be overridden by RenderWidgetHostViewBase subclasses - // that handle content embedded within other RenderWidgetHostViews. - gfx::PointF TransformPointToRootCoordSpaceF( -@@ -307,6 +314,11 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { +@@ -307,6 +311,11 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { virtual void ProcessGestureEvent(const blink::WebGestureEvent& event, const ui::LatencyInfo& latency); From 33035f96a29af6556dbe8a1dc036fe71d8af5334 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Mon, 17 May 2021 19:34:04 -0700 Subject: [PATCH 046/587] chore: remove add_realloc.patch (#29131) --- patches/chromium/.patches | 1 - patches/chromium/add_realloc.patch | 83 ------------------- ..._v8_initialization_isolate_callbacks.patch | 2 +- patches/v8/.patches | 1 - patches/v8/add_realloc.patch | 46 ---------- patches/v8/dcheck.patch | 4 +- shell/browser/javascript_environment.cc | 4 - 7 files changed, 3 insertions(+), 138 deletions(-) delete mode 100644 patches/chromium/add_realloc.patch delete mode 100644 patches/v8/add_realloc.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 8271c33bb04d1..91e0073d9b26d 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -1,4 +1,3 @@ -add_realloc.patch build_gn.patch dcheck.patch accelerator.patch diff --git a/patches/chromium/add_realloc.patch b/patches/chromium/add_realloc.patch deleted file mode 100644 index 9ff226f687479..0000000000000 --- a/patches/chromium/add_realloc.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Thu, 20 Sep 2018 17:44:26 -0700 -Subject: add_realloc.patch - -Blink overrides ArrayBuffer's allocator with its own one, while Node simply -uses malloc and free, so we need to use v8's allocator in Node. As part of the -10.6.0 upgrade, we needed to make SerializerDelegate accept an allocator -argument in its constructor, and override ReallocateBufferMemory and -FreeBufferMemory to use the allocator. We cannot simply allocate and then memcpy -when we override ReallocateBufferMemory, so we therefore need to implement -Realloc on the v8 side and correspondingly in gin. - -diff --git a/gin/array_buffer.cc b/gin/array_buffer.cc -index 210760801f1d027196111631d34bab3eb5a10792..cdfdf91841b5f2feb248b0c5890ddcfdb5a8f9ce 100644 ---- a/gin/array_buffer.cc -+++ b/gin/array_buffer.cc -@@ -37,6 +37,10 @@ void* ArrayBufferAllocator::AllocateUninitialized(size_t length) { - return malloc(length); - } - -+void* ArrayBufferAllocator::Realloc(void* data, size_t length) { -+ return realloc(data, length); -+} -+ - void ArrayBufferAllocator::Free(void* data, size_t length) { - free(data); - } -diff --git a/gin/array_buffer.h b/gin/array_buffer.h -index aef43319737398848dc40a3ab2d9e959ebb399f6..3c6dbc1ec10666b35d68e107a7a694c59c78a59f 100644 ---- a/gin/array_buffer.h -+++ b/gin/array_buffer.h -@@ -20,6 +20,7 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { - public: - void* Allocate(size_t length) override; - void* AllocateUninitialized(size_t length) override; -+ void* Realloc(void* data, size_t length) override; - void Free(void* data, size_t length) override; - - GIN_EXPORT static ArrayBufferAllocator* SharedInstance(); -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 c79fd01a887a54eed3868642b4e8d5a4b050ecca..d91c4344145f5ff2b081a5a9a3e931e9746a07af 100644 ---- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -+++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -@@ -708,6 +708,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { - return result; - } - -+ void* Realloc(void* data, size_t size) override { -+ return ArrayBufferContents::Realloc(data, size); -+ } -+ - void Free(void* data, size_t size) override { - if (max_allocation_ != 0 && data) - total_allocation_.fetch_sub(size, std::memory_order_relaxed); -diff --git a/third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.cc b/third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.cc -index dd90a1e579578e6bfc7419634d8c5fecb32cd167..1881ec0194ef0f33a011109ba7870d7993fe4c27 100644 ---- a/third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.cc -+++ b/third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.cc -@@ -148,6 +148,11 @@ void* ArrayBufferContents::AllocateMemoryOrNull(size_t size, - return AllocateMemoryWithFlags(size, policy, base::PartitionAllocReturnNull); - } - -+void* ArrayBufferContents::Realloc(void* data, size_t size) { -+ return WTF::Partitions::ArrayBufferPartition()->Realloc(data, size, -+ WTF_HEAP_PROFILER_TYPE_NAME(ArrayBufferContents)); -+} -+ - void ArrayBufferContents::FreeMemory(void* data) { - InstanceCounters::DecrementCounter( - InstanceCounters::kArrayBufferContentsCounter); -diff --git a/third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.h b/third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.h -index fcf19e6685686c1c4a40dea4869beccab9de9c03..8aeb0f8db579aa8100a01dedee66f778735e2a9c 100644 ---- a/third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.h -+++ b/third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.h -@@ -107,6 +107,7 @@ class CORE_EXPORT ArrayBufferContents { - void CopyTo(ArrayBufferContents& other); - - static void* AllocateMemoryOrNull(size_t, InitializationPolicy); -+ static void* Realloc(void* data, size_t); - static void FreeMemory(void*); - - private: diff --git a/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch b/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch index f0da1d0a070bb..52daab18ef77d 100644 --- a/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch +++ b/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch @@ -9,7 +9,7 @@ we're running with contextIsolation enabled, we should be falling back to Blink's logic. This will be upstreamed in some form. 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 d91c4344145f5ff2b081a5a9a3e931e9746a07af..9bf3523e1a307a469129df6e48f04df051f5003f 100644 +index c79fd01a887a54eed3868642b4e8d5a4b050ecca..9c2d6db4b8801e30c6f03bd778bd46c1d1d92e60 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc @@ -449,7 +449,7 @@ CodeGenerationCheckCallbackInMainThread(v8::Local context, diff --git a/patches/v8/.patches b/patches/v8/.patches index 61e50e1801dbf..a2c70b4ec4d4c 100644 --- a/patches/v8/.patches +++ b/patches/v8/.patches @@ -1,4 +1,3 @@ -add_realloc.patch build_gn.patch expose_mksnapshot.patch dcheck.patch diff --git a/patches/v8/add_realloc.patch b/patches/v8/add_realloc.patch deleted file mode 100644 index 93830dcf1d3a1..0000000000000 --- a/patches/v8/add_realloc.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Mon, 22 Oct 2018 10:47:11 -0700 -Subject: add_realloc.patch - -Blink overrides ArrayBuffer's allocator with its own one, while Node simply -uses malloc and free, so we need to use v8's allocator in Node. As part of the -10.6.0 upgrade, we needed to make SerializerDelegate accept an allocator -argument in its constructor, and override ReallocateBufferMemory and -FreeBufferMemory to use the allocator. We cannot simply allocate and then memcpy -when we override ReallocateBufferMemory, so we therefore need to implement -Realloc on the v8 side. - -diff --git a/include/v8.h b/include/v8.h -index 81fbe7f97f1f0945b4712287f0c511cc6920379c..c5b2c17da660dbc9fe40e2d33cb09db2554c2507 100644 ---- a/include/v8.h -+++ b/include/v8.h -@@ -5363,6 +5363,13 @@ class V8_EXPORT ArrayBuffer : public Object { - */ - virtual void* AllocateUninitialized(size_t length) = 0; - -+ /** -+ * Free the memory block of size |length|, pointed to by |data|. -+ * That memory must be previously allocated by |Allocate| and not yet freed -+ * with a call to |Free| or |Realloc| -+ */ -+ virtual void* Realloc(void* data, size_t length); -+ - /** - * Free the memory block of size |length|, pointed to by |data|. - * That memory is guaranteed to be previously allocated by |Allocate|. -diff --git a/src/api/api.cc b/src/api/api.cc -index 8f0cd7eaf0f1f2ecf81293e5a401c10139a06824..62b4be5bf0e64f04da22cbf32643ab86cb901bb6 100644 ---- a/src/api/api.cc -+++ b/src/api/api.cc -@@ -324,6 +324,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { - i::V8::SetSnapshotBlob(snapshot_blob); - } - -+void* v8::ArrayBuffer::Allocator::Realloc(void* data, size_t length) { -+ UNIMPLEMENTED(); -+} -+ - namespace { - - class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { diff --git a/patches/v8/dcheck.patch b/patches/v8/dcheck.patch index 5b53df2d01eef..0918bc3938dad 100644 --- a/patches/v8/dcheck.patch +++ b/patches/v8/dcheck.patch @@ -6,10 +6,10 @@ Subject: dcheck.patch https://github.com/auchenberg/volkswagen diff --git a/src/api/api.cc b/src/api/api.cc -index 62b4be5bf0e64f04da22cbf32643ab86cb901bb6..f7f0e7ee899746be121f6b840988cd8e46a1e194 100644 +index 8f0cd7eaf0f1f2ecf81293e5a401c10139a06824..f66ed281cc2d524797ec82638cfdbbad9e4a85b9 100644 --- a/src/api/api.cc +++ b/src/api/api.cc -@@ -8762,7 +8762,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { +@@ -8758,7 +8758,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { } void Isolate::PerformMicrotaskCheckpoint() { diff --git a/shell/browser/javascript_environment.cc b/shell/browser/javascript_environment.cc index d2a0b6a07f0c5..267214633ce45 100644 --- a/shell/browser/javascript_environment.cc +++ b/shell/browser/javascript_environment.cc @@ -93,10 +93,6 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { return result; } - void* Realloc(void* data, size_t size) override { - return allocator_->root()->Realloc(data, size, "Electron"); - } - void Free(void* data, size_t size) override { allocator_->root()->Free(data); } From aeb566c38e0d589d9125124373a918872667bc58 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 18 May 2021 06:04:55 -0700 Subject: [PATCH 047/587] Bump v14.0.0-nightly.20210518 --- ELECTRON_VERSION | 2 +- package.json | 2 +- shell/browser/resources/win/electron.rc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index a1a50091fd598..3958477371c5f 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -14.0.0-nightly.20210517 \ No newline at end of file +14.0.0-nightly.20210518 \ No newline at end of file diff --git a/package.json b/package.json index ad301e34e9cec..1568be9dbde79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "14.0.0-nightly.20210517", + "version": "14.0.0-nightly.20210518", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index 842bddfe2b94c..ce653c2a5f3f2 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 14,0,0,20210517 - PRODUCTVERSION 14,0,0,20210517 + FILEVERSION 14,0,0,20210518 + PRODUCTVERSION 14,0,0,20210518 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L From dcbabcb23cf850582928bb98e2c57136d238c3fd Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Tue, 18 May 2021 10:08:53 -0700 Subject: [PATCH 048/587] refactor: remove ssl_security_state_tab_helper.patch (#29196) --- BUILD.gn | 1 + chromium_src/BUILD.gn | 3 - patches/chromium/.patches | 1 - .../ssl_security_state_tab_helper.patch | 112 ------------------ .../browser/api/electron_api_web_contents.cc | 11 +- 5 files changed, 4 insertions(+), 124 deletions(-) delete mode 100644 patches/chromium/ssl_security_state_tab_helper.patch diff --git a/BUILD.gn b/BUILD.gn index 6988ceef2e1e8..6d4df63f0a8ea 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -335,6 +335,7 @@ source_set("electron_lib") { "//components/network_session_configurator/common", "//components/pref_registry", "//components/prefs", + "//components/security_state/content", "//components/upload_list", "//components/user_prefs", "//components/viz/host", diff --git a/chromium_src/BUILD.gn b/chromium_src/BUILD.gn index 8a154b448b3e4..df62d8405322c 100644 --- a/chromium_src/BUILD.gn +++ b/chromium_src/BUILD.gn @@ -43,8 +43,6 @@ static_library("chrome") { "//chrome/browser/predictors/proxy_lookup_client_impl.h", "//chrome/browser/predictors/resolve_host_client_impl.cc", "//chrome/browser/predictors/resolve_host_client_impl.h", - "//chrome/browser/ssl/security_state_tab_helper.cc", - "//chrome/browser/ssl/security_state_tab_helper.h", "//chrome/browser/ui/views/autofill/autofill_popup_view_utils.cc", "//chrome/browser/ui/views/autofill/autofill_popup_view_utils.h", "//extensions/browser/app_window/size_constraints.cc", @@ -80,7 +78,6 @@ static_library("chrome") { "//components/keyed_service/content", "//components/paint_preview/buildflags", "//components/proxy_config", - "//components/security_state/content", "//content/public/browser", "//services/strings", ] diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 91e0073d9b26d..b13ce9d3780f3 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -33,7 +33,6 @@ mas_disable_remote_accessibility.patch mas_disable_custom_window_frame.patch chrome_key_systems.patch add_didinstallconditionalfeatures.patch -ssl_security_state_tab_helper.patch desktop_media_list.patch proxy_config_monitor.patch gritsettings_resource_ids.patch diff --git a/patches/chromium/ssl_security_state_tab_helper.patch b/patches/chromium/ssl_security_state_tab_helper.patch deleted file mode 100644 index 90a7fbded6c20..0000000000000 --- a/patches/chromium/ssl_security_state_tab_helper.patch +++ /dev/null @@ -1,112 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: deepak1556 -Date: Thu, 20 Sep 2018 17:50:34 -0700 -Subject: ssl_security_state_tab_helper.patch - -Allows populating security tab info for devtools in Electron. - -diff --git a/chrome/browser/ssl/security_state_tab_helper.cc b/chrome/browser/ssl/security_state_tab_helper.cc -index 33d13d4f01cd333bd510e49d62944431df15417a..677239abeee39d1f6a2b8886597b989ec993bd1c 100644 ---- a/chrome/browser/ssl/security_state_tab_helper.cc -+++ b/chrome/browser/ssl/security_state_tab_helper.cc -@@ -7,6 +7,7 @@ - #include - - #include "base/bind.h" -+#include "base/command_line.h" - #include "base/feature_list.h" - #include "base/metrics/field_trial_params.h" - #include "base/metrics/histogram_macros.h" -@@ -14,24 +15,28 @@ - #include "base/strings/string_util.h" - #include "build/build_config.h" - #include "build/chromeos_buildflags.h" -+#if 0 - #include "chrome/browser/browser_process.h" - #include "chrome/browser/profiles/profile.h" - #include "chrome/browser/reputation/reputation_web_contents_observer.h" - #include "chrome/browser/safe_browsing/safe_browsing_service.h" - #include "chrome/browser/safe_browsing/ui_manager.h" - #include "chrome/browser/ssl/known_interception_disclosure_infobar_delegate.h" -+#endif - #include "chrome/common/chrome_features.h" - #include "chrome/common/chrome_switches.h" - #include "chrome/common/pref_names.h" - #include "chrome/common/secure_origin_allowlist.h" - #include "components/autofill/core/common/autofill_features.h" -+#if 0 - #include "components/omnibox/browser/omnibox_field_trial.h" - #include "components/omnibox/common/omnibox_features.h" - #include "components/password_manager/core/browser/password_manager_metrics_util.h" --#include "components/prefs/pref_service.h" - #include "components/safe_browsing/buildflags.h" - #include "components/security_interstitials/core/features.h" - #include "components/security_interstitials/core/pref_names.h" -+#endif -+#include "components/prefs/pref_service.h" - #include "components/security_state/content/content_utils.h" - #include "content/public/browser/browser_context.h" - #include "content/public/browser/navigation_entry.h" -@@ -54,7 +59,7 @@ - #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" - #endif // BUILDFLAG(IS_CHROMEOS_ASH) - --#if BUILDFLAG(FULL_SAFE_BROWSING) -+#if 0 - #include "chrome/browser/safe_browsing/chrome_password_protection_service.h" - #endif - -@@ -76,8 +81,9 @@ void RecordSecurityLevel( - - } // namespace - -+#if 0 - using password_manager::metrics_util::PasswordType; --using safe_browsing::SafeBrowsingUIManager; -+#endif - - SecurityStateTabHelper::SecurityStateTabHelper( - content::WebContents* web_contents) -@@ -101,6 +107,7 @@ SecurityStateTabHelper::GetVisibleSecurityState() { - // information is still being initialized, thus no need to check for that. - state->malicious_content_status = GetMaliciousContentStatus(); - -+#if 0 - ReputationWebContentsObserver* reputation_web_contents_observer = - ReputationWebContentsObserver::FromWebContents(web_contents()); - state->safety_tip_info = -@@ -125,6 +132,7 @@ SecurityStateTabHelper::GetVisibleSecurityState() { - } - } - -+#endif - return state; - } - -@@ -184,8 +192,10 @@ void SecurityStateTabHelper::DidFinishNavigation( - UMA_HISTOGRAM_BOOLEAN("interstitial.ssl.visited_site_after_warning", true); - } - -+#if 0 - MaybeShowKnownInterceptionDisclosureDialog( - web_contents(), visible_security_state->cert_status); -+#endif - } - - void SecurityStateTabHelper::DidChangeVisibleSecurityState() { -@@ -209,6 +219,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const { - web_contents()->GetController().GetVisibleEntry(); - if (!entry) - return security_state::MALICIOUS_CONTENT_STATUS_NONE; -+#if 0 - safe_browsing::SafeBrowsingService* sb_service = - g_browser_process->safe_browsing_service(); - if (!sb_service) -@@ -287,6 +298,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const { - break; - } - } -+#endif - return security_state::MALICIOUS_CONTENT_STATUS_NONE; - } - diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 6dfb859273652..64cd68e0784de 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -27,7 +27,6 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/values.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/ssl/security_state_tab_helper.h" #include "chrome/browser/ui/views/eye_dropper/eye_dropper.h" #include "chrome/common/pref_names.h" #include "components/prefs/pref_service.h" @@ -833,7 +832,6 @@ void WebContents::InitWithSessionAndOptions( web_contents()->NotifyPreferencesChanged(); WebContentsPermissionHelper::CreateForWebContents(web_contents()); - SecurityStateTabHelper::CreateForWebContents(web_contents()); InitZoomController(web_contents(), options); #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) extensions::ElectronExtensionWebContentsObserver::CreateForWebContents( @@ -877,7 +875,6 @@ void WebContents::InitWithExtensionView(v8::Isolate* isolate, Observe(web_contents); InitWithWebContents(web_contents, GetBrowserContext(), IsGuest()); inspectable_web_contents_->GetView()->SetDelegate(this); - SecurityStateTabHelper::CreateForWebContents(web_contents); } #endif @@ -3237,11 +3234,9 @@ bool WebContents::IsFullscreenForTabOrPending( blink::SecurityStyle WebContents::GetSecurityStyle( content::WebContents* web_contents, content::SecurityStyleExplanations* security_style_explanations) { - SecurityStateTabHelper* helper = - SecurityStateTabHelper::FromWebContents(web_contents); - DCHECK(helper); - return security_state::GetSecurityStyle(helper->GetSecurityLevel(), - *helper->GetVisibleSecurityState(), + auto state = security_state::GetVisibleSecurityState(web_contents); + auto security_level = security_state::GetSecurityLevel(*state, false); + return security_state::GetSecurityStyle(security_level, *state, security_style_explanations); } From 9b164e5e16b9e8139e7d9a2cbda74ca3b3538df6 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Tue, 18 May 2021 15:44:11 -0700 Subject: [PATCH 049/587] chore: remove blink_fix_prototype_assert (#29194) --- patches/chromium/.patches | 1 - .../chromium/blink_fix_prototype_assert.patch | 29 ------------------- 2 files changed, 30 deletions(-) delete mode 100644 patches/chromium/blink_fix_prototype_assert.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index b13ce9d3780f3..c6a5c9b58eecb 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -18,7 +18,6 @@ v8_context_snapshot_generator.patch boringssl_build_gn.patch pepper_plugin_support.patch no_cache_storage_check.patch -blink_fix_prototype_assert.patch gtk_visibility.patch sysroot.patch mas_blink_no_private_api.patch diff --git a/patches/chromium/blink_fix_prototype_assert.patch b/patches/chromium/blink_fix_prototype_assert.patch deleted file mode 100644 index c7c582fcc604d..0000000000000 --- a/patches/chromium/blink_fix_prototype_assert.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Cheng Zhao -Date: Thu, 20 Sep 2018 17:48:19 -0700 -Subject: blink_fix_prototype_assert.patch - -A recent Chromium change has accidentally added assertion for the case when -a new window object may not have a prototype attached. In Electron it may -happen when preventDefault for a native new-window event. -https://chromium.googlesource.com/chromium/src/+/f47b361887a31cccf42a6e21a82bccf28372bdaa%5E%21 -In the long term we should investigate why it happened, and take a more -formal fix. But for now I'm just make this assertion silently pass away. - -diff --git a/third_party/blink/renderer/platform/bindings/v8_object_constructor.cc b/third_party/blink/renderer/platform/bindings/v8_object_constructor.cc -index 196548f9b1a817348df05c889b315a8124e1692d..359165f1c52b8afb0d91d4a363da0429cf5372ef 100644 ---- a/third_party/blink/renderer/platform/bindings/v8_object_constructor.cc -+++ b/third_party/blink/renderer/platform/bindings/v8_object_constructor.cc -@@ -95,8 +95,10 @@ v8::Local V8ObjectConstructor::CreateInterfaceObject( - bool get_prototype_value = - interface_object->Get(context, V8AtomicString(isolate, "prototype")) - .ToLocal(&prototype_value); -- CHECK(get_prototype_value); -- CHECK(prototype_value->IsObject()); -+ // CHECK(get_prototype_value); -+ // CHECK(prototype_value->IsObject()); -+ if (!get_prototype_value || !prototype_value->IsObject()) -+ return v8::Local(); - - prototype_object = prototype_value.As(); - } From 8cfd249981b7d8dfbf39f38278606e1405fbd29d Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Tue, 18 May 2021 15:44:33 -0700 Subject: [PATCH 050/587] chore: drop thread_capabilities.patch (#29135) --- patches/chromium/.patches | 1 - patches/chromium/thread_capabilities.patch | 27 ---------------------- 2 files changed, 28 deletions(-) delete mode 100644 patches/chromium/thread_capabilities.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index c6a5c9b58eecb..430cef9f43e2b 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -9,7 +9,6 @@ disable_hidden.patch dom_storage_limits.patch render_widget_host_view_base.patch render_widget_host_view_mac.patch -thread_capabilities.patch webview_cross_drag.patch gin_enable_disable_v8_platform.patch disable-redraw-lock.patch diff --git a/patches/chromium/thread_capabilities.patch b/patches/chromium/thread_capabilities.patch deleted file mode 100644 index 55654b1693e3b..0000000000000 --- a/patches/chromium/thread_capabilities.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Anonymous -Date: Thu, 20 Sep 2018 17:46:43 -0700 -Subject: thread_capabilities.patch - -Chromium automatically drops all capabilities of renderer threads in -Linux, which may cause issues in a context like Electron, where the main -and renderer threads are supposed to keep inherited permissions over the -system. - -See https://github.com/atom/electron/issues/3666 - -diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc -index d7b5d8c441354965ee0cb87a57d9552a4ae1f20d..dd145dd38fdbd7c426bd821baff0d9fe76201469 100644 ---- a/sandbox/linux/services/credentials.cc -+++ b/sandbox/linux/services/credentials.cc -@@ -354,8 +354,10 @@ pid_t Credentials::ForkAndDropCapabilitiesInChild() { - return pid; - } - -+#if 0 - // Since we just forked, we are single threaded. - PCHECK(DropAllCapabilitiesOnCurrentThread()); -+#endif - return 0; - } - From 99d74799fbdd39a5a7178e6dc23d0d78bda058a3 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Tue, 18 May 2021 15:44:46 -0700 Subject: [PATCH 051/587] docs: expand description of desktop_media_list.patch (#29208) --- patches/chromium/desktop_media_list.patch | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/patches/chromium/desktop_media_list.patch b/patches/chromium/desktop_media_list.patch index f0b277e8d59fc..d74d74289befd 100644 --- a/patches/chromium/desktop_media_list.patch +++ b/patches/chromium/desktop_media_list.patch @@ -3,8 +3,25 @@ From: deepak1556 Date: Thu, 18 Oct 2018 17:07:01 -0700 Subject: desktop_media_list.patch -* Expose the capturer source list for the desktopCapturer API -* Free the one-time use capturer after thumbnails are fetched +Our current desktop capturer api is a one-shot call to the underlying +implementation, i.e. a user calls desktopCapturer.getSources with the +interested source type, we then return a promise that will eventually +resolve with the sources and their thumbnails which are returned from +the implementation in a given frame. + +* The core of this work is done by NativeDesktopMediaList in //chrome/browser/media/webrtc/native_desktop_media_list.cc. +* DesktopMediaListObserver (//chrome/browser/media/webrtc/desktop_media_list_observer.h) + is the observer class that gets signalled with the sources from + NativeDesktopMediaList, our desktopcapturer api class is an + implementation of the DesktopMediaListObserver to receive those + signals. +* To set the observer on NativeDesktopMediaList we had to call + DesktopMediaList::StartUpdating https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/media/webrtc/desktop_media_list.h;l=74;drc=09a4396a448775456084fe36bb84662f5757d988; + but this call is not a one-shot but rather repeats the observer + signals for every frame. This is the call which chrome currently + uses. + +This patch allows us to get the one-shot effect with the above classes. diff --git a/chrome/browser/media/webrtc/desktop_media_list.h b/chrome/browser/media/webrtc/desktop_media_list.h index d7b52b0d1b8cfb823513303ec0f6322d8dc8d153..f2dbf39f81abfc6fde4064345ab0d222ee98438c 100644 From 1bfc16b65a09c642221354817fa8d08d2744b319 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Tue, 18 May 2021 15:44:57 -0700 Subject: [PATCH 052/587] docs: expand description of isolate_holder.patch (#29209) --- patches/chromium/isolate_holder.patch | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/patches/chromium/isolate_holder.patch b/patches/chromium/isolate_holder.patch index b9457fc5e7e7a..657e8ccee4014 100644 --- a/patches/chromium/isolate_holder.patch +++ b/patches/chromium/isolate_holder.patch @@ -7,6 +7,13 @@ Pass pre allocated isolate for initialization, node platform needs to register on an isolate so that it can be used later down in the initialization process of an isolate. +Specifically, v8::Isolate::Initialize ends up calling +NodePlatform::GetForegroundTaskRunner, which requires that the +isolate has previously been registered with NodePlatform::RegisterIsolate. +However, if we let gin allocate the isolate, there's no opportunity +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 9fd05f22c4f6d484c5cedfa1f38a147158726d42..2897c065246d5336d209d4e5a856fb984d06063f 100644 --- a/gin/isolate_holder.cc From af426cbdab38e8b0c480040bdb69a065e90d4a3e Mon Sep 17 00:00:00 2001 From: Thomas Kainrad <7394822+tkainrad@users.noreply.github.com> Date: Wed, 19 May 2021 02:52:06 +0200 Subject: [PATCH 053/587] Update accelerator.md (#29193) `Meta` is a valid alternative for `Super` and should be listed as an available modifier. --- docs/api/accelerator.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/api/accelerator.md b/docs/api/accelerator.md index 6c5dfd1a4bfe6..f8d4cc421e689 100644 --- a/docs/api/accelerator.md +++ b/docs/api/accelerator.md @@ -35,7 +35,7 @@ Linux and Windows to define some accelerators. Use `Alt` instead of `Option`. The `Option` key only exists on macOS, whereas the `Alt` key is available on all platforms. -The `Super` key is mapped to the `Windows` key on Windows and Linux and +The `Super` (or `Meta`) key is mapped to the `Windows` key on Windows and Linux and `Cmd` on macOS. ## Available modifiers @@ -48,6 +48,7 @@ The `Super` key is mapped to the `Windows` key on Windows and Linux and * `AltGr` * `Shift` * `Super` +* `Meta` ## Available key codes From adb85f341ba619a8477c87fbb69ec61334c2d656 Mon Sep 17 00:00:00 2001 From: Tony Ferrell Date: Tue, 18 May 2021 17:55:24 -0700 Subject: [PATCH 054/587] docs: update drag and drop tutorial (#29200) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Working * Working * Make the native-file drag and drop documents use context bridge * Add per-file sections * Use the updated link format * Use path.join instead of string interpolation. Co-authored-by: Antón Molleda * Use fs.promises Co-authored-by: Antón Molleda * Update docs/tutorial/native-file-drag-drop.md Co-authored-by: Antón Molleda * fix formatting Co-authored-by: Antón Molleda * Update docs/tutorial/native-file-drag-drop.md Co-authored-by: Antón Molleda * Use more path.join instead of interpolation * Update with PR suggestions * Remove process.cwd() and add more example elements * Minor text fix * Fix typo Co-authored-by: Erick Zhao Co-authored-by: Antón Molleda Co-authored-by: Erick Zhao --- .../fiddles/features/drag-and-drop/index.html | 9 ++--- docs/fiddles/features/drag-and-drop/main.js | 25 +++++++----- .../fiddles/features/drag-and-drop/preload.js | 8 ++++ .../features/drag-and-drop/renderer.js | 12 +++--- docs/tutorial/native-file-drag-drop.md | 40 ++++++++++++++----- 5 files changed, 62 insertions(+), 32 deletions(-) create mode 100644 docs/fiddles/features/drag-and-drop/preload.js diff --git a/docs/fiddles/features/drag-and-drop/index.html b/docs/fiddles/features/drag-and-drop/index.html index d451042521a5d..7541c174b86fd 100644 --- a/docs/fiddles/features/drag-and-drop/index.html +++ b/docs/fiddles/features/drag-and-drop/index.html @@ -7,12 +7,9 @@

Hello World!

-

- We are using node , - Chrome , - and Electron . -

- Drag me +

Drag the boxes below to somewhere in your OS (Finder/Explorer, Desktop, etc.) to copy an example markdown file.

+
Drag me - File 1
+
Drag me - File 2
diff --git a/docs/fiddles/features/drag-and-drop/main.js b/docs/fiddles/features/drag-and-drop/main.js index bdc28bbf45000..9ad158beafd5e 100644 --- a/docs/fiddles/features/drag-and-drop/main.js +++ b/docs/fiddles/features/drag-and-drop/main.js @@ -1,21 +1,28 @@ const { app, BrowserWindow, ipcMain, nativeImage, NativeImage } = require('electron') -const fs = require('fs'); -const http = require('http'); +const path = require('path') +const fs = require('fs') +const https = require('https') -function createWindow () { +function createWindow() { const win = new BrowserWindow({ width: 800, height: 600, webPreferences: { - nodeIntegration: true + preload: path.join(__dirname, 'preload.js') } }) win.loadFile('index.html') } -const iconName = 'iconForDragAndDrop.png'; -const icon = fs.createWriteStream(`${process.cwd()}/${iconName}`); -http.get('http://img.icons8.com/ios/452/drag-and-drop.png', (response) => { + +const iconName = path.join(__dirname, 'iconForDragAndDrop.png'); +const icon = fs.createWriteStream(iconName); + +// Create a new file to copy - you can also copy existing files. +fs.writeFileSync(path.join(__dirname, 'drag-and-drop-1.md'), '# First file to test drag and drop') +fs.writeFileSync(path.join(__dirname, 'drag-and-drop-2.md'), '# Second file to test drag and drop') + +https.get('https://img.icons8.com/ios/452/drag-and-drop.png', (response) => { response.pipe(icon); }); @@ -23,8 +30,8 @@ app.whenReady().then(createWindow) ipcMain.on('ondragstart', (event, filePath) => { event.sender.startDrag({ - file: filePath, - icon: `${process.cwd()}/${iconName}` + file: path.join(__dirname, filePath), + icon: iconName, }) }) diff --git a/docs/fiddles/features/drag-and-drop/preload.js b/docs/fiddles/features/drag-and-drop/preload.js new file mode 100644 index 0000000000000..4609e12c75528 --- /dev/null +++ b/docs/fiddles/features/drag-and-drop/preload.js @@ -0,0 +1,8 @@ +const { contextBridge, ipcRenderer } = require('electron') +const path = require('path') + +contextBridge.exposeInMainWorld('electron', { + startDrag: (fileName) => { + ipcRenderer.send('ondragstart', fileName) + } +}) diff --git a/docs/fiddles/features/drag-and-drop/renderer.js b/docs/fiddles/features/drag-and-drop/renderer.js index 33f328e30aedd..b402fa3929258 100644 --- a/docs/fiddles/features/drag-and-drop/renderer.js +++ b/docs/fiddles/features/drag-and-drop/renderer.js @@ -1,9 +1,9 @@ -const { ipcRenderer } = require('electron') -const fs = require('fs') +document.getElementById('drag1').ondragstart = (event) => { + event.preventDefault() + window.electron.startDrag('drag-and-drop-1.md') +} -document.getElementById('drag').ondragstart = (event) => { - const fileName = 'drag-and-drop.md' - fs.writeFileSync(fileName, '# Test drag and drop'); +document.getElementById('drag2').ondragstart = (event) => { event.preventDefault() - ipcRenderer.send('ondragstart', process.cwd() + `/${fileName}`) + window.electron.startDrag('drag-and-drop-2.md') } diff --git a/docs/tutorial/native-file-drag-drop.md b/docs/tutorial/native-file-drag-drop.md index d355b7fe514c3..75ef4eb212cdc 100644 --- a/docs/tutorial/native-file-drag-drop.md +++ b/docs/tutorial/native-file-drag-drop.md @@ -14,30 +14,46 @@ API in response to the `ondragstart` event. ## Example -Starting with a working application from the -[Quick Start Guide](quick-start.md), add the following lines to the -`index.html` file: +An example demonstrating how you can create a file on the fly to be dragged out of the window. + +### Preload.js + +In `preload.js` use the [`contextBridge`] to inject a method `window.electron.startDrag(...)` that will send an IPC message to the main process. + +```js +const { contextBridge, ipcRenderer } = require('electron') +const path = require('path') + +contextBridge.exposeInMainWorld('electron', { + startDrag: (fileName) => { + ipcRenderer.send('ondragstart', path.join(process.cwd(), fileName)) + } +}) +``` + +### Index.html + +Add a draggable element to `index.html`, and reference your renderer script: ```html -Drag me +
Drag me
``` -and add the following lines to the `renderer.js` file: +### Renderer.js -```javascript -const { ipcRenderer } = require('electron') +In `renderer.js` set up the renderer process to handle drag events by calling the method you added via the [`contextBridge`] above. +```javascript document.getElementById('drag').ondragstart = (event) => { event.preventDefault() - ipcRenderer.send('ondragstart', '/absolute/path/to/the/item') + window.electron.startDrag('drag-and-drop.md') } ``` -The code above instructs the Renderer process to handle the `ondragstart` event -and forward the information to the Main process. +### Main.js -In the Main process(`main.js` file), expand the received event with a path to the file that is +In the Main process (`main.js` file), expand the received event with a path to the file that is being dragged and an icon: ```javascript fiddle='docs/fiddles/features/drag-and-drop' @@ -56,3 +72,5 @@ the item from the BrowserWindow onto your desktop. In this guide, the item is a Markdown file located in the root of the project: ![Drag and drop](../images/drag-and-drop.gif) + +[`contextBridge`]: ../api/context-bridge.md From 5656493676763b37c0f94e7afc09b0cdd3053ba8 Mon Sep 17 00:00:00 2001 From: Ethan Arrowood Date: Tue, 18 May 2021 19:02:12 -0600 Subject: [PATCH 055/587] docs: update macos-dark-mode fiddle and guide content (#29198) * update macos dark mode docs for Electron v12 * pr review fixes * more pr review fixes * reorg paragraphs for better flow * Update docs/tutorial/dark-mode.md Co-authored-by: Erick Zhao * pr fixes Co-authored-by: Erick Zhao --- docs/fiddles/features/macos-dark-mode/main.js | 19 ++- .../features/macos-dark-mode/preload.js | 6 + .../features/macos-dark-mode/renderer.js | 6 +- docs/tutorial/dark-mode.md | 145 +++++++++--------- 4 files changed, 93 insertions(+), 83 deletions(-) create mode 100644 docs/fiddles/features/macos-dark-mode/preload.js diff --git a/docs/fiddles/features/macos-dark-mode/main.js b/docs/fiddles/features/macos-dark-mode/main.js index e74b345d367aa..4f0254e95bd8c 100644 --- a/docs/fiddles/features/macos-dark-mode/main.js +++ b/docs/fiddles/features/macos-dark-mode/main.js @@ -1,11 +1,12 @@ const { app, BrowserWindow, ipcMain, nativeTheme } = require('electron') +const path = require('path') function createWindow () { const win = new BrowserWindow({ width: 800, height: 600, webPreferences: { - nodeIntegration: true + preload: path.join(__dirname, 'preload.js') } }) @@ -25,16 +26,18 @@ function createWindow () { }) } -app.whenReady().then(createWindow) +app.whenReady().then(() => { + createWindow() + + app.on('activate', () => { + if (BrowserWindow.getAllWindows().length === 0) { + createWindow() + } + }) +}) app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit() } }) - -app.on('activate', () => { - if (BrowserWindow.getAllWindows().length === 0) { - createWindow() - } -}) diff --git a/docs/fiddles/features/macos-dark-mode/preload.js b/docs/fiddles/features/macos-dark-mode/preload.js new file mode 100644 index 0000000000000..3def9e06ed8ea --- /dev/null +++ b/docs/fiddles/features/macos-dark-mode/preload.js @@ -0,0 +1,6 @@ +const { contextBridge, ipcRenderer } = require('electron') + +contextBridge.exposeInMainWorld('darkMode', { + toggle: () => ipcRenderer.invoke('dark-mode:toggle'), + system: () => ipcRenderer.invoke('dark-mode:system') +}) diff --git a/docs/fiddles/features/macos-dark-mode/renderer.js b/docs/fiddles/features/macos-dark-mode/renderer.js index 737f19f51cbe1..637f714c22406 100644 --- a/docs/fiddles/features/macos-dark-mode/renderer.js +++ b/docs/fiddles/features/macos-dark-mode/renderer.js @@ -1,11 +1,9 @@ -const { ipcRenderer } = require('electron') - document.getElementById('toggle-dark-mode').addEventListener('click', async () => { - const isDarkMode = await ipcRenderer.invoke('dark-mode:toggle') + const isDarkMode = await window.darkMode.toggle() document.getElementById('theme-source').innerHTML = isDarkMode ? 'Dark' : 'Light' }) document.getElementById('reset-to-system').addEventListener('click', async () => { - await ipcRenderer.invoke('dark-mode:system') + await window.darkMode.system() document.getElementById('theme-source').innerHTML = 'System' }) diff --git a/docs/tutorial/dark-mode.md b/docs/tutorial/dark-mode.md index 2bbda10435c73..5ac69241ebae2 100644 --- a/docs/tutorial/dark-mode.md +++ b/docs/tutorial/dark-mode.md @@ -47,18 +47,18 @@ of this theming, due to the use of the macOS 10.14 SDK. ## Example -We'll start with a working application from the -[Quick Start Guide](quick-start.md) and add functionality gradually. +This example demonstrates an Electron application that derives its theme colors from the +`nativeTheme`. Additionally, it provides theme toggle and reset controls using IPC channels. -First, let's edit our interface so users can toggle between light and dark -modes. This basic UI contains buttons to change the `nativeTheme.themeSource` -setting and a text element indicating which `themeSource` value is selected. -By default, Electron follows the system's dark mode preference, so we -will hardcode the theme source as "System". +```javascript fiddle='docs/fiddles/features/macos-dark-mode' -Add the following lines to the `index.html` file: +``` + +### How does this work? -```html +Starting with the `index.html` file: + +```html title='index.html' @@ -80,65 +80,70 @@ Add the following lines to the `index.html` file: ``` -Next, add [event listeners](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener) -that listen for `click` events on the toggle buttons. Because the `nativeTheme` -module only exposed in the Main process, you need to set up each listener's -callback to use IPC to send messages to and handle responses from the Main -process: +And the `style.css` file: + +```css title='style.css' +@media (prefers-color-scheme: dark) { + body { background: #333; color: white; } +} -* when the "Toggle Dark Mode" button is clicked, we send the -`dark-mode:toggle` message (event) to tell the Main process to trigger a theme -change, and update the "Current Theme Source" label in the UI based on the -response from the Main process. -* when the "Reset to System Theme" button is clicked, we send the -`dark-mode:system` message (event) to tell the Main process to use the system -color scheme, and update the "Current Theme Source" label to `System`. +@media (prefers-color-scheme: light) { + body { background: #ddd; color: black; } +} +``` + +The example renders an HTML page with a couple elements. The `` + element shows which theme is currently selected, and the two `