Bug 1338075 - formautofill: Enable object-shorthand. r=lchang draft
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Thu, 09 Feb 2017 16:28:56 +0800
changeset 481102 ac2eb570b5557aec6fb2073d18d7453d727d1d7c
parent 481101 988700d16081a996768fbded7f97e81bf306af58
child 481103 7e21fc088dd06e963464d9e03acd4b57ce876c93
push id44719
push usermozilla@noorenberghe.ca
push dateThu, 09 Feb 2017 08:31:06 +0000
reviewerslchang
bugs1338075
milestone54.0a1
Bug 1338075 - formautofill: Enable object-shorthand. r=lchang MozReview-Commit-ID: 1y2B2jxmsaC
browser/extensions/formautofill/.eslintrc.js
browser/extensions/formautofill/FormAutofillParent.jsm
browser/extensions/formautofill/test/unit/head.js
browser/extensions/formautofill/test/unit/test_populateFieldValues.js
browser/extensions/formautofill/test/unit/test_profileAutocompleteResult.js
--- a/browser/extensions/formautofill/.eslintrc.js
+++ b/browser/extensions/formautofill/.eslintrc.js
@@ -260,21 +260,16 @@ module.exports = { // eslint-disable-lin
 
     // We use var-only-at-top-level instead of no-var as we allow top level
     // vars.
     "no-var": "off",
 
     // Allow using TODO/FIXME comments.
     "no-warning-comments": "off",
 
-    // Don't require method and property shorthand syntax for object literals.
-    // We use this in the code a lot, but not consistently, and this seems more
-    // like something to check at code review time.
-    "object-shorthand": "off",
-
     // Allow more than one variable declaration per function.
     "one-var": "off",
 
     // Disallow padding within blocks.
     "padded-blocks": ["warn", "never"],
 
     // Don't require quotes around object literal property names.
     "quote-props": "off",
--- a/browser/extensions/formautofill/FormAutofillParent.jsm
+++ b/browser/extensions/formautofill/FormAutofillParent.jsm
@@ -41,17 +41,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 const PROFILE_JSON_FILE_NAME = "autofill-profiles.json";
 
 let FormAutofillParent = {
   _profileStore: null,
 
   /**
    * Initializes ProfileStorage and registers the message handler.
    */
-  init: function() {
+  init() {
     let storePath =
       OS.Path.join(OS.Constants.Path.profileDir, PROFILE_JSON_FILE_NAME);
 
     this._profileStore = new ProfileStorage(storePath);
     this._profileStore.initialize();
 
     let mm = Cc["@mozilla.org/globalmessagemanager;1"]
                .getService(Ci.nsIMessageListenerManager);
@@ -61,17 +61,17 @@ let FormAutofillParent = {
 
   /**
    * Handles the message coming from FormAutofillContent.
    *
    * @param   {string} message.name The name of the message.
    * @param   {object} message.data The data of the message.
    * @param   {nsIFrameMessageManager} message.target Caller's message manager.
    */
-  receiveMessage: function({name, data, target}) {
+  receiveMessage({name, data, target}) {
     switch (name) {
       case "FormAutofill:PopulateFieldValues":
         this._populateFieldValues(data, target);
         break;
       case "FormAutofill:GetProfiles":
         this._getProfiles(data, target);
         break;
     }
@@ -79,26 +79,26 @@ let FormAutofillParent = {
 
   /**
    * Returns the instance of ProfileStorage. To avoid syncing issues, anyone
    * who needs to access the profile should request the instance by this instead
    * of creating a new one.
    *
    * @returns {ProfileStorage}
    */
-  getProfileStore: function() {
+  getProfileStore() {
     return this._profileStore;
   },
 
   /**
    * Uninitializes FormAutofillParent. This is for testing only.
    *
    * @private
    */
-  _uninit: function() {
+  _uninit() {
     if (this._profileStore) {
       this._profileStore._saveImmediately();
       this._profileStore = null;
     }
 
     let mm = Cc["@mozilla.org/globalmessagemanager;1"]
                .getService(Ci.nsIMessageListenerManager);
     mm.removeMessageListener("FormAutofill:PopulateFieldValues", this);
--- a/browser/extensions/formautofill/test/unit/head.js
+++ b/browser/extensions/formautofill/test/unit/head.js
@@ -34,17 +34,17 @@ Components.manager.addBootstrappedManife
 // While the previous test file should have deleted all the temporary files it
 // used, on Windows these might still be pending deletion on the physical file
 // system.  Thus, start from a new base number every time, to make a collision
 // with a file that is still pending deletion highly unlikely.
 let gFileCounter = Math.floor(Math.random() * 1000000);
 
 function loadFormAutofillContent() {
   let facGlobal = {
-    addEventListener: function() {},
+    addEventListener() {},
   };
   let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
                .getService(Ci.mozIJSSubScriptLoader);
   loader.loadSubScriptWithOptions("chrome://formautofill/content/FormAutofillContent.js", {
     target: facGlobal,
   });
 
   return facGlobal;
--- a/browser/extensions/formautofill/test/unit/test_populateFieldValues.js
+++ b/browser/extensions/formautofill/test/unit/test_populateFieldValues.js
@@ -59,17 +59,17 @@ add_task(function* test_populateFieldVal
   yield new Promise((resolve) => {
     FormAutofillParent.receiveMessage({
       name: "FormAutofill:PopulateFieldValues",
       data: {
         guid: TEST_GUID,
         fields: TEST_FIELDS,
       },
       target: {
-        sendAsyncMessage: function(name, data) {
+        sendAsyncMessage(name, data) {
           do_check_eq(name, "FormAutofill:fillForm");
 
           let fields = data.fields;
           do_check_eq(fields.length, TEST_FIELDS.length);
 
           for (let i = 0; i < fields.length; i++) {
             do_check_eq(fields[i].fieldName, TEST_FIELDS[i].fieldName);
             do_check_eq(fields[i].value,
--- a/browser/extensions/formautofill/test/unit/test_profileAutocompleteResult.js
+++ b/browser/extensions/formautofill/test/unit/test_profileAutocompleteResult.js
@@ -11,17 +11,17 @@ let matchingProfiles = [{
   guid: "test-guid-2",
   organization: "Mozilla",
   streetAddress: "331 E. Evelyn Avenue",
   tel: "1-650-903-0800",
 }];
 
 let testCases = [{
   options: {},
-  matchingProfiles: matchingProfiles,
+  matchingProfiles,
   searchString: "",
   fieldName: "",
   expected: {
     searchResult: Ci.nsIAutoCompleteResult.RESULT_SUCCESS,
     defaultIndex: 0,
     items: [{
       style: "autofill-profile",
       image: "",