Bug 1065185 - Fix devtools actors. r=bz
☠☠ backed out by 5c14c63b4c1a ☠ ☠
authorBobby Holley <bobbyholley@gmail.com>
Wed, 01 Oct 2014 15:25:00 +0200
changeset 208200 903fbf9bb0c738ac8694225f2e612cc0de0ef8ab
parent 208199 76e863b63dd8018fd27853c11bca34c6d5b41df4
child 208201 981c0b7c897d7a67e109b003364b9dd9a13c9628
push id27580
push userkwierso@gmail.com
push dateWed, 01 Oct 2014 23:26:55 +0000
treeherderautoland@af6c928893c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1065185
milestone35.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 1065185 - Fix devtools actors. r=bz See browser/devtools/canvasdebugger/test/browser_canvas-actor-test-02.js. And note that we need to re-waive the result, otherwise we get failures in browser/devtools/canvasdebugger/test/browser_canvas-actor-test-10.js. See browser/devtools/shadereditor/test/browser_se_editors-contents.js for the webgls stuff.
toolkit/devtools/server/actors/call-watcher.js
toolkit/devtools/server/actors/webgl.js
--- a/toolkit/devtools/server/actors/call-watcher.js
+++ b/toolkit/devtools/server/actors/call-watcher.js
@@ -407,21 +407,23 @@ let CallWatcherActor = exports.CallWatch
         return;
       }
     }
 
     /**
      * Instruments a function on the specified target object.
      */
     function overrideFunction(global, target, name, descriptor, callback) {
-      let originalFunc = target[name];
+      // Invoking .apply on an unxrayed content function doesn't work, because
+      // the arguments array is inaccessible to it. Get Xrays back.
+      let originalFunc = Cu.unwaiveXrays(target[name]);
 
       Object.defineProperty(target, name, {
         value: function(...args) {
-          let result = originalFunc.apply(this, args);
+          let result = Cu.waiveXrays(originalFunc.apply(this, args));
 
           if (self._recording) {
             let stack = getStack(name);
             let type = CallWatcherFront.METHOD_FUNCTION;
             callback(unwrappedWindow, global, this, type, name, stack, args, result);
           }
           return result;
         },
@@ -430,23 +432,25 @@ let CallWatcherActor = exports.CallWatch
         writable: true
       });
     }
 
     /**
      * Instruments a getter or setter on the specified target object.
      */
     function overrideAccessor(global, target, name, descriptor, callback) {
-      let originalGetter = target.__lookupGetter__(name);
-      let originalSetter = target.__lookupSetter__(name);
+      // Invoking .apply on an unxrayed content function doesn't work, because
+      // the arguments array is inaccessible to it. Get Xrays back.
+      let originalGetter = Cu.unwaiveXrays(target.__lookupGetter__(name));
+      let originalSetter = Cu.unwaiveXrays(target.__lookupSetter__(name));
 
       Object.defineProperty(target, name, {
         get: function(...args) {
           if (!originalGetter) return undefined;
-          let result = originalGetter.apply(this, args);
+          let result = Cu.waiveXrays(originalGetter.apply(this, args));
 
           if (self._recording) {
             let stack = getStack(name);
             let type = CallWatcherFront.GETTER_FUNCTION;
             callback(unwrappedWindow, global, this, type, name, stack, args, result);
           }
           return result;
         },
--- a/toolkit/devtools/server/actors/webgl.js
+++ b/toolkit/devtools/server/actors/webgl.js
@@ -487,17 +487,19 @@ let WebGLInstrumenter = {
     let afterFuncName = callbackName[1] || callbackName[0] || funcName;
 
     context[funcName] = function(...glArgs) {
       if (timing <= 0 && !observer.suppressHandlers) {
         let glBreak = observer[beforeFuncName](glArgs, cache, proxy);
         if (glBreak) return undefined;
       }
 
-      let glResult = originalFunc.apply(this, glArgs);
+      // Invoking .apply on an unxrayed content function doesn't work, because
+      // the arguments array is inaccessible to it. Get Xrays back.
+      let glResult = Cu.waiveXrays(Cu.unwaiveXrays(originalFunc).apply(this, glArgs));
 
       if (timing >= 0 && !observer.suppressHandlers) {
         let glBreak = observer[afterFuncName](glArgs, glResult, cache, proxy);
         if (glBreak) return undefined;
       }
 
       return glResult;
     };