Backed out changeset 531e06bae805 (bug 1568151) for failing browser_ext_devtools_panel.js on a CLOSED TREE

--HG--
extra : amend_source : b4fbc693143810f3c7462c9d3598529627480891
This commit is contained in:
Andreea Pavel 2019-08-07 00:35:56 +03:00
Родитель 52aeaa9e72
Коммит 018d43f8fb
38 изменённых файлов: 74 добавлений и 41 удалений

Просмотреть файл

@ -31,8 +31,9 @@ add_task(async function() {
// Ensure hovering over button highlights the node in content pane
const view = inspectorNode.ownerDocument.defaultView;
const inspectorFront = await toolbox.target.getFront("inspector");
const onNodeHighlight = inspectorFront.highlighter.once("node-highlight");
const onNodeHighlight = toolbox.target
.once("inspector")
.then(inspector => inspector.highlighter.once("node-highlight"));
EventUtils.synthesizeMouseAtCenter(
inspectorNode,
{ type: "mousemove" },

Просмотреть файл

@ -631,7 +631,11 @@ function createHighlightButton(highlighterName, id) {
isChecked(toolbox) {
// if the inspector doesn't exist, then the highlighter has not yet been connected
// to the front end.
const inspectorFront = toolbox.target.getCachedFront("inspector");
// TODO: we are using target._inspector here, but we should be using
// target.getCachedFront. This is a temporary solution until the inspector no
// longer relies on the toolbox and can be destroyed the same way any other
// front would be. Related: #1487677
const inspectorFront = toolbox.target._inspector;
if (!inspectorFront) {
// initialize the inspector front asyncronously. There is a potential for buggy
// behavior here, but we need to change how the buttons get data (have them

Просмотреть файл

@ -18,8 +18,9 @@ add_task(async function() {
let node = getRowByIndex(panel, 2).querySelector(".objectBox-node");
// the inspector should be initialized first and then the node should
// highlight after the hover effect.
const inspectorFront = await toolbox.target.getFront("inspector");
let onNodeHighlight = inspectorFront.highlighter.once("node-highlight");
let onNodeHighlight = toolbox.target
.once("inspector")
.then(inspector => inspector.highlighter.once("node-highlight"));
EventUtils.synthesizeMouseAtCenter(
node,
{

Просмотреть файл

@ -3279,7 +3279,7 @@ Toolbox.prototype = {
// 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");
this._inspector = await this.target.getInspector();
this._walker = this.inspectorFront.walker;
this._highlighter = this.inspectorFront.highlighter;
this._selection = this.inspectorFront.selection;

Просмотреть файл

@ -154,7 +154,10 @@ exports.menuitems = [
const window = event.target.ownerDocument.defaultView;
const target = await TargetFactory.forTab(window.gBrowser.selectedTab);
await target.attach();
const inspectorFront = await target.getFront("inspector");
// 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
const inspectorFront = await target.getInspector();
inspectorFront.pickColorFromPage({ copyOnSelect: true, fromMenu: true });
},
checkbox: true,

Просмотреть файл

@ -93,7 +93,7 @@ add_task(async function test() {
async function runTests() {
const target = await TargetFactory.forTab(gBrowser.selectedTab);
await target.attach();
inspector = await target.getFront("inspector");
inspector = await target.getInspector();
const walker = inspector.walker;
completer = new CSSCompleter({
walker: walker,

Просмотреть файл

@ -16,7 +16,7 @@ add_task(async function() {
async function runTests() {
const target = await TargetFactory.forTab(gBrowser.selectedTab);
await target.attach();
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
const walker = inspector.walker;
const { ed, win, edWin } = await setup({
autocomplete: true,

Просмотреть файл

@ -50,8 +50,9 @@ add_task(async function() {
// the inspector should be initialized first and then the node should
// highlight after the hover effect.
const inspectorFront = await toolbox.target.getFront("inspector");
let onNodeHighlight = inspectorFront.highlighter.once("node-highlight");
let onNodeHighlight = toolbox.target
.once("inspector")
.then(inspector => inspector.highlighter.once("node-highlight"));
EventUtils.synthesizeMouseAtCenter(node, { type: "mousemove" }, view);

Просмотреть файл

@ -82,7 +82,7 @@ async function initLayoutFrontForUrl(url) {
async function initAccessibilityFrontForUrl(url) {
const target = await addTabTarget(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
const walker = inspector.walker;
const accessibility = await target.getFront("accessibility");
@ -113,7 +113,8 @@ async function initPerfFront() {
async function initInspectorFront(url) {
const target = await addTabTarget(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
const walker = inspector.walker;
return { inspector, walker, target };

Просмотреть файл

@ -25,7 +25,7 @@ addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target, doc } = await attachURL(url);
gInspectee = doc;
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gWalker = inspector.walker;
runNextTest();
});

Просмотреть файл

@ -25,7 +25,7 @@ addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target, doc } = await attachURL(url);
gInspectee = doc;
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gWalker = inspector.walker;
runNextTest();
});

Просмотреть файл

@ -25,7 +25,7 @@ addAsyncTest(async function() {
const url = document.getElementById("inspectorContent").href;
const { target, doc } = await attachURL(url);
gDoc = doc;
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gWalker = inspector.walker;
runNextTest();
});

Просмотреть файл

@ -23,7 +23,7 @@ var gWalker;
addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target } = await attachURL(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gWalker = inspector.walker;
runNextTest();
});

Просмотреть файл

@ -23,7 +23,7 @@ let gWalker = null;
addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target } = await attachURL(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gWalker = inspector.walker;
runNextTest();
});

Просмотреть файл

@ -24,7 +24,7 @@ let gInspectee = null;
addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target, doc } = await attachURL(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gInspectee = doc;
gWalker = inspector.walker;
runNextTest();

Просмотреть файл

@ -26,7 +26,7 @@ let attrFront;
addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target, doc } = await attachURL(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gInspectee = doc;
gWalker = inspector.walker;
runNextTest();

Просмотреть файл

@ -33,7 +33,7 @@ window.onload = function() {
const url = document.getElementById("inspectorContent").href;
const { target, doc } = await attachURL(url);
inspectee = doc;
inspector = await target.getFront("inspector");
inspector = await target.getInspector();
walker = inspector.walker;
runNextTest();

Просмотреть файл

@ -38,7 +38,7 @@ var shortString2 = "str2";
addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target, doc } = await attachURL(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gInspectee = doc;
gWalker = inspector.walker;
runNextTest();

Просмотреть файл

@ -26,7 +26,7 @@ window.onload = function() {
const url = document.getElementById("inspectorContent").href;
const { target, doc } = await attachURL(url);
inspector = await target.getFront("inspector");
inspector = await target.getInspector();
win = doc.defaultView;
runNextTest();
});

Просмотреть файл

@ -29,7 +29,7 @@ async function setup(callback) {
const url = document.getElementById("inspectorContent").href;
const { target, doc } = await attachURL(url);
gInspectee = doc;
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
ok(inspector.walker, "getWalker() should return an actor.");
gWalker = inspector.walker;
runNextTest();

Просмотреть файл

@ -24,7 +24,7 @@ let gWalker = null;
addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target, doc } = await attachURL(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gInspectee = doc;
const walker = inspector.walker;
gWalker = await inspector.getWalker();

Просмотреть файл

@ -25,7 +25,7 @@ window.onload = function() {
const url = document.getElementById("inspectorContent").href;
const { target, doc } = await attachURL(url);
inspector = await target.getFront("inspector");
inspector = await target.getInspector();
win = doc.defaultView;
runNextTest();
});

Просмотреть файл

@ -24,7 +24,7 @@ let gDoc;
addTest(async function() {
const url = document.getElementById("inspectorContent").href;
const { target, doc } = await attachURL(url);
gInspector = await target.getFront("inspector");
gInspector = await target.getInspector();
gDoc = doc;
runNextTest();
});

Просмотреть файл

@ -25,7 +25,7 @@ addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target, doc } = await attachURL(url);
gInspectee = doc;
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gWalker = inspector.walker;
runNextTest();
});

Просмотреть файл

@ -29,7 +29,7 @@ window.onload = function() {
const url = document.getElementById("inspectorContent").href;
const { target } = await attachURL(url);
inspector = await target.getFront("inspector");
inspector = await target.getInspector();
walkerFront = inspector.walker;
runNextTest();

Просмотреть файл

@ -23,7 +23,7 @@ window.onload = function() {
const url = document.getElementById("inspectorContent").href;
const { target } = await attachURL(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gWalker = inspector.walker;
runNextTest();

Просмотреть файл

@ -44,7 +44,7 @@ let gWalker = null;
addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target, doc } = await attachURL(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gWalker = inspector.walker;
gNodeFront = await gWalker.querySelector(gWalker.rootNode, "img.custom");
gImg = doc.querySelector("img.custom");

Просмотреть файл

@ -23,7 +23,7 @@ let gWalker = null;
addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target } = await attachURL(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gWalker = inspector.walker;
runNextTest();
});

Просмотреть файл

@ -41,7 +41,7 @@ let gInspector = null;
addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target } = await attachURL(url);
gInspector = await target.getFront("inspector");
gInspector = await target.getInspector();
runNextTest();
});

Просмотреть файл

@ -23,7 +23,7 @@ let gWalker;
addTest(async function() {
const url = document.getElementById("inspectorContent").href;
const { target } = await attachURL(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gWalker = inspector.walker;
runNextTest();
});

Просмотреть файл

@ -25,7 +25,7 @@ var gBodyNode;
addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target } = await attachURL(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gWalker = inspector.walker;
gBodyNode = await gWalker.querySelector(gWalker.rootNode, "body");
gHTMLNode = await gWalker.querySelector(gWalker.rootNode, "html");

Просмотреть файл

@ -24,7 +24,7 @@ let gStyles = null;
addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target } = await attachURL(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gWalker = inspector.walker;
gStyles = await inspector.getPageStyle();
runNextTest();

Просмотреть файл

@ -24,7 +24,7 @@ let gStyles = null;
addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target } = await attachURL(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gWalker = inspector.walker;
gStyles = await inspector.getPageStyle();
runNextTest();

Просмотреть файл

@ -20,7 +20,7 @@ let gStyles = null;
addTest(async function() {
const url = document.getElementById("inspectorContent").href;
const { target } = await attachURL(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gWalker = inspector.walker;
gStyles = await inspector.getPageStyle();
runNextTest();

Просмотреть файл

@ -28,7 +28,7 @@ addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target, doc } = await attachURL(url);
gInspectee = doc;
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gWalker = inspector.walker;
gStyles = await inspector.getPageStyle();
runNextTest();

Просмотреть файл

@ -28,7 +28,7 @@ addAsyncTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target, doc } = await attachURL(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gInspectee = doc;
gWalker = inspector.walker;

Просмотреть файл

@ -25,7 +25,7 @@ let gStyles = null;
addTest(async function setup() {
const url = document.getElementById("inspectorContent").href;
const { target } = await attachURL(url);
const inspector = await target.getFront("inspector");
const inspector = await target.getInspector();
gWalker = inspector.walker;
gStyles = await inspector.getPageStyle();
runNextTest();

Просмотреть файл

@ -67,6 +67,10 @@ function TargetMixin(parentClass) {
// Cache of already created targed-scoped fronts
// [typeName:string => Front instance]
this.fronts = new Map();
// Temporary fix for bug #1493131 - inspector has a different life cycle
// than most other fronts because it is closely related to the toolbox.
// TODO: remove once inspector is separated from the toolbox
this._inspector = null;
this._setupRemoteListeners();
}
@ -187,6 +191,24 @@ function TargetMixin(parentClass) {
return this.client.mainRoot.rootForm;
}
// Temporary fix for bug #1493131 - inspector has a different life cycle
// than most other fronts because it is closely related to the toolbox.
// TODO: remove once inspector is separated from the toolbox
async getInspector() {
// the front might have been destroyed and no longer have an actor ID
if (this._inspector && this._inspector.actorID) {
return this._inspector;
}
this._inspector = await getFront(
this.client,
"inspector",
this.targetForm,
this
);
this.emit("inspector", this._inspector);
return this._inspector;
}
// Run callback on every front of this type that currently exists, and on every
// instantiation of front type in the future.
onFront(typeName, callback) {