Skip to content
Next Next commit
chore(electron): update to latest version 33.3.1
  • Loading branch information
nightnei committed Jan 7, 2025
commit 68ecf5ffdc390b6041e1b6bd943153edcc995dfa
9 changes: 5 additions & 4 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
Copy Markdown
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?

@nightnei nightnei Jan 9, 2025

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

},
},
];
Expand Down