Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Commit

Permalink
fix(desktop): Bump electron to 9.4.4 (#3177)
Browse files Browse the repository at this point in the history
* chore(desktop): Bump electron to 9.4.0

* chore: Bump node-abi to 2.19.3

* fix: Disable renderer process reuse

* fix: Force app.allowRendererProcessReuse = false in test env

* fix(desktop): Bump electron-devtools-installer to 3.1.1

* fix(desktop): Silence deprecation warning

* hotfix(desktop): Patch app-builder-lib to sign macOS objects depth-first

Based on electron-userland/electron-builder@7f8d59c

* chore(desktop): Bump electron to 9.4.1

* chore: update electron to 9.4.4

Co-authored-by: Umair Sarfraz <aquadestructor@icloud.com>
  • Loading branch information
rajivshah3 and laumair committed Mar 20, 2021
1 parent 197d216 commit 99959df
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 52 deletions.
10 changes: 8 additions & 2 deletions src/desktop/native/Index.js
Expand Up @@ -34,6 +34,12 @@ if (
app.quit();
}

/**
* Disable renderer process reuse since we have some native modules that aren't context-aware
* https://github.com/electron/electron/issues/18397
*/
app.allowRendererProcessReuse = false;

/**
* Define wallet windows
*/
Expand Down Expand Up @@ -169,6 +175,7 @@ function createWindow() {
disableBlinkFeatures: 'Auxclick',
webviewTag: false,
enableWebSQL: false,
enableRemoteModule: true,
},
});

Expand Down Expand Up @@ -252,8 +259,7 @@ function createWindow() {
windows.tray.webContents.openDevTools({ mode: 'detach' });
}
*/
installExtension(REACT_DEVELOPER_TOOLS);
installExtension(REDUX_DEVTOOLS);
installExtension([REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS]);
});
}

Expand Down
140 changes: 92 additions & 48 deletions src/desktop/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/desktop/package.json
Expand Up @@ -44,9 +44,9 @@
"cross-env": "7.0.0",
"css-loader": "3.5.3",
"dart-sass": "1.25.0",
"electron": "7.3.3",
"electron": "^9.4.4",
"electron-builder": "22.5.1",
"electron-devtools-installer": "3.0.0",
"electron-devtools-installer": "3.1.1",
"electron-notarize": "0.2.1",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.2",
Expand Down
25 changes: 25 additions & 0 deletions src/desktop/patches/@jest-runner+electron+3.0.0.patch
@@ -0,0 +1,25 @@
diff --git a/node_modules/@jest-runner/electron/build/electron_process_injected_code.js b/node_modules/@jest-runner/electron/build/electron_process_injected_code.js
index b4028c1..b5c256c 100644
--- a/node_modules/@jest-runner/electron/build/electron_process_injected_code.js
+++ b/node_modules/@jest-runner/electron/build/electron_process_injected_code.js
@@ -26,6 +26,7 @@ const isMain = process.env.isMain === 'true'; // for testing purposes, it is pro
// the same scale so that renders do not vary from device to device.
_electron.app.commandLine.appendSwitch('high-dpi-support', 1);
_electron.app.commandLine.appendSwitch('force-device-scale-factor', 1);
+_electron.app.allowRendererProcessReuse = false;
_electron.app.on('ready', async () => {
// electron automatically quits if all windows are destroyed,
// this mainWindow will keep electron running even if all other windows
diff --git a/node_modules/@jest-runner/electron/src/electron_process_injected_code.js b/node_modules/@jest-runner/electron/src/electron_process_injected_code.js
index f88326c..d3d5b83 100644
--- a/node_modules/@jest-runner/electron/src/electron_process_injected_code.js
+++ b/node_modules/@jest-runner/electron/src/electron_process_injected_code.js
@@ -23,7 +23,7 @@ const isMain = process.env.isMain === 'true';
// the same scale so that renders do not vary from device to device.
app.commandLine.appendSwitch('high-dpi-support', 1);
app.commandLine.appendSwitch('force-device-scale-factor', 1);
-
+app.allowRendererProcessReuse = false;
app.on('ready', async () => {
// electron automatically quits if all windows are destroyed,
// this mainWindow will keep electron running even if all other windows
23 changes: 23 additions & 0 deletions src/desktop/patches/app-builder-lib+22.5.1.patch
@@ -0,0 +1,23 @@
diff --git a/node_modules/app-builder-lib/electron-osx-sign/sign.js b/node_modules/app-builder-lib/electron-osx-sign/sign.js
index 3b85d83..b44eb58 100644
--- a/node_modules/app-builder-lib/electron-osx-sign/sign.js
+++ b/node_modules/app-builder-lib/electron-osx-sign/sign.js
@@ -119,6 +119,18 @@ async function verifySignApplicationAsync (opts) {
function signApplicationAsync (opts) {
return walkAsync(getAppContentsPath(opts))
.then(async function (childPaths) {
+ /**
+ * Sort the child paths by how deep they are in the file tree. Some arcane apple
+ * logic expects the deeper files to be signed first otherwise strange errors get
+ * thrown our way
+ */
+ childPaths = childPaths.sort((a, b) => {
+ const aDepth = a.split(path.sep).length
+ const bDepth = b.split(path.sep).length
+ return bDepth - aDepth
+ })
+
+
function ignoreFilePath (opts, filePath) {
if (opts.ignore) {
return opts.ignore.some(function (ignore) {

0 comments on commit 99959df

Please sign in to comment.