Bug 1508992 - Enable ESLint for dom/plugins/test/unit (Automatic Changes). r=qdot
authorchampionshuttler <shivams2799@gmail.com>
Sat, 09 Mar 2019 02:25:43 +0000
changeset 521242 519402d3b189
parent 521231 e571d003f78d
child 521243 c7009174ac7e
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs1508992
milestone67.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 1508992 - Enable ESLint for dom/plugins/test/unit (Automatic Changes). r=qdot Differential Revision: https://phabricator.services.mozilla.com/D22365
dom/plugins/test/unit/head_plugins.js
dom/plugins/test/unit/test_allowed_types.js
dom/plugins/test/unit/test_nice_plugin_name.js
dom/plugins/test/unit/test_persist_in_prefs.js
--- a/dom/plugins/test/unit/head_plugins.js
+++ b/dom/plugins/test/unit/head_plugins.js
@@ -10,31 +10,31 @@ const gIsOSX = mozinfo.os == "mac";
 const gIsLinux = mozinfo.os == "linux";
 const gDirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
 
 function allow_all_plugins() {
   Services.prefs.setBoolPref("plugin.load_flash_only", false);
 }
 
 // Finds the test plugin library
-function get_test_plugin(secondplugin=false) {
+function get_test_plugin(secondplugin = false) {
   for (let dir of gDirSvc.get("APluginsDL", Ci.nsISimpleEnumerator)) {
     let name = get_platform_specific_plugin_name(secondplugin);
     let plugin = dir.clone();
     plugin.append(name);
     if (plugin.exists()) {
       plugin.normalize();
       return plugin;
     }
   }
   return null;
 }
 
 // Finds the test nsIPluginTag
-function get_test_plugintag(aName="Test Plug-in") {
+function get_test_plugintag(aName = "Test Plug-in") {
   var name = aName || "Test Plug-in";
   var host = Cc["@mozilla.org/plugin/host;1"].
              getService(Ci.nsIPluginHost);
   var tags = host.getPluginTags();
 
   for (var i = 0; i < tags.length; i++) {
     if (tags[i].name == name)
       return tags[i];
@@ -50,54 +50,48 @@ function do_get_profile_startup() {
   let profd = env.get("XPCSHELL_TEST_PROFILE_DIR");
   let file = Cc["@mozilla.org/file/local;1"]
                .createInstance(Ci.nsIFile);
   file.initWithPath(profd);
 
   let dirSvc = Cc["@mozilla.org/file/directory_service;1"]
                  .getService(Ci.nsIProperties);
   let provider = {
-    getFile: function(prop, persistent) {
+    getFile(prop, persistent) {
       persistent.value = true;
       if (prop == "ProfDS") {
         return file.clone();
       }
       throw Cr.NS_ERROR_FAILURE;
     },
-    QueryInterface: function(iid) {
-      if (iid.equals(Ci.nsIDirectoryServiceProvider) ||
-          iid.equals(Ci.nsISupports)) {
-        return this;
-      }
-      throw Cr.NS_ERROR_NO_INTERFACE;
-    }
+    QueryInterface: ChromeUtils.generateQI(["nsIDirectoryServiceProvider"]),
   };
   dirSvc.QueryInterface(Ci.nsIDirectoryService)
         .registerProvider(provider);
   return file.clone();
 }
 
-function get_platform_specific_plugin_name(secondplugin=false) {
+function get_platform_specific_plugin_name(secondplugin = false) {
   if (secondplugin) {
     if (gIsWindows) return "npsecondtest.dll";
     if (gIsOSX) return "SecondTest.plugin";
     if (gIsLinux) return "libnpsecondtest.so";
   } else {
     if (gIsWindows) return "nptest.dll";
     if (gIsOSX) return "Test.plugin";
     if (gIsLinux) return "libnptest.so";
   }
   return null;
 }
 
 function get_platform_specific_plugin_suffix() {
   if (gIsWindows) return ".dll";
   else if (gIsOSX) return ".plugin";
   else if (gIsLinux) return ".so";
-  else return null;
+  return null;
 }
 
 function get_test_plugin_no_symlink() {
   let dirSvc = Cc["@mozilla.org/file/directory_service;1"]
                 .getService(Ci.nsIProperties);
   for (let dir of dirSvc.get("APluginsDL", Ci.nsISimpleEnumerator)) {
     let plugin = dir.clone();
     plugin.append(get_platform_specific_plugin_name());
--- a/dom/plugins/test/unit/test_allowed_types.js
+++ b/dom/plugins/test/unit/test_allowed_types.js
@@ -18,17 +18,17 @@ function run_test() {
       Services.prefs.setCharPref("plugin.allowed_types", allowed_types);
     }
     pluginHost.reloadPlugins();
   }
 
   function get_status_for_type(type) {
     try {
       return pluginHost.getStateForType(type);
-    } catch(ex) {
+    } catch (ex) {
       // If the type is not allowed, then nsIPluginHost.getStateForType throws
       // NS_ERROR_NOT_AVAILABLE, for which we return undefined to make it easier
       // to write assertions about the API.
       if (ex.result === Cr.NS_ERROR_NOT_AVAILABLE) {
         return undefined;
       }
       throw ex;
     }
--- a/dom/plugins/test/unit/test_nice_plugin_name.js
+++ b/dom/plugins/test/unit/test_nice_plugin_name.js
@@ -3,22 +3,22 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1";
 const XULAPPINFO_CID = Components.ID("{c763b610-9d49-455a-bbd2-ede71682a1ac}");
 
 var gAppInfo = null;
 
-function createAppInfo(ID, name, version, platformVersion="1.0") {
+function createAppInfo(ID, name, version, platformVersion = "1.0") {
   let tmp = {};
   ChromeUtils.import("resource://testing-common/AppInfo.jsm", tmp);
   tmp.updateAppInfo({
     ID, name, version, platformVersion,
-    crashReporter: true
+    crashReporter: true,
   });
   gAppInfo = tmp.getAppInfo();
 }
 
 var gPluginHost = null;
 
 function test_expected_permission_string(aPermString) {
   gPluginHost.reloadPlugins(false);
--- a/dom/plugins/test/unit/test_persist_in_prefs.js
+++ b/dom/plugins/test/unit/test_persist_in_prefs.js
@@ -38,17 +38,17 @@ function run_test() {
   let copy = pluginDir.clone();
   copy.append("nptestcopy" + suffix);
   file.moveTo(tempDir, null);
 
   // test that the settings persist through a few variations of test-plugin names
   let testNames = [
     pluginName + "2",
     pluginName.toUpperCase() + "_11_5_42_2323",
-    pluginName + "-5.2.7"
+    pluginName + "-5.2.7",
   ];
   testNames.forEach(function(leafName) {
     dump("Checking " + leafName + ".\n");
     copy.moveTo(null, leafName + suffix);
     pluginHost.reloadPlugins(false);
     plugin = get_test_plugintag();
     Assert.equal(false, plugin == null);
     Assert.ok(plugin.disabled);