refactor: improve feature string parsing (#23130)
* test: add pre-change snapshot of new-window event * move to .ts file for easier diff * refactor: improve feature string parsing logic * test: update snapshots * update type names per review * update comma-separated parse test * use for loop instead of reduce per review * tighten up types * avoid variable guest contents id returnValue in test snapshot
This commit is contained in:
parent
b3909f5600
commit
aca2e4f968
10 changed files with 589 additions and 108 deletions
|
@ -5,7 +5,7 @@ const { BrowserWindow } = electron;
|
|||
const { isSameOrigin } = process.electronBinding('v8_util');
|
||||
const { ipcMainInternal } = require('@electron/internal/browser/ipc-main-internal');
|
||||
const ipcMainUtils = require('@electron/internal/browser/ipc-main-internal-utils');
|
||||
const { convertFeaturesString } = require('@electron/internal/common/parse-features-string');
|
||||
const { parseFeatures } = require('@electron/internal/common/parse-features-string');
|
||||
|
||||
const hasProp = {}.hasOwnProperty;
|
||||
const frameToGuest = new Map();
|
||||
|
@ -224,7 +224,10 @@ ipcMainInternal.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_OPEN', (event, url, fra
|
|||
if (features == null) features = '';
|
||||
|
||||
const disposition = 'new-window';
|
||||
const { options, additionalFeatures } = convertFeaturesString(features, frameName);
|
||||
const { options, webPreferences, additionalFeatures } = parseFeatures(features);
|
||||
if (!options.title) options.title = frameName;
|
||||
options.webPreferences = webPreferences;
|
||||
|
||||
const referrer = { url: '', policy: 'default' };
|
||||
internalWindowOpen(event, url, referrer, frameName, disposition, options, additionalFeatures, null);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue