Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Electron to latest version 33.3.1 #782

Open
wants to merge 8 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^6.0.0",
"ejs": "^3.1.10",
"electron": "29.1.0",
"electron": "33.3.1",
"electron-devtools-installer": "^3.2.0",
"electron-playwright-helpers": "^1.7.0",
"eslint": "^8.57.1",
Expand Down
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ async function appBoot() {
} );

function validateIpcSender( event: IpcMainInvokeEvent ) {
if ( ! event.senderFrame ) {
throw new Error(
'Failed IPC sender validation check: the frame has either navigated or been destroyed'
);
}

if ( new URL( event.senderFrame.url ).origin === new URL( MAIN_WINDOW_WEBPACK_ENTRY ).origin ) {
return true;
}
Expand Down
6 changes: 4 additions & 2 deletions src/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ function getAppMenu(
},
{
label: __( 'Test Render Failure (dev only)' ),
click: ( menuItem, browserWindow ) => {
browserWindow?.webContents.send( 'test-render-failure' );
click: () => {
withMainWindow( ( window ) => {
window.webContents.send( 'test-render-failure' );
} );
Comment on lines +61 to +63
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, which change in Electron made it so we had to make this change?

Copy link
Contributor Author

@nightnei nightnei Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They replaced BrowserWindow with BaseWindow, so in this argument we don't have access to webContents anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
},
];
Expand Down
Loading