Skip to content

Commit 93b6d3e

Browse files
authored
⬆ Bump electron to 30.0.6 (#414)
Signed-off-by: Marc Nuri <marc@marcnuri.com>
1 parent b36da2a commit 93b6d3e

35 files changed

+414
-397
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ electronim
3434
## Features
3535

3636
- ⚛ Multi-platform: ElectronIM is available for Linux 🐧, Mac 🍏 and Windows.
37-
- 🌍 Based on Chromium 122
37+
- 🌍 Based on Chromium 124
3838
- 🔔 Desktop notifications: ElectronIM will notify you using your native system notifications.
3939
- 🧐 Spellchecker: ElectronIM contains spellchecker dictionaries for many languages,
4040
if your language is not supported, just [file an issue](https://github.com/manusa/electronim/issues/new).

build-config/electronim.nuspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Improve your productivity by combining all your instant messaging applications (
2424
### Features
2525

2626
- ⚛ Multi-platform: ElectronIM is available for Linux 🐧, Mac 🍏 and Windows.
27-
- 🌍 Based on Chromium 122
27+
- 🌍 Based on Chromium 124
2828
- 🔔 Desktop notifications: ElectronIM will notify you using your native system notifications.
2929
- 🧐 Spellchecker: ElectronIM contains spellchecker dictionaries for many languages,
3030
if your language is not supported, just [file an issue](https://github.com/manusa/electronim/issues/new).

package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@
222222
"dictionary-sv": "^3.0.1",
223223
"dictionary-tr": "^1.3.3",
224224
"dictionary-uk": "^2.1.1",
225-
"electron": "29.3.3",
225+
"electron": "30.0.6",
226226
"htm": "3.1.1",
227227
"markdown-it": "14.1.0",
228228
"nodehun": "3.0.2",

src/__tests__/electron.js

+35-23
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,15 @@
1414
limitations under the License.
1515
*/
1616

17-
const mockBrowserWindowInstance = () => {
17+
const mockWebContentsViewInstance = () => {
1818
const instance = {
1919
listeners: {},
20-
addBrowserView: jest.fn(),
21-
destroy: jest.fn(),
22-
getContentBounds: jest.fn(() => ({})),
23-
isFullScreen: jest.fn(),
24-
loadURL: jest.fn(),
25-
minimize: jest.fn(),
2620
on: jest.fn((eventName, func) => {
2721
instance.listeners[eventName] = func;
2822
}),
29-
removeBrowserView: jest.fn(),
30-
removeMenu: jest.fn(),
31-
setAutoResize: jest.fn(),
3223
setBounds: jest.fn(),
33-
setBrowserView: jest.fn(),
34-
setFullScreen: jest.fn(),
35-
show: jest.fn(),
36-
showInactive: jest.fn(),
3724
webContents: {
3825
loadedUrl: '',
39-
browserWindowInstance: () => instance,
4026
copy: jest.fn(),
4127
copyImageAt: jest.fn(),
4228
cut: jest.fn(),
@@ -61,9 +47,36 @@ const mockBrowserWindowInstance = () => {
6147
return instance;
6248
};
6349

50+
const mockBaseWindowInstance = () => {
51+
const instance = {
52+
listeners: {},
53+
destroy: jest.fn(),
54+
getContentBounds: jest.fn(() => ({})),
55+
isFullScreen: jest.fn(),
56+
loadURL: jest.fn(),
57+
minimize: jest.fn(),
58+
on: jest.fn((eventName, func) => {
59+
instance.listeners[eventName] = func;
60+
}),
61+
removeMenu: jest.fn(),
62+
setBounds: jest.fn(),
63+
setFullScreen: jest.fn(),
64+
show: jest.fn(),
65+
showInactive: jest.fn(),
66+
contentView: {
67+
addChildView: jest.fn(view => instance.contentView.children.push(view)),
68+
removeChildView: jest.fn(view => {
69+
instance.contentView.children = instance.contentView.children.filter(child => child !== view);
70+
}),
71+
children: []
72+
}
73+
};
74+
return instance;
75+
};
76+
6477
const mockElectronInstance = ({...overriddenProps} = {}) => {
65-
const browserViewInstance = mockBrowserWindowInstance();
66-
const browserWindowInstance = mockBrowserWindowInstance();
78+
const webContentsViewInstance = mockWebContentsViewInstance();
79+
const baseWindowInstance = mockBaseWindowInstance();
6780
const sessionInstance = {
6881
clearCache: jest.fn(),
6982
clearCodeCaches: jest.fn(),
@@ -76,10 +89,10 @@ const mockElectronInstance = ({...overriddenProps} = {}) => {
7689
on: jest.fn()
7790
};
7891
const instance = {
79-
BrowserView: jest.fn(() => browserViewInstance),
80-
browserViewInstance,
81-
BrowserWindow: jest.fn(() => browserWindowInstance),
82-
browserWindowInstance,
92+
WebContentsView: jest.fn(() => webContentsViewInstance),
93+
webContentsViewInstance,
94+
BaseWindow: jest.fn(() => baseWindowInstance),
95+
baseWindowInstance,
8396
Menu: jest.fn(),
8497
MenuItem: jest.fn(),
8598
Notification: jest.fn(),
@@ -139,8 +152,7 @@ const mockElectronInstance = ({...overriddenProps} = {}) => {
139152
},
140153
...overriddenProps
141154
};
142-
instance.BrowserWindow.fromWebContents = jest.fn(webContents => webContents.browserWindowInstance());
143155
return instance;
144156
};
145157

146-
module.exports = {mockBrowserWindowInstance, mockElectronInstance};
158+
module.exports = {mockBaseWindowInstance, mockWebContentsViewInstance, mockElectronInstance};

src/__tests__/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
module.exports = {
18-
mockBrowserWindowInstance: require('./electron.js').mockBrowserWindowInstance,
18+
mockBaseWindowInstance: require('./electron.js').mockBaseWindowInstance,
19+
mockWebContentsViewInstance: require('./electron.js').mockWebContentsViewInstance,
1920
mockElectronInstance: require('./electron.js').mockElectronInstance
2021
};

src/__tests__/index.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('Entrypoint test suite', () => {
3232
test('Adds quit event listener', () => expect(app.on).toHaveBeenCalledWith('quit', main.quit));
3333
test('Registers app keyboard shortcuts on every webContents created (web-contents-created)', () => {
3434
expect(app.on)
35-
.toHaveBeenCalledWith('web-contents-created', require('../browser-window').registerAppShortcuts);
35+
.toHaveBeenCalledWith('web-contents-created', require('../base-window').registerAppShortcuts);
3636
});
3737
});
3838
});

src/about/__tests__/index.test.js

+19-17
Original file line numberDiff line numberDiff line change
@@ -15,61 +15,63 @@
1515
*/
1616
describe('About module test suite', () => {
1717
let electron;
18-
let sender;
1918
let about;
2019
beforeEach(() => {
2120
jest.resetModules();
2221
jest.mock('electron', () => require('../../__tests__').mockElectronInstance());
2322
electron = require('electron');
24-
sender = electron.browserWindowInstance.webContents;
2523
about = require('../');
2624
});
2725
describe('openAboutDialog', () => {
26+
let openAbout;
27+
beforeEach(() => {
28+
openAbout = about.openAboutDialog(electron.baseWindowInstance);
29+
});
2830
describe('webPreferences', () => {
2931
test('is sandboxed', () => {
3032
// When
31-
about.openAboutDialog({sender});
33+
openAbout();
3234
// Then
33-
const BrowserView = electron.BrowserView;
34-
expect(BrowserView).toHaveBeenCalledTimes(1);
35-
expect(BrowserView).toHaveBeenCalledWith({
35+
const WebContentsView = electron.WebContentsView;
36+
expect(WebContentsView).toHaveBeenCalledTimes(1);
37+
expect(WebContentsView).toHaveBeenCalledWith({
3638
webPreferences: expect.objectContaining({sandbox: true, nodeIntegration: false})
3739
});
3840
});
3941
test('has no node integration', () => {
4042
// When
41-
about.openAboutDialog({sender});
43+
openAbout();
4244
// Then
43-
expect(electron.BrowserView).toHaveBeenCalledWith({
45+
expect(electron.WebContentsView).toHaveBeenCalledWith({
4446
webPreferences: expect.objectContaining({nodeIntegration: false})
4547
});
4648
});
4749
test('has context isolation', () => {
4850
// When
49-
about.openAboutDialog({sender});
51+
openAbout();
5052
// Then
51-
expect(electron.BrowserView).toHaveBeenCalledWith({
53+
expect(electron.WebContentsView).toHaveBeenCalledWith({
5254
webPreferences: expect.objectContaining({contextIsolation: true})
5355
});
5456
});
5557
});
5658
test('hasWindowOpenHandler', () => {
5759
// Given
58-
electron.browserViewInstance.webContents.getURL.mockReturnValue('file://about/index.html');
59-
about.openAboutDialog({sender});
60+
electron.webContentsViewInstance.webContents.getURL.mockReturnValue('file://about/index.html');
61+
openAbout();
6062
// When
61-
electron.browserViewInstance.webContents.setWindowOpenHandler.mock.calls[0][0]({url: 'https://example.com'});
63+
electron.webContentsViewInstance.webContents.setWindowOpenHandler.mock.calls[0][0]({url: 'https://example.com'});
6264
// Then
6365
expect(electron.shell.openExternal).toHaveBeenCalledWith('https://example.com');
6466
});
6567
test('should open dialog and add event listeners', () => {
6668
// When
67-
about.openAboutDialog({sender: electron.browserWindowInstance.webContents});
69+
openAbout();
6870
// Then
69-
expect(electron.browserViewInstance.webContents.loadURL).toHaveBeenCalledTimes(1);
70-
expect(electron.browserViewInstance.webContents.loadURL)
71+
expect(electron.webContentsViewInstance.webContents.loadURL).toHaveBeenCalledTimes(1);
72+
expect(electron.webContentsViewInstance.webContents.loadURL)
7173
.toHaveBeenCalledWith(expect.stringMatching(/.+?\/index.html$/)); // NOSONAR
72-
expect(electron.browserViewInstance.webContents.on).toHaveBeenCalledWith('will-navigate', expect.any(Function));
74+
expect(electron.webContentsViewInstance.webContents.on).toHaveBeenCalledWith('will-navigate', expect.any(Function));
7375
});
7476
});
7577
});

src/about/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16-
const {BrowserView, BrowserWindow} = require('electron');
16+
const {WebContentsView} = require('electron');
1717
const path = require('path');
18-
const {showDialog} = require('../browser-window');
18+
const {showDialog} = require('../base-window');
1919
const {handleRedirect, windowOpenHandler} = require('../tab-manager/redirect');
2020

2121
const webPreferences = {
@@ -25,12 +25,12 @@ const webPreferences = {
2525
preload: path.resolve(__dirname, '..', '..', 'bundles', 'about.preload.js')
2626
};
2727

28-
const openAboutDialog = event => {
29-
const aboutView = new BrowserView({webPreferences});
28+
const openAboutDialog = baseWindow => () => {
29+
const aboutView = new WebContentsView({webPreferences});
3030
aboutView.webContents.loadURL(`file://${__dirname}/index.html`);
3131
aboutView.webContents.on('will-navigate', handleRedirect(aboutView));
3232
aboutView.webContents.setWindowOpenHandler(windowOpenHandler(aboutView));
33-
showDialog(BrowserWindow.fromWebContents(event.sender), aboutView);
33+
showDialog(baseWindow, aboutView);
3434
};
3535

3636
module.exports = {openAboutDialog};

src/app-menu/__tests__/app-menu.browser.test.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('App Menu in Browser test suite', () => {
2929
};
3030
await loadDOM({meta: import.meta, path: ['..', 'index.html']});
3131
});
32-
test('wrapper, click should close menu (BrowserView)', () => {
32+
test('wrapper, click should close menu (WebContentsView)', () => {
3333
// When
3434
fireEvent.click(document.querySelector('.app-menu .wrapper'));
3535
// Then

src/app-menu/index.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
*/
1616
const path = require('path');
17-
const {BrowserView} = require('electron');
17+
const {WebContentsView} = require('electron');
1818

1919
const webPreferences = {
2020
transparent: true,
@@ -25,13 +25,12 @@ const webPreferences = {
2525
};
2626

2727
/**
28-
* Creates a new BrowserView instance with the App Menu
29-
* @returns {Electron.CrossProcessExports.BrowserView}
28+
* Creates a new WebContentsView instance with the App Menu
29+
* @returns {Electron.CrossProcessExports.WebContentsView}
3030
*/
3131
const newAppMenu = () => {
32-
const appMenu = new BrowserView({webPreferences});
32+
const appMenu = new WebContentsView({webPreferences});
3333
appMenu.isAppMenu = true;
34-
appMenu.setAutoResize({width: false, horizontal: false, height: false, vertical: false});
3534
appMenu.webContents.loadURL(`file://${__dirname}/index.html`);
3635
return appMenu;
3736
};

src/browser-window/__tests__/index.test.js renamed to src/base-window/__tests__/index.test.js

+8-11
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,23 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16-
describe('browser-window util module test suite', () => {
17-
let browserWindow;
16+
describe('base-window util module test suite', () => {
17+
let baseWindow;
1818
beforeEach(() => {
19-
browserWindow = require('../');
19+
baseWindow = require('../');
2020
});
2121
test('showDialog, should fill provided window with provided BrowserView', () => {
2222
// Given
23-
const window = require('../../__tests__/electron').mockBrowserWindowInstance();
23+
const window = require('../../__tests__/electron').mockBaseWindowInstance();
2424
window.getContentBounds = jest.fn(() => ({width: 13, height: 37}));
25-
const dialog = require('../../__tests__/electron').mockBrowserWindowInstance();
25+
const dialog = require('../../__tests__/electron').mockWebContentsViewInstance();
2626
// When
27-
browserWindow.showDialog(window, dialog);
27+
baseWindow.showDialog(window, dialog);
2828
// Then
29-
expect(window.setBrowserView).toHaveBeenCalledWith(dialog);
30-
expect(window.setBrowserView).toHaveBeenCalledBefore(dialog.setBounds);
29+
expect(window.contentView.addChildView).toHaveBeenCalledWith(dialog);
30+
expect(window.contentView.addChildView).toHaveBeenCalledBefore(dialog.setBounds);
3131
expect(dialog.setBounds).toHaveBeenCalledTimes(1);
3232
expect(dialog.setBounds).toHaveBeenCalledWith({x: 0, y: 0, width: 13, height: 37});
33-
expect(dialog.setAutoResize).toHaveBeenCalledTimes(1);
34-
expect(dialog.setAutoResize)
35-
.toHaveBeenCalledWith({width: false, horizontal: false, height: false, vertical: false});
3633
expect(dialog.webContents.focus).toHaveBeenCalledTimes(1);
3734
});
3835
});

0 commit comments

Comments
 (0)