Bug 1081990 - Fix up BrowserElement API to use function forwarders rather than direct chrome function references. r=gabor
authorBobby Holley <bobbyholley@gmail.com>
Sat, 18 Oct 2014 11:02:09 +0200
changeset 211018 6fe41be8cfb0257837691750543d76bc339d1467
parent 211017 fc25ace509cf79df817f852593e4e56837712396
child 211019 5d6eec6916363291eedb1bb36d836662620d8c80
push id50622
push userbobbyholley@gmail.com
push dateSat, 18 Oct 2014 09:02:28 +0000
treeherdermozilla-inbound@2681f9b134c2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgabor
bugs1081990
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1081990 - Fix up BrowserElement API to use function forwarders rather than direct chrome function references. r=gabor
dom/browser-element/BrowserElementParent.jsm
--- a/dom/browser-element/BrowserElementParent.jsm
+++ b/dom/browser-element/BrowserElementParent.jsm
@@ -83,42 +83,42 @@ function BrowserElementParent(frameLoade
     return;
   }
 
   Services.obs.addObserver(this, 'ask-children-to-exit-fullscreen', /* ownsWeak = */ true);
   Services.obs.addObserver(this, 'oop-frameloader-crashed', /* ownsWeak = */ true);
   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);
         args.unshift(self);
         self._pendingAPICalls.push(method.bind.apply(fn, args));
         return;
       }
       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.
   defineNoReturnMethod('setVisible', this._setVisible);
   defineDOMRequestMethod('getVisible', 'get-visible');
 
   // Not expose security sensitive browser API for widgets
   if (!this._frameLoader.QueryInterface(Ci.nsIFrameLoader).ownerIsWidget) {