fix: replace default frameName title with null check (#27813) (#27868)

* 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

* add nativewindowopen check to null title

* fix lint and json formatting

* reformat test cases for this branch

the merged changes included some rearrangements to the json items that
do not apply to this branch, so the items were reordered according to
this branch's previous files.

* remove default frameName title for native open call and modify test txts
This commit is contained in:
Michaela Laurencin
2021-02-23 07:26:01 -08:00
committed by GitHub
parent 1c198eef50
commit c6f8625947
4 changed files with 20 additions and 21 deletions

View File

@@ -588,7 +588,6 @@ WebContents.prototype._init = function () {
width: 800,
height: 600,
webContents,
title: frameName,
webPreferences,
...options
};

View File

@@ -6,14 +6,13 @@
"returnValue": "placeholder-guest-contents-id"
},
"about:blank",
"frame name",
"frame-name",
"new-window",
{
"show": true,
"width": 800,
"height": 600,
"webContents": "[WebContents]",
"title": "frame name",
"webPreferences": {
"nativeWindowOpen": true,
"sandbox": true,
@@ -27,6 +26,7 @@
"resizable": false,
"x": 10,
"y": 5,
"title": "cool",
"backgroundColor": "blue",
"focusable": false
},
@@ -44,14 +44,13 @@
"returnValue": "placeholder-guest-contents-id"
},
"about:blank",
"frame name",
"frame-name",
"new-window",
{
"show": true,
"width": 800,
"height": 600,
"webContents": "[WebContents]",
"title": "frame name",
"webPreferences": {
"zoomFactor": "2",
"nativeWindowOpen": true,
@@ -64,6 +63,7 @@
"resizable": false,
"x": 0,
"y": 10,
"title": "cool",
"backgroundColor": "blue",
"focusable": false
},
@@ -81,14 +81,13 @@
"returnValue": "placeholder-guest-contents-id"
},
"about:blank",
"frame name",
"frame-name",
"new-window",
{
"show": true,
"width": 800,
"height": 600,
"webContents": "[WebContents]",
"title": "frame name",
"webPreferences": {
"nativeWindowOpen": true,
"sandbox": true,
@@ -100,6 +99,7 @@
"backgroundColor": "gray",
"x": 100,
"y": 100,
"title": "cool",
"focusable": false
},
[],
@@ -116,14 +116,13 @@
"returnValue": "placeholder-guest-contents-id"
},
"about:blank",
"frame name",
"frame-name",
"new-window",
{
"show": true,
"width": 800,
"height": 600,
"webContents": "[WebContents]",
"title": "sup",
"webPreferences": {
"nativeWindowOpen": true,
"sandbox": true,
@@ -134,6 +133,7 @@
},
"x": 50,
"y": 20,
"title": "sup",
"backgroundColor": "blue",
"focusable": false
},
@@ -151,14 +151,13 @@
"returnValue": "placeholder-guest-contents-id"
},
"about:blank",
"frame name",
"frame-name",
"new-window",
{
"show": false,
"width": 800,
"height": 600,
"webContents": "[WebContents]",
"title": "frame name",
"webPreferences": {
"nativeWindowOpen": true,
"sandbox": true,
@@ -171,6 +170,7 @@
"left": 1,
"x": 1,
"y": 1,
"title": "cool",
"backgroundColor": "blue",
"focusable": false
},

View File

@@ -7,7 +7,7 @@
"processId": "placeholder-process-id"
},
"about:blank",
"frame name",
"frame-name",
"new-window",
{
"top": 5,
@@ -15,7 +15,7 @@
"resizable": false,
"x": 10,
"y": 5,
"title": "frame name",
"title": "frame-name",
"webPreferences": {
"nodeIntegration": false,
"webviewTag": false,
@@ -41,13 +41,13 @@
"processId": "placeholder-process-id"
},
"about:blank",
"frame name",
"frame-name",
"new-window",
{
"resizable": false,
"x": 0,
"y": 10,
"title": "frame name",
"title": "frame-name",
"webPreferences": {
"zoomFactor": "2",
"nodeIntegration": false,
@@ -74,7 +74,7 @@
"processId": "placeholder-process-id"
},
"about:blank",
"frame name",
"frame-name",
"new-window",
{
"backgroundColor": "gray",
@@ -87,7 +87,7 @@
},
"x": 100,
"y": 100,
"title": "frame name",
"title": "frame-name",
"width": 800,
"height": 600,
"show": false
@@ -107,7 +107,7 @@
"processId": "placeholder-process-id"
},
"about:blank",
"frame name",
"frame-name",
"new-window",
{
"x": 50,
@@ -138,7 +138,7 @@
"processId": "placeholder-process-id"
},
"about:blank",
"frame name",
"frame-name",
"new-window",
{
"show": false,
@@ -146,7 +146,7 @@
"left": 1,
"x": 1,
"y": 1,
"title": "frame name",
"title": "frame-name",
"webPreferences": {
"nodeIntegration": false,
"webviewTag": false,

View File

@@ -9,7 +9,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}')`);
browserWindow.webContents.executeJavaScript(`window.open('about:blank', 'frame-name', '${features}') && true`);
});
}