From e41439a68d31b43423c7dbff19a14ca9731defee Mon Sep 17 00:00:00 2001 From: Brian Hackett Date: Tue, 24 Jul 2018 14:34:23 +0000 Subject: [PATCH] Bug 1207696 Part 16 - Server side devtools changes, r=jimb. --HG-- extra : rebase_source : caf99feea9e9a4685a66ed30a9448aacbdae54b2 --- devtools/server/actors/object.js | 7 ++++--- devtools/server/actors/object/previewers.js | 23 +++++++++++++-------- devtools/server/actors/thread.js | 12 ++++++++--- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/devtools/server/actors/object.js b/devtools/server/actors/object.js index 278952dd217c..df1426ebcc8c 100644 --- a/devtools/server/actors/object.js +++ b/devtools/server/actors/object.js @@ -151,12 +151,13 @@ const proto = { let raw = this.obj.unsafeDereference(); // If Cu is not defined, we are running on a worker thread, where xrays - // don't exist. - if (Cu) { + // don't exist. The raw object will be null/unavailable when interacting + // with a replaying execution. + if (raw && Cu) { raw = Cu.unwaiveXrays(raw); } - if (!DevToolsUtils.isSafeJSObject(raw)) { + if (raw && !DevToolsUtils.isSafeJSObject(raw)) { raw = null; } diff --git a/devtools/server/actors/object/previewers.js b/devtools/server/actors/object/previewers.js index 38f560970465..038606bbc061 100644 --- a/devtools/server/actors/object/previewers.js +++ b/devtools/server/actors/object/previewers.js @@ -448,15 +448,20 @@ previewers.Object = [ } const raw = obj.unsafeDereference(); - const global = Cu.getGlobalForObject(DebuggerServer); - const classProto = global[obj.class].prototype; - // The Xray machinery for TypedArrays denies indexed access on the grounds - // that it's slow, and advises callers to do a structured clone instead. - const safeView = Cu.cloneInto(classProto.subarray.call(raw, 0, - OBJECT_PREVIEW_MAX_ITEMS), global); - const items = grip.preview.items = []; - for (let i = 0; i < safeView.length; i++) { - items.push(safeView[i]); + + // The raw object will be null/unavailable when interacting with a + // replaying execution. + if (raw) { + const global = Cu.getGlobalForObject(DebuggerServer); + const classProto = global[obj.class].prototype; + // The Xray machinery for TypedArrays denies indexed access on the grounds + // that it's slow, and advises callers to do a structured clone instead. + const safeView = Cu.cloneInto(classProto.subarray.call(raw, 0, + OBJECT_PREVIEW_MAX_ITEMS), global); + const items = grip.preview.items = []; + for (let i = 0; i < safeView.length; i++) { + items.push(safeView[i]); + } } return true; diff --git a/devtools/server/actors/thread.js b/devtools/server/actors/thread.js index d9dee7be228f..10198711d63e 100644 --- a/devtools/server/actors/thread.js +++ b/devtools/server/actors/thread.js @@ -115,7 +115,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, { }, get globalDebugObject() { - if (!this._parent.window) { + if (!this._parent.window || this.dbg.replaying) { return null; } return this.dbg.makeGlobalObjectReference(this._parent.window); @@ -411,7 +411,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, { return this._parentClosed ? null : undefined; }, - _makeOnEnterFrame: function({ pauseAndRespond }) { + _makeOnEnterFrame: function({ pauseAndRespond, rewinding }) { return frame => { const generatedLocation = this.sources.getFrameLocation(frame); const { originalSourceActor } = this.unsafeSynchronize( @@ -420,6 +420,11 @@ const ThreadActor = ActorClassWithSpec(threadSpec, { const url = originalSourceActor.url; + // When rewinding into a frame, we end up at the point when it is being popped. + if (rewinding) { + frame.reportedPop = true; + } + if (this.sources.isBlackBoxed(url)) { return undefined; } @@ -1224,6 +1229,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, { // Clear stepping hooks. this.dbg.onEnterFrame = undefined; + this.dbg.onPopFrame = undefined; this.dbg.onExceptionUnwind = undefined; if (frame) { frame.onStep = undefined; @@ -1233,7 +1239,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, { // Clear DOM event breakpoints. // XPCShell tests don't use actual DOM windows for globals and cause // removeListenerForAllEvents to throw. - if (!isWorker && this.global && !this.global.toString().includes("Sandbox")) { + if (!isWorker && this.global && !this.dbg.replaying && !this.global.toString().includes("Sandbox")) { Services.els.removeListenerForAllEvents(this.global, this._allEventsListener, true); for (const [, bp] of this._hiddenBreakpoints) { bp.delete();