Bug 1529847 - Move the Changes Front initialization to the Promise.all. r=rcaliman
authorGabriel Luong <gabriel.luong@gmail.com>
Fri, 22 Feb 2019 00:51:44 -0500
changeset 518595 885c75c731bfc6172c699aee3cc8981d2f46df35
parent 518594 7102801e2ca85f305f1d62371228d828f9d0f502
child 518596 fa8d864ab068910637097f34f75c8d8ae5ef8dce
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrcaliman
bugs1529847
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1529847 - Move the Changes Front initialization to the Promise.all. r=rcaliman Differential Revision: https://phabricator.services.mozilla.com/D20784
devtools/client/inspector/inspector.js
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -147,16 +147,17 @@ Inspector.prototype = {
     // Localize all the nodes containing a data-localization attribute.
     localizeMarkup(this.panelDoc);
 
     await Promise.all([
       this._getCssProperties(),
       this._getPageStyle(),
       this._getDefaultSelection(),
       this._getAccessibilityFront(),
+      this._getChangesFront(),
     ]);
 
     return this._deferredOpen();
   },
 
   get toolbox() {
     return this._toolbox;
   },
@@ -233,26 +234,16 @@ Inspector.prototype = {
     return this._search;
   },
 
   get cssProperties() {
     return this._cssProperties.cssProperties;
   },
 
   /**
-   * Check if the changes panel is enabled and supported by the server.
-   */
-  _supportsChangesPanel() {
-    // The changes actor was introduced in Fx65, we are checking this for backward
-    // compatibility when connecting to an older server. Can be removed once Fx65 hit the
-    // release channel.
-    return this._target.hasActor("changes");
-  },
-
-  /**
    * Handle promise rejections for various asynchronous actions, and only log errors if
    * the inspector panel still exists.
    * This is useful to silence useless errors that happen when the inspector is closed
    * while still initializing (and making protocol requests).
    */
   _handleRejectionIfNotDestroyed: function(e) {
     if (!this._panelDestroyer) {
       console.error(e);
@@ -264,24 +255,16 @@ Inspector.prototype = {
     this.isReady = false;
 
     // Set the node front so that the markup and sidebar panels will have the selected
     // nodeFront ready when they're initialized.
     if (this._defaultNode) {
       this.selection.setNodeFront(this._defaultNode, { reason: "inspector-open" });
     }
 
-    if (this._supportsChangesPanel()) {
-      // Get the Changes front, then call a method on it, which will instantiate
-      // the ChangesActor. We want the ChangesActor to be guaranteed available before
-      // the user makes any changes.
-      this.changesFront = await this.toolbox.target.getFront("changes");
-      this.changesFront.start();
-    }
-
     // Setup the splitter before the sidebar is displayed so, we don't miss any events.
     this.setupSplitter();
 
     // We can display right panel with: tab bar, markup view and breadbrumb. Right after
     // the splitter set the right and left panel sizes, in order to avoid resizing it
     // during load of the inspector.
     this.panelDoc.getElementById("inspector-main-content").style.visibility = "visible";
 
@@ -327,16 +310,25 @@ Inspector.prototype = {
     }, this._handleRejectionIfNotDestroyed);
   },
 
   _getAccessibilityFront: async function() {
     this.accessibilityFront = await this.target.getFront("accessibility");
     return this.accessibilityFront;
   },
 
+  _getChangesFront: async function() {
+    // Get the Changes front, then call a method on it, which will instantiate
+    // the ChangesActor. We want the ChangesActor to be guaranteed available before
+    // the user makes any changes.
+    this.changesFront = await this.toolbox.target.getFront("changes");
+    this.changesFront.start();
+    return this.changesFront;
+  },
+
   _getDefaultSelection: function() {
     // This may throw if the document is still loading and we are
     // refering to a dead about:blank document
     return this._getDefaultNodeForSelection().catch(this._handleRejectionIfNotDestroyed);
   },
 
   _getPageStyle: function() {
     return this.inspector.getPageStyle().then(pageStyle => {
@@ -885,34 +877,29 @@ Inspector.prototype = {
         id: "layoutview",
         title: INSPECTOR_L10N.getStr("inspector.sidebar.layoutViewTitle2"),
       },
       {
         id: "computedview",
         title: INSPECTOR_L10N.getStr("inspector.sidebar.computedViewTitle"),
       },
       {
+        id: "changesview",
+        title: INSPECTOR_L10N.getStr("inspector.sidebar.changesViewTitle"),
+      },
+      {
         id: "fontinspector",
         title: INSPECTOR_L10N.getStr("inspector.sidebar.fontInspectorTitle"),
       },
       {
         id: "animationinspector",
         title: INSPECTOR_L10N.getStr("inspector.sidebar.animationInspectorTitle"),
       },
     ];
 
-    if (this._supportsChangesPanel()) {
-      // Insert Changes as third tab, right after Computed.
-      // TODO: move this inline to `sidebarPanels` above when addressing Bug 1511877.
-      sidebarPanels.splice(2, 0, {
-        id: "changesview",
-        title: INSPECTOR_L10N.getStr("inspector.sidebar.changesViewTitle"),
-      });
-    }
-
     if (Services.prefs.getBoolPref("devtools.inspector.new-rulesview.enabled")) {
       sidebarPanels.push({
         id: "newruleview",
         title: INSPECTOR_L10N.getStr("inspector.sidebar.ruleViewTitle"),
       });
     }
 
     for (const { id, title } of sidebarPanels) {