mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 05:48:26 +00:00
Bug 705731 - Create InspectorUI.notifications.DESTROYED notification; r=prouget
This commit is contained in:
parent
1233f9665e
commit
a90de11c0b
@ -80,6 +80,9 @@ const INSPECTOR_NOTIFICATIONS = {
|
|||||||
// Fires once the Inspector is closed.
|
// Fires once the Inspector is closed.
|
||||||
CLOSED: "inspector-closed",
|
CLOSED: "inspector-closed",
|
||||||
|
|
||||||
|
// Fires once the Inspector is destroyed. Not fired on tab switch.
|
||||||
|
DESTROYED: "inspector-destroyed",
|
||||||
|
|
||||||
// Fires when the Inspector is reopened after tab-switch.
|
// Fires when the Inspector is reopened after tab-switch.
|
||||||
STATE_RESTORED: "inspector-state-restored",
|
STATE_RESTORED: "inspector-state-restored",
|
||||||
|
|
||||||
@ -1046,6 +1049,8 @@ InspectorUI.prototype = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let winId = new String(this.winID); // retain this to notify observers.
|
||||||
|
|
||||||
this.closing = true;
|
this.closing = true;
|
||||||
this.toolbar.hidden = true;
|
this.toolbar.hidden = true;
|
||||||
|
|
||||||
@ -1104,6 +1109,8 @@ InspectorUI.prototype = {
|
|||||||
delete this.stylePanel;
|
delete this.stylePanel;
|
||||||
delete this.toolbar;
|
delete this.toolbar;
|
||||||
Services.obs.notifyObservers(null, INSPECTOR_NOTIFICATIONS.CLOSED, null);
|
Services.obs.notifyObservers(null, INSPECTOR_NOTIFICATIONS.CLOSED, null);
|
||||||
|
if (!aKeepStore)
|
||||||
|
Services.obs.notifyObservers(null, INSPECTOR_NOTIFICATIONS.DESTROYED, winId);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
let doc;
|
let doc;
|
||||||
let salutation;
|
let salutation;
|
||||||
let closing;
|
let closing;
|
||||||
|
let winId;
|
||||||
|
|
||||||
function createDocument()
|
function createDocument()
|
||||||
{
|
{
|
||||||
@ -182,11 +183,12 @@ function inspectNodesFromContextTestWhileOpen()
|
|||||||
|
|
||||||
function inspectNodesFromContextTestHighlight()
|
function inspectNodesFromContextTestHighlight()
|
||||||
{
|
{
|
||||||
|
winId = InspectorUI.winID;
|
||||||
Services.obs.removeObserver(inspectNodesFromContextTestHighlight, InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
|
Services.obs.removeObserver(inspectNodesFromContextTestHighlight, InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
|
||||||
Services.obs.addObserver(finishInspectorTests, InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
|
Services.obs.addObserver(finishInspectorTests, InspectorUI.INSPECTOR_NOTIFICATIONS.DESTROYED, false);
|
||||||
is(InspectorUI.selection, closing, "InspectorUI.selection is header");
|
is(InspectorUI.selection, closing, "InspectorUI.selection is header");
|
||||||
executeSoon(function() {
|
executeSoon(function() {
|
||||||
InspectorUI.closeInspectorUI(true);
|
InspectorUI.closeInspectorUI();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,11 +198,12 @@ function inspectNodesFromContextTestTrap()
|
|||||||
ok(false, "Inspector UI has been opened again. We Should Not Be Here!");
|
ok(false, "Inspector UI has been opened again. We Should Not Be Here!");
|
||||||
}
|
}
|
||||||
|
|
||||||
function finishInspectorTests()
|
function finishInspectorTests(subject, topic, aWinIdString)
|
||||||
{
|
{
|
||||||
Services.obs.removeObserver(finishInspectorTests,
|
Services.obs.removeObserver(finishInspectorTests,
|
||||||
InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED);
|
InspectorUI.INSPECTOR_NOTIFICATIONS.DESTROYED);
|
||||||
|
|
||||||
|
is(parseInt(aWinIdString), winId, "winId of destroyed Inspector matches");
|
||||||
ok(!InspectorUI.highlighter, "Highlighter is gone");
|
ok(!InspectorUI.highlighter, "Highlighter is gone");
|
||||||
ok(!InspectorUI.treePanel, "Inspector Tree Panel is closed");
|
ok(!InspectorUI.treePanel, "Inspector Tree Panel is closed");
|
||||||
ok(!InspectorUI.inspecting, "Inspector is not inspecting");
|
ok(!InspectorUI.inspecting, "Inspector is not inspecting");
|
||||||
@ -211,6 +214,7 @@ function finishInspectorTests()
|
|||||||
is(InspectorUI.sidebarDeck.children.length, 0, "No items in the Sidebar deck");
|
is(InspectorUI.sidebarDeck.children.length, 0, "No items in the Sidebar deck");
|
||||||
ok(!InspectorUI.toolbar, "toolbar is hidden");
|
ok(!InspectorUI.toolbar, "toolbar is hidden");
|
||||||
|
|
||||||
|
Services.obs.removeObserver(inspectNodesFromContextTestTrap, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
|
||||||
gBrowser.removeCurrentTab();
|
gBrowser.removeCurrentTab();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user