Merge pull request #271677 from yu-re-ka/electron

Electron updates
This commit is contained in:
Emily 2023-12-06 21:58:56 +01:00 committed by GitHub
commit 04236bd707
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 287 additions and 1027 deletions

View File

@ -0,0 +1,43 @@
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index de1cd6e..bb5700b 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -616,24 +616,6 @@ config("compiler") {
}
}
- # TODO(crbug.com/1488374): This causes binary size growth and potentially
- # other problems.
- # TODO(crbug.com/1491036): This isn't supported by Cronet's mainline llvm version.
- if (default_toolchain != "//build/toolchain/cros:target" &&
- !llvm_android_mainline) {
- cflags += [
- "-mllvm",
- "-split-threshold-for-reg-with-hint=0",
- ]
- if (use_thin_lto && is_a_target_toolchain) {
- if (is_win) {
- ldflags += [ "-mllvm:-split-threshold-for-reg-with-hint=0" ]
- } else {
- ldflags += [ "-Wl,-mllvm,-split-threshold-for-reg-with-hint=0" ]
- }
- }
- }
-
# TODO(crbug.com/1235145): Investigate why/if this should be needed.
if (is_win) {
cflags += [ "/clang:-ffp-contract=off" ]
@@ -800,13 +782,6 @@ config("compiler") {
if (is_apple) {
ldflags += [ "-Wcrl,object_path_lto" ]
}
- if (!is_chromeos) {
- # TODO(https://crbug.com/972449): turn on for ChromeOS when that
- # toolchain has this flag.
- # We only use one version of LLVM within a build so there's no need to
- # upgrade debug info, which can be expensive since it runs the verifier.
- ldflags += [ "-Wl,-mllvm,-disable-auto-upgrade-debug-info" ]
- }
}
# TODO(https://crbug.com/1211155): investigate why this isn't effective on

View File

@ -246,6 +246,7 @@ let
# (we currently package 1.26 in Nixpkgs while Chromium bundles 1.21):
# Source: https://bugs.chromium.org/p/angleproject/issues/detail?id=7582#c1
./patches/angle-wayland-include-protocol.patch
] ++ lib.optionals (!chromiumVersionAtLeast "120") [
# We need to revert this patch to build M114+ with LLVM 16:
(githubPatch {
# Reland [clang] Disable autoupgrading debug info in ThinLTO builds
@ -253,6 +254,9 @@ let
hash = "sha256-Vryjg8kyn3cxWg3PmSwYRG6zrHOqYWBMSdEMGiaPg6M=";
revert = true;
})
] ++ lib.optionals (chromiumVersionAtLeast "120") [
# We need to revert this patch to build M120+ with LLVM 16:
./chromium-120-llvm-16.patch
] ++ lib.optionals (!chromiumVersionAtLeast "119.0.6024.0") [
# Fix build with at-spi2-core ≥ 2.49
# This version is still needed for electron.

View File

@ -1,6 +1,5 @@
{ newScope, config, stdenv, fetchurl, makeWrapper
, buildPackages
, llvmPackages_16
, ed, gnugrep, coreutils, xdg-utils
, glib, gtk3, gtk4, gnome, gsettings-desktop-schemas, gn, fetchgit
, libva, pipewire, wayland

View File

@ -40,7 +40,7 @@ let
++ optionals (versionAtLeast version "11.0.0") [ "aarch64-darwin" ]
++ optionals (versionOlder version "19.0.0") [ "i686-linux" ];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
knownVulnerabilities = optional (versionOlder version "25.0.0") "Electron version ${version} is EOL";
knownVulnerabilities = optional (versionOlder version "26.0.0") "Electron version ${version} is EOL";
};
fetcher = vers: tag: hash: fetchurl {

View File

@ -42,12 +42,16 @@ in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
src = null;
patches = base.patches ++ lib.optional (lib.versionOlder info.version "28")
patches = base.patches ++ lib.optional (lib.versionOlder info.version "27")
(substituteAll {
name = "version.patch";
src = if lib.versionAtLeast info.version "27" then ./version.patch else ./version-old.patch;
src = ./version.patch;
inherit (info) version;
})
# we remove the web_tests directory in the chromium src FOD to reduce the output size, but this backported patch includes patches on web_tests
++ lib.optional (lib.versions.major info.version == "26")
./electron-26-remove-web_tests-patch.patch
;
unpackPhase = ''
@ -165,9 +169,7 @@ in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: {
enable_widevine = false;
use_perfetto_client_library = false;
enable_check_raw_ptr_fields = false;
} // lib.optionalAttrs (lib.versionOlder info.version "26") {
use_gnome_keyring = false;
} // lib.optionalAttrs (lib.versionAtLeast info.version "28") {
} // lib.optionalAttrs (lib.versionAtLeast info.version "27") {
override_electron_version = info.version;
};

