Bug 1532941 - Enable ESLint for uriloader (manual changes). r=Standard8,qdot

Differential Revision: https://phabricator.services.mozilla.com/D22478

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Syeda Asra Arshia Qadri 2019-03-14 13:33:48 +00:00
parent 235412b0fc
commit e3baa66e24
10 changed files with 26 additions and 26 deletions

View file

@ -27,8 +27,6 @@ netwerk/test/browser/**
netwerk/test/mochitests/** netwerk/test/mochitests/**
netwerk/test/unit*/** netwerk/test/unit*/**
tools/update-packaging/** tools/update-packaging/**
uriloader/exthandler/**
uriloader/exthandler/tests/mochitest/**
xpfe/** xpfe/**
# We currently have no js files in these directories, so we ignore them by # We currently have no js files in these directories, so we ignore them by

View file

@ -0,0 +1,8 @@
"use strict";
module.exports = {
"extends": [
"plugin:mozilla/browser-test",
"plugin:mozilla/mochitest-test",
]
};

View file

@ -60,7 +60,6 @@ add_task(async function simple_navigation() {
// opens with target="_blank" (i.e. a new tab) and ensures that we // opens with target="_blank" (i.e. a new tab) and ensures that we
// automatically open and close that tab. // automatically open and close that tab.
async function testNewTab(browser) { async function testNewTab(browser) {
let targetURL = browser.currentURI.spec;
let dialogAppeared = promiseHelperAppDialog(); let dialogAppeared = promiseHelperAppDialog();
let tabOpened = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabOpen").then((event) => { let tabOpened = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "TabOpen").then((event) => {
return [ event.target, BrowserTestUtils.waitForTabClosing(event.target) ]; return [ event.target, BrowserTestUtils.waitForTabClosing(event.target) ];

View file

@ -17,8 +17,11 @@ function test() {
"handlerApp.xhtml?uri=%s"; "handlerApp.xhtml?uri=%s";
// set up the uri to test with // set up the uri to test with
/* eslint-disable mozilla/use-services */
var ioService = Cc["@mozilla.org/network/io-service;1"]. var ioService = Cc["@mozilla.org/network/io-service;1"].
getService(SpecialPowers.Ci.nsIIOService); getService(SpecialPowers.Ci.nsIIOService);
var uri = ioService.newURI(testURI); var uri = ioService.newURI(testURI);
// create a window, and launch the handler in it // create a window, and launch the handler in it
@ -43,6 +46,8 @@ function test() {
localHandler.name = "Test Local Handler App"; localHandler.name = "Test Local Handler App";
// get a local app that we know will be there and do something sane // get a local app that we know will be there and do something sane
/* eslint-disable mozilla/use-services */
var osString = Cc["@mozilla.org/xre/app-info;1"]. var osString = Cc["@mozilla.org/xre/app-info;1"].
getService(SpecialPowers.Ci.nsIXULRuntime).OS; getService(SpecialPowers.Ci.nsIXULRuntime).OS;

View file

@ -6,7 +6,7 @@ const HELPERAPP_DIALOG_CID =
const FAKE_CID = Cc["@mozilla.org/uuid-generator;1"]. const FAKE_CID = Cc["@mozilla.org/uuid-generator;1"].
getService(Ci.nsIUUIDGenerator).generateUUID(); getService(Ci.nsIUUIDGenerator).generateUUID();
/* eslint-env mozilla/frame-script */
function HelperAppLauncherDialog() {} function HelperAppLauncherDialog() {}
HelperAppLauncherDialog.prototype = { HelperAppLauncherDialog.prototype = {
show(aLauncher, aWindowContext, aReason) { show(aLauncher, aWindowContext, aReason) {

View file

@ -11,18 +11,16 @@ function run_test() {
// its length to make sure this hasn't happened. // its length to make sure this hasn't happened.
var badMimeType = "text/plainÿ"; var badMimeType = "text/plainÿ";
Assert.equal(badMimeType.length, 11); Assert.equal(badMimeType.length, 11);
try { try {
var type = Cc["@mozilla.org/mime;1"]. Cc["@mozilla.org/mime;1"].
getService(Ci.nsIMIMEService). getService(Ci.nsIMIMEService).
getFromTypeAndExtension(badMimeType, "txt"); getFromTypeAndExtension(badMimeType, "txt");
} catch (e) { } catch (e) {
if (!(e instanceof Ci.nsIException) || if (!(e instanceof Ci.nsIException) ||
e.result != Cr.NS_ERROR_NOT_AVAILABLE) { e.result != Cr.NS_ERROR_NOT_AVAILABLE) {
throw e; throw e;
} }
// This is an expected exception, thrown if the type can't be determined // This is an expected exception, thrown if the type can't be determined
} finally {
} }
// Not crashing is good enough // Not crashing is good enough
Assert.equal(true, true); Assert.equal(true, true);

View file

@ -14,8 +14,7 @@ function run_test() {
const mimeService = Cc["@mozilla.org/mime;1"]. const mimeService = Cc["@mozilla.org/mime;1"].
getService(Ci.nsIMIMEService); getService(Ci.nsIMIMEService);
const categoryManager = Cc["@mozilla.org/categorymanager;1"]. const categoryManager = Services.catMan;
getService(Ci.nsICategoryManager);
// --- Test procedure --- // --- Test procedure ---

View file

@ -121,14 +121,14 @@ function run_test() {
const kMockCID = Components.ID("{9b23dfe9-296b-4740-ba1c-d39c9a16e55e}"); const kMockCID = Components.ID("{9b23dfe9-296b-4740-ba1c-d39c9a16e55e}");
const kWindowsRegKeyContractID = "@mozilla.org/windows-registry-key;1"; const kWindowsRegKeyContractID = "@mozilla.org/windows-registry-key;1";
const kWindowsRegKeyClassName = "nsWindowsRegKey";
function registerMockWindowsRegKeyFactory() { function registerMockWindowsRegKeyFactory() {
mockWindowsRegKeyFactory = { mockWindowsRegKeyFactory = {
createInstance(aOuter, aIid) { createInstance(aOuter, aIid) {
if (aOuter != null) if (aOuter != null)
throw Cr.NS_ERROR_NO_AGGREGATION; throw Cr.NS_ERROR_NO_AGGREGATION;
// XXX Bug 1533719 - originalWindowsRegKeyFactory is undefined.
// eslint-disable-next-line no-undef
var innerKey = originalWindowsRegKeyFactory.createInstance(null, aIid); var innerKey = originalWindowsRegKeyFactory.createInstance(null, aIid);
var key = new MockWindowsRegKey(innerKey); var key = new MockWindowsRegKey(innerKey);
@ -171,9 +171,9 @@ function run_test() {
try { try {
// Try and get the MIME type associated with the extension. If this // Try and get the MIME type associated with the extension. If this
// operation does not throw an unexpected exception, the test succeeds. // operation does not throw an unexpected exception, the test succeeds.
var type = Cc["@mozilla.org/mime;1"]. Cc["@mozilla.org/mime;1"].
getService(Ci.nsIMIMEService). getService(Ci.nsIMIMEService).
getTypeFromExtension(".txt"); getTypeFromExtension(".txt");
} catch (e) { } catch (e) {
if (!(e instanceof Ci.nsIException) || if (!(e instanceof Ci.nsIException) ||
e.result != Cr.NS_ERROR_NOT_AVAILABLE) { e.result != Cr.NS_ERROR_NOT_AVAILABLE) {

View file

@ -15,11 +15,7 @@ function run_test() {
const protoSvc = Cc["@mozilla.org/uriloader/external-protocol-service;1"]. const protoSvc = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
getService(Ci.nsIExternalProtocolService); getService(Ci.nsIExternalProtocolService);
const prefSvc = Cc["@mozilla.org/preferences-service;1"]. const prefSvc = Services.prefs;
getService(Ci.nsIPrefService);
const ioService = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
const env = Cc["@mozilla.org/process/environment;1"]. const env = Cc["@mozilla.org/process/environment;1"].
getService(Ci.nsIEnvironment); getService(Ci.nsIEnvironment);
@ -243,10 +239,9 @@ function run_test() {
handlerTypes.splice(handlerTypes.indexOf(handler.type), 1); handlerTypes.splice(handlerTypes.indexOf(handler.type), 1);
} }
Assert.equal(handlerTypes.length, 0); Assert.equal(handlerTypes.length, 0);
// Make sure the handler service's remove method removes a handler record. // Make sure the handler service's remove method removes a handler record.
handlerSvc.remove(handlerInfo2); handlerSvc.remove(handlerInfo2);
handlers = handlerSvc.enumerate(); let handlers = handlerSvc.enumerate();
while (handlers.hasMoreElements()) while (handlers.hasMoreElements())
Assert.notEqual(handlers.getNext().QueryInterface(Ci.nsIHandlerInfo).type, Assert.notEqual(handlers.getNext().QueryInterface(Ci.nsIHandlerInfo).type,
handlerInfo2.type); handlerInfo2.type);

View file

@ -68,9 +68,7 @@ function run_test() {
} }
// set up the uri to test with // set up the uri to test with
var ioService = var ioService = Services.io;
Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
// set up the local handler object // set up the local handler object
var localHandler = var localHandler =