mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 13:55:43 +00:00
Bug 1081990 - Fix up BrowserElement API to use function forwarders rather than direct chrome function references. r=gabor
This commit is contained in:
parent
431115af34
commit
a6984be4f4
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user