mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 966502 - Use Cu.cloneInto() instead of ObjectWrapper.jsm r=baku
This commit is contained in:
parent
1319848117
commit
0b097b1807
@ -20,8 +20,6 @@ XPCOMUtils.defineLazyModuleGetter(this, 'Utils',
|
||||
'resource://gre/modules/accessibility/Utils.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'EventManager',
|
||||
'resource://gre/modules/accessibility/EventManager.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'ObjectWrapper',
|
||||
'resource://gre/modules/ObjectWrapper.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
|
||||
'resource://gre/modules/accessibility/Constants.jsm');
|
||||
|
||||
|
@ -47,8 +47,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "uuidgen",
|
||||
"nsIUUIDGenerator");
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
Cu.import('resource://gre/modules/ObjectWrapper.jsm');
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "gRil",
|
||||
"@mozilla.org/ril;1",
|
||||
"nsIRadioInterfaceLayer");
|
||||
@ -332,7 +330,7 @@ let PaymentProvider = {
|
||||
}
|
||||
}
|
||||
|
||||
return ObjectWrapper.wrap(this._iccInfo, content);
|
||||
return Cu.cloneInto(this._iccInfo, content);
|
||||
},
|
||||
|
||||
_silentNumbers: null,
|
||||
|
@ -10,7 +10,6 @@ Cu.import('resource://gre/modules/DataStoreChangeNotifier.jsm');
|
||||
Cu.import('resource://gre/modules/AlarmService.jsm');
|
||||
Cu.import('resource://gre/modules/ActivitiesService.jsm');
|
||||
Cu.import('resource://gre/modules/PermissionPromptHelper.jsm');
|
||||
Cu.import('resource://gre/modules/ObjectWrapper.jsm');
|
||||
Cu.import('resource://gre/modules/NotificationDB.jsm');
|
||||
Cu.import('resource://gre/modules/Payment.jsm');
|
||||
Cu.import("resource://gre/modules/AppsUtils.jsm");
|
||||
@ -550,7 +549,7 @@ var shell = {
|
||||
sendCustomEvent: function shell_sendCustomEvent(type, details) {
|
||||
let content = getContentWindow();
|
||||
let event = content.document.createEvent('CustomEvent');
|
||||
let payload = details ? ObjectWrapper.wrap(details, content) : {};
|
||||
let payload = details ? Cu.cloneInto(details, content) : {};
|
||||
event.initCustomEvent(type, true, true, payload);
|
||||
content.dispatchEvent(event);
|
||||
},
|
||||
@ -566,7 +565,7 @@ var shell = {
|
||||
}
|
||||
|
||||
this.sendEvent(getContentWindow(), "mozChromeEvent",
|
||||
ObjectWrapper.wrap(details, getContentWindow()));
|
||||
Cu.cloneInto(details, getContentWindow()));
|
||||
},
|
||||
|
||||
openAppForSystemMessage: function shell_openAppForSystemMessage(msg) {
|
||||
|
@ -24,7 +24,6 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
Cu.import("resource://gre/modules/FxAccountsCommon.js");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "FxAccountsManager",
|
||||
|
@ -8,7 +8,6 @@ const { interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
Cu.import("resource://gre/modules/FxAccountsCommon.js");
|
||||
|
||||
|
@ -10,7 +10,6 @@ const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
@ -76,7 +75,7 @@ ActivityProxy.prototype = {
|
||||
case "Activity:FireSuccess":
|
||||
debug("FireSuccess");
|
||||
Services.DOMRequest.fireSuccess(this.activity,
|
||||
ObjectWrapper.wrap(msg.result, this.window));
|
||||
Cu.cloneInto(msg.result, this.window));
|
||||
Services.obs.notifyObservers(null, "Activity:Success", null);
|
||||
break;
|
||||
case "Activity:FireError":
|
||||
|
@ -9,7 +9,6 @@ const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
@ -38,7 +37,7 @@ ActivityWrapper.prototype = {
|
||||
// options is an nsIDOMActivityOptions object.
|
||||
var options = handler.wrappedJSObject._options;
|
||||
options.wrappedJSObject._name = aMessage.payload.name;
|
||||
options.wrappedJSObject._data = ObjectWrapper.wrap(aMessage.payload.data, aWindow);
|
||||
options.wrappedJSObject._data = Cu.cloneInto(aMessage.payload.data, aWindow);
|
||||
|
||||
// When the activity window is closed, fire an error to notify the activity
|
||||
// caller of the situation.
|
||||
|
@ -17,7 +17,6 @@ const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
|
||||
const ALARMSMANAGER_CONTRACTID = "@mozilla.org/alarmsManager;1";
|
||||
const ALARMSMANAGER_CID = Components.ID("{fea1e884-9b05-11e1-9b64-87a7016c3860}");
|
||||
@ -134,7 +133,7 @@ AlarmsManager.prototype = {
|
||||
alarms.push(alarm);
|
||||
});
|
||||
Services.DOMRequest.fireSuccess(request,
|
||||
ObjectWrapper.wrap(alarms, this._window));
|
||||
Cu.cloneInto(alarms, this._window));
|
||||
break;
|
||||
|
||||
case "AlarmsManager:Add:Return:KO":
|
||||
|
@ -16,7 +16,6 @@ const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
|
||||
const DEBUG = false;
|
||||
function debug(aMsg) {
|
||||
@ -175,7 +174,7 @@ InterAppMessagePort.prototype = {
|
||||
},
|
||||
|
||||
_dispatchMessage: function _dispatchMessage(aMessage) {
|
||||
let wrappedMessage = ObjectWrapper.wrap(aMessage, this._window);
|
||||
let wrappedMessage = Cu.cloneInto(aMessage, this._window);
|
||||
if (DEBUG) {
|
||||
debug("_dispatchMessage: wrappedMessage: " +
|
||||
JSON.stringify(wrappedMessage));
|
||||
|
@ -10,7 +10,6 @@ const Cr = Components.results;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
Cu.import("resource://gre/modules/AppsUtils.jsm");
|
||||
Cu.import("resource://gre/modules/BrowserElementPromptService.jsm");
|
||||
|
||||
@ -277,7 +276,7 @@ let manifestCache = {
|
||||
|
||||
let winObjs = this._cache[aManifestURL];
|
||||
if (!(aInnerWindowID in winObjs)) {
|
||||
winObjs[aInnerWindowID] = ObjectWrapper.wrap(aManifest, aWindow);
|
||||
winObjs[aInnerWindowID] = Cu.cloneInto(aManifest, aWindow);
|
||||
}
|
||||
|
||||
return winObjs[aInnerWindowID];
|
||||
@ -381,8 +380,7 @@ WebappsApplication.prototype = {
|
||||
|
||||
get updateManifest() {
|
||||
return this.updateManifest =
|
||||
this._updateManifest ? ObjectWrapper.wrap(this._updateManifest,
|
||||
this._window)
|
||||
this._updateManifest ? Cu.cloneInto(this._updateManifest, this._window)
|
||||
: null;
|
||||
},
|
||||
|
||||
|
@ -10,7 +10,6 @@ const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
@ -175,7 +174,7 @@ MozKeyboard.prototype = {
|
||||
};
|
||||
|
||||
let evt = new this._window.CustomEvent("focuschanged",
|
||||
ObjectWrapper.wrap(detail, this._window));
|
||||
Cu.cloneInto(detail, this._window));
|
||||
handler.handleEvent(evt);
|
||||
} else if (msg.name == "Keyboard:SelectionChange") {
|
||||
let msgJson = msg.json;
|
||||
@ -188,7 +187,7 @@ MozKeyboard.prototype = {
|
||||
return;
|
||||
|
||||
let evt = new this._window.CustomEvent("selectionchange",
|
||||
ObjectWrapper.wrap({}, this._window));
|
||||
Cu.cloneInto({}, this._window));
|
||||
handler.handleEvent(evt);
|
||||
}
|
||||
},
|
||||
@ -413,7 +412,7 @@ MozInputMethod.prototype = {
|
||||
}
|
||||
|
||||
let event = new this._window.Event("inputcontextchange",
|
||||
ObjectWrapper.wrap({}, this._window));
|
||||
Cu.cloneInto({}, this._window));
|
||||
this.__DOM_IMPL__.dispatchEvent(event);
|
||||
},
|
||||
|
||||
@ -552,7 +551,7 @@ MozInputContext.prototype = {
|
||||
case "Keyboard:SetSelectionRange:Result:OK":
|
||||
case "Keyboard:ReplaceSurroundingText:Result:OK":
|
||||
resolver.resolve(
|
||||
ObjectWrapper.wrap(json.selectioninfo, this._window));
|
||||
Cu.cloneInto(json.selectioninfo, this._window));
|
||||
break;
|
||||
case "Keyboard:SequenceError":
|
||||
// Occurs when a new element got focus, but the inputContext was
|
||||
@ -606,7 +605,7 @@ MozInputContext.prototype = {
|
||||
};
|
||||
|
||||
let event = new this._window.Event(eventName,
|
||||
ObjectWrapper.wrap(aDetail, this._window));
|
||||
Cu.cloneInto(aDetail, this._window));
|
||||
this.__DOM_IMPL__.dispatchEvent(event);
|
||||
},
|
||||
|
||||
|
@ -25,7 +25,6 @@ const BrowserElementIsPreloaded = true;
|
||||
Cu.import("resource://gre/modules/Geometry.jsm");
|
||||
Cu.import("resource://gre/modules/IndexedDBHelper.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/SettingsDB.jsm");
|
||||
Cu.import("resource://gre/modules/SettingsQueue.jsm");
|
||||
|
@ -12,7 +12,6 @@ const Cr = Components.results;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
|
||||
const kSystemMessageInternalReady = "system-message-internal-ready";
|
||||
|
||||
@ -94,7 +93,7 @@ SystemMessageManager.prototype = {
|
||||
|
||||
aDispatcher.handler
|
||||
.handleMessage(wrapped ? aMessage
|
||||
: ObjectWrapper.wrap(aMessage, this._window));
|
||||
: Cu.cloneInto(aMessage, this._window));
|
||||
|
||||
// We need to notify the parent one of the system messages has been handled,
|
||||
// so the parent can release the CPU wake lock it took on our behalf.
|
||||
|
@ -12,7 +12,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
|
||||
// Ensure NetworkStatsService and NetworkStatsDB are loaded in the parent process
|
||||
// to receive messages from the child processes.
|
||||
|
@ -132,7 +132,7 @@ MozNFCPeer.prototype = {
|
||||
"blob": blob.slice()
|
||||
};
|
||||
return this._nfcContentHelper.sendFile(this._window,
|
||||
ObjectWrapper.wrap(data, this._window),
|
||||
Cu.cloneInto(data, this._window),
|
||||
this.session);
|
||||
},
|
||||
|
||||
@ -158,7 +158,7 @@ mozNfc.prototype = {
|
||||
_nfcContentHelper: null,
|
||||
_window: null,
|
||||
_wrap: function _wrap(obj) {
|
||||
return ObjectWrapper.wrap(obj, this._window);
|
||||
return Cu.cloneInto(obj, this._window);
|
||||
},
|
||||
|
||||
init: function init(aWindow) {
|
||||
@ -277,8 +277,7 @@ mozNfc.prototype = {
|
||||
let detail = {
|
||||
"detail":sessionToken
|
||||
};
|
||||
let event = new this._window.CustomEvent(peerEvent,
|
||||
ObjectWrapper.wrap(detail, this._window));
|
||||
let event = new this._window.CustomEvent(peerEvent, this._wrap(detail);
|
||||
this.__DOM_IMPL__.dispatchEvent(event);
|
||||
},
|
||||
|
||||
|
@ -37,7 +37,7 @@ SettingsLock.prototype = {
|
||||
},
|
||||
|
||||
_wrap: function _wrap(obj) {
|
||||
return ObjectWrapper.wrap(obj, this._settingsManager._window);
|
||||
return Cu.cloneInto(obj, this._settingsManager._window);
|
||||
},
|
||||
|
||||
process: function process() {
|
||||
@ -257,7 +257,7 @@ SettingsManager.prototype = {
|
||||
_callbacks: null,
|
||||
|
||||
_wrap: function _wrap(obj) {
|
||||
return ObjectWrapper.wrap(obj, this._window);
|
||||
return Cu.cloneInto(obj, this._window);
|
||||
},
|
||||
|
||||
nextTick: function nextTick(aCallback, thisObj) {
|
||||
|
@ -53,7 +53,7 @@ function sendContentEvent(type, detail) {
|
||||
|
||||
let content = getContentWindow();
|
||||
shell.sendEvent(content, "mozContentEvent",
|
||||
ObjectWrapper.wrap(detail, content));
|
||||
Cu.cloneInto(detail, content));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user