Changing command line option name
This commit is contained in:
parent
357caf8991
commit
3321f7d39c
9 changed files with 16 additions and 30 deletions
|
@ -102,11 +102,11 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches(
|
|||
command_line->AppendSwitch(switches::kNodeIntegrationInWorker);
|
||||
|
||||
// Check if webview tag creation is overriden.
|
||||
bool enable_webview_override = false;
|
||||
web_preferences.GetBoolean(options::kEnableWebViewOverride,
|
||||
&enable_webview_override);
|
||||
command_line->AppendSwitchASCII(switches::kEnableWebViewOverride,
|
||||
enable_webview_override ? "true" : "false");
|
||||
bool override_webview_security = false;
|
||||
web_preferences.GetBoolean(options::kOverrideWebViewSecurity,
|
||||
&override_webview_security);
|
||||
command_line->AppendSwitchASCII(switches::kOverrideWebViewSecurity,
|
||||
override_webview_security ? "true" : "false");
|
||||
|
||||
// If the `sandbox` option was passed to the BrowserWindow's webPreferences,
|
||||
// pass `--enable-sandbox` to the renderer so it won't have any node.js
|
||||
|
|
|
@ -129,7 +129,7 @@ const char kDisableBlinkFeatures[] = "disableBlinkFeatures";
|
|||
const char kNodeIntegrationInWorker[] = "nodeIntegrationInWorker";
|
||||
|
||||
// Enable the web view tag irrespective of node-integration setting.
|
||||
const char kEnableWebViewOverride[] = "enableWebViewOverride";
|
||||
const char kOverrideWebViewSecurity[] = "overrideWebViewSecurity";
|
||||
|
||||
} // namespace options
|
||||
|
||||
|
@ -175,7 +175,7 @@ const char kGuestInstanceID[] = "guest-instance-id";
|
|||
const char kOpenerID[] = "opener-id";
|
||||
const char kScrollBounce[] = "scroll-bounce";
|
||||
const char kHiddenPage[] = "hidden-page";
|
||||
const char kEnableWebViewOverride[] = "enable-webview-override";
|
||||
const char kOverrideWebViewSecurity[] = "override-webview-security";
|
||||
|
||||
// Command switch passed to renderer process to control nodeIntegration.
|
||||
const char kNodeIntegrationInWorker[] = "node-integration-in-worker";
|
||||
|
|
|
@ -64,7 +64,7 @@ extern const char kScrollBounce[];
|
|||
extern const char kBlinkFeatures[];
|
||||
extern const char kDisableBlinkFeatures[];
|
||||
extern const char kNodeIntegrationInWorker[];
|
||||
extern const char kEnableWebViewOverride[];
|
||||
extern const char kOverrideWebViewSecurity[];
|
||||
|
||||
} // namespace options
|
||||
|
||||
|
@ -94,7 +94,7 @@ extern const char kOpenerID[];
|
|||
extern const char kScrollBounce[];
|
||||
extern const char kHiddenPage[];
|
||||
extern const char kNodeIntegrationInWorker[];
|
||||
extern const char kEnableWebViewOverride[];
|
||||
extern const char kOverrideWebViewSecurity[];
|
||||
|
||||
extern const char kWidevineCdmPath[];
|
||||
extern const char kWidevineCdmVersion[];
|
||||
|
|
|
@ -307,7 +307,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
|
|||
'Electron Isolated Context' entry in the combo box at the top of the
|
||||
Console tab. **Note:** This option is currently experimental and may
|
||||
change or be removed in future Electron releases.
|
||||
* `enableWebViewOverride` Boolean (optional) - Whether to enable [webview-tag](webview-tag.md)
|
||||
* `overrideWebViewSecurity` Boolean (optional) - Whether to enable [webview-tag](webview-tag.md)
|
||||
ignoring the security restriction based on `nodeIntegration`. Enabling this option will
|
||||
have security implication on creating `webview` with `nodeIntegration` disabled. To avoid the
|
||||
security risk, listen to `will-create-webview` event on [web-contents](web-contents.md) and
|
||||
|
|
|
@ -218,17 +218,6 @@ When in-page navigation happens, the page URL changes but does not cause
|
|||
navigation outside of the page. Examples of this occurring are when anchor links
|
||||
are clicked or when the DOM `hashchange` event is triggered.
|
||||
|
||||
#### Event: 'will-create-webview'
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `params` Object
|
||||
|
||||
Emitted when web-view will be created.
|
||||
|
||||
Use this event to remove preload scripts or stop creating webviews.
|
||||
|
||||
#### Event: 'crashed'
|
||||
|
||||
Returns:
|
||||
|
|
|
@ -17,7 +17,7 @@ webview from the host page require a syncronous call to the main process.
|
|||
|
||||
For security purposes, `webview` can only be used in `BrowserWindow`s that have
|
||||
`nodeIntegration` enabled. You can override this security restiction using
|
||||
`enableWebViewOverride` option on [browser-window](browser-window.md).
|
||||
`overrideWebViewSecurity` option on [browser-window](browser-window.md).
|
||||
|
||||
## Example
|
||||
|
||||
|
|
|
@ -297,10 +297,7 @@ ipcMain.on('ELECTRON_GUEST_VIEW_MANAGER_CREATE_GUEST', function (event, params,
|
|||
})
|
||||
|
||||
ipcMain.on('ELECTRON_GUEST_VIEW_MANAGER_ATTACH_GUEST', function (event, elementInstanceId, guestInstanceId, params) {
|
||||
event.sender.emit('will-create-webview', event, params)
|
||||
if (!event.defaultPrevented) {
|
||||
attachGuest(event, elementInstanceId, guestInstanceId, params)
|
||||
}
|
||||
attachGuest(event, elementInstanceId, guestInstanceId, params)
|
||||
})
|
||||
|
||||
ipcMain.on('ELECTRON_GUEST_VIEW_MANAGER_DESTROY_GUEST', function (event, guestInstanceId) {
|
||||
|
|
|
@ -57,7 +57,7 @@ let nodeIntegration = 'false'
|
|||
let preloadScript = null
|
||||
let isBackgroundPage = false
|
||||
let appPath = null
|
||||
let enableWebView = false
|
||||
let overrideWebViewSecurity = false
|
||||
for (let arg of process.argv) {
|
||||
if (arg.indexOf('--guest-instance-id=') === 0) {
|
||||
// This is a guest web view.
|
||||
|
@ -74,7 +74,7 @@ for (let arg of process.argv) {
|
|||
} else if (arg.indexOf('--app-path=') === 0) {
|
||||
appPath = arg.substr(arg.indexOf('=') + 1)
|
||||
} else if (arg.indexOf('--enable-webview-override=') === 0) {
|
||||
enableWebView = arg.substr(arg.indexOf('=') + 1)
|
||||
overrideWebViewSecurity = arg.substr(arg.indexOf('=') + 1)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ if (window.location.protocol === 'chrome-devtools:') {
|
|||
require('./content-scripts-injector')
|
||||
|
||||
// Load webview tag implementation.
|
||||
if ((nodeIntegration === 'true' || enableWebView === 'true') && process.guestInstanceId == null) {
|
||||
if ((nodeIntegration === 'true' || overrideWebViewSecurity === 'true') && process.guestInstanceId == null) {
|
||||
require('./web-view/web-view')
|
||||
require('./web-view/web-view-attributes')
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ describe('<webview> tag', function () {
|
|||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
preload: path.join(fixtures, 'module', 'preload-webview.js'),
|
||||
enableWebViewOverride: true
|
||||
overrideWebViewSecurity: true
|
||||
}
|
||||
})
|
||||
ipcMain.once('webview', function (event, type) {
|
||||
|
|
Loading…
Reference in a new issue