Bug 1509315 - Remove unecessary calls to listTabs. r=yulia
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 27 Nov 2018 21:48:03 +0000
changeset 507607 3eadd3d0580012f95a9d8e8ac24befb60d93b3fd
parent 507606 322f2dd202990fc3bc215a7296423ca683738244
child 507608 30bc5b0c60ebfe0444530fa9af86c5c8d5498ecd
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyulia
bugs1509315
milestone65.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 1509315 - Remove unecessary calls to listTabs. r=yulia These tests are calling listTabs, but that is no longer necessary thanks to rootForm being automatically managed within RootFront. MozReview-Commit-ID: AmC6dTIJjiY Depends on D12732 Differential Revision: https://phabricator.services.mozilla.com/D12733
devtools/server/tests/mochitest/test_device.html
devtools/server/tests/mochitest/test_preference.html
--- a/devtools/server/tests/mochitest/test_device.html
+++ b/devtools/server/tests/mochitest/test_device.html
@@ -22,61 +22,59 @@ window.onload = function() {
 
   SimpleTest.waitForExplicitFinish();
 
   DebuggerServer.init();
   DebuggerServer.registerAllActors();
 
   const client = new DebuggerClient(DebuggerServer.connectPipe());
   client.connect().then(function onConnect() {
-    client.listTabs().then(function onListTabs(response) {
-      return client.mainRoot.getFront("device");
-    }).then(function(d) {
-      let desc;
-      const appInfo = Services.appinfo;
-      const utils = window.windowUtils;
+    return client.mainRoot.getFront("device");
+  }).then(function(d) {
+    let desc;
+    const appInfo = Services.appinfo;
+    const utils = window.windowUtils;
 
-      const localDesc = {
-        appid: appInfo.ID,
-        vendor: appInfo.vendor,
-        name: appInfo.name,
-        version: appInfo.version,
-        appbuildid: appInfo.appBuildID,
-        platformbuildid: appInfo.platformBuildID,
-        platformversion: appInfo.platformVersion,
-        geckobuildid: appInfo.platformBuildID,
-        geckoversion: appInfo.platformVersion,
-        useragent: window.navigator.userAgent,
-        locale: Services.locale.appLocaleAsLangTag,
-        os: appInfo.OS,
-        processor: appInfo.XPCOMABI.split("-")[0],
-        compiler: appInfo.XPCOMABI.split("-")[1],
-        dpi: utils.displayDPI,
-        width: window.screen.width,
-        height: window.screen.height,
-      };
+    const localDesc = {
+      appid: appInfo.ID,
+      vendor: appInfo.vendor,
+      name: appInfo.name,
+      version: appInfo.version,
+      appbuildid: appInfo.appBuildID,
+      platformbuildid: appInfo.platformBuildID,
+      platformversion: appInfo.platformVersion,
+      geckobuildid: appInfo.platformBuildID,
+      geckoversion: appInfo.platformVersion,
+      useragent: window.navigator.userAgent,
+      locale: Services.locale.appLocaleAsLangTag,
+      os: appInfo.OS,
+      processor: appInfo.XPCOMABI.split("-")[0],
+      compiler: appInfo.XPCOMABI.split("-")[1],
+      dpi: utils.displayDPI,
+      width: window.screen.width,
+      height: window.screen.height,
+    };
 
-      function checkValues() {
-        for (const key in localDesc) {
-          is(desc[key], localDesc[key], "valid field (" + key + ")");
-        }
-
-        const currProfD = Services.dirsvc.get("ProfD", Ci.nsIFile);
-        const profileDir = currProfD.path;
-        ok(profileDir.includes(desc.profile.length > 0 && desc.profile),
-           "valid profile name");
-
-        client.close().then(() => {
-          DebuggerServer.destroy();
-          SimpleTest.finish();
-        });
+    function checkValues() {
+      for (const key in localDesc) {
+        is(desc[key], localDesc[key], "valid field (" + key + ")");
       }
 
-      d.getDescription().then(function(v) {
-        desc = v;
-      }).then(checkValues);
-    });
+      const currProfD = Services.dirsvc.get("ProfD", Ci.nsIFile);
+      const profileDir = currProfD.path;
+      ok(profileDir.includes(desc.profile.length > 0 && desc.profile),
+         "valid profile name");
+
+      client.close().then(() => {
+        DebuggerServer.destroy();
+        SimpleTest.finish();
+      });
+    }
+
+    d.getDescription().then(function(v) {
+      desc = v;
+    }).then(checkValues);
   });
 };
 </script>
 </pre>
 </body>
 </html>
--- a/devtools/server/tests/mochitest/test_preference.html
+++ b/devtools/server/tests/mochitest/test_preference.html
@@ -22,85 +22,83 @@ function runTests() {
 
   SimpleTest.waitForExplicitFinish();
 
   DebuggerServer.init();
   DebuggerServer.registerAllActors();
 
   const client = new DebuggerClient(DebuggerServer.connectPipe());
   client.connect().then(function onConnect() {
-    client.listTabs().then(function onListTabs(response) {
-      return client.mainRoot.getFront("preference");
-    }).then(function(p) {
-      const prefs = {};
+    return client.mainRoot.getFront("preference");
+  }).then(function(p) {
+    const prefs = {};
 
-      const localPref = {
-        boolPref: true,
-        intPref: 0x1234,
-        charPref: "Hello World",
-      };
+    const localPref = {
+      boolPref: true,
+      intPref: 0x1234,
+      charPref: "Hello World",
+    };
 
-      function checkValues() {
-        is(prefs.boolPref, localPref.boolPref, "read/write bool pref");
-        is(prefs.intPref, localPref.intPref, "read/write int pref");
-        is(prefs.charPref, localPref.charPref, "read/write string pref");
+    function checkValues() {
+      is(prefs.boolPref, localPref.boolPref, "read/write bool pref");
+      is(prefs.intPref, localPref.intPref, "read/write int pref");
+      is(prefs.charPref, localPref.charPref, "read/write string pref");
 
-        ["test.all.bool", "test.all.int", "test.all.string"].forEach(function(key) {
-          let expectedValue;
-          switch (Services.prefs.getPrefType(key)) {
-            case Ci.nsIPrefBranch.PREF_STRING:
-              expectedValue = Services.prefs.getCharPref(key);
-              break;
-            case Ci.nsIPrefBranch.PREF_INT:
-              expectedValue = Services.prefs.getIntPref(key);
-              break;
-            case Ci.nsIPrefBranch.PREF_BOOL:
-              expectedValue = Services.prefs.getBoolPref(key);
-              break;
-            default:
-              ok(false, "unexpected pref type (" + key + ")");
-              break;
-          }
+      ["test.all.bool", "test.all.int", "test.all.string"].forEach(function(key) {
+        let expectedValue;
+        switch (Services.prefs.getPrefType(key)) {
+          case Ci.nsIPrefBranch.PREF_STRING:
+            expectedValue = Services.prefs.getCharPref(key);
+            break;
+          case Ci.nsIPrefBranch.PREF_INT:
+            expectedValue = Services.prefs.getIntPref(key);
+            break;
+          case Ci.nsIPrefBranch.PREF_BOOL:
+            expectedValue = Services.prefs.getBoolPref(key);
+            break;
+          default:
+            ok(false, "unexpected pref type (" + key + ")");
+            break;
+        }
 
-          is(prefs.allPrefs[key].value, expectedValue,
-             "valid preference value (" + key + ")");
-          is(prefs.allPrefs[key].hasUserValue, Services.prefs.prefHasUserValue(key),
-             "valid hasUserValue (" + key + ")");
-        });
+        is(prefs.allPrefs[key].value, expectedValue,
+           "valid preference value (" + key + ")");
+        is(prefs.allPrefs[key].hasUserValue, Services.prefs.prefHasUserValue(key),
+           "valid hasUserValue (" + key + ")");
+      });
 
-        ["test.bool", "test.int", "test.string"].forEach(function(key) {
-          ok(!prefs.allPrefs.hasOwnProperty(key), "expect no pref (" + key + ")");
-          is(Services.prefs.getPrefType(key), Ci.nsIPrefBranch.PREF_INVALID,
-             "pref (" + key + ") is clear");
-        });
+      ["test.bool", "test.int", "test.string"].forEach(function(key) {
+        ok(!prefs.allPrefs.hasOwnProperty(key), "expect no pref (" + key + ")");
+        is(Services.prefs.getPrefType(key), Ci.nsIPrefBranch.PREF_INVALID,
+           "pref (" + key + ") is clear");
+      });
 
-        client.close().then(() => {
-          DebuggerServer.destroy();
-          SimpleTest.finish();
-        });
-      }
+      client.close().then(() => {
+        DebuggerServer.destroy();
+        SimpleTest.finish();
+      });
+    }
 
-      function updatePrefsProperty(key) {
-        return function(value) {
-          prefs[key] = value;
-        };
-      }
+    function updatePrefsProperty(key) {
+      return function(value) {
+        prefs[key] = value;
+      };
+    }
 
-      p.getAllPrefs().then(updatePrefsProperty("allPrefs"))
-      .then(() => p.setBoolPref("test.bool", localPref.boolPref))
-      .then(() => p.setIntPref("test.int", localPref.intPref))
-      .then(() => p.setCharPref("test.string", localPref.charPref))
-      .then(() => p.getBoolPref("test.bool")).then(updatePrefsProperty("boolPref"))
-      .then(() => p.getIntPref("test.int")).then(updatePrefsProperty("intPref"))
-      .then(() => p.getCharPref("test.string")).then(updatePrefsProperty("charPref"))
-      .then(() => p.clearUserPref("test.bool"))
-      .then(() => p.clearUserPref("test.int"))
-      .then(() => p.clearUserPref("test.string"))
-      .then(checkValues);
-    });
+    p.getAllPrefs().then(updatePrefsProperty("allPrefs"))
+    .then(() => p.setBoolPref("test.bool", localPref.boolPref))
+    .then(() => p.setIntPref("test.int", localPref.intPref))
+    .then(() => p.setCharPref("test.string", localPref.charPref))
+    .then(() => p.getBoolPref("test.bool")).then(updatePrefsProperty("boolPref"))
+    .then(() => p.getIntPref("test.int")).then(updatePrefsProperty("intPref"))
+    .then(() => p.getCharPref("test.string")).then(updatePrefsProperty("charPref"))
+    .then(() => p.clearUserPref("test.bool"))
+    .then(() => p.clearUserPref("test.int"))
+    .then(() => p.clearUserPref("test.string"))
+    .then(checkValues);
   });
 }
 
 window.onload = function() {
   SpecialPowers.pushPrefEnv({
     "set": [
       ["test.all.bool", true],
       ["test.all.int", 0x4321],