Skip to content

Commit

Permalink
fix: use createWindow option
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmaddock committed Sep 28, 2024
1 parent 620bc67 commit 0d696aa
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions packages/shell/browser/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,17 +297,15 @@ class Browser {
case 'foreground-tab':
case 'background-tab':
case 'new-window': {
// setWindowOpenHandler doesn't yet support creating BrowserViews
// instead of BrowserWindows. For now, we're opting to break
// window.open until a fix is available.
// https://github.com/electron/electron/issues/33383
queueMicrotask(() => {
const win = this.getWindowFromWebContents(webContents)
const tab = win.tabs.create()
tab.loadURL(details.url)
})

return { action: 'deny' }
return {
action: 'allow',
createWindow: () => {
const win = this.getWindowFromWebContents(webContents);
const tab = win.tabs.create();
tab.loadURL(details.url);
return tab.webContents;
}
}
}
default:
return { action: 'allow' }
Expand Down

0 comments on commit 0d696aa

Please sign in to comment.