Rename option to contextIsolation

This commit is contained in:
Kevin Sawicki 2016-12-15 13:20:17 -08:00
parent b56bdc83af
commit ad3b837ad5
5 changed files with 20 additions and 15 deletions

View file

@ -121,8 +121,9 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches(
// Run Electron APIs and preload script in isolated world
bool isolated;
if (web_preferences.GetBoolean("isolated", &isolated) && isolated)
command_line->AppendSwitch(switches::kIsolatedWorld);
if (web_preferences.GetBoolean(options::kContextIsolation, &isolated) &&
isolated)
command_line->AppendSwitch(switches::kContextIsolation);
// --background-color.
std::string color;

View file

@ -99,6 +99,9 @@ const char kPreloadURL[] = "preloadURL";
// Enable the node integration.
const char kNodeIntegration[] = "nodeIntegration";
// Enable context isolation of Electron APIs and preload script
const char kContextIsolation[] = "contextIsolation";
// Instancd ID of guest WebContents.
const char kGuestInstanceID[] = "guestInstanceId";
@ -158,15 +161,15 @@ const char kCipherSuiteBlacklist[] = "cipher-suite-blacklist";
const char kAppUserModelId[] = "app-user-model-id";
// The command line switch versions of the options.
const char kBackgroundColor[] = "background-color";
const char kZoomFactor[] = "zoom-factor";
const char kPreloadScript[] = "preload";
const char kPreloadURL[] = "preload-url";
const char kNodeIntegration[] = "node-integration";
const char kIsolatedWorld[] = "isolated-world";
const char kGuestInstanceID[] = "guest-instance-id";
const char kOpenerID[] = "opener-id";
const char kScrollBounce[] = "scroll-bounce";
const char kBackgroundColor[] = "background-color";
const char kZoomFactor[] = "zoom-factor";
const char kPreloadScript[] = "preload";
const char kPreloadURL[] = "preload-url";
const char kNodeIntegration[] = "node-integration";
const char kContextIsolation[] = "context-isolation";
const char kGuestInstanceID[] = "guest-instance-id";
const char kOpenerID[] = "opener-id";
const char kScrollBounce[] = "scroll-bounce";
// Widevine options
// Path to Widevine CDM binaries.

View file

@ -54,6 +54,7 @@ extern const char kZoomFactor[];
extern const char kPreloadScript[];
extern const char kPreloadURL[];
extern const char kNodeIntegration[];
extern const char kContextIsolation[];
extern const char kGuestInstanceID[];
extern const char kExperimentalFeatures[];
extern const char kExperimentalCanvasFeatures[];
@ -86,7 +87,7 @@ extern const char kZoomFactor[];
extern const char kPreloadScript[];
extern const char kPreloadURL[];
extern const char kNodeIntegration[];
extern const char kIsolatedWorld[];
extern const char kContextIsolation[];
extern const char kGuestInstanceID[];
extern const char kOpenerID[];
extern const char kScrollBounce[];

View file

@ -163,7 +163,7 @@ AtomRendererClient::AtomRendererClient()
: node_bindings_(NodeBindings::Create(false)),
atom_bindings_(new AtomBindings) {
isolated_world_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kIsolatedWorld);
switches::kContextIsolation);
// Parse --standard-schemes=scheme1,scheme2
std::vector<std::string> standard_schemes_list =
ParseSchemesCLISwitch(switches::kStandardSchemes);

View file

@ -1835,7 +1835,7 @@ describe('BrowserWindow module', function () {
})
})
describe('isolated option', () => {
describe('contextIsolation option', () => {
it('separates the page context from the Electron/preload context', (done) => {
if (w != null) w.destroy()
@ -1860,7 +1860,7 @@ describe('BrowserWindow module', function () {
w = new BrowserWindow({
show: false,
webPreferences: {
isolated: true,
contextIsolation: true,
preload: path.join(fixtures, 'api', 'isolated-preload.js')
}
})