Bug 1499483 - Make the Layout view the default sidebar tab. r=pbro
authorGabriel Luong <gabriel.luong@gmail.com>
Wed, 17 Oct 2018 17:00:35 -0400
changeset 490135 1dc2238f2ba7cf0a41b7d8901aff2f60e9b7d74e
parent 490134 ee8274a9b6c09241f0da9b6ed3b83a95b8091574
child 490137 d717af5612184b5661488184c5a41425a7d186f8
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewerspbro
bugs1499483
milestone64.0a1
Bug 1499483 - Make the Layout view the default sidebar tab. r=pbro
devtools/client/inspector/inspector.js
devtools/client/inspector/test/browser_inspector_sidebarstate.js
devtools/client/preferences/devtools-client.js
devtools/client/shared/test/browser_telemetry_sidebar.js
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -871,17 +871,17 @@ Inspector.prototype = {
       hideTabstripe: true
     });
 
     // defaultTab may also be an empty string or a tab id that doesn't exist anymore
     // (e.g. it was a tab registered by an addon that has been uninstalled).
     let defaultTab = Services.prefs.getCharPref("devtools.inspector.activeSidebar");
 
     if (this.is3PaneModeEnabled && defaultTab === "ruleview") {
-      defaultTab = "computedview";
+      defaultTab = "layoutview";
     }
 
     // Append all side panels
 
     await this.addRuleView({ defaultTab });
 
     // Inject a lazy loaded react tab by exposing a fake React object
     // with a lazy defined Tab thanks to `panel` being a function
