Bug 980835 - Fix for intermittent | browser_webconsole_output_dom_elements_02.js | The current inspector selection is correct - Got [object HTMLParagraphElement], expected [object HTMLBodyElement]; r=me

This commit is contained in:
Mihai Sucan 2014-03-08 23:13:59 +02:00
parent 7ebdc14a3b
commit e429f95666
3 changed files with 14 additions and 4 deletions

View File

@ -90,6 +90,10 @@ exports.RuleViewTool = RuleViewTool;
RuleViewTool.prototype = { RuleViewTool.prototype = {
onSelect: function RVT_onSelect(aEvent) { onSelect: function RVT_onSelect(aEvent) {
if (!this.view) {
// Skip the event if RuleViewTool has been destroyed.
return;
}
this.view.setPageStyle(this.inspector.pageStyle); this.view.setPageStyle(this.inspector.pageStyle);
if (!this.inspector.selection.isConnected() || if (!this.inspector.selection.isConnected() ||
@ -158,6 +162,10 @@ exports.ComputedViewTool = ComputedViewTool;
ComputedViewTool.prototype = { ComputedViewTool.prototype = {
onSelect: function CVT_onSelect(aEvent) onSelect: function CVT_onSelect(aEvent)
{ {
if (!this.view) {
// Skip the event if ComputedViewTool has been destroyed.
return;
}
this.view.setPageStyle(this.inspector.pageStyle); this.view.setPageStyle(this.inspector.pageStyle);
if (!this.inspector.selection.isConnected() || if (!this.inspector.selection.isConnected() ||

View File

@ -524,6 +524,7 @@ Messages.BaseMessage.prototype = {
for (let widget of this.widgets) { for (let widget of this.widgets) {
widget.destroy(); widget.destroy();
} }
this.widgets.clear();
} }
}; // Messages.BaseMessage.prototype }; // Messages.BaseMessage.prototype

View File

@ -38,8 +38,9 @@ function test() {
// Loading the inspector panel at first, to make it possible to listen for // Loading the inspector panel at first, to make it possible to listen for
// new node selections // new node selections
yield toolbox.loadTool("inspector"); yield toolbox.selectTool("inspector");
let inspector = toolbox.getPanel("inspector"); let inspector = toolbox.getCurrentPanel();
yield toolbox.selectTool("webconsole");
info("Iterating over the test data"); info("Iterating over the test data");
for (let data of TEST_DATA) { for (let data of TEST_DATA) {
@ -60,7 +61,7 @@ function test() {
ok(true, "Inspector selected and new node got selected"); ok(true, "Inspector selected and new node got selected");
let rawNode = content.wrappedJSObject[data.input.replace(/\(\)/g, "")](); let rawNode = content.wrappedJSObject[data.input.replace(/\(\)/g, "")]();
is(rawNode, inspector.selection.node.wrappedJSObject, is(inspector.selection.node.wrappedJSObject, rawNode,
"The current inspector selection is correct"); "The current inspector selection is correct");
info("Switching back to the console"); info("Switching back to the console");