Bug 1492700 - Stop exposing shell() on adb-device because it only forwards to ADB;r=daisuke
authorJulian Descottes <jdescottes@mozilla.com>
Tue, 27 Nov 2018 12:50:57 +0000
changeset 507474 d5e67b8fbde32dd9c145ffd02086bf0398fdbd58
parent 507473 65825c93b47bdcef950dc020ac8a12edfdcdc789
child 507475 5db9614af6a5f77a6836009dd781f4d8ab5723f1
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)
reviewersdaisuke
bugs1492700
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 1492700 - Stop exposing shell() on adb-device because it only forwards to ADB;r=daisuke Depends on D12762 Differential Revision: https://phabricator.services.mozilla.com/D12763
devtools/shared/adb/adb-device.js
devtools/shared/adb/adb-scanner.js
--- a/devtools/shared/adb/adb-device.js
+++ b/devtools/shared/adb/adb-device.js
@@ -5,29 +5,24 @@
 "use strict";
 
 const { ADB } = require("devtools/shared/adb/adb");
 
 /**
  * A Device instance is created and registered with the Devices module whenever
  * ADB notices a new device is connected.
  */
-function AdbDevice(id) {
-  this.id = id;
+class AdbDevice {
+  constructor(id) {
+    this.id = id;
+  }
+
+  async getModel() {
+    if (this._model) {
+      return this._model;
+    }
+    const model = await ADB.shell("getprop ro.product.model");
+    this._model = model.trim();
+    return this._model;
+  }
 }
 
-AdbDevice.prototype = {
-  type: "adb",
-
-  shell: ADB.shell.bind(ADB),
-
-  getModel() {
-    if (this._modelPromise) {
-      return this._modelPromise;
-    }
-    this._modelPromise = this.shell("getprop ro.product.model")
-                             .then(model => model.trim());
-    return this._modelPromise;
-  },
-  // push, pull were removed in Bug 1481691.
-};
-
 module.exports = AdbDevice;
--- a/devtools/shared/adb/adb-scanner.js
+++ b/devtools/shared/adb/adb-scanner.js
@@ -119,17 +119,17 @@ function FirefoxOnAndroidRuntime(adbDevi
 
 // This requires Unix socket support from Firefox for Android (35+)
 FirefoxOnAndroidRuntime.detect = async function(adbDevice, model) {
   const runtimes = [];
   // A matching entry looks like:
   // 00000000: 00000002 00000000 00010000 0001 01 6551588
   //  /data/data/org.mozilla.fennec/firefox-debugger-socket
   const query = "cat /proc/net/unix";
-  const rawSocketInfo = await adbDevice.shell(query);
+  const rawSocketInfo = await ADB.shell(query);
   let socketInfos = rawSocketInfo.split(/\r?\n/);
   // Filter to lines with "firefox-debugger-socket"
   socketInfos = socketInfos.filter(l => l.includes("firefox-debugger-socket"));
   // It's possible to have multiple lines with the same path, so de-dupe them
   const socketPaths = new Set();
   for (const socketInfo of socketInfos) {
     const socketPath = socketInfo.split(" ").pop();
     socketPaths.add(socketPath);