fix: replace default frameName title with null check (#27521)
* refactor: replace default frameName title with null check * add isNativeWindowOpen check in makeBrowserWindowOptions * modify snapshot test files * replace title with frame-name again for proxy - not native open * modify proxy snapshot title key-value to come after height key-value
This commit is contained in:
parent
40aeb0d994
commit
357becd113
4 changed files with 24 additions and 22 deletions
|
@ -47,6 +47,7 @@ export function openGuestWindow ({ event, embedder, guest, referrer, disposition
|
|||
embedder,
|
||||
features,
|
||||
frameName,
|
||||
isNativeWindowOpen,
|
||||
overrideOptions: overrideBrowserWindowOptions
|
||||
});
|
||||
|
||||
|
@ -199,10 +200,11 @@ const securityWebPreferences: { [key: string]: boolean } = {
|
|||
enableWebSQL: false
|
||||
};
|
||||
|
||||
function makeBrowserWindowOptions ({ embedder, features, frameName, overrideOptions, useDeprecatedBehaviorForBareValues = true, useDeprecatedBehaviorForOptionInheritance = true }: {
|
||||
function makeBrowserWindowOptions ({ embedder, features, frameName, isNativeWindowOpen, overrideOptions, useDeprecatedBehaviorForBareValues = true, useDeprecatedBehaviorForOptionInheritance = true }: {
|
||||
embedder: WebContents,
|
||||
features: string,
|
||||
frameName: string,
|
||||
isNativeWindowOpen: boolean,
|
||||
overrideOptions?: BrowserWindowConstructorOptions,
|
||||
useDeprecatedBehaviorForBareValues?: boolean
|
||||
useDeprecatedBehaviorForOptionInheritance?: boolean
|
||||
|
@ -216,9 +218,9 @@ function makeBrowserWindowOptions ({ embedder, features, frameName, overrideOpti
|
|||
options: {
|
||||
...(useDeprecatedBehaviorForOptionInheritance && deprecatedInheritedOptions),
|
||||
show: true,
|
||||
title: frameName,
|
||||
width: 800,
|
||||
height: 600,
|
||||
...(!isNativeWindowOpen && { title: frameName }),
|
||||
...parsedOptions,
|
||||
...overrideOptions,
|
||||
webPreferences: makeWebPreferences({ embedder, insecureParsedWebPreferences: parsedWebPreferences, secureOverrideWebPreferences: overrideOptions && overrideOptions.webPreferences, useDeprecatedBehaviorForOptionInheritance: true })
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
"sender": "[WebContents]"
|
||||
},
|
||||
"about:blank",
|
||||
"frame name",
|
||||
"frame-name",
|
||||
"new-window",
|
||||
{
|
||||
"width": 800,
|
||||
"title": "frame name",
|
||||
"title": "cool",
|
||||
"backgroundColor": "blue",
|
||||
"focusable": false,
|
||||
"webPreferences": {
|
||||
|
@ -43,11 +43,11 @@
|
|||
"sender": "[WebContents]"
|
||||
},
|
||||
"about:blank",
|
||||
"frame name",
|
||||
"frame-name",
|
||||
"new-window",
|
||||
{
|
||||
"width": 800,
|
||||
"title": "frame name",
|
||||
"title": "cool",
|
||||
"backgroundColor": "blue",
|
||||
"focusable": false,
|
||||
"webPreferences": {
|
||||
|
@ -80,11 +80,11 @@
|
|||
"sender": "[WebContents]"
|
||||
},
|
||||
"about:blank",
|
||||
"frame name",
|
||||
"frame-name",
|
||||
"new-window",
|
||||
{
|
||||
"width": 800,
|
||||
"title": "frame name",
|
||||
"title": "cool",
|
||||
"backgroundColor": "gray",
|
||||
"focusable": false,
|
||||
"webPreferences": {
|
||||
|
@ -115,7 +115,7 @@
|
|||
"sender": "[WebContents]"
|
||||
},
|
||||
"about:blank",
|
||||
"frame name",
|
||||
"frame-name",
|
||||
"new-window",
|
||||
{
|
||||
"width": 800,
|
||||
|
@ -150,11 +150,11 @@
|
|||
"sender": "[WebContents]"
|
||||
},
|
||||
"about:blank",
|
||||
"frame name",
|
||||
"frame-name",
|
||||
"new-window",
|
||||
{
|
||||
"width": 800,
|
||||
"title": "frame name",
|
||||
"title": "cool",
|
||||
"backgroundColor": "blue",
|
||||
"focusable": false,
|
||||
"webPreferences": {
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
"processId": "placeholder-process-id"
|
||||
},
|
||||
"about:blank",
|
||||
"frame name",
|
||||
"frame-name",
|
||||
"new-window",
|
||||
{
|
||||
"show": true,
|
||||
"title": "frame name",
|
||||
"width": 800,
|
||||
"height": 600,
|
||||
"title": "frame-name",
|
||||
"top": 5,
|
||||
"left": 10,
|
||||
"resizable": false,
|
||||
|
@ -42,13 +42,13 @@
|
|||
"processId": "placeholder-process-id"
|
||||
},
|
||||
"about:blank",
|
||||
"frame name",
|
||||
"frame-name",
|
||||
"new-window",
|
||||
{
|
||||
"show": true,
|
||||
"title": "frame name",
|
||||
"width": 800,
|
||||
"height": 600,
|
||||
"title": "frame-name",
|
||||
"resizable": false,
|
||||
"x": 0,
|
||||
"y": 10,
|
||||
|
@ -76,13 +76,13 @@
|
|||
"processId": "placeholder-process-id"
|
||||
},
|
||||
"about:blank",
|
||||
"frame name",
|
||||
"frame-name",
|
||||
"new-window",
|
||||
{
|
||||
"show": true,
|
||||
"title": "frame name",
|
||||
"width": 800,
|
||||
"height": 600,
|
||||
"title": "frame-name",
|
||||
"backgroundColor": "gray",
|
||||
"webPreferences": {
|
||||
"nodeIntegration": false,
|
||||
|
@ -110,13 +110,13 @@
|
|||
"processId": "placeholder-process-id"
|
||||
},
|
||||
"about:blank",
|
||||
"frame name",
|
||||
"frame-name",
|
||||
"new-window",
|
||||
{
|
||||
"show": true,
|
||||
"title": "sup",
|
||||
"width": 800,
|
||||
"height": 600,
|
||||
"title": "sup",
|
||||
"x": 50,
|
||||
"y": 20,
|
||||
"webPreferences": {
|
||||
|
@ -142,13 +142,13 @@
|
|||
"processId": "placeholder-process-id"
|
||||
},
|
||||
"about:blank",
|
||||
"frame name",
|
||||
"frame-name",
|
||||
"new-window",
|
||||
{
|
||||
"show": false,
|
||||
"title": "frame name",
|
||||
"width": 800,
|
||||
"height": 600,
|
||||
"title": "frame-name",
|
||||
"top": 1,
|
||||
"left": 1,
|
||||
"x": 1,
|
||||
|
|
|
@ -10,7 +10,7 @@ function genSnapshot (browserWindow: BrowserWindow, features: string) {
|
|||
browserWindow.webContents.on('new-window', (...args: any[]) => {
|
||||
resolve([features, ...args]);
|
||||
});
|
||||
browserWindow.webContents.executeJavaScript(`window.open('about:blank', 'frame name', '${features}') && true`);
|
||||
browserWindow.webContents.executeJavaScript(`window.open('about:blank', 'frame-name', '${features}') && true`);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue