Bug 1568157 - Part 2: Replace `toolbox.{inspector,walker,selection,highlighter}` usage with the attributes from `target.getFront("inspector")` in inspector.js. r=yulia,ochameau

Differential Revision: https://phabricator.services.mozilla.com/D40314

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gabriel Luong 2019-08-07 17:47:11 +00:00
Родитель 341915c5fc
Коммит 2273f8c932
1 изменённых файлов: 13 добавлений и 21 удалений

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

@ -151,15 +151,10 @@ function Inspector(toolbox) {
this.telemetry = toolbox.telemetry;
this.store = Store();
this._markupBox = this.panelDoc.getElementById("markup-box");
// Map [panel id => panel instance]
// Stores all the instances of sidebar panels like rule view, computed view, ...
this._panels = new Map();
this.reflowTracker = new ReflowTracker(this._target);
this.styleChangeTracker = new InspectorStyleChangeTracker(this);
this._clearSearchResultsLabel = this._clearSearchResultsLabel.bind(this);
this._handleRejectionIfNotDestroyed = this._handleRejectionIfNotDestroyed.bind(
this
@ -208,6 +203,8 @@ Inspector.prototype = {
this.target.threadFront.on("resumed", this.handleThreadResumed);
}
await this.initInspectorFront();
this.target.on("will-navigate", this._onBeforeNavigate);
await Promise.all([
@ -221,30 +218,25 @@ Inspector.prototype = {
// Store the URL of the target page prior to navigation in order to ensure
// telemetry counts in the Grid Inspector are not double counted on reload.
this.previousURL = this.target.url;
this.reflowTracker = new ReflowTracker(this.target);
this.styleChangeTracker = new InspectorStyleChangeTracker(this);
this._markupBox = this.panelDoc.getElementById("markup-box");
return this._deferredOpen();
},
async initInspectorFront() {
this.inspectorFront = await this.target.getFront("inspector");
this.highlighter = this.inspectorFront.highlighter;
this.selection = this.inspectorFront.selection;
this.walker = this.inspectorFront.walker;
},
get toolbox() {
return this._toolbox;
},
get inspectorFront() {
return this.toolbox.inspectorFront;
},
get walker() {
return this.toolbox.walker;
},
get selection() {
return this.toolbox.selection;
},
get highlighter() {
return this.toolbox.highlighter;
},
get highlighters() {
if (!this._highlighters) {
this._highlighters = new HighlightersOverlay(this);