Skip to content

Commit 79a2d27

Browse files
committed
Adapt to the patch in bug 1036949
1 parent ccb31d5 commit 79a2d27

File tree

3 files changed

+41
-10
lines changed

3 files changed

+41
-10
lines changed

lib/firequery-actor.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,15 @@ var FireQueryActor = ActorClass(
307307

308308
onDomNodeForm: makeInfallible(function(eventId, nodeActor, form) {
309309
let data = hasJQueryData(nodeActor.rawNode);
310-
form.jQueryData = data;
311310

312-
if (data) {
313-
Trace.sysout("FireQueryActor.onDomNodeForm; " +
314-
JSON.stringify(data), arguments);
315-
}
311+
// Pass only a flag that says whether there are any jQuery
312+
// data associated or not. The data itself will be fetched
313+
// on demand (when displayed e.g. in a tooltip)
314+
//form.setProperty("jQueryData", data);
315+
form.setProperty("hasJQueryData", !!data)
316+
317+
let json = data ? JSON.stringify(data) : "";
318+
Trace.sysout("FireQueryActor.onDomNodeForm; " + json, arguments);
316319
})
317320
});
318321

@@ -363,7 +366,16 @@ function hasJQueryData(object) {
363366
let originalForm = NodeActor.prototype.form;
364367
NodeActor.prototype.form = function() {
365368
let form = originalForm.apply(this, arguments);
366-
DebuggerServer.emit("domnode-form", this, form);
369+
if (!form.setProperty) {
370+
form.setProperty = (name, value) => {
371+
if (!form.props) {
372+
form.props = {};
373+
}
374+
form.props[name] = value;
375+
};
376+
377+
DebuggerServer.emit("domnode-form", this, form);
378+
}
367379
return form;
368380
}
369381

lib/inspector-overlay.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const InspectorOverlay = Class(
5353
this.onMarkupViewRender = this.onMarkupViewRender.bind(this);
5454
this.onMarkupViewLoaded = this.onMarkupViewLoaded.bind(this);
5555
this.onMarkupViewUnloaded = this.onMarkupViewUnloaded.bind(this);
56+
this.onMarkupMutation = this.onMarkupMutation.bind(this);
57+
this.onInspectorUpdated = this.onInspectorUpdated.bind(this);
5658

5759
// Tooltip events
5860
this.onClickTooltip = this.onClickTooltip.bind(this);
@@ -88,6 +90,8 @@ const InspectorOverlay = Class(
8890
// Handle MarkupView events.
8991
this.panel.on("markupview-render", this.onMarkupViewRender);
9092
this.panel.on("markuploaded", this.onMarkupViewLoaded);
93+
this.panel.on("markupmutation", this.onMarkupMutation);
94+
this.panel.on("inspector-updated", this.onInspectorUpdated);
9195

9296
// Listen to {@FireQueryToolboxOverlay} events related to
9397
// backend actor attach and detach.
@@ -172,6 +176,14 @@ const InspectorOverlay = Class(
172176
this.nodes = [];
173177
},
174178

179+
onInspectorUpdated: function(eventId, name) {
180+
Trace.sysout("+++InspectorOverlay.onInspectorUpdated; " + name, arguments);
181+
},
182+
183+
onMarkupMutation: function(eventId) {
184+
Trace.sysout("+++InspectorOverlay.onMarkupMutation; ", arguments);
185+
},
186+
175187
onMarkupViewRender: function(eventId, node, type, data, options) {
176188
this.renderNode(node, type, data);
177189
},
@@ -181,11 +193,18 @@ const InspectorOverlay = Class(
181193
return;
182194
}
183195

184-
let value;
196+
// Get custom 'hasJQueryData' property send from the backed.
197+
// If the node has some jQuery data the property is set to true.
198+
// xxxHonza: back compatibility, can be removed when
199+
// Bug 1036949 - New API: MarkupView customization
200+
// .. is in the release channel. It implements the
201+
// nodeFront.getProperty() method.
185202
let nodeFront = data.node;
186-
let jQueryData = nodeFront._form.jQueryData;
203+
let hasJQueryData = nodeFront.getProperty ?
204+
nodeFront.getProperty("hasJQueryData") :
205+
nodeFront._form.props.hasJQueryData;
187206

188-
if (!jQueryData) {
207+
if (!hasJQueryData) {
189208
return;
190209
}
191210

lib/markup-view-patch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const { MarkupView } = devtools["require"]("devtools/markupview/markup-view");
2121
let originalTemplate = MarkupView.prototype.template;
2222
MarkupView.prototype.template = function(aName, aDest, aOptions) {
2323
let node = originalTemplate.apply(this, arguments);
24-
this._inspector.emit("markupview-render", node, aName, aDest, aOptions);
24+
//this._inspector.emit("markupview-render", node, aName, aDest, aOptions);
2525
return node;
2626
}
2727

0 commit comments

Comments
 (0)