Bug 1081990 - Fix up BrowserElement API to use function forwarders rather than direct chrome function references. r=gabor

This commit is contained in:
Bobby Holley 2014-10-18 11:02:09 +02:00
parent 431115af34
commit a6984be4f4

View File

@ -88,15 +88,15 @@ function BrowserElementParent(frameLoader, hasRemoteFrame, isPendingFrame) {
Services.obs.addObserver(this, 'copypaste-docommand', /* ownsWeak = */ true);
let defineMethod = function(name, fn) {
XPCNativeWrapper.unwrap(self._frameElement)[name] = function() {
XPCNativeWrapper.unwrap(self._frameElement)[name] = Cu.exportFunction(function() {
if (self._isAlive()) {
return fn.apply(self, arguments);
}
};
}, self._frameElement);
}
let defineNoReturnMethod = function(name, fn) {
XPCNativeWrapper.unwrap(self._frameElement)[name] = function method() {
XPCNativeWrapper.unwrap(self._frameElement)[name] = Cu.exportFunction(function method() {
if (!self._domRequestReady) {
// Remote browser haven't been created, we just queue the API call.
let args = Array.slice(arguments);
@ -107,13 +107,13 @@ function BrowserElementParent(frameLoader, hasRemoteFrame, isPendingFrame) {
if (self._isAlive()) {
fn.apply(self, arguments);
}
};
}, self._frameElement);
};
let defineDOMRequestMethod = function(domName, msgName) {
XPCNativeWrapper.unwrap(self._frameElement)[domName] = function() {
XPCNativeWrapper.unwrap(self._frameElement)[domName] = Cu.exportFunction(function() {
return self._sendDOMRequest(msgName);
};
}, self._frameElement);
}
// Define methods on the frame element.