[MM-63842] Upgrade to Electron v35.2.0 (#3398)

This commit is contained in:
Devin Binnie
2025-04-22 09:15:54 -04:00
committed by GitHub
parent e147f56492
commit 54874ecaca
9 changed files with 35 additions and 73 deletions

28
package-lock.json generated
View File

@@ -54,7 +54,7 @@
"copy-webpack-plugin": "10.2.4",
"cross-env": "7.0.3",
"css-loader": "6.7.1",
"electron": "34.0.1",
"electron": "35.2.0",
"electron-builder": "24.13.3",
"electron-connect": "0.6.3",
"eslint": "8.57.0",
@@ -4167,12 +4167,13 @@
"dev": true
},
"node_modules/@types/node": {
"version": "20.12.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.2.tgz",
"integrity": "sha512-zQ0NYO87hyN6Xrclcqp7f8ZbXNbRfoGWNcMvHTPQp9UUrwI0mI7XBz+cu7/W6/VClYo2g63B0cjull/srU7LgQ==",
"version": "22.14.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.14.1.tgz",
"integrity": "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~5.26.4"
"undici-types": "~6.21.0"
}
},
"node_modules/@types/parse-json": {
@@ -7189,15 +7190,15 @@
}
},
"node_modules/electron": {
"version": "34.0.1",
"resolved": "https://registry.npmjs.org/electron/-/electron-34.0.1.tgz",
"integrity": "sha512-aArw5tAM80i3CKwEREnyZSM1SkARf5Jd1yBMTIdOL4pB1M+p/oDeyWSFI9Dl+vujyfJKiK4SS5+j19wna1onMw==",
"version": "35.2.0",
"resolved": "https://registry.npmjs.org/electron/-/electron-35.2.0.tgz",
"integrity": "sha512-GHda7oCkN0pA23qzah735DEbRa06IPwlzP3uvjAmf9af8gxdj5i93JEHeQVGVmSVpd7sSb1pfecs9nz7B1q5ag==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
"@electron/get": "^2.0.0",
"@types/node": "^20.9.0",
"@types/node": "^22.7.7",
"extract-zip": "^2.0.1"
},
"bin": {
@@ -16715,10 +16716,11 @@
}
},
"node_modules/undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
"dev": true
"version": "6.21.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
"dev": true,
"license": "MIT"
},
"node_modules/unicode-canonical-property-names-ecmascript": {
"version": "2.0.0",

View File

@@ -131,7 +131,7 @@
"copy-webpack-plugin": "10.2.4",
"cross-env": "7.0.3",
"css-loader": "6.7.1",
"electron": "34.0.1",
"electron": "35.2.0",
"electron-builder": "24.13.3",
"electron-connect": "0.6.3",
"eslint": "8.57.0",

View File

@@ -1,33 +0,0 @@
diff --git a/node_modules/electron/electron.d.ts b/node_modules/electron/electron.d.ts
index 64b873d..9d9010d 100644
--- a/node_modules/electron/electron.d.ts
+++ b/node_modules/electron/electron.d.ts
@@ -9894,23 +9894,23 @@ declare namespace Electron {
*
* @platform darwin,win32
*/
- on(event: 'speed-limit-change', listener: () => void): this;
+ on(event: 'speed-limit-change', listener: (limit: number) => void): this;
/**
* @platform darwin,win32
*/
- off(event: 'speed-limit-change', listener: () => void): this;
+ off(event: 'speed-limit-change', listener: (limit: number) => void): this;
/**
* @platform darwin,win32
*/
- once(event: 'speed-limit-change', listener: () => void): this;
+ once(event: 'speed-limit-change', listener: (limit: number) => void): this;
/**
* @platform darwin,win32
*/
- addListener(event: 'speed-limit-change', listener: () => void): this;
+ addListener(event: 'speed-limit-change', listener: (limit: number) => void): this;
/**
* @platform darwin,win32
*/
- removeListener(event: 'speed-limit-change', listener: () => void): this;
+ removeListener(event: 'speed-limit-change', listener: (limit: number) => void): this;
/**
* Emitted when the system is suspending.
*/

View File

@@ -100,7 +100,7 @@ export function showBadgeOSX(sessionExpired: boolean, mentionCount: number, show
} else if (sessionExpired) {
badge = '!';
}
app.dock.setBadge(badge);
app.dock?.setBadge(badge);
}
function showBadgeLinux(sessionExpired: boolean, mentionCount: number) {

View File

@@ -402,7 +402,7 @@ describe('main/notifications', () => {
Object.defineProperty(process, 'platform', {
value: originalPlatform,
});
expect(app.dock.bounce).not.toBeCalled();
expect(app.dock!.bounce).not.toBeCalled();
});
it('mac - should bounce icon when config item is set', async () => {
@@ -428,7 +428,7 @@ describe('main/notifications', () => {
Object.defineProperty(process, 'platform', {
value: originalPlatform,
});
expect(app.dock.bounce).toHaveBeenCalledWith('critical');
expect(app.dock!.bounce).toHaveBeenCalledWith('critical');
});
});

View File

@@ -267,7 +267,7 @@ function flashFrame(flash: boolean) {
}
}
if (process.platform === 'darwin' && Config.notifications.bounceIcon && Config.notifications.bounceIconType) {
app.dock.bounce(Config.notifications.bounceIconType);
app.dock?.bounce(Config.notifications.bounceIconType);
}
}

