Bug 1121577 - Only toggle security pref during a session, r=AutomatedTester

This commit is contained in:
Jonathan Griffin 2015-01-16 15:38:25 -08:00
Родитель da64cbe550
Коммит a9ccbbf2fe
1 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -25,9 +25,6 @@ loader.loadSubScript("chrome://marionette/content/ChromeUtils.js", utils);
loader.loadSubScript("chrome://marionette/content/atoms.js", utils);
loader.loadSubScript("chrome://marionette/content/marionette-sendkeys.js", utils);
// SpecialPowers requires insecure automation-only features that we put behind a pref.
Services.prefs.setBoolPref('security.turn_off_all_security_so_that_viruses_can_take_over_this_computer',
true);
let specialpowers = {};
loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserver.js",
specialpowers);
@ -56,6 +53,7 @@ loader.loadSubScript("resource://gre/modules/devtools/transport/transport.js");
let bypassOffline = false;
let qemu = "0";
let device = null;
const SECURITY_PREF = 'security.turn_off_all_security_so_that_viruses_can_take_over_this_computer';
XPCOMUtils.defineLazyServiceGetter(this, "cookieManager",
"@mozilla.org/cookiemanager;1",
@ -163,6 +161,7 @@ function MarionetteServerConnection(aPrefix, aTransport, aServer)
this.currentFrameElement = null;
this.testName = null;
this.mozBrowserClose = null;
this.enabled_security_pref = false;
this.sandbox = null;
this.oopFrameId = null; // frame ID of current remote frame, used for mozbrowserclose events
this.sessionCapabilities = {
@ -584,6 +583,16 @@ MarionetteServerConnection.prototype = {
this.command_id = this.getCommandId();
this.newSessionCommandId = this.command_id;
// SpecialPowers requires insecure automation-only features that we put behind a pref
let security_pref_value = false;
try {
security_pref_value = Services.prefs.getBoolPref(SECURITY_PREF);
} catch(e) {}
if (!security_pref_value) {
this.enabled_security_pref = true;
Services.prefs.setBoolPref(SECURITY_PREF, true);
}
this.scriptTimeout = 10000;
if (aRequest && aRequest.parameters) {
this.sessionId = aRequest.parameters.session_id ? aRequest.parameters.session_id : null;