View File

@ -0,0 +1,73 @@
diff --git a/electron/patches/chromium/cherry-pick-80106e31c7ea.patch b/electron/patches/chromium/cherry-pick-80106e31c7ea.patch
index 3f8ae7d1b2..af8859a1a5 100644
--- a/electron/patches/chromium/cherry-pick-80106e31c7ea.patch
+++ b/electron/patches/chromium/cherry-pick-80106e31c7ea.patch
@@ -361,68 +361,3 @@ index 3d562fa22bd84dc438abfe9fa883eff6f5846b1b..c64c7fb1b15f7f523b37671abca2ab50
auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(
script_state, exception_state.GetContext());
ScriptPromise promise = resolver->Promise();
-diff --git a/third_party/blink/web_tests/external/wpt/webusb/usbDevice.https.any.js b/third_party/blink/web_tests/external/wpt/webusb/usbDevice.https.any.js
-index b1b0c133ce160a314ea392514ac5b38e4cac136d..804af2afb9db3a0d5fafbeb26aed64f89badb1b3 100644
---- a/third_party/blink/web_tests/external/wpt/webusb/usbDevice.https.any.js
-+++ b/third_party/blink/web_tests/external/wpt/webusb/usbDevice.https.any.js
-@@ -1247,3 +1247,60 @@ usb_test((t) => {
- .then(() => promise_rejects_dom(t, 'NotFoundError', device.reset()));
- });
- }, 'resetDevice rejects when called on a disconnected device');
-+
-+usb_test(async (t) => {
-+ const PACKET_COUNT = 4;
-+ const PACKET_LENGTH = 8;
-+ const {device, fakeDevice} = await getFakeDevice();
-+ await device.open();
-+ await device.selectConfiguration(2);
-+ await device.claimInterface(0);
-+ await device.selectAlternateInterface(0, 1);
-+ const buffer = new Uint8Array(PACKET_COUNT * PACKET_LENGTH);
-+ const packetLengths = new Array(PACKET_COUNT).fill(PACKET_LENGTH);
-+ packetLengths[0] = PACKET_LENGTH - 1;
-+ await promise_rejects_dom(
-+ t, 'DataError', device.isochronousTransferOut(1, buffer, packetLengths));
-+}, 'isochronousTransferOut rejects when buffer size exceeds packet lengths');
-+
-+usb_test(async (t) => {
-+ const PACKET_COUNT = 4;
-+ const PACKET_LENGTH = 8;
-+ const {device, fakeDevice} = await getFakeDevice();
-+ await device.open();
-+ await device.selectConfiguration(2);
-+ await device.claimInterface(0);
-+ await device.selectAlternateInterface(0, 1);
-+ const buffer = new Uint8Array(PACKET_COUNT * PACKET_LENGTH);
-+ const packetLengths = new Array(PACKET_COUNT).fill(PACKET_LENGTH);
-+ packetLengths[0] = PACKET_LENGTH + 1;
-+ await promise_rejects_dom(
-+ t, 'DataError', device.isochronousTransferOut(1, buffer, packetLengths));
-+}, 'isochronousTransferOut rejects when packet lengths exceed buffer size');
-+
-+usb_test(async (t) => {
-+ const PACKET_COUNT = 2;
-+ const PACKET_LENGTH = 8;
-+ const {device, fakeDevice} = await getFakeDevice();
-+ await device.open();
-+ await device.selectConfiguration(2);
-+ await device.claimInterface(0);
-+ await device.selectAlternateInterface(0, 1);
-+ const packetLengths = [0xffffffff, 1];
-+ await promise_rejects_dom(
-+ t, 'DataError', device.isochronousTransferIn(1, packetLengths));
-+}, 'isochronousTransferIn rejects when packet lengths exceed maximum size');
-+
-+usb_test(async (t) => {
-+ const PACKET_COUNT = 2;
-+ const PACKET_LENGTH = 8;
-+ const {device, fakeDevice} = await getFakeDevice();
-+ await device.open();
-+ await device.selectConfiguration(2);
-+ await device.claimInterface(0);
-+ await device.selectAlternateInterface(0, 1);
-+ const buffer = new Uint8Array(PACKET_LENGTH * PACKET_COUNT);
-+ const packetLengths = [0xffffffff, 1];
-+ await promise_rejects_dom(
-+ t, 'DataError', device.isochronousTransferOut(1, buffer, packetLengths));
-+}, 'isochronousTransferOut rejects when packet lengths exceed maximum size');

