Skip to content

Commit 5438974

Browse files
committed
#32 DebuggerServer.ObjectActorPreviewers is undefined
1 parent d22244c commit 5438974

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

lib/firequery-actor.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@
1212
const { Cu, Ci, components } = require("chrome");
1313

1414
// DevTools
15-
const { DebuggerServer } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
1615
const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
17-
const protocol = devtools["require"]("devtools/server/protocol");
18-
const { method, RetVal, ActorClass, Actor, Arg, types } = protocol;
16+
const { DebuggerServer } = devtools["require"]("devtools/server/main");
1917
const Events = devtools["require"]("sdk/event/core");
2018
const { makeInfallible } = devtools["require"]("devtools/toolkit/DevToolsUtils.js");
2119
const DevToolsUtils = devtools["require"]("devtools/toolkit/DevToolsUtils");
2220
const { NodeActor } = devtools["require"]("devtools/server/actors/inspector");
21+
const protocol = devtools["require"]("devtools/server/protocol");
22+
const { method, RetVal, ActorClass, Actor, Arg, types } = protocol;
23+
24+
// Make sure the DebuggerServer.ObjectActorPreviewers is initialized.
25+
// See also: https://github.com/firebug/firequery/issues/32
26+
const { ObjectActor } = devtools["require"]("devtools/server/actors/object");
2327

2428
// Number of items to preview in objects, arrays, maps, sets, lists,
2529
// collections, etc.
@@ -52,7 +56,7 @@ function expectState(expectedState, method) {
5256
", method: " + method);
5357

5458
let msg = "Wrong State: Expected '" + expectedState + "', but current " +
55-
"state is '" + this.state + "'";
59+
"state is '" + this.state + "', method: " + method;
5660

5761
return Promise.reject(new Error(msg));
5862
}
@@ -160,7 +164,8 @@ var FireQueryActor = ActorClass(
160164

161165
this.state = "attached";
162166

163-
// xxxHonza: it's sometimes undefined (e.g. when enabling installed FQ) FIXME
167+
// It's been sometimes undefined (e.g. when enabling installed FQ)
168+
// See also: https://github.com/firebug/firequery/issues/32
164169
let Previewers = DebuggerServer.ObjectActorPreviewers;
165170
if (typeof Previewers != "undefined") {
166171
Previewers.Object.unshift(this.onBuildPreview);
@@ -196,7 +201,8 @@ var FireQueryActor = ActorClass(
196201
win.removeEventListener("firequery-event", this.onDataModified, true);
197202
}
198203

199-
// Remove previewer listener (web console).
204+
// It's been sometimes undefined (e.g. when enabling installed FQ)
205+
// See also: https://github.com/firebug/firequery/issues/32
200206
let Previewers = DebuggerServer.ObjectActorPreviewers;
201207
if (typeof Previewers != "undefined") {
202208
removeItem(Previewers.Object, this.onBuildPreview);

0 commit comments

Comments
 (0)