mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1121577 - Only enable SpecialPowers at newSession, r=AutomatedTester
This commit is contained in:
parent
4368e3d7ea
commit
58d435e150
@ -16,8 +16,6 @@ let logger = Log.repository.getLogger("Marionette");
|
||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader);
|
||||
let specialpowers = {};
|
||||
loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserver.js",
|
||||
specialpowers);
|
||||
|
||||
//list of OOP frames that has the frame script loaded
|
||||
let remoteFrames = [];
|
||||
@ -108,6 +106,11 @@ FrameManager.prototype = {
|
||||
let oopFrame = frameWindow.document.getElementsByTagName("iframe")[message.json.frame]; //find the OOP frame
|
||||
let mm = oopFrame.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader.messageManager; //get the OOP frame's mm
|
||||
|
||||
if (!specialpowers.hasOwnProperty("specialPowersObserver")) {
|
||||
loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserver.js",
|
||||
specialpowers);
|
||||
}
|
||||
|
||||
// See if this frame already has our frame script loaded in it; if so,
|
||||
// just wake it up.
|
||||
for (let i = 0; i < remoteFrames.length; i++) {
|
||||
|
@ -25,14 +25,7 @@ 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);
|
||||
specialpowers.specialPowersObserver = new specialpowers.SpecialPowersObserver();
|
||||
specialpowers.specialPowersObserver.init();
|
||||
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
@ -56,6 +49,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 +157,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 +579,23 @@ 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);
|
||||
}
|
||||
|
||||
if (!specialpowers.hasOwnProperty('specialPowersObserver')) {
|
||||
loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserver.js",
|
||||
specialpowers);
|
||||
specialpowers.specialPowersObserver = new specialpowers.SpecialPowersObserver();
|
||||
specialpowers.specialPowersObserver.init();
|
||||
}
|
||||
|
||||
this.scriptTimeout = 10000;
|
||||
if (aRequest && aRequest.parameters) {
|
||||
this.sessionId = aRequest.parameters.session_id ? aRequest.parameters.session_id : null;
|
||||
|
@ -16,13 +16,15 @@ if (typeof(Cc) == 'undefined') {
|
||||
/**
|
||||
* Special Powers Exception - used to throw exceptions nicely
|
||||
**/
|
||||
function SpecialPowersException(aMsg) {
|
||||
this.SpecialPowersException = function SpecialPowersException(aMsg) {
|
||||
this.message = aMsg;
|
||||
this.name = "SpecialPowersException";
|
||||
}
|
||||
|
||||
SpecialPowersException.prototype.toString = function() {
|
||||
return this.name + ': "' + this.message + '"';
|
||||
SpecialPowersException.prototype = {
|
||||
toString: function SPE_toString() {
|
||||
return this.name + ': "' + this.message + '"';
|
||||
}
|
||||
};
|
||||
|
||||
this.SpecialPowersObserverAPI = function SpecialPowersObserverAPI() {
|
||||
|
Loading…
Reference in New Issue
Block a user