From 9d70a1799f46e50cd7fba7e1e4e8c9f7819032a1 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 15 Oct 2014 15:05:09 +0200 Subject: [PATCH] Bug 1082450 - Use automation machinery instead of exposedProps in Mock{Color,File}Picker.jsm. r=gabor --- .../specialpowers/content/MockColorPicker.jsm | 16 ++++------------ testing/specialpowers/content/MockFilePicker.jsm | 16 ++++------------ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/testing/specialpowers/content/MockColorPicker.jsm b/testing/specialpowers/content/MockColorPicker.jsm index ab9f00b0c33c..3cce150c859b 100644 --- a/testing/specialpowers/content/MockColorPicker.jsm +++ b/testing/specialpowers/content/MockColorPicker.jsm @@ -14,6 +14,10 @@ const CONTRACT_ID = "@mozilla.org/colorpicker;1"; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +// Allow stuff from this scope to be accessed from non-privileged scopes. This +// would crash if used outside of automation. +Cu.forcePermissiveCOWs(); + var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); var oldClassID = "", oldFactory = null; var newClassID = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator).generateUUID(); @@ -111,15 +115,3 @@ MockColorPickerInstance.prototype = { }.bind(this), 0); } }; - -// Expose everything to content. We call reset() here so that all of the -// relevant lazy expandos get added. -MockColorPicker.reset(); -function exposeAll(obj) { - var props = {}; - for (var prop in obj) - props[prop] = 'rw'; - obj.__exposedProps__ = props; -} -exposeAll(MockColorPicker); -exposeAll(MockColorPickerInstance.prototype); diff --git a/testing/specialpowers/content/MockFilePicker.jsm b/testing/specialpowers/content/MockFilePicker.jsm index 6657ee9e1f5e..c1de2bcaed9e 100644 --- a/testing/specialpowers/content/MockFilePicker.jsm +++ b/testing/specialpowers/content/MockFilePicker.jsm @@ -15,6 +15,10 @@ Cu.import("resource://gre/modules/FileUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +// Allow stuff from this scope to be accessed from non-privileged scopes. This +// would crash if used outside of automation. +Cu.forcePermissiveCOWs(); + var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); var oldClassID, oldFactory; var newClassID = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator).generateUUID(); @@ -222,15 +226,3 @@ MockFilePickerInstance.prototype = { }.bind(this), 0); } }; - -// Expose everything to content. We call reset() here so that all of the relevant -// lazy expandos get added. -MockFilePicker.reset(); -function exposeAll(obj) { - var props = {}; - for (var prop in obj) - props[prop] = 'rw'; - obj.__exposedProps__ = props; -} -exposeAll(MockFilePicker); -exposeAll(MockFilePickerInstance.prototype);