Bug 1508992 - Enable ESLint for dom/plugin/test/unit (Manual Changes). r=qdot
authorchampionshuttler <shivams2799@gmail.com>
Sat, 09 Mar 2019 02:26:37 +0000
changeset 521243 c7009174ac7e
parent 521242 519402d3b189
child 521244 5890446de116
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/plugin/test/unit (Manual Changes). r=qdot Depends on D22365 Differential Revision: https://phabricator.services.mozilla.com/D22366
.eslintignore
dom/plugins/test/unit/head_plugins.js
dom/plugins/test/unit/test_bug471245.js
dom/plugins/test/unit/test_bug813245.js
dom/plugins/test/unit/test_plugin_default_state.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -184,17 +184,16 @@ dom/media/tests/**
 dom/media/webaudio/**
 dom/media/webspeech/**
 dom/messagechannel/**
 dom/midi/**
 dom/network/**
 dom/payments/**
 dom/performance/**
 dom/permission/**
-dom/plugins/test/unit/**
 dom/promise/**
 dom/push/**
 dom/quota/**
 dom/security/test/cors/**
 dom/security/test/csp/**
 dom/security/test/general/**
 dom/security/test/mixedcontentblocker/**
 dom/security/test/sri/**
--- a/dom/plugins/test/unit/head_plugins.js
+++ b/dom/plugins/test/unit/head_plugins.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 const gIsWindows = mozinfo.os == "win";
 const gIsOSX = mozinfo.os == "mac";
 const gIsLinux = mozinfo.os == "linux";
-const gDirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
+const gDirSvc = Services.dirsvc;
 
 function allow_all_plugins() {
   Services.prefs.setBoolPref("plugin.load_flash_only", false);
 }
 
 // Finds the test plugin library
 function get_test_plugin(secondplugin = false) {
   for (let dir of gDirSvc.get("APluginsDL", Ci.nsISimpleEnumerator)) {
@@ -47,18 +47,17 @@ function do_get_profile_startup() {
   let env = Cc["@mozilla.org/process/environment;1"]
               .getService(Ci.nsIEnvironment);
   // the python harness sets this in the environment for us
   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 dirSvc = Services.dirsvc;
   let provider = {
     getFile(prop, persistent) {
       persistent.value = true;
       if (prop == "ProfDS") {
         return file.clone();
       }
       throw Cr.NS_ERROR_FAILURE;
     },
@@ -85,18 +84,17 @@ function get_platform_specific_plugin_na
 function get_platform_specific_plugin_suffix() {
   if (gIsWindows) return ".dll";
   else if (gIsOSX) return ".plugin";
   else if (gIsLinux) return ".so";
   return null;
 }
 
 function get_test_plugin_no_symlink() {
-  let dirSvc = Cc["@mozilla.org/file/directory_service;1"]
-                .getService(Ci.nsIProperties);
+  let dirSvc = Services.dirsvc;
   for (let dir of dirSvc.get("APluginsDL", Ci.nsISimpleEnumerator)) {
     let plugin = dir.clone();
     plugin.append(get_platform_specific_plugin_name());
     if (plugin.exists()) {
       return plugin;
     }
   }
   return null;
--- a/dom/plugins/test/unit/test_bug471245.js
+++ b/dom/plugins/test/unit/test_bug471245.js
@@ -8,14 +8,14 @@ function run_test() {
   do_get_profile_startup();
 
   var plugin = get_test_plugintag();
   Assert.ok(plugin == null);
 
   // Initialises a profile folder
   do_get_profile();
 
-  var plugin = get_test_plugintag();
+  plugin = get_test_plugintag();
   Assert.equal(false, plugin == null);
 
   // Clean up
   Services.prefs.clearUserPref("plugin.importedState");
 }
--- a/dom/plugins/test/unit/test_bug813245.js
+++ b/dom/plugins/test/unit/test_bug813245.js
@@ -3,19 +3,21 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 // Plugin registry uses different field delimeters on different platforms
 var DELIM = mozinfo.os == "win" ? "|" : ":";
 
 var gProfD = do_get_profile_startup();
 
+var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+
 // Writes out some plugin registry to the profile
 function write_registry(version, info) {
-  let runtime = Cc["@mozilla.org/xre/runtime;1"].getService(Ci.nsIXULRuntime);
+  let runtime = Services.appinfo;
 
   var header = "Generated File. Do not edit.\n\n";
   header += "[HEADER]\n";
   header += "Version" + DELIM + version + DELIM + "$\n";
   header += "Arch" + DELIM + runtime.XPCOMABI + DELIM + "$\n";
   header += "\n";
   header += "[PLUGINS]\n";
 
@@ -67,17 +69,17 @@ function run_test() {
   registry += "\n";
   registry += "[INVALID]\n";
   registry += "\n";
   write_registry("0.15", registry);
 
   // Initialise profile folder
   do_get_profile();
 
-  var plugin = get_test_plugintag();
+  plugin = get_test_plugintag();
   if (!plugin)
     do_throw("Plugin tag not found");
 
   // The plugin registry should have been rejected.
   // If not, the test plugin version would be 0.0.0.0
   Assert.equal(plugin.version, "1.0.0.0");
 
   // Clean up
--- a/dom/plugins/test/unit/test_plugin_default_state.js
+++ b/dom/plugins/test/unit/test_plugin_default_state.js
@@ -1,17 +1,16 @@
 function run_test() {
   allow_all_plugins();
   let pluginDefaultState = Services.prefs.getIntPref("plugin.default.state");
   // if this fails, we just have to switch around the values we're testing
   Assert.notEqual(pluginDefaultState, Ci.nsIPluginTag.STATE_DISABLED);
   let nonDefaultState = (pluginDefaultState != Ci.nsIPluginTag.STATE_ENABLED ?
                          Ci.nsIPluginTag.STATE_ENABLED :
                          Ci.nsIPluginTag.STATE_CLICKTOPLAY);
-  let ph = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
   let testPlugin = get_test_plugintag();
   // the test plugin should have the default enabledState
   Assert.equal(testPlugin.enabledState, pluginDefaultState);
 
   let secondTestPlugin = get_test_plugintag("Second Test Plug-in");
   // set an enabledState for the second test plugin
   secondTestPlugin.enabledState = Ci.nsIPluginTag.STATE_DISABLED;
   // change what the default enabledState is