Bug 1440718 - Enable no-unused-vars for global scope on jsm files in services/sync/. r?kitcambridge draft
authorMark Banner <standard8@mozilla.com>
Fri, 23 Feb 2018 17:05:05 +0000
changeset 759058 ced8afe6ee2386fae284d0e1d911d0cf4926e24c
parent 758927 6661c077325c35af028f1cdaa660f673cbea39be
push id100265
push userbmo:standard8@mozilla.com
push dateFri, 23 Feb 2018 17:05:33 +0000
reviewerskitcambridge
bugs1440718
milestone60.0a1
Bug 1440718 - Enable no-unused-vars for global scope on jsm files in services/sync/. r?kitcambridge MozReview-Commit-ID: 77z0qScZw2P
.eslintrc.js
services/sync/tps/extensions/tps/resource/modules/addons.jsm
services/sync/tps/extensions/tps/resource/tps.jsm
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -51,17 +51,16 @@ module.exports = {
     }
   }, {
     // XXX Bug 1434446. These directories have jsm files still being fixed, so
     // turn off global no-unused-vars checking for them.
     "files": [
       "accessible/**/*.jsm",
       "browser/components/**/*.jsm",
       "browser/extensions/**/*.jsm",
-      "services/sync/**/*.jsm",
       "toolkit/**/*.jsm",
     ],
     "rules": {
       "mozilla/mark-exported-symbols-as-used": "error",
       "no-unused-vars": ["error", {
         "args": "none",
         "vars": "local",
         "varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS"
--- a/services/sync/tps/extensions/tps/resource/modules/addons.jsm
+++ b/services/sync/tps/extensions/tps/resource/modules/addons.jsm
@@ -1,51 +1,23 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
 var EXPORTED_SYMBOLS = ["Addon", "STATE_ENABLED", "STATE_DISABLED"];
 
 ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
-ChromeUtils.import("resource://gre/modules/addons/AddonRepository.jsm");
-ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
 ChromeUtils.import("resource://services-sync/addonutils.js");
 ChromeUtils.import("resource://services-sync/util.js");
 ChromeUtils.import("resource://tps/logger.jsm");
 
-const ADDONSGETURL = "http://127.0.0.1:4567/";
 const STATE_ENABLED = 1;
 const STATE_DISABLED = 2;
 
-function GetFileAsText(file) {
-  let channel = NetUtil.newChannel({
-    uri: file,
-    loadUsingSystemPrincipal: true
-  });
-  let inputStream = channel.open2();
-  if (channel instanceof Ci.nsIHttpChannel &&
-      channel.responseStatus != 200) {
-    return "";
-  }
-
-  let streamBuf = "";
-  let sis = Cc["@mozilla.org/scriptableinputstream;1"]
-            .createInstance(Ci.nsIScriptableInputStream);
-  sis.init(inputStream);
-
-  let available;
-  while ((available = sis.available()) != 0) {
-    streamBuf += sis.read(available);
-  }
-
-  inputStream.close();
-  return streamBuf;
-}
-
 function Addon(TPS, id) {
   this.TPS = TPS;
   this.id = id;
 }
 
 Addon.prototype = {
   addon: null,
 
--- a/services/sync/tps/extensions/tps/resource/tps.jsm
+++ b/services/sync/tps/extensions/tps/resource/tps.jsm
@@ -2,17 +2,21 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
  /* This is a JavaScript module (JSM) to be imported via
   * Components.utils.import() and acts as a singleton. Only the following
   * listed symbols will exposed on import, and only when and where imported.
   */
 
-var EXPORTED_SYMBOLS = ["ACTIONS", "TPS"];
+var EXPORTED_SYMBOLS = [
+  "ACTIONS", "Addons", "Addresses", "Bookmarks",
+  "Formdata", "History", "Passwords", "Prefs",
+  "Tabs", "TPS", "Windows"
+];
 
 var module = this;
 
 // Global modules
 ChromeUtils.import("resource://formautofill/FormAutofillSync.jsm");
 ChromeUtils.import("resource://gre/modules/Log.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
@@ -41,19 +45,16 @@ ChromeUtils.import("resource://tps/modul
 ChromeUtils.import("resource://tps/modules/formautofill.jsm");
 ChromeUtils.import("resource://tps/modules/forms.jsm");
 ChromeUtils.import("resource://tps/modules/history.jsm");
 ChromeUtils.import("resource://tps/modules/passwords.jsm");
 ChromeUtils.import("resource://tps/modules/prefs.jsm");
 ChromeUtils.import("resource://tps/modules/tabs.jsm");
 ChromeUtils.import("resource://tps/modules/windows.jsm");
 
-var hh = Cc["@mozilla.org/network/protocol;1?name=http"]
-         .getService(Ci.nsIHttpProtocolHandler);
-
 XPCOMUtils.defineLazyGetter(this, "fileProtocolHandler", () => {
   let fileHandler = Services.io.getProtocolHandler("file");
   return fileHandler.QueryInterface(Ci.nsIFileProtocolHandler);
 });
 
 XPCOMUtils.defineLazyGetter(this, "gTextDecoder", () => {
   return new TextDecoder();
 });