From 32d45fdbb54397f8acd0e71e0cc0d3f9c12944c4 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Fri, 3 Oct 2014 10:05:50 +0200 Subject: [PATCH] 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 | 14 +++++++++----- toolkit/devtools/server/actors/webgl.js | 4 +++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/toolkit/devtools/server/actors/call-watcher.js b/toolkit/devtools/server/actors/call-watcher.js index b8483858af4..990858480d7 100644 --- a/toolkit/devtools/server/actors/call-watcher.js +++ b/toolkit/devtools/server/actors/call-watcher.js @@ -412,11 +412,13 @@ let CallWatcherActor = exports.CallWatcherActor = protocol.ActorClass({ * 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); @@ -435,13 +437,15 @@ let CallWatcherActor = exports.CallWatcherActor = protocol.ActorClass({ * 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); diff --git a/toolkit/devtools/server/actors/webgl.js b/toolkit/devtools/server/actors/webgl.js index afeeb0d32d0..21e9165b08d 100644 --- a/toolkit/devtools/server/actors/webgl.js +++ b/toolkit/devtools/server/actors/webgl.js @@ -492,7 +492,9 @@ let WebGLInstrumenter = { 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);