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.
This commit is contained in:
Bobby Holley 2014-10-03 10:05:50 +02:00
parent 9a234aeb71
commit 32d45fdbb5
2 changed files with 12 additions and 6 deletions

View File

@ -412,11 +412,13 @@ let CallWatcherActor = exports.CallWatcherActor = protocol.ActorClass({
* Instruments a function on the specified target object. * Instruments a function on the specified target object.
*/ */
function overrideFunction(global, target, name, descriptor, callback) { 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, { Object.defineProperty(target, name, {
value: function(...args) { value: function(...args) {
let result = originalFunc.apply(this, args); let result = Cu.waiveXrays(originalFunc.apply(this, args));
if (self._recording) { if (self._recording) {
let stack = getStack(name); let stack = getStack(name);
@ -435,13 +437,15 @@ let CallWatcherActor = exports.CallWatcherActor = protocol.ActorClass({
* Instruments a getter or setter on the specified target object. * Instruments a getter or setter on the specified target object.
*/ */
function overrideAccessor(global, target, name, descriptor, callback) { function overrideAccessor(global, target, name, descriptor, callback) {
let originalGetter = target.__lookupGetter__(name); // Invoking .apply on an unxrayed content function doesn't work, because
let originalSetter = target.__lookupSetter__(name); // 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, { Object.defineProperty(target, name, {
get: function(...args) { get: function(...args) {
if (!originalGetter) return undefined; if (!originalGetter) return undefined;
let result = originalGetter.apply(this, args); let result = Cu.waiveXrays(originalGetter.apply(this, args));
if (self._recording) { if (self._recording) {
let stack = getStack(name); let stack = getStack(name);

View File

@ -492,7 +492,9 @@ let WebGLInstrumenter = {
if (glBreak) return undefined; 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) { if (timing >= 0 && !observer.suppressHandlers) {
let glBreak = observer[afterFuncName](glArgs, glResult, cache, proxy); let glBreak = observer[afterFuncName](glArgs, glResult, cache, proxy);