--- a/devtools/client/inspector/test/browser_inspector_sidebarstate.js
+++ b/devtools/client/inspector/test/browser_inspector_sidebarstate.js
@@ -7,37 +7,37 @@ const TEST_URI = "data:text/html;charset
   "<h1>browser_inspector_sidebarstate.js</h1>";
 const OPTOUT = Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTOUT;
 
 const TELEMETRY_DATA = [
   {
     timestamp: null,
     category: "devtools.main",
     method: "tool_timer",
-    object: "computedview",
-    value: null,
-    extra: {
-      time_open: ""
-    }
-  },
-  {
-    timestamp: null,
-    category: "devtools.main",
-    method: "tool_timer",
     object: "layoutview",
     value: null,
     extra: {
       time_open: ""
     }
   },
   {
     timestamp: null,
     category: "devtools.main",
     method: "tool_timer",
-    object: "ruleview",
+    object: "fontinspector",
+    value: null,
+    extra: {
+      time_open: ""
+    }
+  },
+  {
+    timestamp: null,
+    category: "devtools.main",
+    method: "tool_timer",
+    object: "computedview",
     value: null,
     extra: {
       time_open: ""
     }
   }
 ];
 
 add_task(async function() {
@@ -45,41 +45,41 @@ add_task(async function() {
   Services.telemetry.clearEvents();
 
   // Ensure no events have been logged
   const snapshot = Services.telemetry.snapshotEvents(OPTOUT, true);
   ok(!snapshot.parent, "No events have been logged for the main process");
 
   let { inspector, toolbox } = await openInspectorForURL(TEST_URI);
 
+  info("Selecting font inspector.");
+  inspector.sidebar.select("fontinspector");
+
+  is(inspector.sidebar.getCurrentTabID(), "fontinspector",
+    "Font Inspector is selected");
+
   info("Selecting computed view.");
   inspector.sidebar.select("computedview");
 
   is(inspector.sidebar.getCurrentTabID(), "computedview",
     "Computed View is selected");
 
-  info("Selecting layout view.");
-  inspector.sidebar.select("layoutview");
-
-  is(inspector.sidebar.getCurrentTabID(), "layoutview",
-    "Layout View is selected");
-
   info("Closing inspector.");
   await toolbox.destroy();
 
   info("Re-opening inspector.");
   inspector = (await openInspector()).inspector;
 
   if (!inspector.sidebar.getCurrentTabID()) {
     info("Default sidebar still to be selected, adding select listener.");
     await inspector.sidebar.once("select");
   }
 
-  is(inspector.sidebar.getCurrentTabID(), "layoutview",
-     "Layout view is selected by default.");
+  is(inspector.sidebar.getCurrentTabID(), "computedview",
+     "Computed view is selected by default.");
 
   checkTelemetryResults();
 });
 
 function checkTelemetryResults() {
   const snapshot = Services.telemetry.snapshotEvents(OPTOUT, true);
   const events = snapshot.parent.filter(event => event[1] === "devtools.main" &&
                                                  event[2] === "tool_timer"
--- a/devtools/client/preferences/devtools-client.js
+++ b/devtools/client/preferences/devtools-client.js
@@ -28,17 +28,17 @@ pref("devtools.command-button-screenshot
 pref("devtools.command-button-rulers.enabled", false);
 pref("devtools.command-button-measure.enabled", false);
 pref("devtools.command-button-noautohide.enabled", false);
 
 // Inspector preferences
 // Enable the Inspector
 pref("devtools.inspector.enabled", true);
 // What was the last active sidebar in the inspector
-pref("devtools.inspector.activeSidebar", "ruleview");
+pref("devtools.inspector.activeSidebar", "layoutview");
 pref("devtools.inspector.remote", false);
 
 // Enable the 3 pane mode in the inspector
 pref("devtools.inspector.three-pane-enabled", true);
 // Enable the 3 pane mode in the chrome inspector
 pref("devtools.inspector.chrome.three-pane-enabled", false);
 // Collapse pseudo-elements by default in the rule-view
 pref("devtools.inspector.show_pseudo_elements", false);
--- a/devtools/client/shared/test/browser_telemetry_sidebar.js
+++ b/devtools/client/shared/test/browser_telemetry_sidebar.js
@@ -14,17 +14,17 @@ const TOOL_DELAY = 200;
 const DATA = [
   {
     timestamp: null,
     category: "devtools.main",
     method: "sidepanel_changed",
     object: "inspector",
     value: null,
     extra: {
-      oldpanel: "computedview",
+      oldpanel: "layoutview",
       newpanel: "animationinspector"
     }
   },
   {
     timestamp: null,
     category: "devtools.main",
     method: "sidepanel_changed",
     object: "inspector",
@@ -151,18 +151,18 @@ function testSidebar(toolbox) {
   });
 }
 
 function checkResults() {
   // For help generating these tests use generateTelemetryTests("DEVTOOLS_")
   // here.
   checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_COUNT", "", [1, 0, 0], "array");
   checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_COUNT", "", [1, 0, 0], "array");
-  checkTelemetry("DEVTOOLS_COMPUTEDVIEW_OPENED_COUNT", "", [3, 0, 0], "array");
-  checkTelemetry("DEVTOOLS_LAYOUTVIEW_OPENED_COUNT", "", [2, 0, 0], "array");
+  checkTelemetry("DEVTOOLS_COMPUTEDVIEW_OPENED_COUNT", "", [2, 0, 0], "array");
+  checkTelemetry("DEVTOOLS_LAYOUTVIEW_OPENED_COUNT", "", [3, 0, 0], "array");
   checkTelemetry("DEVTOOLS_FONTINSPECTOR_OPENED_COUNT", "", [2, 0, 0], "array");
   checkTelemetry("DEVTOOLS_COMPUTEDVIEW_TIME_ACTIVE_SECONDS", "", null, "hasentries");
   checkTelemetry("DEVTOOLS_LAYOUTVIEW_TIME_ACTIVE_SECONDS", "", null, "hasentries");
   checkTelemetry("DEVTOOLS_FONTINSPECTOR_TIME_ACTIVE_SECONDS", "", null, "hasentries");
 }
 
 function checkEventTelemetry() {
   const snapshot = Services.telemetry.snapshotEvents(OPTOUT, true);