fix: remove windowName set as title for native window.open() (#27481)
This commit is contained in:
parent
d5bcf742be
commit
c175d41ae8
4 changed files with 11 additions and 21 deletions
|
@ -14,6 +14,12 @@ This document uses the following convention to categorize breaking changes:
|
|||
|
||||
## Planned Breaking API Changes (14.0)
|
||||
|
||||
### API Changed: `window.(open)`
|
||||
|
||||
The optional parameter `frameName` will no longer set the title of the window. This now follows the specification described by the [native documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters) under the corresponding parameter `windowName`.
|
||||
|
||||
If you were using this parameter to set the title of a window, you can instead use [win.setTitle(title)](https://www.electronjs.org/docs/api/browser-window#winsettitletitle).
|
||||
|
||||
### Removed: `worldSafeExecuteJavaScript`
|
||||
|
||||
In Electron 14, `worldSafeExecuteJavaScript` will be removed. There is no alternative, please
|
||||
|
|
|
@ -46,8 +46,6 @@ export function openGuestWindow ({ event, embedder, guest, referrer, disposition
|
|||
const { options: browserWindowOptions, additionalFeatures } = makeBrowserWindowOptions({
|
||||
embedder,
|
||||
features,
|
||||
frameName,
|
||||
isNativeWindowOpen,
|
||||
overrideOptions: overrideBrowserWindowOptions
|
||||
});
|
||||
|
||||
|
@ -200,11 +198,9 @@ const securityWebPreferences: { [key: string]: boolean } = {
|
|||
enableWebSQL: false
|
||||
};
|
||||
|
||||
function makeBrowserWindowOptions ({ embedder, features, frameName, isNativeWindowOpen, overrideOptions, useDeprecatedBehaviorForBareValues = true, useDeprecatedBehaviorForOptionInheritance = true }: {
|
||||
function makeBrowserWindowOptions ({ embedder, features, overrideOptions, useDeprecatedBehaviorForBareValues = true, useDeprecatedBehaviorForOptionInheritance = true }: {
|
||||
embedder: WebContents,
|
||||
features: string,
|
||||
frameName: string,
|
||||
isNativeWindowOpen: boolean,
|
||||
overrideOptions?: BrowserWindowConstructorOptions,
|
||||
useDeprecatedBehaviorForBareValues?: boolean
|
||||
useDeprecatedBehaviorForOptionInheritance?: boolean
|
||||
|
@ -220,7 +216,6 @@ function makeBrowserWindowOptions ({ embedder, features, frameName, isNativeWind
|
|||
show: true,
|
||||
width: 800,
|
||||
height: 600,
|
||||
...(!isNativeWindowOpen && { title: frameName }),
|
||||
...parsedOptions,
|
||||
...overrideOptions,
|
||||
webPreferences: makeWebPreferences({ embedder, insecureParsedWebPreferences: parsedWebPreferences, secureOverrideWebPreferences: overrideOptions && overrideOptions.webPreferences, useDeprecatedBehaviorForOptionInheritance: true })
|
||||
|
|
|
@ -744,20 +744,13 @@ describe('chromium features', () => {
|
|||
expect(await w.webContents.executeJavaScript('b.location.href')).to.equal('about:blank');
|
||||
});
|
||||
|
||||
it('sets the window title to the specified frameName', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
w.loadURL('about:blank');
|
||||
w.webContents.executeJavaScript('{ b = window.open(\'\', \'hello\'); null }');
|
||||
const [, window] = await emittedOnce(app, 'browser-window-created');
|
||||
expect(window.getTitle()).to.equal('hello');
|
||||
});
|
||||
|
||||
it('does not throw an exception when the frameName is a built-in object property', async () => {
|
||||
const w = new BrowserWindow({ show: false });
|
||||
w.loadURL('about:blank');
|
||||
w.webContents.executeJavaScript('{ b = window.open(\'\', \'__proto__\'); null }');
|
||||
const [, window] = await emittedOnce(app, 'browser-window-created');
|
||||
expect(window.getTitle()).to.equal('__proto__');
|
||||
const [, , frameName] = await emittedOnce(w.webContents, 'new-window');
|
||||
|
||||
expect(frameName).to.equal('__proto__');
|
||||
});
|
||||
|
||||
it('denies custom open when nativeWindowOpen: true', async () => {
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
"show": true,
|
||||
"width": 800,
|
||||
"height": 600,
|
||||
"title": "frame-name",
|
||||
"top": 5,
|
||||
"left": 10,
|
||||
"resizable": false,
|
||||
|
@ -48,7 +47,6 @@
|
|||
"show": true,
|
||||
"width": 800,
|
||||
"height": 600,
|
||||
"title": "frame-name",
|
||||
"resizable": false,
|
||||
"x": 0,
|
||||
"y": 10,
|
||||
|
@ -82,7 +80,6 @@
|
|||
"show": true,
|
||||
"width": 800,
|
||||
"height": 600,
|
||||
"title": "frame-name",
|
||||
"backgroundColor": "gray",
|
||||
"webPreferences": {
|
||||
"nodeIntegration": false,
|
||||
|
@ -116,9 +113,9 @@
|
|||
"show": true,
|
||||
"width": 800,
|
||||
"height": 600,
|
||||
"title": "sup",
|
||||
"x": 50,
|
||||
"y": 20,
|
||||
"title": "sup",
|
||||
"webPreferences": {
|
||||
"nodeIntegration": false,
|
||||
"webviewTag": false,
|
||||
|
@ -148,7 +145,6 @@
|
|||
"show": false,
|
||||
"width": 800,
|
||||
"height": 600,
|
||||
"title": "frame-name",
|
||||
"top": 1,
|
||||
"left": 1,
|
||||
"x": 1,
|
||||
|
|
Loading…
Add table
Reference in a new issue