mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 17:55:50 +00:00
Backed out changeset 3182a1d6debb (bug 1500142) for xpcshell failures at test_oob_cert_auth.js. CLOSED TREE
This commit is contained in:
parent
63f73c09e6
commit
f2aabeaa59
@ -88,6 +88,7 @@ AccessibilityPanel.prototype = {
|
||||
this.shouldRefresh = true;
|
||||
this.panelWin.gToolbox = this._toolbox;
|
||||
|
||||
await this._toolbox.initInspector();
|
||||
await this.startup.initAccessibility();
|
||||
if (this.supports.enableDisable) {
|
||||
this.picker = new Picker(this);
|
||||
|
@ -93,6 +93,7 @@ DebuggerPanel.prototype = {
|
||||
},
|
||||
|
||||
openInspector: async function() {
|
||||
await this.toolbox.initInspector();
|
||||
this.toolbox.selectTool("inspector");
|
||||
},
|
||||
|
||||
|
@ -217,6 +217,8 @@ function Toolbox(
|
||||
this._toolStartups = new Map();
|
||||
this._inspectorExtensionSidebars = new Map();
|
||||
|
||||
this._initInspector = null;
|
||||
this._inspector = null;
|
||||
this._netMonitorAPI = null;
|
||||
|
||||
// Map of frames (id => frame-info) and currently selected frame id.
|
||||
@ -298,10 +300,6 @@ function Toolbox(
|
||||
this._target.on("frame-update", this._updateFrames);
|
||||
this._target.on("inspect-object", this._onInspectObject);
|
||||
|
||||
this._target.onFront("inspector", async inspectorFront => {
|
||||
registerWalkerListeners(this.store, inspectorFront.walker);
|
||||
});
|
||||
|
||||
this.on("host-changed", this._refreshHostTitle);
|
||||
this.on("select", this._onToolSelected);
|
||||
|
||||
@ -525,6 +523,14 @@ Toolbox.prototype = {
|
||||
return this.win.document;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the toolbox's inspector front. Note that it may not always have been
|
||||
* initialized first. Use `initInspector()` if needed.
|
||||
*/
|
||||
get inspectorFront() {
|
||||
return this._inspector;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the toggled state of the split console
|
||||
*/
|
||||
@ -1911,19 +1917,19 @@ Toolbox.prototype = {
|
||||
* Update the buttons.
|
||||
*/
|
||||
updateToolboxButtons() {
|
||||
const inspectorFront = this.target.getCachedFront("inspectorFront");
|
||||
const inspector = this.inspectorFront;
|
||||
// two of the buttons have highlighters that need to be cleared
|
||||
// on will-navigate, otherwise we hold on to the stale highlighter
|
||||
const hasHighlighters =
|
||||
inspectorFront &&
|
||||
(inspectorFront.hasHighlighter("RulersHighlighter") ||
|
||||
inspectorFront.hasHighlighter("MeasuringToolHighlighter"));
|
||||
inspector &&
|
||||
(inspector.hasHighlighter("RulersHighlighter") ||
|
||||
inspector.hasHighlighter("MeasuringToolHighlighter"));
|
||||
if (hasHighlighters || this.isPaintFlashing) {
|
||||
if (this.isPaintFlashing) {
|
||||
this.togglePaintFlashing();
|
||||
}
|
||||
if (hasHighlighters) {
|
||||
inspectorFront.destroyHighlighters();
|
||||
inspector.destroyHighlighters();
|
||||
}
|
||||
this.component.setToolboxButtons(this.toolbarButtons);
|
||||
}
|
||||
@ -2159,7 +2165,7 @@ Toolbox.prototype = {
|
||||
// Defer the extension sidebar creation if the inspector
|
||||
// has not been created yet (and do not create the inspector
|
||||
// only to register an extension sidebar).
|
||||
if (!this.target.getCachedFront("inspector")) {
|
||||
if (!this._inspector) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2190,7 +2196,7 @@ Toolbox.prototype = {
|
||||
|
||||
// Remove the created sidebar instance if the inspector panel
|
||||
// has been already created.
|
||||
if (!this.target.getCachedFront("inspector")) {
|
||||
if (!this._inspector) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2230,6 +2236,10 @@ Toolbox.prototype = {
|
||||
* The id of the tool to load.
|
||||
*/
|
||||
loadTool: function(id) {
|
||||
if (id === "inspector" && !this._inspector) {
|
||||
this.initInspector();
|
||||
}
|
||||
|
||||
let iframe = this.doc.getElementById("toolbox-panel-iframe-" + id);
|
||||
if (iframe) {
|
||||
const panel = this._toolPanels.get(id);
|
||||
@ -2272,6 +2282,18 @@ Toolbox.prototype = {
|
||||
}
|
||||
|
||||
const onLoad = async () => {
|
||||
if (id === "inspector") {
|
||||
await this._initInspector;
|
||||
|
||||
// Stop loading the inspector if the toolbox is already being destroyed. This
|
||||
// can happen in unit tests where the tests are rapidly opening and closing the
|
||||
// toolbox and we encounter the scenario where the toolbox is closing as
|
||||
// the inspector is still loading.
|
||||
if (!this._inspector || !iframe.contentWindow) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent flicker while loading by waiting to make visible until now.
|
||||
iframe.style.visibility = "visible";
|
||||
|
||||
@ -3276,6 +3298,24 @@ Toolbox.prototype = {
|
||||
this.emit("tool-unregistered", toolId);
|
||||
},
|
||||
|
||||
/**
|
||||
* Initialize the inspector/walker/selection/highlighter fronts.
|
||||
* Returns a promise that resolves when the fronts are initialized
|
||||
*/
|
||||
initInspector: function() {
|
||||
if (!this._initInspector) {
|
||||
this._initInspector = async function() {
|
||||
// Temporary fix for bug #1493131 - inspector has a different life cycle
|
||||
// than most other fronts because it is closely related to the toolbox.
|
||||
// TODO: replace with getFront once inspector is separated from the toolbox
|
||||
// TODO: remove these bindings
|
||||
this._inspector = await this.target.getFront("inspector");
|
||||
registerWalkerListeners(this.store, this._inspector.walker);
|
||||
}.bind(this)();
|
||||
}
|
||||
return this._initInspector;
|
||||
},
|
||||
|
||||
/**
|
||||
* An helper function that returns an object contain a highlighter and unhighlighter
|
||||
* function.
|
||||
@ -3370,6 +3410,23 @@ Toolbox.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroy the inspector/walker/selection fronts
|
||||
* Returns a promise that resolves when the fronts are destroyed
|
||||
* TODO: move to the inspector front once we can have listener hooks into fronts
|
||||
*/
|
||||
destroyInspector: function() {
|
||||
if (!this._inspector) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Temporary fix for bug #1493131 - inspector has a different life cycle
|
||||
// than most other fronts because it is closely related to the toolbox.
|
||||
this._inspector.destroy();
|
||||
|
||||
this._inspector = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the toolbox's notification component
|
||||
*
|
||||
@ -3533,6 +3590,9 @@ Toolbox.prototype = {
|
||||
settleAll(outstanding)
|
||||
.catch(console.error)
|
||||
.then(async () => {
|
||||
// Destroying the walker and inspector fronts
|
||||
this.destroyInspector();
|
||||
|
||||
this.selection.destroy();
|
||||
this.selection = null;
|
||||
|
||||
|
@ -89,7 +89,7 @@ class Front extends Pool {
|
||||
this._beforeListeners = null;
|
||||
}
|
||||
|
||||
async manage(front) {
|
||||
manage(front) {
|
||||
if (!front.actorID) {
|
||||
throw new Error(
|
||||
"Can't manage front without an actor ID.\n" +
|
||||
@ -100,10 +100,6 @@ class Front extends Pool {
|
||||
}
|
||||
super.manage(front);
|
||||
|
||||
if (typeof front.initialize == "function") {
|
||||
await front.initialize();
|
||||
}
|
||||
|
||||
// Call listeners registered via `onFront` method
|
||||
this._frontListeners.emit(front.typeName, front);
|
||||
}
|
||||
|
@ -497,7 +497,7 @@ exports.registerFront = function(cls) {
|
||||
* If we are instantiating a target-scoped front, this is a reference to the front's
|
||||
* Target instance, otherwise this is null.
|
||||
*/
|
||||
async function getFront(client, typeName, form, target = null) {
|
||||
function getFront(client, typeName, form, target = null) {
|
||||
const type = types.getType(typeName);
|
||||
if (!type) {
|
||||
throw new Error(`No spec for front type '${typeName}'.`);
|
||||
@ -521,13 +521,19 @@ async function getFront(client, typeName, form, target = null) {
|
||||
` actor's form.`
|
||||
);
|
||||
}
|
||||
|
||||
// Historically, all global and target scoped front were the first protocol.js in the
|
||||
// hierarchy of fronts. So that they have to self-own themself. But now, Root and Target
|
||||
// are fronts and should own them. The only issue here is that we should manage the
|
||||
// front *before* calling initialize which is going to try managing child fronts.
|
||||
if (!target) {
|
||||
await instance.manage(instance);
|
||||
instance.manage(instance);
|
||||
} else {
|
||||
await target.manage(instance);
|
||||
target.manage(instance);
|
||||
}
|
||||
|
||||
if (typeof instance.initialize == "function") {
|
||||
return instance.initialize().then(() => instance);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
exports.getFront = getFront;
|
||||
|
Loading…
Reference in New Issue
Block a user