View File

@@ -164,8 +164,8 @@ export class PerformanceMonitor {
}
};
private handleSpeedLimitChange = (limit: number) => {
if (limit < 100) {
private handleSpeedLimitChange = (details: {limit: number}) => {
if (details.limit < 100) {
this.stop();
} else {
this.start();

View File

@@ -226,26 +226,26 @@ describe('main/views/webContentsEvents', () => {
});
it('should respect logging levels', () => {
consoleMessage({}, 0, 'test0', 0, '');
consoleMessage({level: 'info', message: 'test0', lineNumber: 0, sourceId: ''});
expect(logObject.debug).toHaveBeenCalledWith('test0');
consoleMessage({}, 1, 'test1', 0, '');
consoleMessage({level: 'info', message: 'test1', lineNumber: 0, sourceId: ''});
expect(logObject.debug).toHaveBeenCalledWith('test1');
consoleMessage({}, 2, 'test2', 0, '');
consoleMessage({level: 'warning', message: 'test2', lineNumber: 0, sourceId: ''});
expect(logObject.warn).toHaveBeenCalledWith('test2');
consoleMessage({}, 3, 'test3', 0, '');
consoleMessage({level: 'error', message: 'test3', lineNumber: 0, sourceId: ''});
expect(logObject.error).toHaveBeenCalledWith('test3');
});
it('should only add line numbers for debug and silly', () => {
getLevel.mockReturnValue('debug');
consoleMessage({}, 0, 'test1', 42, 'meaning_of_life.js');
consoleMessage({level: 'info', message: 'test1', lineNumber: 42, sourceId: 'meaning_of_life.js'});
expect(logObject.debug).toHaveBeenCalledWith('test1', '(meaning_of_life.js:42)');
getLevel.mockReturnValue('warn');
consoleMessage({}, 0, 'test2', 42, 'meaning_of_life.js');
consoleMessage({level: 'info', message: 'test2', lineNumber: 42, sourceId: 'meaning_of_life.js'});
expect(logObject.warn).not.toHaveBeenCalledWith('test2', '(meaning_of_life.js:42)');
});
});

View File

@@ -2,36 +2,29 @@
// See LICENSE.txt for license information.
import path from 'path';
import type {Event} from 'electron';
import type {Event, WebContentsConsoleMessageEventParams} from 'electron';
import type {Logger} from 'common/log';
import {getLevel} from 'common/log';
import {protocols} from '../../../electron-builder.json';
enum ConsoleMessageLevel {
Verbose,
Info,
Warning,
Error
}
export const generateHandleConsoleMessage = (log: Logger) => (_: Event, level: number, message: string, line: number, sourceId: string) => {
export const generateHandleConsoleMessage = (log: Logger) => (event: Event<WebContentsConsoleMessageEventParams>) => {
const wcLog = log.withPrefix('renderer');
let logFn = wcLog.debug;
switch (level) {
case ConsoleMessageLevel.Error:
switch (event.level) {
case 'error':
logFn = wcLog.error;
break;
case ConsoleMessageLevel.Warning:
case 'warning':
logFn = wcLog.warn;
break;
}
// Only include line entries if we're debugging
const entries = [message];
const entries = [event.message];
if (['debug', 'silly'].includes(getLevel())) {
entries.push(`(${path.basename(sourceId)}:${line})`);
entries.push(`(${path.basename(event.sourceId)}:${event.lineNumber})`);
}
logFn(...entries);