File diff suppressed because it is too large Load Diff

View File

@ -1,42 +0,0 @@
diff --git a/electron/BUILD.gn b/electron/BUILD.gn
index c905891eb8..f2cf11fe88 100644
--- a/electron/BUILD.gn
+++ b/electron/BUILD.gn
@@ -111,8 +111,6 @@ electron_version = exec_script("script/print-version.py",
[],
"trim string",
[
- ".git/packed-refs",
- ".git/HEAD",
"script/lib/get-version.js",
])
diff --git a/electron/script/lib/get-version.js b/electron/script/lib/get-version.js
index 45a120482b..ddaf8ab60e 100644
--- a/electron/script/lib/get-version.js
+++ b/electron/script/lib/get-version.js
@@ -1,22 +1 @@
-const { spawnSync } = require('child_process');
-const path = require('path');
-
-module.exports.getElectronVersion = () => {
- // Find the nearest tag to the current HEAD
- // This is equivilant to our old logic of "use a value in package.json" for the following reasons
- //
- // 1. Whenever we updated the package.json we ALSO pushed a tag with the same version
- // 2. Whenever we _reverted_ a bump all we actually did was push a commit that deleted the tag and changed the version number back
- //
- // The only difference in the "git describe" technique is that technically a commit can "change" it's version
- // number if a tag is created / removed retroactively. i.e. the first time a commit is pushed it will be 1.2.3
- // and after the tag is made rebuilding the same commit will result in it being 1.2.4
- const output = spawnSync('git', ['describe', '--tags', '--abbrev=0'], {
- cwd: path.resolve(__dirname, '..', '..')
- });
- if (output.status !== 0) {
- console.error(output.stderr);
- throw new Error('Failed to get current electron version');
- }
- return output.stdout.toString().trim().replace(/^v/g, '');
-};
+module.exports.getElectronVersion = () => "@version@";

View File

@ -16,8 +16,8 @@ index 45a120482b..ddaf8ab60e 100644
--- a/electron/script/lib/get-version.js
+++ b/electron/script/lib/get-version.js
@@ -1,22 +1 @@
-const { spawnSync } = require('node:child_process');
-const path = require('node:path');
-const { spawnSync } = require('child_process');
-const path = require('path');
-
-module.exports.getElectronVersion = () => {
- // Find the nearest tag to the current HEAD

View File

@ -18478,9 +18478,10 @@ with pkgs;
electron_22 = electron_22-bin;
electron_23 = electron_23-bin;
electron_24 = electron_24-bin;
electron_25 = if lib.meta.availableOn stdenv.hostPlatform electron-source.electron_25 then electron-source.electron_25 else electron_25-bin;
electron_25 = electron_25-bin;
electron_26 = if lib.meta.availableOn stdenv.hostPlatform electron-source.electron_26 then electron-source.electron_26 else electron_26-bin;
electron_27 = if lib.meta.availableOn stdenv.hostPlatform electron-source.electron_27 then electron-source.electron_27 else electron_27-bin;
electron_28 = electron-source.electron_28;
electron = electron_27;
autobuild = callPackage ../development/tools/misc/autobuild { };