Bug 1082450 - Use automation machinery instead of exposedProps in Mock{Color,File}Picker.jsm. r=gabor

This commit is contained in:
Bobby Holley 2014-10-15 15:05:09 +02:00
Родитель a1ebfbe84e
Коммит 9d70a1799f
2 изменённых файлов: 8 добавлений и 24 удалений

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

@ -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);

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

@ -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);